Decompiled source of Testy Modpack v1.1.0
pachers/BepInEx.MonoMod.HookGenPatcher/BepInEx.MonoMod.HookGenPatcher.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security.Cryptography; using BepInEx.Configuration; using BepInEx.Logging; using Mono.Cecil; using MonoMod; using MonoMod.RuntimeDetour.HookGen; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Bepinex.Monomod.HookGenPatcher")] [assembly: AssemblyDescription("Runtime HookGen for BepInEx")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HarbingerOfMe")] [assembly: AssemblyProduct("Bepinex.Monomod.HookGenPatcher")] [assembly: AssemblyCopyright("HarbingerOfMe-2022")] [assembly: AssemblyTrademark("MIT")] [assembly: ComVisible(false)] [assembly: Guid("12032e45-9577-4195-8f4f-a729911b2f08")] [assembly: AssemblyFileVersion("1.2.1.0")] [assembly: NeutralResourcesLanguage("en")] [assembly: AssemblyVersion("1.2.1.0")] namespace BepInEx.MonoMod.HookGenPatcher; public static class HookGenPatcher { internal static ManualLogSource Logger = Logger.CreateLogSource("HookGenPatcher"); private const string CONFIG_FILE_NAME = "HookGenPatcher.cfg"; private static readonly ConfigFile Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "HookGenPatcher.cfg"), true); private const char EntrySeparator = ','; private static readonly ConfigEntry<string> AssemblyNamesToHookGenPatch = Config.Bind<string>("General", "MMHOOKAssemblyNames", "Assembly-CSharp.dll", $"Assembly names to make mmhooks for, separate entries with : {','} "); private static readonly ConfigEntry<bool> preciseHash = Config.Bind<bool>("General", "Preciser filehashing", false, "Hash file using contents instead of size. Minor perfomance impact."); private static bool skipHashing => !preciseHash.Value; public static IEnumerable<string> TargetDLLs { get; } = new string[0]; public static void Initialize() { //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown string[] array = AssemblyNamesToHookGenPatch.Value.Split(new char[1] { ',' }); string text = Path.Combine(Paths.PluginPath, "MMHOOK"); string[] array2 = array; foreach (string text2 in array2) { string text3 = "MMHOOK_" + text2; string text4 = Path.Combine(Paths.ManagedPath, text2); string text5 = Path.Combine(text, text3); bool flag = true; string[] files = Directory.GetFiles(Paths.PluginPath, text3, SearchOption.AllDirectories); foreach (string text6 in files) { if (Path.GetFileName(text6).Equals(text3)) { text5 = text6; Logger.LogInfo((object)"Previous MMHOOK location found. Using that location to save instead."); flag = false; break; } } if (flag) { Directory.CreateDirectory(text); } FileInfo fileInfo = new FileInfo(text4); long length = fileInfo.Length; long num = 0L; if (File.Exists(text5)) { try { AssemblyDefinition val = AssemblyDefinition.ReadAssembly(text5); try { if (val.MainModule.GetType("BepHookGen.size" + length) != null) { if (skipHashing) { Logger.LogInfo((object)"Already ran for this version, reusing that file."); continue; } num = fileInfo.makeHash(); if (val.MainModule.GetType("BepHookGen.content" + num) != null) { Logger.LogInfo((object)"Already ran for this version, reusing that file."); continue; } } } finally { ((IDisposable)val)?.Dispose(); } } catch (BadImageFormatException) { Logger.LogWarning((object)("Failed to read " + Path.GetFileName(text5) + ", probably corrupted, remaking one.")); } } Environment.SetEnvironmentVariable("MONOMOD_HOOKGEN_PRIVATE", "1"); Environment.SetEnvironmentVariable("MONOMOD_DEPENDENCY_MISSING_THROW", "0"); MonoModder val2 = new MonoModder { InputPath = text4, OutputPath = text5, ReadingMode = (ReadingMode)2 }; try { IAssemblyResolver assemblyResolver = val2.AssemblyResolver; IAssemblyResolver obj = ((assemblyResolver is BaseAssemblyResolver) ? assemblyResolver : null); if (obj != null) { ((BaseAssemblyResolver)obj).AddSearchDirectory(Paths.BepInExAssemblyDirectory); } val2.Read(); val2.MapDependencies(); if (File.Exists(text5)) { Logger.LogDebug((object)("Clearing " + text5)); File.Delete(text5); } Logger.LogInfo((object)"Starting HookGenerator"); HookGenerator val3 = new HookGenerator(val2, Path.GetFileName(text5)); ModuleDefinition outputModule = val3.OutputModule; try { val3.Generate(); outputModule.Types.Add(new TypeDefinition("BepHookGen", "size" + length, (TypeAttributes)1, outputModule.TypeSystem.Object)); if (!skipHashing) { outputModule.Types.Add(new TypeDefinition("BepHookGen", "content" + ((num == 0L) ? fileInfo.makeHash() : num), (TypeAttributes)1, outputModule.TypeSystem.Object)); } outputModule.Write(text5); } finally { ((IDisposable)outputModule)?.Dispose(); } Logger.LogInfo((object)"Done."); } finally { ((IDisposable)val2)?.Dispose(); } } } public static void Patch(AssemblyDefinition _) { } private static long makeHash(this FileInfo fileInfo) { FileStream inputStream = fileInfo.OpenRead(); byte[] value = null; using (MD5 mD = new MD5CryptoServiceProvider()) { value = mD.ComputeHash(inputStream); } long num = BitConverter.ToInt64(value, 0); if (num == 0L) { return 1L; } return num; } }
pachers/BepInEx.MonoMod.HookGenPatcher/MonoMod.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Cecil.Mdb; using Mono.Cecil.Pdb; using Mono.Collections.Generic; using MonoMod.Cil; using MonoMod.InlineRT; using MonoMod.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("0x0ade")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright 2021 0x0ade")] [assembly: AssemblyDescription("General purpose .NET assembly modding \"basework\". This package contains the core IL patcher and relinker.")] [assembly: AssemblyFileVersion("21.8.5.1")] [assembly: AssemblyInformationalVersion("21.08.05.01")] [assembly: AssemblyProduct("MonoMod")] [assembly: AssemblyTitle("MonoMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("21.8.5.1")] [module: UnverifiableCode] internal static class MultiTargetShims { private static readonly object[] _NoArgs = new object[0]; public static TypeReference GetConstraintType(this TypeReference type) { return type; } } namespace MonoMod { [MonoMod__SafeToCopy__] public class MonoModAdded : Attribute { } [MonoMod__SafeToCopy__] public class MonoModConstructor : Attribute { } [MonoMod__SafeToCopy__] public class MonoModCustomAttributeAttribute : Attribute { public MonoModCustomAttributeAttribute(string h) { } } [MonoMod__SafeToCopy__] public class MonoModCustomMethodAttributeAttribute : Attribute { public MonoModCustomMethodAttributeAttribute(string h) { } } [MonoMod__SafeToCopy__] public class MonoModEnumReplace : Attribute { } [MonoMod__SafeToCopy__] public class MonoModForceCall : Attribute { } [MonoMod__SafeToCopy__] public class MonoModForceCallvirt : Attribute { } [MonoMod__SafeToCopy__] [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] [Obsolete("Use MonoModLinkFrom or RuntimeDetour / HookGen instead.")] public class MonoModHook : Attribute { public string FindableID; public Type Type; public MonoModHook(string findableID) { FindableID = findableID; } public MonoModHook(Type type) { Type = type; FindableID = type.FullName; } } [MonoMod__SafeToCopy__] public class MonoModIfFlag : Attribute { public MonoModIfFlag(string key) { } public MonoModIfFlag(string key, bool fallback) { } } [MonoMod__SafeToCopy__] public class MonoModIgnore : Attribute { } [MonoMod__SafeToCopy__] [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] public class MonoModLinkFrom : Attribute { public string FindableID; public Type Type; public MonoModLinkFrom(string findableID) { FindableID = findableID; } public MonoModLinkFrom(Type type) { Type = type; FindableID = type.FullName; } } [MonoMod__SafeToCopy__] public class MonoModLinkTo : Attribute { public MonoModLinkTo(string t) { } public MonoModLinkTo(Type t) { } public MonoModLinkTo(string t, string n) { } public MonoModLinkTo(Type t, string n) { } } [MonoMod__SafeToCopy__] public class MonoModNoNew : Attribute { } [MonoMod__SafeToCopy__] public class MonoModOnPlatform : Attribute { public MonoModOnPlatform(params Platform[] p) { } } [MonoMod__SafeToCopy__] public class MonoModOriginal : Attribute { } [MonoMod__SafeToCopy__] public class MonoModOriginalName : Attribute { public MonoModOriginalName(string n) { } } [MonoMod__SafeToCopy__] public class MonoModPatch : Attribute { public MonoModPatch(string name) { } } [MonoMod__SafeToCopy__] public class MonoModPublic : Attribute { } [MonoMod__SafeToCopy__] public class MonoModRemove : Attribute { } [MonoMod__SafeToCopy__] public class MonoModReplace : Attribute { } [MonoMod__SafeToCopy__] public class MonoModTargetModule : Attribute { public MonoModTargetModule(string name) { } } [MonoMod__SafeToCopy__] internal class MonoMod__SafeToCopy__ : Attribute { } public delegate bool MethodParser(MonoModder modder, MethodBody body, Instruction instr, ref int instri); public delegate void MethodRewriter(MonoModder modder, MethodDefinition method); public delegate void MethodBodyRewriter(MonoModder modder, MethodBody body, Instruction instr, int instri); public delegate ModuleDefinition MissingDependencyResolver(MonoModder modder, ModuleDefinition main, string name, string fullName); public delegate void PostProcessor(MonoModder modder); public delegate void ModReadEventHandler(MonoModder modder, ModuleDefinition mod); public class RelinkMapEntry { public string Type; public string FindableID; public RelinkMapEntry() { } public RelinkMapEntry(string type, string findableID) { Type = type; FindableID = findableID; } } public enum DebugSymbolFormat { Auto, MDB, PDB } public class MonoModder : IDisposable { public static readonly bool IsMono = (object)Type.GetType("Mono.Runtime") != null; public static readonly Version Version = typeof(MonoModder).Assembly.GetName().Version; public Dictionary<string, object> SharedData = new Dictionary<string, object>(); public Dictionary<string, object> RelinkMap = new Dictionary<string, object>(); public Dictionary<string, ModuleDefinition> RelinkModuleMap = new Dictionary<string, ModuleDefinition>(); public HashSet<string> SkipList = new HashSet<string>(EqualityComparer<string>.Default); public Dictionary<string, IMetadataTokenProvider> RelinkMapCache = new Dictionary<string, IMetadataTokenProvider>(); public Dictionary<string, TypeReference> RelinkModuleMapCache = new Dictionary<string, TypeReference>(); public Dictionary<string, OpCode> ForceCallMap = new Dictionary<string, OpCode>(); public ModReadEventHandler OnReadMod; public PostProcessor PostProcessors; public Dictionary<string, Action<object, object[]>> CustomAttributeHandlers = new Dictionary<string, Action<object, object[]>> { { "MonoMod.MonoModPublic", delegate { } } }; public Dictionary<string, Action<object, object[]>> CustomMethodAttributeHandlers = new Dictionary<string, Action<object, object[]>>(); public MissingDependencyResolver MissingDependencyResolver; public MethodParser MethodParser; public MethodRewriter MethodRewriter; public MethodBodyRewriter MethodBodyRewriter; public Stream Input; public string InputPath; public Stream Output; public string OutputPath; public List<string> DependencyDirs = new List<string>(); public ModuleDefinition Module; public Dictionary<ModuleDefinition, List<ModuleDefinition>> DependencyMap = new Dictionary<ModuleDefinition, List<ModuleDefinition>>(); public Dictionary<string, ModuleDefinition> DependencyCache = new Dictionary<string, ModuleDefinition>(); public Func<ICustomAttributeProvider, TypeReference, bool> ShouldCleanupAttrib; public bool LogVerboseEnabled; public bool CleanupEnabled; public bool PublicEverything; public List<ModuleReference> Mods = new List<ModuleReference>(); public bool Strict; public bool MissingDependencyThrow; public bool RemovePatchReferences; public bool PreventInline; public bool? UpgradeMSCORLIB; public ReadingMode ReadingMode = (ReadingMode)1; public DebugSymbolFormat DebugSymbolOutputFormat; public int CurrentRID; protected IAssemblyResolver _assemblyResolver; protected ReaderParameters _readerParameters; protected WriterParameters _writerParameters; public bool GACEnabled; private string[] _GACPathsNone = new string[0]; protected string[] _GACPaths; protected MethodDefinition _mmOriginalCtor; protected MethodDefinition _mmOriginalNameCtor; protected MethodDefinition _mmAddedCtor; protected MethodDefinition _mmPatchCtor; public virtual IAssemblyResolver AssemblyResolver { get { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown if (_assemblyResolver == null) { DefaultAssemblyResolver val = new DefaultAssemblyResolver(); foreach (string dependencyDir in DependencyDirs) { ((BaseAssemblyResolver)val).AddSearchDirectory(dependencyDir); } _assemblyResolver = (IAssemblyResolver)(object)val; } return _assemblyResolver; } set { _assemblyResolver = value; } } public virtual ReaderParameters ReaderParameters { get { //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_0014: 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_002c: Expected O, but got Unknown if (_readerParameters == null) { _readerParameters = new ReaderParameters(ReadingMode) { AssemblyResolver = AssemblyResolver, ReadSymbols = true }; } return _readerParameters; } set { _readerParameters = value; } } public virtual WriterParameters WriterParameters { get { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0067: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown if (_writerParameters == null) { bool flag = DebugSymbolOutputFormat == DebugSymbolFormat.PDB; bool flag2 = DebugSymbolOutputFormat == DebugSymbolFormat.MDB; if (DebugSymbolOutputFormat == DebugSymbolFormat.Auto) { if ((PlatformHelper.Current & 0x25) == 37) { flag = true; } else { flag2 = true; } } WriterParameters val = new WriterParameters { WriteSymbols = true }; object symbolWriterProvider; if (!flag) { if (!flag2) { symbolWriterProvider = null; } else { ISymbolWriterProvider val2 = (ISymbolWriterProvider)new MdbWriterProvider(); symbolWriterProvider = val2; } } else { ISymbolWriterProvider val2 = (ISymbolWriterProvider)new NativePdbWriterProvider(); symbolWriterProvider = val2; } val.SymbolWriterProvider = (ISymbolWriterProvider)symbolWriterProvider; _writerParameters = val; } return _writerParameters; } set { _writerParameters = value; } } public string[] GACPaths { get { if (!GACEnabled) { return _GACPathsNone; } if (_GACPaths != null) { return _GACPaths; } if (!IsMono) { string environmentVariable = Environment.GetEnvironmentVariable("windir"); if (string.IsNullOrEmpty(environmentVariable)) { return _GACPaths = _GACPathsNone; } environmentVariable = Path.Combine(environmentVariable, "Microsoft.NET"); environmentVariable = Path.Combine(environmentVariable, "assembly"); _GACPaths = new string[3] { Path.Combine(environmentVariable, "GAC_32"), Path.Combine(environmentVariable, "GAC_64"), Path.Combine(environmentVariable, "GAC_MSIL") }; } else { List<string> list = new List<string>(); string text = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(typeof(object).Module.FullyQualifiedName)), "gac"); if (Directory.Exists(text)) { list.Add(text); } string environmentVariable2 = Environment.GetEnvironmentVariable("MONO_GAC_PREFIX"); if (!string.IsNullOrEmpty(environmentVariable2)) { string[] array = environmentVariable2.Split(new char[1] { Path.PathSeparator }); foreach (string text2 in array) { if (!string.IsNullOrEmpty(text2)) { string path = text2; path = Path.Combine(path, "lib"); path = Path.Combine(path, "mono"); path = Path.Combine(path, "gac"); if (Directory.Exists(path) && !list.Contains(path)) { list.Add(path); } } } } _GACPaths = list.ToArray(); } return _GACPaths; } set { GACEnabled = true; _GACPaths = value; } } public MonoModder() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) MethodParser = DefaultParser; MissingDependencyResolver = DefaultMissingDependencyResolver; PostProcessors = (PostProcessor)Delegate.Combine(PostProcessors, new PostProcessor(DefaultPostProcessor)); string environmentVariable = Environment.GetEnvironmentVariable("MONOMOD_DEPDIRS"); if (!string.IsNullOrEmpty(environmentVariable)) { foreach (string item in from dir in environmentVariable.Split(new char[1] { Path.PathSeparator }) select dir.Trim()) { IAssemblyResolver assemblyResolver = AssemblyResolver; IAssemblyResolver obj = ((assemblyResolver is BaseAssemblyResolver) ? assemblyResolver : null); if (obj != null) { ((BaseAssemblyResolver)obj).AddSearchDirectory(item); } DependencyDirs.Add(item); } } LogVerboseEnabled = Environment.GetEnvironmentVariable("MONOMOD_LOG_VERBOSE") == "1"; CleanupEnabled = Environment.GetEnvironmentVariable("MONOMOD_CLEANUP") != "0"; PublicEverything = Environment.GetEnvironmentVariable("MONOMOD_PUBLIC_EVERYTHING") == "1"; PreventInline = Environment.GetEnvironmentVariable("MONOMOD_PREVENTINLINE") == "1"; Strict = Environment.GetEnvironmentVariable("MONOMOD_STRICT") == "1"; MissingDependencyThrow = Environment.GetEnvironmentVariable("MONOMOD_DEPENDENCY_MISSING_THROW") != "0"; RemovePatchReferences = Environment.GetEnvironmentVariable("MONOMOD_DEPENDENCY_REMOVE_PATCH") != "0"; string environmentVariable2 = Environment.GetEnvironmentVariable("MONOMOD_DEBUG_FORMAT"); if (environmentVariable2 != null) { environmentVariable2 = environmentVariable2.ToLowerInvariant(); if (environmentVariable2 == "pdb") { DebugSymbolOutputFormat = DebugSymbolFormat.PDB; } else if (environmentVariable2 == "mdb") { DebugSymbolOutputFormat = DebugSymbolFormat.MDB; } } string environmentVariable3 = Environment.GetEnvironmentVariable("MONOMOD_MSCORLIB_UPGRADE"); UpgradeMSCORLIB = (string.IsNullOrEmpty(environmentVariable3) ? null : new bool?(environmentVariable3 != "0")); GACEnabled = Environment.GetEnvironmentVariable("MONOMOD_GAC_ENABLED") != "0"; MonoModRulesManager.Register(this); } public virtual void ClearCaches(bool all = false, bool shareable = false, bool moduleSpecific = false) { if (all || shareable) { foreach (KeyValuePair<string, ModuleDefinition> item in DependencyCache) { item.Value.Dispose(); } DependencyCache.Clear(); } if (all || moduleSpecific) { RelinkMapCache.Clear(); RelinkModuleMapCache.Clear(); } } public virtual void Dispose() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) ClearCaches(all: true); ModuleDefinition module = Module; if (module != null) { module.Dispose(); } Module = null; ((IDisposable)AssemblyResolver)?.Dispose(); AssemblyResolver = null; foreach (ModuleDefinition mod in Mods) { if ((int)mod != 0) { mod.Dispose(); } } foreach (List<ModuleDefinition> value in DependencyMap.Values) { foreach (ModuleDefinition item in value) { if (item != null) { item.Dispose(); } } } DependencyMap.Clear(); Input?.Dispose(); Output?.Dispose(); } public virtual void Log(object value) { Log(value.ToString()); } public virtual void Log(string text) { Console.Write("[MonoMod] "); Console.WriteLine(text); } public virtual void LogVerbose(object value) { if (LogVerboseEnabled) { Log(value); } } public virtual void LogVerbose(string text) { if (LogVerboseEnabled) { Log(text); } } private static ModuleDefinition _ReadModule(Stream input, ReaderParameters args) { if (args.ReadSymbols) { try { return ModuleDefinition.ReadModule(input, args); } catch { args.ReadSymbols = false; input.Seek(0L, SeekOrigin.Begin); } } return ModuleDefinition.ReadModule(input, args); } private static ModuleDefinition _ReadModule(string input, ReaderParameters args) { if (args.ReadSymbols) { try { return ModuleDefinition.ReadModule(input, args); } catch { args.ReadSymbols = false; } } return ModuleDefinition.ReadModule(input, args); } public virtual void Read() { if (Module != null) { return; } if (Input != null) { Log("Reading input stream into module."); Module = _ReadModule(Input, GenReaderParameters(mainModule: true)); } else if (InputPath != null) { Log("Reading input file into module."); IAssemblyResolver assemblyResolver = AssemblyResolver; IAssemblyResolver obj = ((assemblyResolver is BaseAssemblyResolver) ? assemblyResolver : null); if (obj != null) { ((BaseAssemblyResolver)obj).AddSearchDirectory(Path.GetDirectoryName(InputPath)); } DependencyDirs.Add(Path.GetDirectoryName(InputPath)); Module = _ReadModule(InputPath, GenReaderParameters(mainModule: true, InputPath)); } string environmentVariable = Environment.GetEnvironmentVariable("MONOMOD_MODS"); if (string.IsNullOrEmpty(environmentVariable)) { return; } foreach (string item in from path in environmentVariable.Split(new char[1] { Path.PathSeparator }) select path.Trim()) { ReadMod(item); } } public virtual void MapDependencies() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown foreach (ModuleDefinition mod in Mods) { ModuleDefinition main = mod; MapDependencies(main); } MapDependencies(Module); } public virtual void MapDependencies(ModuleDefinition main) { //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 (DependencyMap.ContainsKey(main)) { return; } DependencyMap[main] = new List<ModuleDefinition>(); Enumerator<AssemblyNameReference> enumerator = main.AssemblyReferences.GetEnumerator(); try { while (enumerator.MoveNext()) { AssemblyNameReference current = enumerator.Current; MapDependency(main, current); } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual void MapDependency(ModuleDefinition main, AssemblyNameReference depRef) { MapDependency(main, depRef.Name, depRef.FullName, depRef); } public virtual void MapDependency(ModuleDefinition main, string name, string fullName = null, AssemblyNameReference depRef = null) { if (!DependencyMap.TryGetValue(main, out var value)) { value = (DependencyMap[main] = new List<ModuleDefinition>()); } if (fullName != null && (DependencyCache.TryGetValue(fullName, out var value2) || DependencyCache.TryGetValue(fullName + " [RT:" + main.RuntimeVersion + "]", out value2))) { LogVerbose("[MapDependency] " + ((ModuleReference)main).Name + " -> " + ((ModuleReference)value2).Name + " ((" + fullName + "), (" + name + ")) from cache"); value.Add(value2); MapDependencies(value2); return; } if (DependencyCache.TryGetValue(name, out value2) || DependencyCache.TryGetValue(name + " [RT:" + main.RuntimeVersion + "]", out value2)) { LogVerbose("[MapDependency] " + ((ModuleReference)main).Name + " -> " + ((ModuleReference)value2).Name + " (" + name + ") from cache"); value.Add(value2); MapDependencies(value2); return; } string text = Path.GetExtension(name).ToLowerInvariant(); bool flag = text == "pdb" || text == "mdb"; string text2 = null; foreach (string dependencyDir in DependencyDirs) { text2 = Path.Combine(dependencyDir, name + ".dll"); if (!File.Exists(text2)) { text2 = Path.Combine(dependencyDir, name + ".exe"); } if (!File.Exists(text2) && !flag) { text2 = Path.Combine(dependencyDir, name); } if (File.Exists(text2)) { break; } text2 = null; } if (text2 == null && depRef != null) { try { AssemblyDefinition obj = AssemblyResolver.Resolve(depRef); value2 = ((obj != null) ? obj.MainModule : null); } catch { } if (value2 != null) { text2 = value2.FileName; } } if (text2 == null) { string[] gACPaths = GACPaths; for (int i = 0; i < gACPaths.Length; i++) { text2 = Path.Combine(gACPaths[i], name); if (Directory.Exists(text2)) { string[] directories = Directory.GetDirectories(text2); int num = 0; int num2 = 0; for (int j = 0; j < directories.Length; j++) { string text3 = directories[j]; if (text3.StartsWith(text2)) { text3 = text3.Substring(text2.Length + 1); } Match match = Regex.Match(text3, "\\d+"); if (match.Success) { int num3 = int.Parse(match.Value); if (num3 > num) { num = num3; num2 = j; } } } text2 = Path.Combine(directories[num2], name + ".dll"); break; } text2 = null; } } if (text2 == null) { try { AssemblyDefinition obj3 = AssemblyResolver.Resolve(AssemblyNameReference.Parse(fullName ?? name)); value2 = ((obj3 != null) ? obj3.MainModule : null); } catch { } if (value2 != null) { text2 = value2.FileName; } } if (value2 == null) { if (text2 != null && File.Exists(text2)) { value2 = _ReadModule(text2, GenReaderParameters(mainModule: false, text2)); } else if ((value2 = MissingDependencyResolver?.Invoke(this, main, name, fullName)) == null) { return; } } LogVerbose("[MapDependency] " + ((ModuleReference)main).Name + " -> " + ((ModuleReference)value2).Name + " ((" + fullName + "), (" + name + ")) loaded"); value.Add(value2); if (fullName == null) { fullName = value2.Assembly.FullName; } DependencyCache[fullName] = value2; DependencyCache[name] = value2; MapDependencies(value2); } public virtual ModuleDefinition DefaultMissingDependencyResolver(MonoModder mod, ModuleDefinition main, string name, string fullName) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (MissingDependencyThrow && Environment.GetEnvironmentVariable("MONOMOD_DEPENDENCY_MISSING_THROW") == "0") { Log("[MissingDependencyResolver] [WARNING] Use MMILRT.Modder.MissingDependencyThrow instead of setting the env var MONOMOD_DEPENDENCY_MISSING_THROW"); MissingDependencyThrow = false; } if (MissingDependencyThrow || Strict) { throw new RelinkTargetNotFoundException("MonoMod cannot map dependency " + ((ModuleReference)main).Name + " -> ((" + fullName + "), (" + name + ")) - not found", (IMetadataTokenProvider)(object)main, (IMetadataTokenProvider)null); } return null; } public virtual void Write(Stream output = null, string outputPath = null) { output = output ?? Output; outputPath = outputPath ?? OutputPath; PatchRefsInType(PatchWasHere()); if (output != null) { Log("[Write] Writing modded module into output stream."); Module.Write(output, WriterParameters); } else { Log("[Write] Writing modded module into output file."); Module.Write(outputPath, WriterParameters); } } public virtual ReaderParameters GenReaderParameters(bool mainModule, string path = null) { //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_0013: Expected O, but got Unknown ReaderParameters readerParameters = ReaderParameters; ReaderParameters val = new ReaderParameters(readerParameters.ReadingMode); val.AssemblyResolver = readerParameters.AssemblyResolver; val.MetadataResolver = readerParameters.MetadataResolver; val.InMemory = readerParameters.InMemory; val.MetadataImporterProvider = readerParameters.MetadataImporterProvider; val.ReflectionImporterProvider = readerParameters.ReflectionImporterProvider; val.ThrowIfSymbolsAreNotMatching = readerParameters.ThrowIfSymbolsAreNotMatching; val.ApplyWindowsRuntimeProjections = readerParameters.ApplyWindowsRuntimeProjections; val.SymbolStream = readerParameters.SymbolStream; val.SymbolReaderProvider = readerParameters.SymbolReaderProvider; val.ReadSymbols = readerParameters.ReadSymbols; if (path != null && !File.Exists(path + ".mdb") && !File.Exists(Path.ChangeExtension(path, "pdb"))) { val.ReadSymbols = false; } return val; } public virtual void ReadMod(string path) { if (Directory.Exists(path)) { Log("[ReadMod] Loading mod dir: " + path); string text = ((ModuleReference)Module).Name.Substring(0, ((ModuleReference)Module).Name.Length - 3); string value = text.Replace(" ", ""); if (!DependencyDirs.Contains(path)) { IAssemblyResolver assemblyResolver = AssemblyResolver; IAssemblyResolver obj = ((assemblyResolver is BaseAssemblyResolver) ? assemblyResolver : null); if (obj != null) { ((BaseAssemblyResolver)obj).AddSearchDirectory(path); } DependencyDirs.Add(path); } string[] files = Directory.GetFiles(path); foreach (string text2 in files) { if ((Path.GetFileName(text2).StartsWith(text) || Path.GetFileName(text2).StartsWith(value)) && text2.ToLower().EndsWith(".mm.dll")) { ReadMod(text2); } } return; } Log("[ReadMod] Loading mod: " + path); ModuleDefinition val = _ReadModule(path, GenReaderParameters(mainModule: false, path)); string directoryName = Path.GetDirectoryName(path); if (!DependencyDirs.Contains(directoryName)) { IAssemblyResolver assemblyResolver2 = AssemblyResolver; IAssemblyResolver obj2 = ((assemblyResolver2 is BaseAssemblyResolver) ? assemblyResolver2 : null); if (obj2 != null) { ((BaseAssemblyResolver)obj2).AddSearchDirectory(directoryName); } DependencyDirs.Add(directoryName); } Mods.Add((ModuleReference)(object)val); OnReadMod?.Invoke(this, val); } public virtual void ReadMod(Stream stream) { Log($"[ReadMod] Loading mod: stream#{(uint)stream.GetHashCode()}"); ModuleDefinition val = _ReadModule(stream, GenReaderParameters(mainModule: false)); Mods.Add((ModuleReference)(object)val); OnReadMod?.Invoke(this, val); } public virtual void ParseRules(ModuleDefinition mod) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) TypeDefinition type = mod.GetType("MonoMod.MonoModRules"); Type rulesTypeMMILRT = null; if (type != null) { rulesTypeMMILRT = this.ExecuteRules(type); mod.Types.Remove(type); } Enumerator<TypeDefinition> enumerator = mod.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; ParseRulesInType(current, rulesTypeMMILRT); } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual void ParseRulesInType(TypeDefinition type, Type rulesTypeMMILRT = null) { //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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: 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_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) Extensions.GetPatchFullName((MemberReference)(object)type); if (!MatchingConditionals((ICustomAttributeProvider)(object)type, Module)) { return; } CustomAttribute customAttribute = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModCustomAttributeAttribute"); CustomAttributeArgument val; if (customAttribute != null) { val = customAttribute.ConstructorArguments[0]; MethodInfo method2 = rulesTypeMMILRT.GetMethod((string)((CustomAttributeArgument)(ref val)).Value); CustomAttributeHandlers[((MemberReference)type).FullName] = delegate(object self, object[] args) { method2.Invoke(self, args); }; } customAttribute = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModCustomMethodAttributeAttribute"); if (customAttribute != null) { val = customAttribute.ConstructorArguments[0]; MethodInfo method = rulesTypeMMILRT.GetMethod((string)((CustomAttributeArgument)(ref val)).Value); ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length == 2 && Extensions.IsCompatible(parameters[0].ParameterType, typeof(ILContext))) { CustomMethodAttributeHandlers[((MemberReference)type).FullName] = delegate(object self, object[] args) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown ILContext il = new ILContext((MethodDefinition)args[0]); il.Invoke((Manipulator)delegate { method.Invoke(self, new object[2] { il, args[1] }); }); if (il.IsReadOnly) { il.Dispose(); } }; } else { CustomMethodAttributeHandlers[((MemberReference)type).FullName] = delegate(object self, object[] args) { method.Invoke(self, args); }; } } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModHook"); val2 != null; val2 = ((ICustomAttributeProvider)(object)type).GetNextCustomAttribute("MonoMod.MonoModHook")) { ParseLinkFrom((MemberReference)(object)type, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModLinkFrom"); val2 != null; val2 = ((ICustomAttributeProvider)(object)type).GetNextCustomAttribute("MonoMod.MonoModLinkFrom")) { ParseLinkFrom((MemberReference)(object)type, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModLinkTo"); val2 != null; val2 = ((ICustomAttributeProvider)(object)type).GetNextCustomAttribute("MonoMod.MonoModLinkTo")) { ParseLinkTo((MemberReference)(object)type, val2); } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModIgnore")) { return; } Enumerator<MethodDefinition> enumerator = type.Methods.GetEnumerator(); try { while (enumerator.MoveNext()) { MethodDefinition current = enumerator.Current; if (MatchingConditionals((ICustomAttributeProvider)(object)current, Module)) { for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current, "MonoMod.MonoModHook"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current).GetNextCustomAttribute("MonoMod.MonoModHook")) { ParseLinkFrom((MemberReference)(object)current, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current, "MonoMod.MonoModLinkFrom"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current).GetNextCustomAttribute("MonoMod.MonoModLinkFrom")) { ParseLinkFrom((MemberReference)(object)current, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current, "MonoMod.MonoModLinkTo"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current).GetNextCustomAttribute("MonoMod.MonoModLinkTo")) { ParseLinkTo((MemberReference)(object)current, val2); } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)current, "MonoMod.MonoModForceCall")) { ForceCallMap[Extensions.GetID((MethodReference)(object)current, (string)null, (string)null, true, false)] = OpCodes.Call; } else if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)current, "MonoMod.MonoModForceCallvirt")) { ForceCallMap[Extensions.GetID((MethodReference)(object)current, (string)null, (string)null, true, false)] = OpCodes.Callvirt; } } } } finally { ((IDisposable)enumerator).Dispose(); } Enumerator<FieldDefinition> enumerator2 = type.Fields.GetEnumerator(); try { while (enumerator2.MoveNext()) { FieldDefinition current2 = enumerator2.Current; if (MatchingConditionals((ICustomAttributeProvider)(object)current2, Module)) { for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current2, "MonoMod.MonoModHook"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current2).GetNextCustomAttribute("MonoMod.MonoModHook")) { ParseLinkFrom((MemberReference)(object)current2, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current2, "MonoMod.MonoModLinkFrom"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current2).GetNextCustomAttribute("MonoMod.MonoModLinkFrom")) { ParseLinkFrom((MemberReference)(object)current2, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current2, "MonoMod.MonoModLinkTo"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current2).GetNextCustomAttribute("MonoMod.MonoModLinkTo")) { ParseLinkTo((MemberReference)(object)current2, val2); } } } } finally { ((IDisposable)enumerator2).Dispose(); } Enumerator<PropertyDefinition> enumerator3 = type.Properties.GetEnumerator(); try { while (enumerator3.MoveNext()) { PropertyDefinition current3 = enumerator3.Current; if (MatchingConditionals((ICustomAttributeProvider)(object)current3, Module)) { for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current3, "MonoMod.MonoModHook"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current3).GetNextCustomAttribute("MonoMod.MonoModHook")) { ParseLinkFrom((MemberReference)(object)current3, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current3, "MonoMod.MonoModLinkFrom"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current3).GetNextCustomAttribute("MonoMod.MonoModLinkFrom")) { ParseLinkFrom((MemberReference)(object)current3, val2); } for (CustomAttribute val2 = Extensions.GetCustomAttribute((ICustomAttributeProvider)(object)current3, "MonoMod.MonoModLinkTo"); val2 != null; val2 = ((ICustomAttributeProvider)(object)current3).GetNextCustomAttribute("MonoMod.MonoModLinkTo")) { ParseLinkTo((MemberReference)(object)current3, val2); } } } } finally { ((IDisposable)enumerator3).Dispose(); } Enumerator<TypeDefinition> enumerator4 = type.NestedTypes.GetEnumerator(); try { while (enumerator4.MoveNext()) { TypeDefinition current4 = enumerator4.Current; ParseRulesInType(current4, rulesTypeMMILRT); } } finally { ((IDisposable)enumerator4).Dispose(); } } public virtual void ParseLinkFrom(MemberReference target, CustomAttribute hook) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_003c: 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_005a: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) CustomAttributeArgument val = hook.ConstructorArguments[0]; string key = (string)((CustomAttributeArgument)(ref val)).Value; object value; if (target is TypeReference) { value = Extensions.GetPatchFullName((MemberReference)(TypeReference)target); } else if (target is MethodReference) { value = new RelinkMapEntry(Extensions.GetPatchFullName((MemberReference)(object)((MemberReference)(MethodReference)target).DeclaringType), Extensions.GetID((MethodReference)target, (string)null, (string)null, false, false)); } else if (target is FieldReference) { value = new RelinkMapEntry(Extensions.GetPatchFullName((MemberReference)(object)((MemberReference)(FieldReference)target).DeclaringType), ((MemberReference)(FieldReference)target).Name); } else { if (!(target is PropertyReference)) { return; } value = new RelinkMapEntry(Extensions.GetPatchFullName((MemberReference)(object)((MemberReference)(PropertyReference)target).DeclaringType), ((MemberReference)(PropertyReference)target).Name); } RelinkMap[key] = value; } public virtual void ParseLinkTo(MemberReference from, CustomAttribute hook) { //IL_0063: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) MemberReference obj = ((from is MethodReference) ? from : null); string key = ((obj != null) ? Extensions.GetID((MethodReference)(object)obj, (string)null, (string)null, true, false) : null) ?? Extensions.GetPatchFullName(from); CustomAttributeArgument val; if (hook.ConstructorArguments.Count == 1) { Dictionary<string, object> relinkMap = RelinkMap; val = hook.ConstructorArguments[0]; relinkMap[key] = (string)((CustomAttributeArgument)(ref val)).Value; } else { Dictionary<string, object> relinkMap2 = RelinkMap; val = hook.ConstructorArguments[0]; string type = (string)((CustomAttributeArgument)(ref val)).Value; val = hook.ConstructorArguments[1]; relinkMap2[key] = new RelinkMapEntry(type, (string)((CustomAttributeArgument)(ref val)).Value); } } public virtual void RunCustomAttributeHandlers(ICustomAttributeProvider cap) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown if (!cap.HasCustomAttributes) { return; } CustomAttribute[] array = cap.CustomAttributes.ToArray(); foreach (CustomAttribute val in array) { if (CustomAttributeHandlers.TryGetValue(((MemberReference)val.AttributeType).FullName, out var value)) { value?.Invoke(null, new object[2] { cap, val }); } if (cap is MethodReference && CustomMethodAttributeHandlers.TryGetValue(((MemberReference)val.AttributeType).FullName, out value)) { value?.Invoke(null, new object[2] { (object)(MethodDefinition)cap, val }); } } } public virtual void AutoPatch() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown Log("[AutoPatch] Parsing rules in loaded mods"); foreach (ModuleDefinition mod4 in Mods) { ModuleDefinition mod = mod4; ParseRules(mod); } Log("[AutoPatch] PrePatch pass"); foreach (ModuleDefinition mod5 in Mods) { ModuleDefinition mod2 = mod5; PrePatchModule(mod2); } Log("[AutoPatch] Patch pass"); foreach (ModuleDefinition mod6 in Mods) { ModuleDefinition mod3 = mod6; PatchModule(mod3); } Log("[AutoPatch] PatchRefs pass"); PatchRefs(); if (PostProcessors != null) { Delegate[] invocationList = PostProcessors.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Log($"[PostProcessor] PostProcessor pass #{i + 1}"); ((PostProcessor)invocationList[i])?.Invoke(this); } } } public virtual IMetadataTokenProvider Relinker(IMetadataTokenProvider mtp, IGenericParameterProvider context) { //IL_0027: 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 { return PostRelinker(MainRelinker(mtp, context) ?? mtp, context) ?? throw new RelinkTargetNotFoundException(mtp, (IMetadataTokenProvider)(object)context); } catch (Exception ex) { throw new RelinkFailedException((string)null, ex, mtp, (IMetadataTokenProvider)(object)context); } } public virtual IMetadataTokenProvider MainRelinker(IMetadataTokenProvider mtp, IGenericParameterProvider context) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) TypeReference val = (TypeReference)(object)((mtp is TypeReference) ? mtp : null); if (val != null) { if (((MemberReference)val).Module == Module) { return (IMetadataTokenProvider)(object)val; } if (((MemberReference)val).Module != null && !Mods.Contains((ModuleReference)(object)((MemberReference)val).Module)) { return (IMetadataTokenProvider)(object)Module.ImportReference(val); } val = (TypeReference)(((object)Extensions.SafeResolve(val)) ?? ((object)val)); TypeReference val2 = FindTypeDeep(Extensions.GetPatchFullName((MemberReference)(object)val)); if (val2 == null) { if (RelinkMap.ContainsKey(((MemberReference)val).FullName)) { return null; } throw new RelinkTargetNotFoundException(mtp, (IMetadataTokenProvider)(object)context); } return (IMetadataTokenProvider)(object)Module.ImportReference(val2); } if (mtp is FieldReference || mtp is MethodReference || mtp is PropertyReference || mtp is EventReference) { return Extensions.ImportReference(Module, mtp); } throw new InvalidOperationException($"MonoMod default relinker can't handle metadata token providers of the type {((object)mtp).GetType()}"); } public virtual IMetadataTokenProvider PostRelinker(IMetadataTokenProvider mtp, IGenericParameterProvider context) { return ResolveRelinkTarget(mtp) ?? mtp; } public virtual IMetadataTokenProvider ResolveRelinkTarget(IMetadataTokenProvider mtp, bool relink = true, bool relinkModule = true) { //IL_000b: 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_002f: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_023c: Expected O, but got Unknown //IL_02d2: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_0193: Unknown result type (might be due to invalid IL or missing references) string text = null; string text2; if (mtp is TypeReference) { text2 = ((MemberReference)(TypeReference)mtp).FullName; } else if (mtp is MethodReference) { text2 = Extensions.GetID((MethodReference)mtp, (string)null, (string)null, true, false); text = Extensions.GetID((MethodReference)mtp, (string)null, (string)null, true, true); } else if (mtp is FieldReference) { text2 = ((MemberReference)(FieldReference)mtp).FullName; } else { if (!(mtp is PropertyReference)) { return null; } text2 = ((MemberReference)(PropertyReference)mtp).FullName; } if (RelinkMapCache.TryGetValue(text2, out var value)) { return value; } if (relink && (RelinkMap.TryGetValue(text2, out var value2) || (text != null && RelinkMap.TryGetValue(text, out value2)))) { if (value2 is IMetadataTokenProvider) { return RelinkMapCache[text2] = Extensions.ImportReference(Module, (IMetadataTokenProvider)value2); } if (value2 is RelinkMapEntry) { string type = ((RelinkMapEntry)value2).Type; string findableID = ((RelinkMapEntry)value2).FindableID; TypeReference obj = FindTypeDeep(type); TypeDefinition val2 = ((obj != null) ? Extensions.SafeResolve(obj) : null); if (val2 == null) { return RelinkMapCache[text2] = ResolveRelinkTarget(mtp, relink: false, relinkModule); } value2 = Extensions.FindMethod(val2, findableID, true) ?? ((object)Extensions.FindField(val2, findableID)) ?? ((object)(Extensions.FindProperty(val2, findableID) ?? null)); if (value2 == null) { if (Strict) { throw new RelinkTargetNotFoundException(string.Format("{0} ({1}, {2}) (remap: {3})", "MonoMod relinker failed finding", type, findableID, mtp), mtp, (IMetadataTokenProvider)null); } return null; } return RelinkMapCache[text2] = Extensions.ImportReference(Module, (IMetadataTokenProvider)value2); } if (value2 is string && mtp is TypeReference) { IMetadataTokenProvider val5 = (IMetadataTokenProvider)(object)FindTypeDeep((string)value2); if (val5 == null) { if (Strict) { throw new RelinkTargetNotFoundException(string.Format("{0} {1} (remap: {2})", "MonoMod relinker failed finding", value2, mtp), mtp, (IMetadataTokenProvider)null); } return null; } value2 = Extensions.ImportReference(Module, ResolveRelinkTarget(val5, relink: false, relinkModule) ?? val5); } if (value2 is IMetadataTokenProvider) { Dictionary<string, IMetadataTokenProvider> relinkMapCache = RelinkMapCache; string key = text2; IMetadataTokenProvider val6 = (IMetadataTokenProvider)value2; IMetadataTokenProvider result = val6; relinkMapCache[key] = val6; return result; } throw new InvalidOperationException($"MonoMod doesn't support RelinkMap value of type {value2.GetType()} (remap: {mtp})"); } if (relinkModule && mtp is TypeReference) { if (RelinkModuleMapCache.TryGetValue(text2, out var value3)) { return (IMetadataTokenProvider)(object)value3; } value3 = (TypeReference)mtp; if (RelinkModuleMap.TryGetValue(value3.Scope.Name, out var value4)) { TypeReference type2 = (TypeReference)(object)value4.GetType(((MemberReference)value3).FullName); if (type2 == null) { if (Strict) { throw new RelinkTargetNotFoundException(string.Format("{0} {1} (remap: {2})", "MonoMod relinker failed finding", ((MemberReference)value3).FullName, mtp), mtp, (IMetadataTokenProvider)null); } return null; } return (IMetadataTokenProvider)(object)(RelinkModuleMapCache[text2] = Module.ImportReference(type2)); } return (IMetadataTokenProvider)(object)Module.ImportReference(value3); } return null; } public virtual bool DefaultParser(MonoModder mod, MethodBody body, Instruction instr, ref int instri) { return true; } public virtual TypeReference FindType(string name) { return FindType(Module, name, new Stack<ModuleDefinition>()) ?? Module.GetType(name, false); } public virtual TypeReference FindType(string name, bool runtimeName) { return FindType(Module, name, new Stack<ModuleDefinition>()) ?? Module.GetType(name, runtimeName); } protected virtual TypeReference FindType(ModuleDefinition main, string fullName, Stack<ModuleDefinition> crawled) { TypeReference type; if ((type = main.GetType(fullName, false)) != null) { return type; } if (fullName.StartsWith("<PrivateImplementationDetails>/")) { return null; } if (crawled.Contains(main)) { return null; } crawled.Push(main); foreach (ModuleDefinition item in DependencyMap[main]) { if ((!RemovePatchReferences || !((AssemblyNameReference)item.Assembly.Name).Name.EndsWith(".mm")) && (type = FindType(item, fullName, crawled)) != null) { return type; } } return null; } public virtual TypeReference FindTypeDeep(string name) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown TypeReference val = FindType(name, runtimeName: false); if (val != null) { return val; } Stack<ModuleDefinition> crawled = new Stack<ModuleDefinition>(); val = null; foreach (ModuleDefinition mod in Mods) { ModuleDefinition key = mod; foreach (ModuleDefinition item in DependencyMap[key]) { if ((val = FindType(item, name, crawled)) != null) { IMetadataScope scope = val.Scope; AssemblyNameReference dllRef = (AssemblyNameReference)(object)((scope is AssemblyNameReference) ? scope : null); if (dllRef != null && !((IEnumerable<AssemblyNameReference>)Module.AssemblyReferences).Any((AssemblyNameReference n) => n.Name == dllRef.Name)) { Module.AssemblyReferences.Add(dllRef); } return Module.ImportReference(val); } } } return null; } public virtual void PrePatchModule(ModuleDefinition mod) { //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_003d: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown Enumerator<TypeDefinition> enumerator = mod.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; PrePatchType(current); } } finally { ((IDisposable)enumerator).Dispose(); } Enumerator<ModuleReference> enumerator2 = mod.ModuleReferences.GetEnumerator(); try { while (enumerator2.MoveNext()) { ModuleReference current2 = enumerator2.Current; if (!Module.ModuleReferences.Contains(current2)) { Module.ModuleReferences.Add(current2); } } } finally { ((IDisposable)enumerator2).Dispose(); } Enumerator<Resource> enumerator3 = mod.Resources.GetEnumerator(); try { while (enumerator3.MoveNext()) { Resource current3 = enumerator3.Current; if (current3 is EmbeddedResource) { Module.Resources.Add((Resource)new EmbeddedResource(current3.Name.StartsWith(((AssemblyNameReference)mod.Assembly.Name).Name) ? (((AssemblyNameReference)Module.Assembly.Name).Name + current3.Name.Substring(((AssemblyNameReference)mod.Assembly.Name).Name.Length)) : current3.Name, current3.Attributes, ((EmbeddedResource)current3).GetResourceData())); } } } finally { ((IDisposable)enumerator3).Dispose(); } } public virtual void PrePatchType(TypeDefinition type, bool forceAdd = false) { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown string patchFullName = Extensions.GetPatchFullName((MemberReference)(object)type); if ((((TypeReference)type).Namespace != "MonoMod" && Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModIgnore")) || SkipList.Contains(patchFullName) || !MatchingConditionals((ICustomAttributeProvider)(object)type, Module) || (((MemberReference)type).FullName == "MonoMod.MonoModRules" && !forceAdd)) { return; } TypeReference val = (forceAdd ? null : Module.GetType(patchFullName, false)); TypeDefinition val2 = ((val != null) ? Extensions.SafeResolve(val) : null); if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModReplace") || Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModRemove")) { if (val2 != null) { if (val2.DeclaringType == null) { Module.Types.Remove(val2); } else { val2.DeclaringType.NestedTypes.Remove(val2); } } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModRemove")) { return; } } else if (val != null) { PrePatchNested(type); return; } LogVerbose("[PrePatchType] Adding " + patchFullName + " to the target module."); TypeDefinition val3 = new TypeDefinition(((TypeReference)type).Namespace, ((MemberReference)type).Name, type.Attributes, type.BaseType); Enumerator<GenericParameter> enumerator = ((TypeReference)type).GenericParameters.GetEnumerator(); try { while (enumerator.MoveNext()) { GenericParameter current = enumerator.Current; ((TypeReference)val3).GenericParameters.Add(Extensions.Clone(current)); } } finally { ((IDisposable)enumerator).Dispose(); } Enumerator<InterfaceImplementation> enumerator2 = type.Interfaces.GetEnumerator(); try { while (enumerator2.MoveNext()) { InterfaceImplementation current2 = enumerator2.Current; val3.Interfaces.Add(current2); } } finally { ((IDisposable)enumerator2).Dispose(); } val3.ClassSize = type.ClassSize; if (type.DeclaringType != null) { val3.DeclaringType = Extensions.Relink((TypeReference)(object)type.DeclaringType, new Relinker(Relinker), (IGenericParameterProvider)(object)val3).Resolve(); val3.DeclaringType.NestedTypes.Add(val3); } else { Module.Types.Add(val3); } val3.PackingSize = type.PackingSize; Extensions.AddRange<SecurityDeclaration>(val3.SecurityDeclarations, (IEnumerable<SecurityDeclaration>)type.SecurityDeclarations); val3.CustomAttributes.Add(new CustomAttribute(GetMonoModAddedCtor())); val = (TypeReference)(object)val3; PrePatchNested(type); } protected virtual void PrePatchNested(TypeDefinition type) { for (int i = 0; i < type.NestedTypes.Count; i++) { PrePatchType(type.NestedTypes[i]); } } public virtual void PatchModule(ModuleDefinition mod) { //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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) Enumerator<TypeDefinition> enumerator = mod.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; if ((((TypeReference)current).Namespace == "MonoMod" || ((TypeReference)current).Namespace.StartsWith("MonoMod.")) && ((MemberReference)current.BaseType).FullName == "System.Attribute") { PatchType(current); } } } finally { ((IDisposable)enumerator).Dispose(); } enumerator = mod.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current2 = enumerator.Current; if ((!(((TypeReference)current2).Namespace == "MonoMod") && !((TypeReference)current2).Namespace.StartsWith("MonoMod.")) || !(((MemberReference)current2.BaseType).FullName == "System.Attribute")) { PatchType(current2); } } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual void PatchType(TypeDefinition type) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) string patchFullName = Extensions.GetPatchFullName((MemberReference)(object)type); TypeReference type2 = Module.GetType(patchFullName, false); if (type2 == null) { return; } TypeDefinition val = ((type2 != null) ? Extensions.SafeResolve(type2) : null); Enumerator<CustomAttribute> enumerator; if ((((TypeReference)type).Namespace != "MonoMod" && Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModIgnore")) || SkipList.Contains(patchFullName) || !MatchingConditionals((ICustomAttributeProvider)(object)type, Module)) { if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModIgnore") && val != null) { enumerator = type.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName)) { val.CustomAttributes.Add(Extensions.Clone(current)); } } } finally { ((IDisposable)enumerator).Dispose(); } } PatchNested(type); return; } if (patchFullName == ((MemberReference)type).FullName) { LogVerbose("[PatchType] Patching type " + patchFullName); } else { LogVerbose("[PatchType] Patching type " + patchFullName + " (prefixed: " + ((MemberReference)type).FullName + ")"); } enumerator = type.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current2 = enumerator.Current; if (!Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)val, ((MemberReference)current2.AttributeType).FullName)) { val.CustomAttributes.Add(Extensions.Clone(current2)); } } } finally { ((IDisposable)enumerator).Dispose(); } HashSet<MethodDefinition> hashSet = new HashSet<MethodDefinition>(); Enumerator<PropertyDefinition> enumerator2 = type.Properties.GetEnumerator(); try { while (enumerator2.MoveNext()) { PropertyDefinition current3 = enumerator2.Current; PatchProperty(val, current3, hashSet); } } finally { ((IDisposable)enumerator2).Dispose(); } HashSet<MethodDefinition> hashSet2 = new HashSet<MethodDefinition>(); Enumerator<EventDefinition> enumerator3 = type.Events.GetEnumerator(); try { while (enumerator3.MoveNext()) { EventDefinition current4 = enumerator3.Current; PatchEvent(val, current4, hashSet2); } } finally { ((IDisposable)enumerator3).Dispose(); } Enumerator<MethodDefinition> enumerator4 = type.Methods.GetEnumerator(); try { while (enumerator4.MoveNext()) { MethodDefinition current5 = enumerator4.Current; if (!hashSet.Contains(current5) && !hashSet2.Contains(current5)) { PatchMethod(val, current5); } } } finally { ((IDisposable)enumerator4).Dispose(); } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)type, "MonoMod.MonoModEnumReplace")) { int num = 0; while (num < val.Fields.Count) { if (((MemberReference)val.Fields[num]).Name == "value__") { num++; } else { val.Fields.RemoveAt(num); } } } Enumerator<FieldDefinition> enumerator5 = type.Fields.GetEnumerator(); try { while (enumerator5.MoveNext()) { FieldDefinition current6 = enumerator5.Current; PatchField(val, current6); } } finally { ((IDisposable)enumerator5).Dispose(); } PatchNested(type); } protected virtual void PatchNested(TypeDefinition type) { for (int i = 0; i < type.NestedTypes.Count; i++) { PatchType(type.NestedTypes[i]); } } public virtual void PatchProperty(TypeDefinition targetType, PropertyDefinition prop, HashSet<MethodDefinition> propMethods = null) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_022b: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Expected O, but got Unknown //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Expected O, but got Unknown //IL_02b5: Expected O, but got Unknown //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) if (!MatchingConditionals((ICustomAttributeProvider)(object)prop, Module)) { return; } ((MemberReference)prop).Name = Extensions.GetPatchName((MemberReference)(object)prop); PropertyDefinition val = Extensions.FindProperty(targetType, ((MemberReference)prop).Name); string text = "<" + ((MemberReference)prop).Name + ">__BackingField"; FieldDefinition val2 = Extensions.FindField(prop.DeclaringType, text); FieldDefinition val3 = Extensions.FindField(targetType, text); Enumerator<CustomAttribute> enumerator; Enumerator<MethodDefinition> enumerator2; if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)prop, "MonoMod.MonoModIgnore")) { if (val != null) { enumerator = prop.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName)) { val.CustomAttributes.Add(Extensions.Clone(current)); } } } finally { ((IDisposable)enumerator).Dispose(); } } if (val2 != null) { val2.DeclaringType.Fields.Remove(val2); } if (prop.GetMethod != null) { propMethods?.Add(prop.GetMethod); } if (prop.SetMethod != null) { propMethods?.Add(prop.SetMethod); } enumerator2 = prop.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current2 = enumerator2.Current; propMethods?.Add(current2); } return; } finally { ((IDisposable)enumerator2).Dispose(); } } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)prop, "MonoMod.MonoModRemove") || Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)prop, "MonoMod.MonoModReplace")) { if (val != null) { targetType.Properties.Remove(val); if (val3 != null) { targetType.Fields.Remove(val3); } if (val.GetMethod != null) { targetType.Methods.Remove(val.GetMethod); } if (val.SetMethod != null) { targetType.Methods.Remove(val.SetMethod); } enumerator2 = val.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current3 = enumerator2.Current; targetType.Methods.Remove(current3); } } finally { ((IDisposable)enumerator2).Dispose(); } } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)prop, "MonoMod.MonoModRemove")) { return; } } if (val == null) { PropertyDefinition val4 = new PropertyDefinition(((MemberReference)prop).Name, prop.Attributes, ((PropertyReference)prop).PropertyType); val = val4; PropertyDefinition val5 = val4; val5.CustomAttributes.Add(new CustomAttribute(GetMonoModAddedCtor())); Enumerator<ParameterDefinition> enumerator3 = ((PropertyReference)prop).Parameters.GetEnumerator(); try { while (enumerator3.MoveNext()) { ParameterDefinition current4 = enumerator3.Current; ((PropertyReference)val5).Parameters.Add(Extensions.Clone(current4)); } } finally { ((IDisposable)enumerator3).Dispose(); } val5.DeclaringType = targetType; targetType.Properties.Add(val5); if (val2 != null) { FieldDefinition val6 = new FieldDefinition(text, val2.Attributes, ((FieldReference)val2).FieldType); val3 = val6; FieldDefinition val7 = val6; targetType.Fields.Add(val7); } } enumerator = prop.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current5 = enumerator.Current; val.CustomAttributes.Add(Extensions.Clone(current5)); } } finally { ((IDisposable)enumerator).Dispose(); } MethodDefinition getMethod = prop.GetMethod; MethodDefinition getMethod2; if (getMethod != null && (getMethod2 = PatchMethod(targetType, getMethod)) != null) { val.GetMethod = getMethod2; propMethods?.Add(getMethod); } MethodDefinition setMethod = prop.SetMethod; if (setMethod != null && (getMethod2 = PatchMethod(targetType, setMethod)) != null) { val.SetMethod = getMethod2; propMethods?.Add(setMethod); } enumerator2 = prop.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current6 = enumerator2.Current; if ((getMethod2 = PatchMethod(targetType, current6)) != null) { val.OtherMethods.Add(getMethod2); propMethods?.Add(current6); } } } finally { ((IDisposable)enumerator2).Dispose(); } } public virtual void PatchEvent(TypeDefinition targetType, EventDefinition srcEvent, HashSet<MethodDefinition> propMethods = null) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Expected O, but got Unknown //IL_0252: Expected O, but got Unknown //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Expected O, but got Unknown //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) ((MemberReference)srcEvent).Name = Extensions.GetPatchName((MemberReference)(object)srcEvent); EventDefinition val = Extensions.FindEvent(targetType, ((MemberReference)srcEvent).Name); string text = "<" + ((MemberReference)srcEvent).Name + ">__BackingField"; FieldDefinition val2 = Extensions.FindField(srcEvent.DeclaringType, text); FieldDefinition val3 = Extensions.FindField(targetType, text); Enumerator<CustomAttribute> enumerator; Enumerator<MethodDefinition> enumerator2; if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)srcEvent, "MonoMod.MonoModIgnore")) { if (val != null) { enumerator = srcEvent.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName)) { val.CustomAttributes.Add(Extensions.Clone(current)); } } } finally { ((IDisposable)enumerator).Dispose(); } } if (val2 != null) { val2.DeclaringType.Fields.Remove(val2); } if (srcEvent.AddMethod != null) { propMethods?.Add(srcEvent.AddMethod); } if (srcEvent.RemoveMethod != null) { propMethods?.Add(srcEvent.RemoveMethod); } if (srcEvent.InvokeMethod != null) { propMethods?.Add(srcEvent.InvokeMethod); } enumerator2 = srcEvent.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current2 = enumerator2.Current; propMethods?.Add(current2); } return; } finally { ((IDisposable)enumerator2).Dispose(); } } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)srcEvent, "MonoMod.MonoModRemove") || Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)srcEvent, "MonoMod.MonoModReplace")) { if (val != null) { targetType.Events.Remove(val); if (val3 != null) { targetType.Fields.Remove(val3); } if (val.AddMethod != null) { targetType.Methods.Remove(val.AddMethod); } if (val.RemoveMethod != null) { targetType.Methods.Remove(val.RemoveMethod); } if (val.InvokeMethod != null) { targetType.Methods.Remove(val.InvokeMethod); } if (val.OtherMethods != null) { enumerator2 = val.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current3 = enumerator2.Current; targetType.Methods.Remove(current3); } } finally { ((IDisposable)enumerator2).Dispose(); } } } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)srcEvent, "MonoMod.MonoModRemove")) { return; } } if (val == null) { EventDefinition val4 = new EventDefinition(((MemberReference)srcEvent).Name, srcEvent.Attributes, ((EventReference)srcEvent).EventType); val = val4; EventDefinition val5 = val4; val5.CustomAttributes.Add(new CustomAttribute(GetMonoModAddedCtor())); val5.DeclaringType = targetType; targetType.Events.Add(val5); if (val2 != null) { FieldDefinition val6 = new FieldDefinition(text, val2.Attributes, ((FieldReference)val2).FieldType); targetType.Fields.Add(val6); } } enumerator = srcEvent.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current4 = enumerator.Current; val.CustomAttributes.Add(Extensions.Clone(current4)); } } finally { ((IDisposable)enumerator).Dispose(); } MethodDefinition addMethod = srcEvent.AddMethod; MethodDefinition addMethod2; if (addMethod != null && (addMethod2 = PatchMethod(targetType, addMethod)) != null) { val.AddMethod = addMethod2; propMethods?.Add(addMethod); } MethodDefinition removeMethod = srcEvent.RemoveMethod; if (removeMethod != null && (addMethod2 = PatchMethod(targetType, removeMethod)) != null) { val.RemoveMethod = addMethod2; propMethods?.Add(removeMethod); } MethodDefinition invokeMethod = srcEvent.InvokeMethod; if (invokeMethod != null && (addMethod2 = PatchMethod(targetType, invokeMethod)) != null) { val.InvokeMethod = addMethod2; propMethods?.Add(invokeMethod); } enumerator2 = srcEvent.OtherMethods.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodDefinition current5 = enumerator2.Current; if ((addMethod2 = PatchMethod(targetType, current5)) != null) { val.OtherMethods.Add(addMethod2); propMethods?.Add(current5); } } } finally { ((IDisposable)enumerator2).Dispose(); } } public virtual void PatchField(TypeDefinition targetType, FieldDefinition field) { //IL_0174: 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) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) string patchFullName = Extensions.GetPatchFullName((MemberReference)(object)field.DeclaringType); if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)field, "MonoMod.MonoModNoNew") || SkipList.Contains(patchFullName + "::" + ((MemberReference)field).Name) || !MatchingConditionals((ICustomAttributeProvider)(object)field, Module)) { return; } ((MemberReference)field).Name = Extensions.GetPatchName((MemberReference)(object)field); if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)field, "MonoMod.MonoModRemove") || Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)field, "MonoMod.MonoModReplace")) { FieldDefinition val = Extensions.FindField(targetType, ((MemberReference)field).Name); if (val != null) { targetType.Fields.Remove(val); } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)field, "MonoMod.MonoModRemove")) { return; } } FieldDefinition val2 = Extensions.FindField(targetType, ((MemberReference)field).Name); Enumerator<CustomAttribute> enumerator; if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)field, "MonoMod.MonoModIgnore") && val2 != null) { enumerator = field.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName)) { val2.CustomAttributes.Add(Extensions.Clone(current)); } } return; } finally { ((IDisposable)enumerator).Dispose(); } } if (val2 == null) { val2 = new FieldDefinition(((MemberReference)field).Name, field.Attributes, ((FieldReference)field).FieldType); val2.CustomAttributes.Add(new CustomAttribute(GetMonoModAddedCtor())); val2.InitialValue = field.InitialValue; if (field.HasConstant) { val2.Constant = field.Constant; } targetType.Fields.Add(val2); } enumerator = field.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current2 = enumerator.Current; val2.CustomAttributes.Add(Extensions.Clone(current2)); } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual MethodDefinition PatchMethod(TypeDefinition targetType, MethodDefinition method) { //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Expected O, but got Unknown //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Expected O, but got Unknown //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_0300: 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_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Expected O, but got Unknown //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Expected O, but got Unknown if (((MemberReference)method).Name.StartsWith("orig_") || Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModOriginal")) { return null; } if (!AllowedSpecialName(method, targetType) || !MatchingConditionals((ICustomAttributeProvider)(object)method, Module)) { return null; } string patchFullName = Extensions.GetPatchFullName((MemberReference)(object)targetType); if (SkipList.Contains(Extensions.GetID((MethodReference)(object)method, (string)null, patchFullName, true, false))) { return null; } ((MemberReference)method).Name = Extensions.GetPatchName((MemberReference)(object)method); if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModConstructor")) { if (!method.IsSpecialName && !Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModOriginalName")) { CustomAttribute val = new CustomAttribute(GetMonoModOriginalNameCtor()); val.ConstructorArguments.Add(new CustomAttributeArgument(Module.TypeSystem.String, (object)("orig_" + ((MemberReference)method).Name))); method.CustomAttributes.Add(val); } ((MemberReference)method).Name = (method.IsStatic ? ".cctor" : ".ctor"); method.IsSpecialName = true; method.IsRuntimeSpecialName = true; } MethodDefinition val2 = Extensions.FindMethod(targetType, Extensions.GetID((MethodReference)(object)method, (string)null, patchFullName, true, false), true); MethodDefinition obj = method; string text = patchFullName; MethodDefinition val3 = Extensions.FindMethod(targetType, Extensions.GetID((MethodReference)(object)obj, method.GetOriginalName(), text, true, false), true); if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModIgnore")) { if (val2 != null) { Enumerator<CustomAttribute> enumerator = method.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName) || CustomMethodAttributeHandlers.ContainsKey(((MemberReference)current.AttributeType).FullName)) { val2.CustomAttributes.Add(Extensions.Clone(current)); } } } finally { ((IDisposable)enumerator).Dispose(); } } return null; } if (val2 == null && Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModNoNew")) { return null; } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModRemove")) { if (val2 != null) { targetType.Methods.Remove(val2); } return null; } if (Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModReplace")) { if (val2 != null) { val2.CustomAttributes.Clear(); val2.Attributes = method.Attributes; val2.IsPInvokeImpl = method.IsPInvokeImpl; val2.ImplAttributes = method.ImplAttributes; } } else if (val2 != null && val3 == null) { val3 = Extensions.Clone(val2, (MethodDefinition)null); ((MemberReference)val3).Name = method.GetOriginalName(); val3.Attributes = (MethodAttributes)(val2.Attributes & 0xF7FF & 0xEFFF); ((MemberReference)val3).MetadataToken = GetMetadataToken((TokenType)100663296); val3.IsVirtual = false; val3.Overrides.Clear(); Enumerator<MethodReference> enumerator2 = method.Overrides.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodReference current2 = enumerator2.Current; val3.Overrides.Add(current2); } } finally { ((IDisposable)enumerator2).Dispose(); } val3.CustomAttributes.Add(new CustomAttribute(GetMonoModOriginalCtor())); MethodDefinition val4 = Extensions.FindMethod(method.DeclaringType, Extensions.GetID((MethodReference)(object)method, method.GetOriginalName(), (string)null, true, false), true); if (val4 != null) { Enumerator<CustomAttribute> enumerator = val4.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current3 = enumerator.Current; if (CustomAttributeHandlers.ContainsKey(((MemberReference)current3.AttributeType).FullName) || CustomMethodAttributeHandlers.ContainsKey(((MemberReference)current3.AttributeType).FullName)) { val3.CustomAttributes.Add(Extensions.Clone(current3)); } } } finally { ((IDisposable)enumerator).Dispose(); } } targetType.Methods.Add(val3); } if (val3 != null && method.IsConstructor && method.IsStatic && method.HasBody && !Extensions.HasCustomAttribute((ICustomAttributeProvider)(object)method, "MonoMod.MonoModConstructor")) { Collection<Instruction> instructions = method.Body.Instructions; ILProcessor iLProcessor = method.Body.GetILProcessor(); iLProcessor.InsertBefore(instructions[instructions.Count - 1], iLProcessor.Create(OpCodes.Call, (MethodReference)(object)val3)); } if (val2 != null) { val2.Body = Extensions.Clone(method.Body, val2); val2.IsManaged = method.IsManaged; val2.IsIL = method.IsIL; val2.IsNative = method.IsNative; val2.PInvokeInfo = method.PInvokeInfo; val2.IsPreserveSig = method.IsPreserveSig; val2.IsInternalCall = method.IsInternalCall; val2.IsPInvokeImpl = method.IsPInvokeImpl; Enumerator<CustomAttribute> enumerator = method.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current4 = enumerator.Current; val2.CustomAttributes.Add(Extensions.Clone(current4)); } } finally { ((IDisposable)enumerator).Dispose(); } method = val2; } else { MethodDefinition val5 = new MethodDefinition(((MemberReference)method).Name, method.Attributes, Module.TypeSystem.Void); ((MemberReference)val5).MetadataToken = GetMetadataToken((TokenType)100663296); ((MethodReference)val5).CallingConvention = ((MethodReference)method).CallingConvention; ((MethodReference)val5).ExplicitThis = ((MethodReference)method).ExplicitThis; ((MethodReference)val5).MethodReturnType = ((MethodReference)method).MethodReturnType; val5.Attributes = method.Attributes; val5.ImplAttributes = method.ImplAttributes; val5.SemanticsAttributes = method.SemanticsAttributes; val5.DeclaringType = targetType; ((MethodReference)val5).ReturnType = ((MethodReference)method).ReturnType; val5.Body = Extensions.Clone(method.Body, val5); val5.PInvokeInfo = method.PInvokeInfo; val5.IsPInvokeImpl = method.IsPInvokeImpl; Enumerator<GenericParameter> enumerator3 = ((MethodReference)method).GenericParameters.GetEnumerator(); try { while (enumerator3.MoveNext()) { GenericParameter current5 = enumerator3.Current; ((MethodReference)val5).GenericParameters.Add(Extensions.Clone(current5)); } } finally { ((IDisposable)enumerator3).Dispose(); } Enumerator<ParameterDefinition> enumerator4 = ((MethodReference)method).Parameters.GetEnumerator(); try { while (enumerator4.MoveNext()) { ParameterDefinition current6 = enumerator4.Current; ((MethodReference)val5).Parameters.Add(Extensions.Clone(current6)); } } finally { ((IDisposable)enumerator4).Dispose(); } Enumerator<CustomAttribute> enumerator = method.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current7 = enumerator.Current; val5.CustomAttributes.Add(Extensions.Clone(current7)); } } finally { ((IDisposable)enumerator).Dispose(); } Enumerator<MethodReference> enumerator2 = method.Overrides.GetEnumerator(); try { while (enumerator2.MoveNext()) { MethodReference current8 = enumerator2.Current; val5.Overrides.Add(current8); } } finally { ((IDisposable)enumerator2).Dispose(); } val5.CustomAttributes.Add(new CustomAttribute(GetMonoModAddedCtor())); targetType.Methods.Add(val5); method = val5; } if (val3 != null) { CustomAttribute val6 = new CustomAttribute(GetMonoModOriginalNameCtor()); val6.ConstructorArguments.Add(new CustomAttributeArgument(Module.TypeSystem.String, (object)((MemberReference)val3).Name)); method.CustomAttributes.Add(val6); } return method; } public virtual void PatchRefs() { //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) if (!UpgradeMSCORLIB.HasValue) { Version fckUnity = new Version(2, 0, 5, 0); UpgradeMSCORLIB = ((IEnumerable<AssemblyNameReference>)Module.AssemblyReferences).Any((AssemblyNameReference x) => x.Version == fckUnity); } if (UpgradeMSCORLIB.Value) { List<AssemblyNameReference> list = new List<AssemblyNameReference>(); for (int i = 0; i < Module.AssemblyReferences.Count; i++) { AssemblyNameReference val = Module.AssemblyReferences[i]; if (val.Name == "mscorlib") { list.Add(val); } } if (list.Count > 1) { AssemblyNameReference val2 = list.OrderByDescending((AssemblyNameReference x) => x.Version).First(); if (DependencyCache.TryGetValue(val2.FullName, out var value)) { for (int j = 0; j < Module.AssemblyReferences.Count; j++) { AssemblyNameReference val3 = Module.AssemblyReferences[j]; if (val3.Name == "mscorlib" && val2.Version > val3.Version) { LogVerbose("[PatchRefs] Removing and relinking duplicate mscorlib: " + val3.Version); RelinkModuleMap[val3.FullName] = value; Module.AssemblyReferences.RemoveAt(j); j--; } } } } } Enumerator<TypeDefinition> enumerator = Module.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; PatchRefsInType(current); } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual void PatchRefs(ModuleDefinition mod) { //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) Enumerator<TypeDefinition> enumerator = mod.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; PatchRefsInType(current); } } finally { ((IDisposable)enumerator).Dispose(); } } public virtual void PatchRefsInType(TypeDefinition type) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_02a1: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Expected O, but got Unknown LogVerbose($"[VERBOSE] [PatchRefsInType] Patching refs in {type}"); if (type.BaseType != null) { type.BaseType = Extensions.Relink(type.BaseType, new Relinker(Relinker), (IGenericParameterProvider)(object)type); } for (int i = 0; i < ((TypeReference)type).GenericParameters.Count; i++) { ((TypeReference)type).GenericParameters[i] = Extensions.Relink(((TypeReference)type).GenericParameters[i], new Relinker(Relinker), (IGenericParameterProvider)(object)type); } for (int j = 0; j < type.Interfaces.Count; j++) { InterfaceImplementation obj = type.Interfaces[j]; InterfaceImplementation val = new InterfaceImplementation(Extensions.Relink(obj.InterfaceType, new Relinker(Relinker), (IGenericParameterProvider)(object)type)); Enumerator<CustomAttribute> enumerator = obj.CustomAttributes.GetEnumerator(); try { while (enumerator.MoveNext()) { CustomAttribute current = enumerator.Current; val.CustomAttributes.Add(Extensions.Relink(current, new Relinker(Relinker), (IGenericParameterProvider)(object)type)); } } finally { ((IDisposable)enumerator).Dispose(); } type.Interfaces[j] = val; } for (int k = 0; k < type.CustomAttributes.Count; k++) { type.CustomAttributes[k] = Extensions.Relink(type.CustomAttributes[k], new Relinker(Relinker), (IGenericParameterProvider)(object)type); } Enumerator<PropertyDefinition> enumerator2 = type.Properties.GetEnumerator(); try { while (enumerator2.MoveNext()) { PropertyDefinition current2 = enumerator2.Current; ((PropertyReference)current2).PropertyType = Extensions.Relink(((PropertyReference)current2).PropertyType, new Relinker(Relinker), (IGenericParameterProvider)(object)type); for (int l = 0; l < current2.CustomAttributes.Count; l++) { current2.CustomAttributes[l] = Extensions.Relink(current2.CustomAttributes[l], new Relinker(Relinker), (IGenericParameterProvider)(object)type); } } } finally { ((IDisposable)enumerator2).Dispose(); } Enumerator<EventDefinition> enumerator3 = type.Events.GetEnumerator(); try { while (enumerator3.MoveNext()) { EventDefinition current3 = enumerator3.Current; ((EventReference)current3).EventType = Extensions.Relink(((EventReference)current3).EventType, new Relinker(Relinker), (IGenericParameterProvider)(object)type); for (int m = 0; m < current3.CustomAttributes.Count; m++) { current3.CustomAttributes[m] = Extensions.Relink(current3.CustomAttributes[m], new Relinker(Relinker), (IGenericParameterProvider)(object)type); } } } finally { ((IDisposable)enumerator3).Dispose(); } Enumerator<MethodDefinition> enumerator4 = type.Methods.GetEnumerator(); try { while (enumerator4.MoveNext()) { MethodDefinition current4 = enumerator4.Current; PatchRefsInMethod(current4); } } finally { ((IDisposable)enumerator4).Dispose(); } Enumerator<FieldDefinition> enumerator5 = type.Fields.GetEnumerator(); try { while (enumerator5.MoveNext()) { FieldDefinition current5 = enumerator5.Current; ((FieldReference)current5).FieldType = Extensions.Relink(((FieldReference)current5).FieldType, new Relinker(Relinker), (IGenericParameterProvider)(object)type); for (int n = 0; n < current5.CustomAttributes.Count; n++) { current5.CustomAttributes[n] = Extensions.Relink(current5.CustomAttributes[n], new Relinker(Relinker), (IGenericParameterProvider)(object)type); } } } finally { ((IDisposable)enumerator5).Dispose(); } for (int num = 0; num < type.NestedTypes.Count; num++) { PatchRefsInType(type.NestedTypes[num]); } } public virtual void PatchRefsInMethod(MethodDefinition method) { //IL_0030: Unknown result t
pachers/BepInEx.MonoMod.HookGenPatcher/MonoMod.RuntimeDetour.HookGen.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using MonoMod.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("0x0ade")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright 2021 0x0ade")] [assembly: AssemblyDescription("Auto-generate hook helper .dlls, hook arbitrary methods via events: On.Namespace.Type.Method += YourHandlerHere;")] [assembly: AssemblyFileVersion("21.8.5.1")] [assembly: AssemblyInformationalVersion("21.08.05.01")] [assembly: AssemblyProduct("MonoMod.RuntimeDetour.HookGen")] [assembly: AssemblyTitle("MonoMod.RuntimeDetour.HookGen")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("21.8.5.1")] [module: UnverifiableCode] internal static class MultiTargetShims { private static readonly object[] _NoArgs = new object[0]; public static TypeReference GetConstraintType(this TypeReference type) { return type; } } namespace MonoMod { internal static class MMDbgLog { public static readonly string Tag; public static TextWriter Writer; public static bool Debugging; static MMDbgLog() { Tag = typeof(MMDbgLog).Assembly.GetName().Name; if (Environment.GetEnvironmentVariable("MONOMOD_DBGLOG") == "1" || (Environment.GetEnvironmentVariable("MONOMOD_DBGLOG")?.ToLowerInvariant()?.Contains(Tag.ToLowerInvariant())).GetValueOrDefault()) { Start(); } } public static void WaitForDebugger() { if (!Debugging) { Debugging = true; Debugger.Launch(); Thread.Sleep(6000); Debugger.Break(); } } public static void Start() { if (Writer != null) { return; } string text = Environment.GetEnvironmentVariable("MONOMOD_DBGLOG_PATH"); if (text == "-") { Writer = Console.Out; return; } if (string.IsNullOrEmpty(text)) { text = "mmdbglog.txt"; } text = Path.GetFullPath(Path.GetFileNameWithoutExtension(text) + "-" + Tag + Path.GetExtension(text)); try { if (File.Exists(text)) { File.Delete(text); } } catch { } try { string directoryName = Path.GetDirectoryName(text); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } Writer = new StreamWriter(new FileStream(text, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete), Encoding.UTF8); } catch { } } public static void Log(string str) { TextWriter writer = Writer; if (writer != null) { writer.WriteLine(str); writer.Flush(); } } public static T Log<T>(string str, T value) { TextWriter writer = Writer; if (writer == null) { return value; } writer.WriteLine(string.Format(str, value)); writer.Flush(); return value; } } } namespace MonoMod.RuntimeDetour.HookGen { public class HookGenerator { private const string ObsoleteMessageBackCompat = "This method only exists for backwards-compatibility purposes."; private static readonly Regex NameVerifyRegex; private static readonly Dictionary<Type, string> ReflTypeNameMap; private static readonly Dictionary<string, string> TypeNameMap; public MonoModder Modder; public ModuleDefinition OutputModule; public string Namespace; public string NamespaceIL; public bool HookOrig; public bool HookPrivate; public string HookExtName; public ModuleDefinition module_RuntimeDetour; public ModuleDefinition module_Utils; public TypeReference t_MulticastDelegate; public TypeReference t_IAsyncResult; public TypeReference t_AsyncCallback; public TypeReference t_MethodBase; public TypeReference t_RuntimeMethodHandle; public TypeReference t_EditorBrowsableState; public MethodReference m_Object_ctor; public MethodReference m_ObsoleteAttribute_ctor; public MethodReference m_EditorBrowsableAttribute_ctor; public MethodReference m_GetMethodFromHandle; public MethodReference m_Add; public MethodReference m_Remove; public MethodReference m_Modify; public MethodReference m_Unmodify; public TypeReference t_ILManipulator; static HookGenerator() { NameVerifyRegex = new Regex("[^a-zA-Z]"); ReflTypeNameMap = new Dictionary<Type, string> { { typeof(string), "string" }, { typeof(object), "object" }, { typeof(bool), "bool" }, { typeof(byte), "byte" }, { typeof(char), "char" }, { typeof(decimal), "decimal" }, { typeof(double), "double" }, { typeof(short), "short" }, { typeof(int), "int" }, { typeof(long), "long" }, { typeof(sbyte), "sbyte" }, { typeof(float), "float" }, { typeof(ushort), "ushort" }, { typeof(uint), "uint" }, { typeof(ulong), "ulong" }, { typeof(void), "void" } }; TypeNameMap = new Dictionary<string, string>(); foreach (KeyValuePair<Type, string> item in ReflTypeNameMap) { TypeNameMap[item.Key.FullName] = item.Value; } } public HookGenerator(MonoModder modder, string name) { //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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0306: 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_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Expected O, but got Unknown //IL_0326: Expected O, but got Unknown Modder = modder; OutputModule = ModuleDefinition.CreateModule(name, new ModuleParameters { Architecture = modder.Module.Architecture, AssemblyResolver = modder.Module.AssemblyResolver, Kind = (ModuleKind)0, Runtime = modder.Module.Runtime }); modder.MapDependencies(); Extensions.AddRange<AssemblyNameReference>(OutputModule.AssemblyReferences, (IEnumerable<AssemblyNameReference>)modder.Module.AssemblyReferences); modder.DependencyMap[OutputModule] = new List<ModuleDefinition>(modder.DependencyMap[modder.Module]); Namespace = Environment.GetEnvironmentVariable("MONOMOD_HOOKGEN_NAMESPACE"); if (string.IsNullOrEmpty(Namespace)) { Namespace = "On"; } NamespaceIL = Environment.GetEnvironmentVariable("MONOMOD_HOOKGEN_NAMESPACE_IL"); if (string.IsNullOrEmpty(NamespaceIL)) { NamespaceIL = "IL"; } HookOrig = Environment.GetEnvironmentVariable("MONOMOD_HOOKGEN_ORIG") == "1"; HookPrivate = Environment.GetEnvironmentVariable("MONOMOD_HOOKGEN_PRIVATE") == "1"; modder.MapDependency(modder.Module, "MonoMod.RuntimeDetour", (string)null, (AssemblyNameReference)null); if (!modder.DependencyCache.TryGetValue("MonoMod.RuntimeDetour", out module_RuntimeDetour)) { throw new FileNotFoundException("MonoMod.RuntimeDetour not found!"); } modder.MapDependency(modder.Module, "MonoMod.Utils", (string)null, (AssemblyNameReference)null); if (!modder.DependencyCache.TryGetValue("MonoMod.Utils", out module_Utils)) { throw new FileNotFoundException("MonoMod.Utils not found!"); } t_MulticastDelegate = OutputModule.ImportReference(modder.FindType("System.MulticastDelegate")); t_IAsyncResult = OutputModule.ImportReference(modder.FindType("System.IAsyncResult")); t_AsyncCallback = OutputModule.ImportReference(modder.FindType("System.AsyncCallback")); t_MethodBase = OutputModule.ImportReference(modder.FindType("System.Reflection.MethodBase")); t_RuntimeMethodHandle = OutputModule.ImportReference(modder.FindType("System.RuntimeMethodHandle")); t_EditorBrowsableState = OutputModule.ImportReference(modder.FindType("System.ComponentModel.EditorBrowsableState")); TypeDefinition type = module_RuntimeDetour.GetType("MonoMod.RuntimeDetour.HookGen.HookEndpointManager"); t_ILManipulator = OutputModule.ImportReference((TypeReference)(object)module_Utils.GetType("MonoMod.Cil.ILContext/Manipulator")); m_Object_ctor = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(modder.FindType("System.Object").Resolve(), "System.Void .ctor()", true)); m_ObsoleteAttribute_ctor = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(modder.FindType("System.ObsoleteAttribute").Resolve(), "System.Void .ctor(System.String,System.Boolean)", true)); m_EditorBrowsableAttribute_ctor = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(modder.FindType("System.ComponentModel.EditorBrowsableAttribute").Resolve(), "System.Void .ctor(System.ComponentModel.EditorBrowsableState)", true)); ModuleDefinition outputModule = OutputModule; MethodReference val = new MethodReference("GetMethodFromHandle", t_MethodBase, t_MethodBase); val.Parameters.Add(new ParameterDefinition(t_RuntimeMethodHandle)); m_GetMethodFromHandle = outputModule.ImportReference(val); m_Add = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(type, "Add", true)); m_Remove = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(type, "Remove", true)); m_Modify = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(type, "Modify", true)); m_Unmodify = OutputModule.ImportReference((MethodReference)(object)Extensions.FindMethod(type, "Unmodify", true)); } public void Generate() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) Enumerator<TypeDefinition> enumerator = Modder.Module.Types.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeDefinition current = enumerator.Current; GenerateFor(current, out var hookType, out var hookILType); if (hookType != null && hookILType != null && !((TypeReference)hookType).IsNested) { OutputModule.Types.Add(hookType); OutputModule.Types.Add(hookILType); } } } finally { ((IDisposable)enumerator).Dispose(); } } public void GenerateFor(TypeDefinition type, out TypeDefinition hookType, out TypeDefinition hookILType) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) hookType = (hookILType = null); if (((TypeReference)type).HasGenericParameters || type.IsRuntimeSpecialName || ((MemberReference)type).Name.StartsWith("<") || (!HookPrivate && type.IsNotPublic)) { return; } Modder.LogVerbose("[HookGen] Generating for type " + ((MemberReference)type).FullName); hookType = new TypeDefinition(((TypeReference)type).IsNested ? null : (Namespace + (string.IsNullOrEmpty(((TypeReference)type).Namespace) ? "" : ("." + ((TypeReference)type).Namespace))), ((MemberReference)type).Name, (TypeAttributes)(((!((TypeReference)type).IsNested) ? 1 : 2) | 0x80 | 0x100 | 0), OutputModule.TypeSystem.Object); hookILType = new TypeDefinition(((TypeReference)type).IsNested ? null : (NamespaceIL + (string.IsNullOrEmpty(((TypeReference)type).Namespace) ? "" : ("." + ((TypeReference)type).Namespace))), ((MemberReference)type).Name, (TypeAttributes)(((!((TypeReference)type).IsNested) ? 1 : 2) | 0x80 | 0x100 | 0), OutputModule.TypeSystem.Object); bool flag = false; Enumerator<MethodDefinition> enumerator = type.Methods.GetEnumerator(); try { while (enumerator.MoveNext()) { MethodDefinition current = enumerator.Current; flag |= GenerateFor(hookType, hookILType, current); } } finally { ((IDisposable)enumerator).Dispose(); } Enumerator<TypeDefinition> enumerator2 = type.NestedTypes.GetEnumerator(); try { while (enumerator2.MoveNext()) { TypeDefinition current2 = enumerator2.Current; GenerateFor(current2, out var hookType2, out var hookILType2); if (hookType2 != null && hookILType2 != null) { flag = true; hookType.NestedTypes.Add(hookType2); hookILType.NestedTypes.Add(hookILType2); } } } finally { ((IDisposable)enumerator2).Dispose(); } if (!flag) { hookType = (hookILType = null); } } public bool GenerateFor(TypeDefinition hookType, TypeDefinition hookILType, MethodDefinition method) { //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Expected O, but got Unknown //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Expected O, but got Unknown //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Expected O, but got Unknown //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Expected O, but got Unknown //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Expected O, but got Unknown //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Expected O, but got Unknown //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Expected O, but got Unknown //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Expected O, but got Unknown //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Expected O, but got Unknown //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Expected O, but got Unknown //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Expected O, but got Unknown //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Expected O, but got Unknown //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Expected O, but got Unknown //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Expected O, but got Unknown //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Expected O, but got Unknown //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Expected O, but got Unknown //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_061a: Expected O, but got Unknown //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Expected O, but got Unknown //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Expected O, but got Unknown //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Expected O, but got Unknown if (((MethodReference)method).HasGenericParameters || method.IsAbstract || (method.IsSpecialName && !method.IsConstructor)) { return false; } if (!HookOrig && ((MemberReference)method).Name.StartsWith("orig_")) { return false; } if (!HookPrivate && method.IsPrivate) { return false; } string name = GetFriendlyName((MethodReference)(object)method); bool flag = true; if (((MethodReference)method).Parameters.Count == 0) { flag = false; } IEnumerable<MethodDefinition> source = null; if (flag) { source = ((IEnumerable<MethodDefinition>)method.DeclaringType.Methods).Where((MethodDefinition other) => !((MethodReference)other).HasGenericParameters && GetFriendlyName((MethodReference)(object)other) == name && other != method); if (source.Count() == 0) { flag = false; } } if (flag) { StringBuilder stringBuilder = new StringBuilder(); for (int parami = 0; parami < ((MethodReference)method).Parameters.Count; parami++) { ParameterDefinition param = ((MethodReference)method).Parameters[parami]; if (!TypeNameMap.TryGetValue(((MemberReference)((ParameterReference)param).ParameterType).FullName, out var typeName)) { typeName = GetFriendlyName(((ParameterReference)param).ParameterType, full: false); } if (source.Any(delegate(MethodDefinition other) { ParameterDefinition val11 = ((IEnumerable<ParameterDefinition>)((MethodReference)other).Parameters).ElementAtOrDefault(parami); return val11 != null && GetFriendlyName(((ParameterReference)val11).ParameterType, full: false) == typeName && ((ParameterReference)val11).ParameterType.Namespace != ((ParameterReference)param).ParameterType.Namespace; })) { typeName = GetFriendlyName(((ParameterReference)param).ParameterType, full: true); } stringBuilder.Append("_"); stringBuilder.Append(typeName.Replace(".", "").Replace("`", "")); } name += stringBuilder.ToString(); } if (Extensions.FindEvent(hookType, name) != null) { int num = 1; string text; while (Extensions.FindEvent(hookType, text = name + "_" + num) != null) { num++; } name = text; } TypeDefinition val = GenerateDelegateFor(method); ((MemberReference)val).Name = "orig_" + name; val.CustomAttributes.Add(GenerateEditorBrowsable(EditorBrowsableState.Never)); hookType.NestedTypes.Add(val); TypeDefinition val2 = GenerateDelegateFor(method); ((MemberReference)val2).Name = "hook_" + name; ((MethodReference)Extensions.FindMethod(val2, "Invoke", true)).Parameters.Insert(0, new ParameterDefinition("orig", (ParameterAttributes)0, (TypeReference)(object)val)); ((MethodReference)Extensions.FindMethod(val2, "BeginInvoke", true)).Parameters.Insert(0, new ParameterDefinition("orig", (ParameterAttributes)0, (TypeReference)(object)val)); val2.CustomAttributes.Add(GenerateEditorBrowsable(EditorBrowsableState.Never)); hookType.NestedTypes.Add(val2); MethodReference val3 = OutputModule.ImportReference((MethodReference)(object)method); MethodDefinition val4 = new MethodDefinition("add_" + name, (MethodAttributes)2198, OutputModule.TypeSystem.Void); ((MethodReference)val4).Parameters.Add(new ParameterDefinition((string)null, (ParameterAttributes)0, (TypeReference)(object)val2)); val4.Body = new MethodBody(val4); ILProcessor iLProcessor = val4.Body.GetILProcessor(); iLProcessor.Emit(OpCodes.Ldtoken, val3); iLProcessor.Emit(OpCodes.Call, m_GetMethodFromHandle); iLProcessor.Emit(OpCodes.Ldarg_0); GenericInstanceMethod val5 = new GenericInstanceMethod(m_Add); val5.GenericArguments.Add((TypeReference)(object)val2); iLProcessor.Emit(OpCodes.Call, (MethodReference)(object)val5); iLProcessor.Emit(OpCodes.Ret); hookType.Methods.Add(val4); MethodDefinition val6 = new MethodDefinition("remove_" + name, (MethodAttributes)2198, OutputModule.TypeSystem.Void); ((MethodReference)val6).Parameters.Add(new ParameterDefinition((string)null, (ParameterAttributes)0, (TypeReference)(object)val2)); val6.Body = new MethodBody(val6); ILProcessor iLProcessor2 = val6.Body.GetILProcessor(); iLProcessor2.Emit(OpCodes.Ldtoken, val3); iLProcessor2.Emit(OpCodes.Call, m_GetMethodFromHandle); iLProcessor2.Emit(OpCodes.Ldarg_0); val5 = new GenericInstanceMethod(m_Remove); val5.GenericArguments.Add((TypeReference)(object)val2); iLProcessor2.Emit(OpCodes.Call, (MethodReference)(object)val5); iLProcessor2.Emit(OpCodes.Ret); hookType.Methods.Add(val6); EventDefinition val7 = new EventDefinition(name, (EventAttributes)0, (TypeReference)(object)val2) { AddMethod = val4, RemoveMethod = val6 }; hookType.Events.Add(val7); MethodDefinition val8 = new MethodDefinition("add_" + name, (MethodAttributes)2198, OutputModule.TypeSystem.Void); ((MethodReference)val8).Parameters.Add(new ParameterDefinition((string)null, (ParameterAttributes)0, t_ILManipulator)); val8.Body = new MethodBody(val8); ILProcessor iLProcessor3 = val8.Body.GetILProcessor(); iLProcessor3.Emit(OpCodes.Ldtoken, val3); iLProcessor3.Emit(OpCodes.Call, m_GetMethodFromHandle); iLProcessor3.Emit(OpCodes.Ldarg_0); val5 = new GenericInstanceMethod(m_Modify); val5.GenericArguments.Add((TypeReference)(object)val2); iLProcessor3.Emit(OpCodes.Call, (MethodReference)(object)val5); iLProcessor3.Emit(OpCodes.Ret); hookILType.Methods.Add(val8); MethodDefinition val9 = new MethodDefinition("remove_" + name, (MethodAttributes)2198, OutputModule.TypeSystem.Void); ((MethodReference)val9).Parameters.Add(new ParameterDefinition((string)null, (ParameterAttributes)0, t_ILManipulator)); val9.Body = new MethodBody(val9); ILProcessor iLProcessor4 = val9.Body.GetILProcessor(); iLProcessor4.Emit(OpCodes.Ldtoken, val3); iLProcessor4.Emit(OpCodes.Call, m_GetMethodFromHandle); iLProcessor4.Emit(OpCodes.Ldarg_0); val5 = new GenericInstanceMethod(m_Unmodify); val5.GenericArguments.Add((TypeReference)(object)val2); iLProcessor4.Emit(OpCodes.Call, (MethodReference)(object)val5); iLProcessor4.Emit(OpCodes.Ret); hookILType.Methods.Add(val9); EventDefinition val10 = new EventDefinition(name, (EventAttributes)0, t_ILManipulator) { AddMethod = val8, RemoveMethod = val9 }; hookILType.Events.Add(val10); return true; } public TypeDefinition GenerateDelegateFor(MethodDefinition method) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_01c9: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01f1: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_029b: 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_02b1: Expected O, but got Unknown //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Expected O, but got Unknown //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Expected O, but got Unknown //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Expected O, but got Unknown //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Expected O, but got Unknown //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Expected O, but got Unknown //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Expected O, but got Unknown string name = GetFriendlyName((MethodReference)(object)method); int num = ((IEnumerable<MethodDefinition>)method.DeclaringType.Methods).Where((MethodDefinition other) => !((MethodReference)other).HasGenericParameters && GetFriendlyName((MethodReference)(object)other) == name).ToList().IndexOf(method); if (num != 0) { string suffix = num.ToString(); do { name = name + "_" + suffix; } while (((IEnumerable<MethodDefinition>)method.DeclaringType.Methods).Any((MethodDefinition other) => !((MethodReference)other).HasGenericParameters && GetFriendlyName((MethodReference)(object)other) == name + suffix)); } name = "d_" + name; TypeDefinition val = new TypeDefinition((string)null, (string)null, (TypeAttributes)258, t_MulticastDelegate); MethodDefinition val2 = new MethodDefinition(".ctor", (MethodAttributes)6278, OutputModule.TypeSystem.Void) { ImplAttributes = (MethodImplAttributes)3, HasThis = true }; ((MethodReference)val2).Parameters.Add(new ParameterDefinition(OutputModule.TypeSystem.Object)); ((MethodReference)val2).Parameters.Add(new ParameterDefinition(OutputModule.TypeSystem.IntPtr)); val2.Body = new MethodBody(val2); val.Methods.Add(val2); MethodDefinition val3 = new MethodDefinition("Invoke", (MethodAttributes)454, ImportVisible(((MethodReference)method).ReturnType)) { ImplAttributes = (MethodImplAttributes)3, HasThis = true }; if (!method.IsStatic) { TypeReference val4 = ImportVisible((TypeReference)(object)method.DeclaringType); if (((TypeReference)method.DeclaringType).IsValueType) { val4 = (TypeReference)new ByReferenceType(val4); } ((MethodReference)val3).Parameters.Add(new ParameterDefinition("self", (ParameterAttributes)0, val4)); } Enumerator<ParameterDefinition> enumerator = ((MethodReference)method).Parameters.GetEnumerator(); try { while (enumerator.MoveNext()) { ParameterDefinition current = enumerator.Current; ((MethodReference)val3).Parameters.Add(new ParameterDefinition(((ParameterReference)current).Name, (ParameterAttributes)(current.Attributes & 0xFFEF & 0xEFFF), ImportVisible(((ParameterReference)current).ParameterType))); } } finally { ((IDisposable)enumerator).Dispose(); } val3.Body = new MethodBody(val3); val.Methods.Add(val3); MethodDefinition val5 = new MethodDefinition("BeginInvoke", (MethodAttributes)454, t_IAsyncResult) { ImplAttributes = (MethodImplAttributes)3, HasThis = true }; enumerator = ((MethodReference)val3).Parameters.GetEnumerator(); try { while (enumerator.MoveNext()) { ParameterDefinition current2 = enumerator.Current; ((MethodReference)val5).Parameters.Add(new ParameterDefinition(((ParameterReference)current2).Name, current2.Attributes, ((ParameterReference)current2).ParameterType)); } } finally { ((IDisposable)enumerator).Dispose(); } ((MethodReference)val5).Parameters.Add(new ParameterDefinition("callback", (ParameterAttributes)0, t_AsyncCallback)); ((MethodReference)val5).Parameters.Add(new ParameterDefinition((string)null, (ParameterAttributes)0, OutputModule.TypeSystem.Object)); val5.Body = new MethodBody(val5); val.Methods.Add(val5); MethodDefinition val6 = new MethodDefinition("EndInvoke", (MethodAttributes)454, OutputModule.TypeSystem.Object) { ImplAttributes = (MethodImplAttributes)3, HasThis = true }; ((MethodReference)val6).Parameters.Add(new ParameterDefinition("result", (ParameterAttributes)0, t_IAsyncResult)); val6.Body = new MethodBody(val6); val.Methods.Add(val6); return val; } private string GetFriendlyName(MethodReference method) { string text = ((MemberReference)method).Name; if (text.StartsWith(".")) { text = text.Substring(1); } return text.Replace('.', '_'); } private string GetFriendlyName(TypeReference type, bool full) { if (type is TypeSpecification) { StringBuilder stringBuilder = new StringBuilder(); BuildFriendlyName(stringBuilder, type, full); return stringBuilder.ToString(); } if (!full) { return ((MemberReference)type).Name; } return ((MemberReference)type).FullName; } private void BuildFriendlyName(StringBuilder builder, TypeReference type, bool full) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!(type is TypeSpecification)) { builder.Append((full ? ((MemberReference)type).FullName : ((MemberReference)type).Name).Replace("_", "")); return; } if (type.IsByReference) { builder.Append("ref"); } else if (type.IsPointer) { builder.Append("ptr"); } BuildFriendlyName(builder, ((TypeSpecification)type).ElementType, full); if (type.IsArray) { builder.Append("Array"); } } private bool IsPublic(TypeDefinition typeDef) { if (typeDef != null && (typeDef.IsNestedPublic || typeDef.IsPublic)) { return !typeDef.IsNotPublic; } return false; } private bool HasPublicArgs(GenericInstanceType typeGen) { //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) Enumerator<TypeReference> enumerator = typeGen.GenericArguments.GetEnumerator(); try { while (enumerator.MoveNext()) { TypeReference current = enumerator.Current; if (current.IsGenericParameter) { return false; } GenericInstanceType val = (GenericInstanceType)(object)((current is GenericInstanceType) ? current : null); if (val != null && !HasPublicArgs(val)) { return false; } if (!IsPublic(Extensions.SafeResolve(current))) { return false; } } } finally { ((IDisposable)enumerator).Dispose(); } return true; } private TypeReference ImportVisible(TypeReference typeRef) { for (TypeDefinition val = ((typeRef != null) ? Extensions.SafeResolve(typeRef) : null); val != null; val = ((typeRef != null) ? Extensions.SafeResolve(typeRef) : null)) { GenericInstanceType val2 = (GenericInstanceType)(object)((typeRef is GenericInstanceType) ? typeRef : null); if (val2 == null || HasPublicArgs(val2)) { TypeDefinition val3 = val; while (true) { if (val3 != null) { if (IsPublic(val3) && (val3 == val || !((TypeReference)val3).HasGenericParameters)) { val3 = val3.DeclaringType; continue; } if (!val.IsEnum) { break; } typeRef = ((FieldReference)Extensions.FindField(val, "value__")).FieldType; } try { return OutputModule.ImportReference(typeRef); } catch { return OutputModule.TypeSystem.Object; } } } typeRef = val.BaseType; } return OutputModule.TypeSystem.Object; } private CustomAttribute GenerateObsolete(string message, bool error) { //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_0022: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown CustomAttribute val = new CustomAttribute(m_ObsoleteAttribute_ctor); val.ConstructorArguments.Add(new CustomAttributeArgument(OutputModule.TypeSystem.String, (object)message)); val.ConstructorArguments.Add(new CustomAttributeArgument(OutputModule.TypeSystem.Boolean, (object)error)); return val; } private CustomAttribute GenerateEditorBrowsable(EditorBrowsableState state) { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown CustomAttribute val = new CustomAttribute(m_EditorBrowsableAttribute_ctor); val.ConstructorArguments.Add(new CustomAttributeArgument(t_EditorBrowsableState, (object)state)); return val; } } internal class Program { private static void Main(string[] args) { //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown Console.WriteLine("MonoMod.RuntimeDetour.HookGen " + typeof(Program).Assembly.GetName().Version); Console.WriteLine("using MonoMod " + typeof(MonoModder).Assembly.GetName().Version); Console.WriteLine("using MonoMod.RuntimeDetour " + typeof(Detour).Assembly.GetName().Version); if (args.Length == 0) { Console.WriteLine("No valid arguments (assembly path) passed."); if (Debugger.IsAttached) { Console.ReadKey(); } return; } int num = 0; for (int i = 0; i < args.Length; i++) { if (args[i] == "--namespace" && i + 2 < args.Length) { i++; Environment.SetEnvironmentVariable("MONOMOD_HOOKGEN_NAMESPACE", args[i]); continue; } if (args[i] == "--namespace-il" && i + 2 < args.Length) { i++; Environment.SetEnvironmentVariable("MONOMOD_HOOKGEN_NAMESPACE_IL", args[i]); continue; } if (args[i] == "--orig") { Environment.SetEnvironmentVariable("MONOMOD_HOOKGEN_ORIG", "1"); continue; } if (args[i] == "--private") { Environment.SetEnvironmentVariable("MONOMOD_HOOKGEN_PRIVATE", "1"); continue; } num = i; break; } if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MONOMOD_DEPENDENCY_MISSING_THROW"))) { Environment.SetEnvironmentVariable("MONOMOD_DEPENDENCY_MISSING_THROW", "0"); } if (num >= args.Length) { Console.WriteLine("No assembly path passed."); if (Debugger.IsAttached) { Console.ReadKey(); } return; } string text = args[num]; string text2 = ((args.Length != 1 && num != args.Length - 1) ? args[^1] : null); text2 = text2 ?? Path.Combine(Path.GetDirectoryName(text), "MMHOOK_" + Path.ChangeExtension(Path.GetFileName(text), "dll")); MonoModder val = new MonoModder { InputPath = text, OutputPath = text2, ReadingMode = (ReadingMode)2 }; try { val.Read(); val.MapDependencies(); if (File.Exists(text2)) { val.Log("[HookGen] Clearing " + text2); File.Delete(text2); } val.Log("[HookGen] Starting HookGenerator"); HookGenerator hookGenerator = new HookGenerator(val, Path.GetFileName(text2)); ModuleDefinition outputModule = hookGenerator.OutputModule; try { hookGenerator.Generate(); outputModule.Write(text2); } finally { ((IDisposable)outputModule)?.Dispose(); } val.Log("[HookGen] Done."); } finally { ((IDisposable)val)?.Dispose(); } if (Debugger.IsAttached) { Console.ReadKey(); } } } }
plugins/BadAssCompany/BadAssCompany.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using EmotesAPI; using LethalEmotesAPI.ImportV2; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BadAssCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+05c4fbfd124d98b42e54199e1a53a078cc7d443c")] [assembly: AssemblyProduct("BadAssCompany")] [assembly: AssemblyTitle("BadAssCompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class LivingParticlesAudioModule : MonoBehaviour { public Transform audioPosition; public LivingParticlesAudioSource LPaSourse; public bool useBuffer; public bool firstAndLastPixelBlack = false; private Texture2D t2d; private float[] finalSpectrum; private Color col = Color.black; private ParticleSystemRenderer psr; private void Start() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown psr = ((Component)this).GetComponent<ParticleSystemRenderer>(); switch (LPaSourse.numberOfBands) { case LivingParticlesAudioSource._numberOfBands.Bands8: if (firstAndLastPixelBlack) { t2d = new Texture2D(10, 1); } else { t2d = new Texture2D(8, 1); } break; case LivingParticlesAudioSource._numberOfBands.Bands16: if (firstAndLastPixelBlack) { t2d = new Texture2D(18, 1); } else { t2d = new Texture2D(16, 1); } break; } ((Texture)t2d).wrapMode = (TextureWrapMode)0; } private void Update() { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) if (useBuffer) { switch (LPaSourse.numberOfBands) { case LivingParticlesAudioSource._numberOfBands.Bands8: finalSpectrum = LPaSourse.finalBands8Buffer; break; case LivingParticlesAudioSource._numberOfBands.Bands16: finalSpectrum = LPaSourse.finalBands16Buffer; break; } } else { switch (LPaSourse.numberOfBands) { case LivingParticlesAudioSource._numberOfBands.Bands8: finalSpectrum = LPaSourse.finalBands8; break; case LivingParticlesAudioSource._numberOfBands.Bands16: finalSpectrum = LPaSourse.finalBands16; break; } } for (int i = 0; i < finalSpectrum.Length; i++) { col.r = finalSpectrum[i]; if (firstAndLastPixelBlack) { t2d.SetPixel(i + 1, 0, col); } else { t2d.SetPixel(i, 0, col); } } if (firstAndLastPixelBlack) { t2d.SetPixel(0, 0, Color.black); switch (LPaSourse.numberOfBands) { case LivingParticlesAudioSource._numberOfBands.Bands8: t2d.SetPixel(9, 0, Color.black); break; case LivingParticlesAudioSource._numberOfBands.Bands16: t2d.SetPixel(17, 0, Color.black); break; } } t2d.Apply(); ((Renderer)psr).material.SetTexture("_AudioSpectrum", (Texture)(object)t2d); ((Renderer)psr).material.SetVector("_AudioPosition", Vector4.op_Implicit(audioPosition.position)); switch (LPaSourse.numberOfBands) { case LivingParticlesAudioSource._numberOfBands.Bands8: { int num = 1; float amplitudeBuffer = (LPaSourse.amplitudeBuffer8 + 48f) / 48f; LPaSourse.amplitudeBuffer8 = amplitudeBuffer; ((Renderer)psr).material.SetFloat("_AudioAverageAmplitude", LPaSourse.amplitudeBuffer8); break; } case LivingParticlesAudioSource._numberOfBands.Bands16: ((Renderer)psr).material.SetFloat("_AudioAverageAmplitude", LPaSourse.amplitudeBuffer16); break; } } } public class LivingParticlesAudioSource : MonoBehaviour { public enum _numberOfBands { Bands8, Bands16 } public AudioClip audioClip; [Range(0.1f, 2f)] public float bufferInitialDecreaseSpeed = 1f; [Range(0f, 10f)] public float bufferDecreaseSpeedMultiply = 5f; public float freqBandsPower = 10f; public float audioProfileInitialValue = 5f; public bool audioProfileDecreasing = true; public float audioProfileDecreasingSpeed = 0.1f; public _numberOfBands numberOfBands = _numberOfBands.Bands8; private float[] initialSamplesL = new float[512]; private float[] initialSamplesR = new float[512]; private float[] freqBands8 = new float[8]; private float[] freqBands8Buffer = new float[8]; private float[] freqBands8BufferDecrease = new float[8]; private float[] freqBands8Highest = new float[8]; private float[] freqBands16 = new float[16]; private float[] freqBands16Buffer = new float[16]; private float[] freqBands16BufferDecrease = new float[16]; private float[] freqBands16Highest = new float[16]; private AudioSource audioSource; [HideInInspector] public float[] finalBands8 = new float[8]; [HideInInspector] public float[] finalBands8Buffer = new float[8]; [HideInInspector] public float[] finalBands16 = new float[16]; [HideInInspector] public float[] finalBands16Buffer = new float[16]; [HideInInspector] public float amplitude8; [HideInInspector] public float amplitudeBuffer8; [HideInInspector] public float amplitude16; [HideInInspector] public float amplitudeBuffer16; private float amplitudeHighest; private static bool speaking; private uint _length = 0u; private bool yote = false; private float[] left; private float[] right; private double[] _window; private void Start() { audioSource = ((Component)this).GetComponent<AudioSource>(); AudioProfile(audioProfileInitialValue); } public void StartAudio() { Reset(); } public void Reset() { _length = 0u; } private static bool readWav(string filename, out float[] L, out float[] R, out uint samplerate, out uint channels) { speaking = true; L = (R = null); samplerate = 0u; channels = 0u; try { using FileStream input = File.Open(filename, FileMode.Open); BinaryReader binaryReader = new BinaryReader(input); int num = binaryReader.ReadInt32(); int num2 = binaryReader.ReadInt32(); int num3 = binaryReader.ReadInt32(); int num4 = binaryReader.ReadInt32(); int num5 = binaryReader.ReadInt32(); int num6 = binaryReader.ReadInt16(); int num7 = binaryReader.ReadInt16(); int num8 = binaryReader.ReadInt32(); int num9 = binaryReader.ReadInt32(); int num10 = binaryReader.ReadInt16(); int num11 = binaryReader.ReadInt16(); samplerate = (uint)num8; channels = (uint)num7; if (num5 == 18) { int count = binaryReader.ReadInt16(); binaryReader.ReadBytes(count); } int num12 = binaryReader.ReadInt32(); int num13 = binaryReader.ReadInt32(); byte[] src = binaryReader.ReadBytes(num13); int num14 = num11 / 8; int num15 = num13 / num14; float[] array = null; switch (num11) { case 64: { double[] array3 = new double[num15]; Buffer.BlockCopy(src, 0, array3, 0, num13); array = Array.ConvertAll(array3, (double e) => (float)e); break; } case 32: array = new float[num15]; Buffer.BlockCopy(src, 0, array, 0, num13); break; case 16: { short[] array2 = new short[num15]; Buffer.BlockCopy(src, 0, array2, 0, num13); array = Array.ConvertAll(array2, (short e) => (float)e / 32768f); break; } default: return false; } switch (channels) { case 1u: L = array; R = null; return true; case 2u: { int num16 = num15 / 2; L = new float[num16]; R = new float[num16]; int i = 0; int num17 = 0; for (; i < num16; i++) { L[i] = array[num17++]; R[i] = array[num17++]; } return true; } default: return false; } } catch { Debug.Log((object)("...Failed to load: " + filename)); return false; } } private bool WavBufferToWwise(uint playingID, uint channelIndex, float[] samples) { if (left.Length == 0) { DebugClass.Log((object)"There was an error playing the audio file, The audio buffer is empty!"); } if (_length >= (uint)left.Length) { _length = (uint)left.Length; } initialSamplesL = new float[samples.Length]; initialSamplesR = new float[samples.Length]; try { uint num = 0u; for (num = 0u; num < samples.Length; num++) { if (num + _length >= left.Length) { speaking = false; _length = 0u; break; } initialSamplesL[num] = left[num + _length]; initialSamplesR[num] = right[num + _length]; samples[num] = 0f; } _length += num; } catch (Exception) { Debug.Log((object)"--------end of audio???"); throw; } if (_length >= (uint)left.Length) { _length = (uint)left.Length; speaking = false; } DoSpectrumDataStuff(); return speaking; } private void ApplyWindow() { int num = initialSamplesL.Length; CreateWindow(num); for (int i = 0; i < num; i++) { initialSamplesL[i] = (float)((double)initialSamplesL[i] * _window[i]); initialSamplesR[i] = (float)((double)initialSamplesR[i] * _window[i]); } } private void DoSpectrumDataStuff() { ApplyWindow(); switch (numberOfBands) { case _numberOfBands.Bands8: CreateFreqBands8(); CreateBandBuffer8(); CreateFinalBands8(); CreateAmplitude8(); break; case _numberOfBands.Bands16: CreateFreqBands16(); CreateBandBuffer16(); CreateFinalBands16(); CreateAmplitude16(); break; } } private void CreateWindow(int size, bool normalize = false) { _window = new double[size]; for (int i = 0; i < size; i++) { double num = (double)i / (double)(size - 1); _window[i] = (double)(0.42f - 0.5f * Mathf.Cos((float)(i / size))) + 0.08 * (double)Mathf.Cos(2f * (float)i / (float)size); } if (normalize) { double num2 = 0.0; for (int j = 0; j < _window.Length; j++) { num2 += _window[j]; } for (int k = 0; k < _window.Length; k++) { _window[k] /= num2; } } } private void AudioProfile(float audioProfileValue) { for (int i = 0; i < 8; i++) { freqBands8Highest[i] = audioProfileValue; } for (int j = 0; j < 16; j++) { freqBands16Highest[j] = audioProfileValue; } } private void CreateAmplitude8() { float num = 0f; float num2 = 0f; for (int i = 0; i < 8; i++) { num += finalBands8[i]; num2 += finalBands8Buffer[i]; } if (num > amplitudeHighest) { amplitudeHighest = num; } amplitude8 = num / amplitudeHighest; amplitudeBuffer8 = num2 / amplitudeHighest; } private void CreateAmplitude16() { float num = 0f; float num2 = 0f; for (int i = 0; i < 16; i++) { num += finalBands16[i]; num2 += finalBands16Buffer[i]; } if (num > amplitudeHighest) { amplitudeHighest = num; } amplitude16 = num / amplitudeHighest; amplitudeBuffer16 = num2 / amplitudeHighest; } private void CreateFinalBands8() { for (int i = 0; i < 8; i++) { if (audioProfileDecreasing) { freqBands8Highest[i] -= audioProfileDecreasingSpeed * Time.deltaTime; } if (freqBands8[i] > freqBands8Highest[i]) { freqBands8Highest[i] = freqBands8[i]; } finalBands8[i] = freqBands8[i] / freqBands8Highest[i]; finalBands8Buffer[i] = freqBands8Buffer[i] / freqBands8Highest[i]; } } private void CreateFinalBands16() { for (int i = 0; i < 16; i++) { if (audioProfileDecreasing) { freqBands16Highest[i] -= audioProfileDecreasingSpeed * Time.deltaTime; } if (freqBands16[i] > freqBands16Highest[i]) { freqBands16Highest[i] = freqBands16[i]; } finalBands16[i] = freqBands16[i] / freqBands16Highest[i]; finalBands16Buffer[i] = freqBands16Buffer[i] / freqBands16Highest[i]; } } private void CreateBandBuffer8() { for (int i = 0; i < 8; i++) { if (freqBands8[i] > freqBands8Buffer[i]) { freqBands8Buffer[i] = freqBands8[i]; freqBands8BufferDecrease[i] = bufferInitialDecreaseSpeed * freqBands8Highest[i] * Time.deltaTime; } if (freqBands8[i] < freqBands8Buffer[i]) { freqBands8Buffer[i] -= freqBands8BufferDecrease[i]; freqBands8BufferDecrease[i] *= 1f + bufferDecreaseSpeedMultiply * Time.deltaTime; } } } private void CreateBandBuffer16() { for (int i = 0; i < 16; i++) { if (freqBands16[i] > freqBands16Buffer[i]) { freqBands16Buffer[i] = freqBands16[i]; freqBands16BufferDecrease[i] = bufferInitialDecreaseSpeed * freqBands16Highest[i] * Time.deltaTime; } if (freqBands16[i] < freqBands16Buffer[i]) { freqBands16Buffer[i] -= freqBands16BufferDecrease[i]; freqBands16BufferDecrease[i] *= 1f + bufferDecreaseSpeedMultiply * Time.deltaTime; } } } private void CreateFreqBands8() { int num = 1; } private void CreateFreqBands16() { int num = 0; int num2 = 1; int num3 = 0; for (int i = 0; i < 16; i++) { float num4 = 0f; if (i == 2 || i == 4 || i == 6 || i == 8 || i == 10 || i == 12 || i == 14) { num3++; num2 = (int)Mathf.Pow(2f, (float)num3); if (num3 == 7) { num2++; } } for (int j = 0; j < num2; j++) { num4 += (initialSamplesL[num] + initialSamplesR[num]) * (float)(num + 1); num++; } num4 /= (float)num; freqBands16[i] = num4 * freqBandsPower * 2f; } } } namespace BadAssEmotes { internal class CSS_Loader { } } namespace ExamplePlugin { internal static class Assets { internal static readonly List<AssetBundle> AssetBundles = new List<AssetBundle>(); private static readonly Dictionary<string, int> AssetIndices = new Dictionary<string, int>(); internal static void LoadAssetBundlesFromFolder(string folderName) { folderName = Path.Combine(Path.GetDirectoryName(BadAssEmotesPlugin.PInfo.Location), folderName); string[] files = Directory.GetFiles(folderName); foreach (string text in files) { AssetBundle val = AssetBundle.LoadFromFile(text); int count = AssetBundles.Count; AssetBundles.Add(val); string[] allAssetNames = val.GetAllAssetNames(); foreach (string text2 in allAssetNames) { string text3 = text2.ToLowerInvariant(); if (text3.StartsWith("assets/")) { text3 = text3.Remove(0, "assets/".Length); } AssetIndices[text3] = count; } DebugClass.Log((object)("Loaded AssetBundle: " + Path.GetFileName(text))); } } internal static T Load<T>(string assetName) where T : Object { try { assetName = assetName.ToLowerInvariant(); if (assetName.Contains(":")) { string[] array = assetName.Split(':'); assetName = array[1].ToLowerInvariant(); } if (assetName.StartsWith("assets/")) { assetName = assetName.Remove(0, "assets/".Length); } int index = AssetIndices[assetName]; return AssetBundles[index].LoadAsset<T>("assets/" + assetName); } catch (Exception arg) { DebugClass.Log((object)$"Couldn't load asset [{assetName}] reason: {arg}"); return default(T); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.weliveinasociety.badasscompany", "BadAssCompany", "1.1.5")] public class BadAssEmotesPlugin : BaseUnityPlugin { public const string PluginGUID = "com.weliveinasociety.badasscompany"; public const string PluginAuthor = "Nunchuk"; public const string PluginName = "BadAssCompany"; public const string PluginVersion = "1.1.5"; private int stageInt = -1; private int pressInt = -1; internal static GameObject stage; internal static GameObject press; internal static GameObject pressMechanism; internal static LivingParticleArrayController LPAC; public static BadAssEmotesPlugin instance; private static List<string> HatKidDances = new List<string>(); private int stand = -1; private List<BoneMapper> punchingMappers = new List<BoneMapper>(); private int prop1 = -1; public static PluginInfo PInfo { get; private set; } public void Awake() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0fe5: Unknown result type (might be due to invalid IL or missing references) //IL_0feb: Expected O, but got Unknown //IL_106a: Unknown result type (might be due to invalid IL or missing references) //IL_106f: Unknown result type (might be due to invalid IL or missing references) //IL_1074: Unknown result type (might be due to invalid IL or missing references) //IL_108f: Unknown result type (might be due to invalid IL or missing references) //IL_1094: Unknown result type (might be due to invalid IL or missing references) //IL_1099: Unknown result type (might be due to invalid IL or missing references) //IL_10b0: Unknown result type (might be due to invalid IL or missing references) //IL_10ff: Unknown result type (might be due to invalid IL or missing references) //IL_1105: Expected O, but got Unknown //IL_1135: Unknown result type (might be due to invalid IL or missing references) //IL_1157: Unknown result type (might be due to invalid IL or missing references) //IL_115d: Expected O, but got Unknown //IL_118d: Unknown result type (might be due to invalid IL or missing references) //IL_11d9: Unknown result type (might be due to invalid IL or missing references) //IL_11df: Expected O, but got Unknown //IL_1252: Unknown result type (might be due to invalid IL or missing references) //IL_1492: Unknown result type (might be due to invalid IL or missing references) //IL_1498: Expected O, but got Unknown //IL_14ee: Unknown result type (might be due to invalid IL or missing references) //IL_14f3: Unknown result type (might be due to invalid IL or missing references) //IL_14f8: Unknown result type (might be due to invalid IL or missing references) //IL_1504: Unknown result type (might be due to invalid IL or missing references) //IL_1558: Unknown result type (might be due to invalid IL or missing references) //IL_155e: Expected O, but got Unknown //IL_15a0: Unknown result type (might be due to invalid IL or missing references) //IL_15d0: Unknown result type (might be due to invalid IL or missing references) //IL_15d6: Expected O, but got Unknown //IL_15ff: Unknown result type (might be due to invalid IL or missing references) //IL_18e6: Unknown result type (might be due to invalid IL or missing references) //IL_18ec: Expected O, but got Unknown //IL_1950: Unknown result type (might be due to invalid IL or missing references) //IL_1955: Unknown result type (might be due to invalid IL or missing references) //IL_195a: Unknown result type (might be due to invalid IL or missing references) //IL_1966: Unknown result type (might be due to invalid IL or missing references) //IL_19a8: Unknown result type (might be due to invalid IL or missing references) //IL_19ae: Expected O, but got Unknown //IL_19fe: Unknown result type (might be due to invalid IL or missing references) //IL_1a71: Unknown result type (might be due to invalid IL or missing references) //IL_1a77: Expected O, but got Unknown //IL_1adb: Unknown result type (might be due to invalid IL or missing references) //IL_1ae0: Unknown result type (might be due to invalid IL or missing references) //IL_1ae5: Unknown result type (might be due to invalid IL or missing references) //IL_1af1: Unknown result type (might be due to invalid IL or missing references) //IL_1b2c: Unknown result type (might be due to invalid IL or missing references) //IL_1b32: Expected O, but got Unknown //IL_1b82: Unknown result type (might be due to invalid IL or missing references) //IL_1be3: Unknown result type (might be due to invalid IL or missing references) //IL_1be9: Expected O, but got Unknown //IL_1c3f: Unknown result type (might be due to invalid IL or missing references) //IL_1e44: Unknown result type (might be due to invalid IL or missing references) //IL_1e4e: Expected O, but got Unknown //IL_1e56: Unknown result type (might be due to invalid IL or missing references) //IL_1e60: Expected O, but got Unknown //IL_1e68: Unknown result type (might be due to invalid IL or missing references) //IL_1e72: Expected O, but got Unknown //IL_1e7a: Unknown result type (might be due to invalid IL or missing references) //IL_1e84: Expected O, but got Unknown instance = this; PInfo = ((BaseUnityPlugin)this).Info; Assets.LoadAssetBundlesFromFolder("assetbundles"); Settings.Setup(); CustomEmoteParams val = new CustomEmoteParams(); val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/Breakin.anim") }; val.audioLoops = false; val.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/breakin'.ogg") }; val.syncAnim = true; val.syncAudio = true; val.lockType = (LockType)1; val.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/Breakin'_NNTranscription.ogg") }; val.displayName = "Breakin"; EmoteImporter.ImportEmote(val); AddAnimation("Breakneck", (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/Breakneck.ogg") }, null, looping: true, dimAudio: true, sync: true, (LockType)1, "", (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/Breakneck.ogg") }, null, DMCA: false, 0.7f); AddAnimation("Crabby", "Crabby", "", looping: true, dimAudio: true, sync: true, (LockType)3, "", "Crabby", "", DMCA: false, 0.7f); AddAnimation("Dabstand", "Dabstand", "", looping: false, dimAudio: false, sync: false, (LockType)1, "", "Dabstand", "", DMCA: false, 0.05f); AddAnimation("DanceMoves", "Fortnite default dance sound", "", looping: false, dimAudio: true, sync: true, (LockType)1, "Default Dance", "Fortnite default dance sound", "", DMCA: false, 0.7f); AddAnimation("DanceTherapyIntro", "DanceTherapyLoop", "Dance Therapy Intro", "Dance Therapy Loop", looping: true, dimAudio: true, sync: true, (LockType)1, "Dance Therapy", "Dance Therapy Intro", "Dance Therapy Loop", DMCA: false, 0.7f); AddAnimation("DeepDab", "Dabstand", "", looping: false, dimAudio: false, sync: false, (LockType)3, "Deep Dab", "Dabstand", "", DMCA: false, 0.05f); AddAnimation("Droop", "Droop", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Droop", "", DMCA: false, 0.7f); AddAnimation("ElectroSwing", "ElectroSwing", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Electro Swing", "ElectroSwing", "", DMCA: false, 0.7f); AddAnimation("Extraterrestial", "Extraterestrial", "", looping: true, dimAudio: true, sync: true, (LockType)3, "", "Extraterestrial", "", DMCA: false, 0.7f); AddAnimation("FancyFeet", "FancyFeet", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Fancy Feet", "FancyFeet", "", DMCA: false, 0.7f); AddAnimation("FlamencoIntro", "FlamencoLoop", "Flamenco", "FlamencoLoop", looping: true, dimAudio: true, sync: true, (LockType)1, "Flamenco", "FlamencoLoop", "", DMCA: false, 0.7f); AddAnimation("Floss", "Floss", "", looping: true, dimAudio: true, sync: false, (LockType)3, "", "Floss", "", DMCA: false, 0.5f); AddAnimation("Fresh", "Fresh", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Fresh", "", DMCA: false, 0.7f); AddAnimation("Hype", "Hype", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Hype", "", DMCA: false, 0.7f); AddAnimation("Infectious", "Infectious", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Infectious", "", DMCA: false, 0.7f); AddAnimation("InfinidabIntro", "InfinidabLoop", "InfinidabIntro", "InfinidabLoop", looping: true, dimAudio: true, sync: false, (LockType)1, "Infinidab", "InfinidabLoop", "", DMCA: false, 0.1f); AddAnimation("NeverGonna", "Never Gonna Give you Up", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Never Gonna", "Never Gonna Give you Up", "", DMCA: true, 0.7f); AddAnimation("NinjaStyle", "NinjaStyle", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Ninja Style", "NinjaStyle", "", DMCA: false, 0.7f); AddAnimation("OldSchool", "Old School", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Oldschool", "Old School", "", DMCA: false, 0.7f); AddAnimation("OrangeJustice", "Orange Justice", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Orange Justice", "Orange Justice", "", DMCA: false, 0.6f); AddAnimation("Overdrive", "Overdrive", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Overdrive", "", DMCA: false, 0.7f); AddAnimation("PawsAndClaws", "im a cat", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Paws and Claws", "im a cat", "", DMCA: false, 0.7f); AddAnimation("PhoneItIn", "Phone It In", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Phone It In", "Phone It In", "", DMCA: false, 0.7f); AddAnimation("PopLock", "PopLock", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Pop Lock", "PopLock", "", DMCA: false, 0.7f); AddAnimation("Scenario", "Scenario", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Scenario", "", DMCA: false, 0.7f); AddAnimation("SpringLoaded", "SpringLoaded", "", looping: true, dimAudio: false, sync: false, (LockType)1, "Spring Loaded", "SpringLoaded", "", DMCA: false, 0.1f); AddAnimation("Springy", "Springy", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Springy", "", DMCA: false, 0.7f); AddAnimation("AnkhaZone", "AnkhaZone", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "AnkhaZone", "", DMCA: true, 0.7f); AddAnimation("GangnamStyle", "GangnamStyle", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Gangnam Style", "GangnamStyle", "", DMCA: true, 0.7f); AddAnimation("DontStart", "DontStart", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Don't Start", "DontStart", "", DMCA: true, 0.7f); AddAnimation("BunnyHop", "BunnyHop", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Bunny Hop", "BunnyHop", "", DMCA: false, 0.4f); AddAnimation("BestMates", "BestMates", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Best Mates", "BestMates", "", DMCA: false, 0.7f); AddAnimation("JackOPose", "", "", looping: true, dimAudio: false, sync: false, (LockType)1, "Jack-O Crouch", "", "", DMCA: false, 0f); AddAnimation("Crackdown", "Crackdown", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Crackdown", "", DMCA: false, 0.7f); AddAnimation("Thicc", "Thicc", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Thicc", "", DMCA: false, 0.7f); AddAnimation("TakeTheL", "TakeTheL", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Take The L", "TakeTheL", "", DMCA: false, 0.8f); AddAnimation("LetsDanceBoys", "LetsDanceBoys", "", looping: true, dimAudio: true, sync: true, (LockType)3, "Let's Dance Boys", "LetsDanceBoys", "", DMCA: false, 0.7f); AddAnimation("BlindingLightsIntro", "BlindingLights", "BlindingLightsIntro", "BlindingLightsLoop", looping: true, dimAudio: true, sync: true, (LockType)1, "Blinding Lights", "BlindingLightsIntro", "BlindingLightsLoop", DMCA: true, 0.7f); AddAnimation("ImDiamond", "ImDiamond", "", looping: true, dimAudio: true, sync: true, (LockType)1, "I'm Diamond", "ImDiamond", "", DMCA: true, 0.7f); AddAnimation("ItsDynamite", "ItsDynamite", "", looping: true, dimAudio: true, sync: true, (LockType)1, "It's Dynamite", "ItsDynamite", "", DMCA: true, 0.7f); AddAnimation("TheRobot", "TheRobot", "", looping: true, dimAudio: true, sync: true, (LockType)1, "The Robot", "TheRobot", "", DMCA: false, 0.7f); AddAnimation("Cartwheelin", "Cartwheelin", "", looping: true, dimAudio: false, sync: false, (LockType)1, "", "Cartwheelin", "", DMCA: false, 0.1f); AddAnimation("CrazyFeet", "CrazyFeet", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Crazy Feet", "CrazyFeet", "", DMCA: false, 0.7f); AddAnimation("FullTilt", "FullTilt", "", looping: true, dimAudio: true, sync: true, (LockType)3, "Full Tilt", "FullTilt", "", DMCA: false, 0.1f); AddAnimation("FloorSamus", "", "", looping: true, dimAudio: false, sync: false, (LockType)3, "Samus Crawl", "", "", DMCA: false, 0f); AddAnimation("DEDEDE", "", "", looping: true, dimAudio: false, sync: false, (LockType)1, "", "", "", DMCA: false, 0f); AddAnimation("Specialist", "Specialist", "", looping: false, dimAudio: true, sync: true, (LockType)3, "The Specialist", "Specialist", "", DMCA: false, 0.7f); AddStartAndJoinAnim(new string[2] { "PPmusic", "PPmusicFollow" }, "PPmusic", looping: true, dimaudio: true, sync: true, (LockType)1, "Penis Music", "PPmusic", DMCA: false, 0.7f); AddAnimation("GetDown", "GetDown", "", looping: false, dimAudio: true, sync: true, (LockType)3, "Get Down", "GetDown", "", DMCA: true, 0.7f); AddAnimation("Yakuza", "Yakuza", "", looping: true, dimAudio: true, sync: true, (LockType)3, "Koi no Disco Queen", "Yakuza", "", DMCA: false, 0.7f); AddAnimation("Miku", "Miku", "", looping: true, dimAudio: true, sync: true, (LockType)3, "", "Miku", "", DMCA: false, 0.7f); AddAnimation("Horny", new string[2] { "Horny", "TeddyLoid - ME!ME!ME! feat. Daoko" }, looping: true, dimaudio: true, sync: true, (LockType)1, "", new string[2] { "Horny", "TeddyLoid - ME!ME!ME! feat. Daoko" }, DMCA: true, 0.7f); AddAnimation("GangTorture", "GangTorture", "", looping: false, dimAudio: true, sync: true, (LockType)3, "", "GangTorture", "", DMCA: true, 0.7f); AddAnimation("PoseBurter", "GinyuForce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Burter Pose", "GinyuForce", "", DMCA: false, 0.7f); AddAnimation("PoseGinyu", "GinyuForce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Ginyu Pose", "GinyuForce", "", DMCA: false, 0.7f); AddAnimation("PoseGuldo", "GinyuForce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Guldo Pose", "GinyuForce", "", DMCA: false, 0.7f); AddAnimation("PoseJeice", "GinyuForce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Jeice Pose", "GinyuForce", "", DMCA: false, 0.7f); AddAnimation("PoseRecoome", "GinyuForce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Recoome Pose", "GinyuForce", "", DMCA: false, 0.7f); AddAnimation("Carson", "Carson", "", looping: false, dimAudio: true, sync: true, (LockType)1, "", "Carson", "", DMCA: true, 0.7f); AddAnimation("Frolic", "Frolic", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Frolic", "", DMCA: false, 0.7f); AddAnimation("MoveIt", "MoveIt", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Move It", "MoveIt", "", DMCA: true, 0.7f); AddStartAndJoinAnim(new string[2] { "ByTheFireLead", "ByTheFirePartner" }, "ByTheFire", looping: true, dimaudio: true, sync: true, (LockType)1, "By The Fire", "ByTheFire", DMCA: true, 0.7f); AddStartAndJoinAnim(new string[2] { "SwayLead", "SwayPartner" }, "Sway", looping: true, dimaudio: true, sync: true, (LockType)1, "Sway", "Sway", DMCA: true, 0.7f); AddAnimation("Macarena", "Macarena", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Macarena", "", DMCA: true, 0.7f); AddAnimation("Thanos", "Thanos", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Thanos", "", DMCA: true, 0.7f); AddAnimation("StarGet", (AudioClip[])(object)new AudioClip[6] { Assets.Load<AudioClip>("assets/compressedaudio/starget2.ogg"), Assets.Load<AudioClip>("assets/compressedaudio/starget3.ogg"), Assets.Load<AudioClip>("assets/compressedaudio/starget4.ogg"), Assets.Load<AudioClip>("assets/compressedaudio/starget5.ogg"), Assets.Load<AudioClip>("assets/compressedaudio/starget6.ogg"), Assets.Load<AudioClip>("assets/compressedaudio/starget7.ogg") }, null, looping: false, dimAudio: false, sync: false, (LockType)3, "Star Get", (AudioClip[])(object)new AudioClip[6] { Assets.Load<AudioClip>("assets/DMCAMusic/starget2_NNTranscription.ogg"), Assets.Load<AudioClip>("assets/DMCAMusic/starget3_NNTranscription.ogg"), Assets.Load<AudioClip>("assets/DMCAMusic/starget4_NNTranscription.ogg"), Assets.Load<AudioClip>("assets/DMCAMusic/starget5_NNTranscription.ogg"), Assets.Load<AudioClip>("assets/DMCAMusic/starget6_NNTranscription.ogg"), Assets.Load<AudioClip>("assets/DMCAMusic/starget7_NNTranscription.ogg") }, null, DMCA: false, 0.6f); AddAnimation("Poyo", "Poyo", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Poyo", "", DMCA: false, 0.7f); AddAnimation("Chika", "Chika", "", looping: false, dimAudio: true, sync: true, (LockType)3, "", "Chika", "", DMCA: true, 0.7f); AddAnimation("Goopie", "Goopie", "", looping: false, dimAudio: true, sync: true, (LockType)1, "", "Goopie", "", DMCA: true, 0.7f); AddAnimation("Crossbounce", "Crossbounce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Crossbounce", "", DMCA: false, 0.7f); AddAnimation("Butt", "Butt", "", looping: false, dimAudio: false, sync: false, (LockType)2, "", "Butt", "", DMCA: false, 0.5f); AddAnimation("MakeItRainIntro", "MakeItRainLoop", "MakeItRainIntro", "MakeItRainLoop", looping: true, dimAudio: true, sync: true, (LockType)3, "Make it Rain", "MakeItRainLoop", "", DMCA: true, 0.7f); AddAnimation("Penguin", "Penguin", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Club Penguin", "Penguin", "", DMCA: false, 0.4f); AddAnimation("DesertRivers", "DesertRivers", "", looping: false, dimAudio: true, sync: true, (LockType)3, "Rivers in the Dessert", "DesertRivers", "", DMCA: false, 0.7f); AddAnimation("HondaStep", "HondaStep", "", looping: false, dimAudio: true, sync: true, (LockType)3, "Step!", "HondaStep", "", DMCA: true, 0.7f); AddAnimation("UGotThat", "UGotThat", "", looping: false, dimAudio: true, sync: true, (LockType)3, "U Got That", "UGotThat", "", DMCA: true, 0.7f); AddAnimation("OfficerEarl", "", "", looping: true, dimAudio: false, sync: false, (LockType)3, "Officer Earl", "", "", DMCA: false, 0f); AddAnimation("Cirno", "Cirno", "", looping: false, dimAudio: true, sync: true, (LockType)3, "", "Cirno", "", DMCA: false, 0.7f); CustomEmoteParams val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/Haruhi.anim") }; val2.audioLoops = false; val2.primaryAudioClips = (AudioClip[])(object)new AudioClip[2] { Assets.Load<AudioClip>("assets/compressedaudio/Haruhi.ogg"), Assets.Load<AudioClip>("assets/compressedaudio/HaruhiYoung.ogg") }; val2.syncAnim = true; val2.syncAudio = true; val2.startPref = 0; val2.joinPref = 0; val2.joinSpots = (JoinSpot[])(object)new JoinSpot[2] { new JoinSpot("Yuki_Nagato", new Vector3(1.5f, 0f, -1.5f)), new JoinSpot("Mikuru_Asahina", new Vector3(-1.5f, 0f, -1.5f)) }; val2.internalName = "Hare Hare Yukai"; val2.lockType = (LockType)3; val2.willGetClaimedByDMCA = true; val2.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[2] { Assets.Load<AudioClip>("assets/DMCAMusic/Haruhi_NNTranscription.ogg"), Assets.Load<AudioClip>("assets/DMCAMusic/HaruhiYoung_NNTranscription.ogg") }; val2.audioLevel = 0.7f; val2.displayName = "Hare Hare Yukai"; EmoteImporter.ImportEmote(val2); val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/Yuki_Nagato.anim") }; val2.audioLoops = false; val2.syncAnim = true; val2.visible = false; val2.lockType = (LockType)2; val2.audioLevel = 0f; val2.displayName = "Hare Hare Yukai"; EmoteImporter.ImportEmote(val2); val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/Mikuru_Asahina.anim") }; val2.audioLoops = false; val2.syncAnim = true; val2.visible = false; val2.lockType = (LockType)2; val2.audioLevel = 0f; val2.displayName = "Hare Hare Yukai"; EmoteImporter.ImportEmote(val2); BoneMapper.animClips["com.weliveinasociety.badasscompany__Yuki_Nagato"].vulnerableEmote = true; BoneMapper.animClips["com.weliveinasociety.badasscompany__Mikuru_Asahina"].vulnerableEmote = true; val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[3] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/GGGG.anim"), Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/GGGG2.anim"), Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/GGGG3.anim") }; val2.audioLoops = false; val2.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/GGGG.ogg") }; val2.syncAnim = true; val2.syncAudio = true; val2.startPref = -2; val2.joinPref = -2; val2.lockType = (LockType)3; val2.willGetClaimedByDMCA = true; val2.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/GGGG_NNTranscription.ogg") }; val2.audioLevel = 0.7f; val2.displayName = "GGGG"; EmoteImporter.ImportEmote(val2); AddAnimation("Shufflin", "Shufflin", "", looping: false, dimAudio: true, sync: true, (LockType)3, "", "Shufflin", "", DMCA: true, 0.7f); AddAnimation("BimBamBom", "BimBamBom", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Bim Bam Boom", "BimBamBom", "", DMCA: true, 0.7f); AddAnimation("Savage", "Savage", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Savage", "", DMCA: true, 0.7f); AddAnimation("Stuck", "Stuck", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Stuck", "", DMCA: true, 0.7f); AddAnimation("Roflcopter", "Roflcopter", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Roflcopter", "", DMCA: false, 0.7f); AddAnimation("Float", "Float", "", looping: false, dimAudio: true, sync: true, (LockType)1, "", "Float", "", DMCA: false, 0.4f); AddAnimation("Rollie", "Rollie", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Rollie", "", DMCA: true, 0.7f); AddAnimation("GalaxyObservatory", new string[3] { "GalaxyObservatory1", "GalaxyObservatory2", "GalaxyObservatory3" }, looping: true, dimaudio: true, sync: true, (LockType)3, "Galaxy Observatory", new string[3] { "GalaxyObservatory1", "GalaxyObservatory2", "GalaxyObservatory3" }, DMCA: false, 0.5f); AddAnimation("Markiplier", "Markiplier", "", looping: false, dimAudio: false, sync: false, (LockType)3, "", "Markiplier", "", DMCA: true, 0.6f); AddAnimation("DevilSpawn", "DevilSpawn", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "DevilSpawn", "", DMCA: true, 0.7f); val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/DuckThisOneIdle.anim") }; val2.audioLoops = true; val2.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/DuckThisOneIdle.ogg") }; val2.joinSpots = (JoinSpot[])(object)new JoinSpot[1] { new JoinSpot("DuckThisJoinSpot", new Vector3(0f, 0f, 2f)) }; val2.lockType = (LockType)2; val2.internalName = "Duck This One"; val2.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/DuckThisOneIdle_NNTranscription.ogg") }; val2.willGetClaimedByDMCA = false; val2.audioLevel = 0.7f; val2.displayName = "Duck This One"; val2.preventMovement = true; EmoteImporter.ImportEmote(val2); val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/DuckThisOne.anim") }; val2.audioLoops = false; val2.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/DuckThisOne.ogg") }; val2.visible = false; val2.lockType = (LockType)2; val2.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/DuckThisOne.ogg") }; val2.displayName = "Duck This One"; EmoteImporter.ImportEmote(val2); val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/DuckThisOneJoin.anim") }; val2.audioLoops = false; val2.visible = false; val2.lockType = (LockType)2; val2.displayName = "Duck This One"; EmoteImporter.ImportEmote(val2); BoneMapper.animClips["com.weliveinasociety.badasscompany__Duck This One"].vulnerableEmote = true; BoneMapper.animClips["com.weliveinasociety.badasscompany__DuckThisOne"].vulnerableEmote = true; BoneMapper.animClips["com.weliveinasociety.badasscompany__DuckThisOneJoin"].vulnerableEmote = true; AddAnimation("Griddy", "Griddy", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Griddy", "", DMCA: true, 0.7f); AddAnimation("Tidy", "Tidy", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Tidy", "", DMCA: true, 0.7f); AddAnimation("Toosie", "Toosie", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Toosie", "", DMCA: true, 0.7f); AddAnimation("INEEDAMEDICBAG", (AudioClip[])(object)new AudioClip[2] { Assets.Load<AudioClip>("assets/compressedaudio/INEEDAMEDICBAG1.ogg"), Assets.Load<AudioClip>("assets/compressedaudio/INEEDAMEDICBAG2.ogg") }, null, looping: false, dimAudio: false, sync: false, (LockType)3, "I NEED A MEDIC BAG", (AudioClip[])(object)new AudioClip[2] { Assets.Load<AudioClip>("assets/compressedaudio/INEEDAMEDICBAG1.ogg"), Assets.Load<AudioClip>("assets/compressedaudio/INEEDAMEDICBAG2.ogg") }, null, DMCA: false, 0.9f); AddAnimation("Smoke", "Smoke", "", looping: true, dimAudio: true, sync: true, (LockType)3, "Ralsei Dies", "Smoke", "", DMCA: false, 0.7f); AddAnimation("FamilyGuyDeath", "", "", looping: true, dimAudio: false, sync: false, (LockType)1, "Family Guy Death Pose", "", "", DMCA: false, 0f); AddAnimation("Panda", "", "", looping: false, dimAudio: false, sync: false, (LockType)3, "", "", "", DMCA: false, 0f); AddAnimation("Yamcha", "", "", looping: true, dimAudio: false, sync: false, (LockType)1, "Yamcha Death Pose", "", "", DMCA: false, 0f); AddAnimation("Thriller", "Thriller", "", looping: true, dimAudio: true, sync: true, (LockType)3, "", "Thriller", "", DMCA: true, 0.7f); AddAnimation("Wess", "Wess", "", looping: false, dimAudio: true, sync: true, (LockType)1, "", "Wess", "", DMCA: true, 0.7f); AddAnimation("Distraction", "Distraction", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Distraction Dance", "Distraction", "", DMCA: false, 1f); AddAnimation("Security", "Security", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Last Surprise", "Security", "", DMCA: false, 0.7f); AddAnimation("KillMeBaby", "KillMeBaby", "", looping: false, dimAudio: true, sync: true, (LockType)1, "Kill Me Baby", "KillMeBaby", "", DMCA: true, 0.7f); val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/MyWorld.anim") }; val2.audioLoops = true; val2.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/MyWorld.ogg") }; val2.syncAnim = true; val2.syncAudio = true; val2.joinSpots = (JoinSpot[])(object)new JoinSpot[1] { new JoinSpot("MyWorldJoinSpot", new Vector3(2f, 0f, 0f)) }; val2.lockType = (LockType)1; val2.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/MyWorld_NNTranscription.ogg") }; val2.audioLevel = 0.7f; val2.willGetClaimedByDMCA = true; val2.displayName = "My World"; EmoteImporter.ImportEmote(val2); val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/MyWorldJoin.anim") }; val2.audioLoops = true; val2.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/MyWorld.ogg") }; val2.syncAnim = true; val2.syncAudio = true; val2.visible = false; val2.lockType = (LockType)1; val2.audioLevel = 0f; val2.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/MyWorld_NNTranscription.ogg") }; val2.willGetClaimedByDMCA = true; val2.displayName = "My World"; EmoteImporter.ImportEmote(val2); CustomAnimationClip obj = BoneMapper.animClips["com.weliveinasociety.badasscompany__MyWorldJoin"]; obj.syncPos--; BoneMapper.animClips["com.weliveinasociety.badasscompany__MyWorldJoin"].vulnerableEmote = true; val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/VSWORLD.anim") }; val2.audioLoops = true; val2.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/VSWORLD.ogg") }; val2.syncAnim = true; val2.syncAudio = true; val2.joinSpots = (JoinSpot[])(object)new JoinSpot[1] { new JoinSpot("VSWORLDJoinSpot", new Vector3(-2f, 0f, 0f)) }; val2.lockType = (LockType)1; val2.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/VSWORLD_NNTranscription.ogg") }; val2.audioLevel = 0.7f; val2.displayName = "VSWORLD"; EmoteImporter.ImportEmote(val2); val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/VSWORLDLEFT.anim") }; val2.audioLoops = true; val2.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/VSWORLD.ogg") }; val2.syncAnim = true; val2.syncAudio = true; val2.visible = false; val2.lockType = (LockType)1; val2.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/VSWORLD_NNTranscription.ogg") }; val2.displayName = "VSWORLD"; EmoteImporter.ImportEmote(val2); CustomAnimationClip obj2 = BoneMapper.animClips["com.weliveinasociety.badasscompany__VSWORLDLEFT"]; obj2.syncPos--; BoneMapper.animClips["com.weliveinasociety.badasscompany__VSWORLDLEFT"].vulnerableEmote = true; val2 = new CustomEmoteParams(); val2.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/ChugJug.anim") }; val2.audioLoops = false; val2.primaryAudioClips = (AudioClip[])(object)new AudioClip[2] { Assets.Load<AudioClip>("assets/compressedaudio/ChugJug.ogg"), Assets.Load<AudioClip>("assets/compressedaudio/MikuJug.ogg") }; val2.syncAnim = true; val2.syncAudio = true; val2.lockType = (LockType)1; val2.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[2] { Assets.Load<AudioClip>("assets/DMCAMusic/ChugJug_NNTranscription.ogg"), Assets.Load<AudioClip>("assets/DMCAMusic/MikuJug_NNTranscription.ogg") }; val2.audioLevel = 0.7f; val2.displayName = "Chug Jug"; EmoteImporter.ImportEmote(val2); AddAnimation("Summertime", "Summertime", "", looping: false, dimAudio: true, sync: true, (LockType)1, "", "Summertime", "", DMCA: true, 0.7f); AddAnimation("Dougie", "Dougie", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Dougie", "", DMCA: true, 0.7f); AddAnimation("CaliforniaGirls", "CaliforniaGirls", "", looping: true, dimAudio: true, sync: true, (LockType)1, "California Gurls", "CaliforniaGirls", "", DMCA: true, 0.7f); AddAnimation("SeeTinh", "SeeTinh", "", looping: false, dimAudio: true, sync: true, (LockType)1, "See Tình", "SeeTinh", "", DMCA: true, 0.7f); AddAnimation("VirtualInsanityIntro", "VirtualInsanityLoop", "VirtualInsanityStart", "VirtualInsanityLoop", looping: false, dimAudio: true, sync: true, (LockType)1, "Virtual Insanity", "VirtualInsanityStart", "VirtualInsanityLoop", DMCA: true, 0.5f); AddAnimation("Im a Mystery", "Im a Mystery Loop", "Im a Mystery", "Im a Mystery Loop", looping: true, dimAudio: true, sync: true, (LockType)1, "Im a Mystery", "Im a Mystery", "Im a Mystery Loop", DMCA: true, 0.5f); AddAnimation("Bird", "Bird", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Bird", "Bird", "", DMCA: false, 0.7f); AddAnimation("Real Slim Shady", "Real Slim Shady Loop", "Real Slim Shady", "Real Slim Shady Loop", looping: true, dimAudio: true, sync: true, (LockType)1, "Real Slim Shady", "Real Slim Shady", "Real Slim Shady Loop", DMCA: true, 0.7f); AddAnimation("Steady", "Steady", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Steady", "Steady", "", DMCA: false, 0.7f); CustomEmotesAPI.animChanged += new AnimationChanged(CustomEmotesAPI_animChanged); CustomEmotesAPI.emoteSpotJoined_Body += new JoinedEmoteSpotBody(CustomEmotesAPI_emoteSpotJoined_Body); CustomEmotesAPI.emoteSpotJoined_Prop += new JoinedEmoteSpotProp(CustomEmotesAPI_emoteSpotJoined_Prop); CustomEmotesAPI.boneMapperCreated += new BoneMapperCreated(CustomEmotesAPI_boneMapperCreated); } private void CustomEmotesAPI_boneMapperCreated(BoneMapper mapper) { } private void CustomEmotesAPI_emoteSpotJoined_Prop(GameObject emoteSpot, BoneMapper joiner, BoneMapper host) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown switch (((Object)emoteSpot).name) { case "ifumiddle": { ((Component)host).GetComponentsInChildren<Animator>()[1].SetTrigger("Start"); joiner.PlayAnim("ifu", 0); GameObject val = new GameObject(); ((Object)val).name = "ifumiddle_JoinProp"; IFU(joiner, host, emoteSpot, val); break; } case "ifeleft": { ((Component)host).GetComponentsInChildren<Animator>()[1].SetTrigger("Start"); joiner.PlayAnim("ifeleft", 0); GameObject val = new GameObject(); ((Object)val).name = "ifeleft_JoinProp"; IFU(joiner, host, emoteSpot, val); break; } case "ifuright": { ((Component)host).GetComponentsInChildren<Animator>()[1].SetTrigger("Start"); joiner.PlayAnim("ifuright", 0); GameObject val = new GameObject(); ((Object)val).name = "ifuright_JoinProp"; IFU(joiner, host, emoteSpot, val); break; } case "HydrolicPressJoinSpot": { GameObject val = new GameObject(); ((Object)val).name = "hydrolicpress_JoinProp"; HydrolicPress(joiner, host, emoteSpot, val); break; } } } private void IFU(BoneMapper joiner, BoneMapper host, GameObject emoteSpot, GameObject g) { } private void HydrolicPress(BoneMapper joiner, BoneMapper host, GameObject emoteSpot, GameObject g) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) joiner.props.Add(g); g.transform.SetParent(((Component)host).transform); g.transform.localPosition = new Vector3(0f, 0.03f, 0f); g.transform.localEulerAngles = Vector3.zero; g.transform.localScale = Vector3.one; g.AddComponent<HydrolicPressComponent>().boneMapper = joiner; joiner.AssignParentGameObject(g, true, false, true, false, false); emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner); ((MonoBehaviour)this).StartCoroutine(WaitForSecondsThenEndEmote(joiner, 10f, g)); } private IEnumerator WaitForSecondsThenEndEmote(BoneMapper mapper, float time, GameObject parent) { yield return (object)new WaitForSeconds(time); if (Object.op_Implicit((Object)(object)mapper) && (Object)(object)mapper.parentGameObject == (Object)(object)parent) { mapper.preserveProps = true; mapper.AssignParentGameObject(mapper.parentGameObject, false, false, true, false, false); mapper.preserveParent = true; mapper.preserveProps = true; mapper.PlayAnim("none", 0); } } internal IEnumerator WaitForSecondsThenDeleteGameObject(GameObject obj, float time) { yield return (object)new WaitForSeconds(time); if (Object.op_Implicit((Object)(object)obj)) { Object.Destroy((Object)(object)obj); } } private void CustomEmotesAPI_emoteSpotJoined_Body(GameObject emoteSpot, BoneMapper joiner, BoneMapper host) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Expected O, but got Unknown //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Expected O, but got Unknown //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Expected O, but got Unknown //IL_06a6: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_0712: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Unknown result type (might be due to invalid IL or missing references) string name = ((Object)emoteSpot).name; if (name == "StandingHereJoinSpot") { joiner.PlayAnim("StandingHere", 0); GameObject val = new GameObject(); ((Object)val).name = "StandingHereProp"; joiner.props.Add(val); val.transform.SetParent(((Component)host).transform); Vector3 lossyScale = ((Component)host).transform.lossyScale; val.transform.localPosition = new Vector3(0f, 0f, 0.75f / lossyScale.z); val.transform.localEulerAngles = new Vector3(0f, 130f, 0f); val.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f); joiner.AssignParentGameObject(val, true, true, true, true, true); joiner.SetAnimationSpeed(2f); emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner); } if (name == "DuckThisJoinSpot") { joiner.PlayAnim("com.weliveinasociety.badasscompany__DuckThisOneJoin", 0); GameObject val2 = new GameObject(); ((Object)val2).name = "DuckThisOneJoinProp"; joiner.props.Add(val2); val2.transform.SetParent(((Component)host).transform); Vector3 lossyScale2 = ((Component)host).transform.lossyScale; val2.transform.localPosition = new Vector3(0f, 0f, 1f / lossyScale2.z); val2.transform.localEulerAngles = new Vector3(0f, 180f, 0f); val2.transform.localScale = Vector3.one; joiner.AssignParentGameObject(val2, true, true, true, true, true); host.PlayAnim("com.weliveinasociety.badasscompany__DuckThisOne", 0); joiner.currentlyLockedBoneMapper = host; val2 = new GameObject(); ((Object)val2).name = "DuckThisOneHostProp"; host.props.Add(val2); val2.transform.localPosition = ((Component)host).transform.position; val2.transform.localEulerAngles = ((Component)host).transform.eulerAngles; val2.transform.localScale = Vector3.one; val2.transform.SetParent(host.mapperBodyTransform.parent); host.AssignParentGameObject(val2, true, true, true, true, false); } if (name == "Yuki_Nagato") { joiner.PlayAnim("com.weliveinasociety.badasscompany__Yuki_Nagato", 0); DebugClass.Log((object)$"{joiner.currentClip != null} {host.currentClip != null}"); DebugClass.Log((object)$"{host.currentClip.syncPos}"); DebugClass.Log((object)$"{joiner.currentClip.syncPos}"); CustomAnimationClip.syncTimer[joiner.currentClip.syncPos] = CustomAnimationClip.syncTimer[host.currentClip.syncPos]; CustomAnimationClip.syncPlayerCount[joiner.currentClip.syncPos]++; joiner.PlayAnim("com.weliveinasociety.badasscompany__Yuki_Nagato", 0); CustomAnimationClip.syncPlayerCount[joiner.currentClip.syncPos]--; GameObject val3 = new GameObject(); ((Object)val3).name = "Yuki_NagatoProp"; joiner.props.Add(val3); val3.transform.SetParent(((Component)host).transform); Vector3 lossyScale3 = ((Component)host).transform.lossyScale; val3.transform.localPosition = new Vector3(0f, 0f, 0f); val3.transform.localEulerAngles = new Vector3(0f, 0f, 0f); val3.transform.localScale = Vector3.one; joiner.AssignParentGameObject(val3, true, true, true, true, true); joiner.currentlyLockedBoneMapper = host; emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner); } if (name == "Mikuru_Asahina") { joiner.PlayAnim("com.weliveinasociety.badasscompany__Mikuru_Asahina", 0); CustomAnimationClip.syncTimer[joiner.currentClip.syncPos] = CustomAnimationClip.syncTimer[host.currentClip.syncPos]; CustomAnimationClip.syncPlayerCount[joiner.currentClip.syncPos]++; joiner.PlayAnim("com.weliveinasociety.badasscompany__Mikuru_Asahina", 0); CustomAnimationClip.syncPlayerCount[joiner.currentClip.syncPos]--; GameObject val4 = new GameObject(); ((Object)val4).name = "Mikuru_AsahinaProp"; joiner.props.Add(val4); val4.transform.SetParent(((Component)host).transform); Vector3 lossyScale4 = ((Component)host).transform.lossyScale; val4.transform.localPosition = new Vector3(0f, 0f, 0f); val4.transform.localEulerAngles = new Vector3(0f, 0f, 0f); val4.transform.localScale = Vector3.one; joiner.AssignParentGameObject(val4, true, true, true, true, true); joiner.currentlyLockedBoneMapper = host; emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner); } if (name == "MyWorldJoinSpot") { joiner.PlayAnim("com.weliveinasociety.badasscompany__MyWorldJoin", 0); GameObject val5 = new GameObject(); ((Object)val5).name = "MyWorldJoinProp"; joiner.props.Add(val5); val5.transform.SetParent(((Component)host).transform); val5.transform.localPosition = new Vector3(2f, 0f, 0f); val5.transform.localEulerAngles = Vector3.zero; val5.transform.localScale = Vector3.one; joiner.AssignParentGameObject(val5, true, true, true, true, true); joiner.currentlyLockedBoneMapper = host; emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner); } if (name == "VSWORLDJoinSpot") { joiner.PlayAnim("com.weliveinasociety.badasscompany__VSWORLDLEFT", 0); GameObject val6 = new GameObject(); ((Object)val6).name = "VSWORLDLEFTJoinProp"; joiner.props.Add(val6); Vector3 localScale = ((Component)host).transform.parent.localScale; ((Component)host).transform.parent.localScale = Vector3.one; val6.transform.SetParent(((Component)host).transform.parent); val6.transform.localPosition = new Vector3(-2f, 0f, 0f); val6.transform.localEulerAngles = new Vector3(90f, 0f, 0f); val6.transform.localScale = Vector3.one * (host.scale / joiner.scale); ((Component)host).transform.parent.localScale = localScale; joiner.AssignParentGameObject(val6, true, true, false, false, true); joiner.currentlyLockedBoneMapper = host; emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner); } } private void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: 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) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_0847: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_079a: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_097e: Unknown result type (might be due to invalid IL or missing references) //IL_099f: Unknown result type (might be due to invalid IL or missing references) //IL_0c57: Unknown result type (might be due to invalid IL or missing references) //IL_0c5e: Expected O, but got Unknown //IL_0c86: Unknown result type (might be due to invalid IL or missing references) //IL_0c9e: Unknown result type (might be due to invalid IL or missing references) //IL_0cb0: Unknown result type (might be due to invalid IL or missing references) //IL_0ba8: Unknown result type (might be due to invalid IL or missing references) //IL_0bc9: Unknown result type (might be due to invalid IL or missing references) //IL_0c13: Unknown result type (might be due to invalid IL or missing references) //IL_0c18: Unknown result type (might be due to invalid IL or missing references) //IL_0d63: Unknown result type (might be due to invalid IL or missing references) //IL_0d84: Unknown result type (might be due to invalid IL or missing references) //IL_0edb: Unknown result type (might be due to invalid IL or missing references) //IL_0efc: Unknown result type (might be due to invalid IL or missing references) if (!newAnimation.StartsWith("com.weliveinasociety.badasscompany")) { return; } newAnimation = newAnimation.Split("__")[1]; prop1 = -1; try { if (newAnimation != "none") { stand = mapper.currentClip.syncPos; } } catch (Exception) { } if (punchingMappers.Contains(mapper)) { punchingMappers.Remove(mapper); } if (punchingMappers.Count == 0) { } if (newAnimation == "StandingHere") { punchingMappers.Add(mapper); } if (newAnimation == "StoodHere") { GameObject val = new GameObject(); ((Object)val).name = "StoodHereProp"; mapper.props.Add(val); val.transform.localPosition = ((Component)mapper).transform.position; val.transform.localEulerAngles = ((Component)mapper).transform.eulerAngles; val.transform.localScale = Vector3.one; mapper.AssignParentGameObject(val, false, false, true, true, false); } if (newAnimation == "Chika") { prop1 = mapper.props.Count; GameObject val2 = ((Random.Range(0, 100) != 0) ? Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/prefabs/CSSDesker.prefab") : Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/models/desker.prefab")); mapper.props.Add(Object.Instantiate<GameObject>(val2)); mapper.props[prop1].transform.SetParent(((Component)mapper).transform); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; mapper.ScaleProps(); } if (newAnimation == "Make it Rain") { prop1 = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/money.prefab"))); mapper.props[prop1].transform.SetParent(((Component)mapper).transform); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; mapper.ScaleProps(); } switch (newAnimation) { default: if (!(newAnimation == "GGGG")) { break; } goto case "Rivers in the Dessert"; case "Rivers in the Dessert": case "Cirno": case "Hare Hare Yukai": prop1 = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/desertlight.prefab"))); mapper.props[prop1].transform.SetParent(((Component)mapper).transform); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; break; } if (newAnimation == "Step!") { prop1 = mapper.props.Count; GameObject val3 = Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/hondastuff.prefab")); ParticleSystem[] componentsInChildren = val3.GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val4 in componentsInChildren) { val4.time = CustomAnimationClip.syncTimer[mapper.currentClip.syncPos]; } Animator componentInChildren = val3.GetComponentInChildren<Animator>(); componentInChildren.Play("MusicSync", 0, CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] % ((AnimatorClipInfo)(ref componentInChildren.GetCurrentAnimatorClipInfo(0)[0])).clip.length / ((AnimatorClipInfo)(ref componentInChildren.GetCurrentAnimatorClipInfo(0)[0])).clip.length); val3.transform.SetParent(((Component)mapper).transform); val3.transform.localEulerAngles = Vector3.zero; val3.transform.localPosition = Vector3.zero; mapper.props.Add(val3); } if (newAnimation == "Train") { prop1 = mapper.props.Count; if (CustomAnimationClip.syncPlayerCount[stand] == 1) { mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/train.prefab"))); } else { mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/passenger.prefab"))); } mapper.props[prop1].transform.SetParent(((Component)mapper).transform); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; mapper.SetAutoWalk(1f, false); mapper.ScaleProps(); } if (newAnimation == "Bim Bam Boom") { prop1 = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/BimBamBom.prefab"))); ParticleSystem[] componentsInChildren2 = mapper.props[prop1].GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val5 in componentsInChildren2) { val5.time = CustomAnimationClip.syncTimer[mapper.currentClip.syncPos]; } mapper.props[prop1].transform.SetParent(((Component)mapper).transform); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; mapper.ScaleProps(); } if (newAnimation == "Summertime") { prop1 = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:Assets/Prefabs/Summermogus.prefab"))); Animator[] componentsInChildren3 = mapper.props[prop1].GetComponentsInChildren<Animator>(); foreach (Animator val6 in componentsInChildren3) { val6.Play("Summertime", 0, CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] % ((AnimatorClipInfo)(ref val6.GetCurrentAnimatorClipInfo(0)[0])).clip.length / ((AnimatorClipInfo)(ref val6.GetCurrentAnimatorClipInfo(0)[0])).clip.length); } mapper.props[prop1].transform.SetParent(((Component)mapper).transform); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; mapper.ScaleProps(); } if (newAnimation == "Float") { prop1 = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/FloatLight.prefab"))); mapper.props[prop1].transform.SetParent(((Component)mapper).transform); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; mapper.ScaleProps(); } if (newAnimation == "Markiplier") { prop1 = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/Amogus.prefab"))); Animator[] componentsInChildren4 = mapper.props[prop1].GetComponentsInChildren<Animator>(); foreach (Animator val7 in componentsInChildren4) { val7.Play("Markimogus", 0, CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] % ((AnimatorClipInfo)(ref val7.GetCurrentAnimatorClipInfo(0)[0])).clip.length / ((AnimatorClipInfo)(ref val7.GetCurrentAnimatorClipInfo(0)[0])).clip.length); } mapper.props[prop1].transform.SetParent(((Component)mapper).transform); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; mapper.ScaleProps(); } if (newAnimation == "Officer Earl") { mapper.SetAutoWalk(1f, false); } if (newAnimation == "Virtual Insanity") { mapper.SetAutoWalk(0.2f, false); } if (newAnimation == "Move It") { mapper.SetAutoWalk(0.2f, false); } if (newAnimation == "Spring Loaded") { mapper.SetAutoWalk(-1f, false); } if (newAnimation == "Samus Crawl") { mapper.SetAutoWalk(0.5f, false); } if (newAnimation == "Duck This One") { } if (newAnimation == "Full Tilt") { mapper.SetAutoWalk(1f, false); } if (newAnimation == "Cartwheelin") { mapper.SetAutoWalk(0.75f, false); } if (newAnimation == "Ralsei Dies") { prop1 = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/BluntAnimator.prefab"))); Animator[] componentsInChildren5 = mapper.props[prop1].GetComponentsInChildren<Animator>(); foreach (Animator val8 in componentsInChildren5) { val8.Play("Blunt", 0, CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] % ((AnimatorClipInfo)(ref val8.GetCurrentAnimatorClipInfo(0)[0])).clip.length / ((AnimatorClipInfo)(ref val8.GetCurrentAnimatorClipInfo(0)[0])).clip.length); } mapper.props[prop1].transform.SetParent(((Component)mapper).transform); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; ParticleSystem componentInChildren2 = mapper.props[prop1].GetComponentInChildren<ParticleSystem>(); componentInChildren2.gravityModifier *= mapper.scale; LimitVelocityOverLifetimeModule limitVelocityOverLifetime = mapper.props[prop1].GetComponentInChildren<ParticleSystem>().limitVelocityOverLifetime; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen * mapper.scale; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limitMultiplier = mapper.scale; mapper.ScaleProps(); } if (newAnimation == "Hare Hare Yukai") { GameObject val9 = new GameObject(); ((Object)val9).name = "HaruhiProp"; mapper.props.Add(val9); val9.transform.localPosition = ((Component)mapper).transform.position; val9.transform.localEulerAngles = ((Component)mapper).transform.eulerAngles; val9.transform.localScale = Vector3.one; mapper.AssignParentGameObject(val9, false, false, true, true, false); } if (newAnimation == "Last Surprise" && (Object)(object)mapper != (Object)(object)CustomEmotesAPI.localMapper) { prop1 = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/prefabs/neversee.prefab"))); mapper.props[prop1].transform.SetParent(((Component)mapper).gameObject.GetComponent<Animator>().GetBoneTransform((HumanBodyBones)7)); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; mapper.ScaleProps(); } if (newAnimation == "IFU Stage") { } if (newAnimation == "Hydraulic Press") { } if (newAnimation == "Im a Mystery") { prop1 = mapper.props.Count; mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/Im a Mystery.prefab"))); Animator componentInChildren3 = mapper.props[prop1].GetComponentInChildren<Animator>(); if (CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] < 0.4f) { componentInChildren3.Play("Mystery Model Intro", 0, CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] % 0.4f / 0.4f); } else { componentInChildren3.Play("Mstery Model", 0, (CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] - 0.4f) % 7.333f / 7.333f); } mapper.props[prop1].transform.SetParent(((Component)mapper).transform); mapper.props[prop1].transform.localEulerAngles = Vector3.zero; mapper.props[prop1].transform.localPosition = Vector3.zero; mapper.ScaleProps(); } } internal void AddAnimation(string AnimClip, AudioClip[] startClips, AudioClip[] loopClips, bool looping, bool dimAudio, bool sync, LockType lockType, string customName, AudioClip[] dmcaStartClips, AudioClip[] dmcaLoopClips, bool DMCA, float audio) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (customName == "") { customName = ((Object)Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim")).name; } CustomEmoteParams val = new CustomEmoteParams(); val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim") }; val.audioLoops = looping; val.primaryAudioClips = startClips; val.secondaryAudioClips = loopClips; val.syncAnim = sync; val.syncAudio = sync; val.lockType = lockType; val.internalName = customName; val.primaryDMCAFreeAudioClips = dmcaStartClips; val.secondaryDMCAFreeAudioClips = dmcaLoopClips; val.willGetClaimedByDMCA = DMCA; val.audioLevel = audio; val.displayName = customName; EmoteImporter.ImportEmote(val); } internal void AddAnimation(string AnimClip, string startClip, string loopClip, bool looping, bool dimAudio, bool sync, LockType lockType, string customName, string dmcaStartClip, string dmcaLoopClip, bool DMCA, float audio) { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) if (customName == "") { customName = ((Object)Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim")).name; } AudioClip[] primaryAudioClips = (AudioClip[])(object)((!(startClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + startClip + ".ogg") } : null); AudioClip[] secondaryAudioClips = (AudioClip[])(object)((!(loopClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + loopClip + ".ogg") } : null); AudioClip[] primaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaStartClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/" + dmcaStartClip + "_NNTranscription.ogg") } : null); AudioClip[] secondaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaLoopClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/" + dmcaLoopClip + "_NNTranscription.ogg") } : null); CustomEmoteParams val = new CustomEmoteParams(); val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim") }; val.audioLoops = looping; val.primaryAudioClips = primaryAudioClips; val.secondaryAudioClips = secondaryAudioClips; val.syncAnim = sync; val.syncAudio = sync; val.lockType = lockType; val.internalName = customName; val.primaryDMCAFreeAudioClips = primaryDMCAFreeAudioClips; val.secondaryDMCAFreeAudioClips = secondaryDMCAFreeAudioClips; val.willGetClaimedByDMCA = DMCA; val.audioLevel = audio; val.displayName = customName; EmoteImporter.ImportEmote(val); } internal void AddAnimation(string AnimClip, string AnimClip2, string startClip, string loopClip, bool looping, bool dimAudio, bool sync, LockType lockType, string customName, string dmcaStartClip, string dmcaLoopClip, bool DMCA, float audio) { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) if (customName == "") { customName = ((Object)Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim")).name; } AudioClip[] primaryAudioClips = (AudioClip[])(object)((!(startClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + startClip + ".ogg") } : null); AudioClip[] secondaryAudioClips = (AudioClip[])(object)((!(loopClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + loopClip + ".ogg") } : null); AudioClip[] primaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaStartClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/" + dmcaStartClip + "_NNTranscription.ogg") } : null); AudioClip[] secondaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaLoopClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/" + dmcaLoopClip + "_NNTranscription.ogg") } : null); CustomEmoteParams val = new CustomEmoteParams(); val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim") }; val.secondaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip2 + ".anim") }; val.audioLoops = looping; val.primaryAudioClips = primaryAudioClips; val.secondaryAudioClips = secondaryAudioClips; val.syncAnim = sync; val.syncAudio = sync; val.lockType = lockType; val.internalName = customName; val.primaryDMCAFreeAudioClips = primaryDMCAFreeAudioClips; val.secondaryDMCAFreeAudioClips = secondaryDMCAFreeAudioClips; val.willGetClaimedByDMCA = DMCA; val.audioLevel = audio; val.displayName = customName; EmoteImporter.ImportEmote(val); } internal void AddAnimation(string AnimClip, string[] startClip, bool looping, bool dimaudio, bool sync, LockType lockType, string customName, string[] dmcaStartClips, bool DMCA, float audio) { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) if (customName == "") { customName = ((Object)Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim")).name; } List<AudioClip> list = new List<AudioClip>(); foreach (string text in startClip) { list.Add(Assets.Load<AudioClip>("assets/compressedaudio/" + text + ".ogg")); } List<AudioClip> list2 = new List<AudioClip>(); foreach (string text2 in dmcaStartClips) { if (text2 == "") { list2.Add(null); } else { list2.Add(Assets.Load<AudioClip>("assets/DMCAMusic/" + text2 + "_NNTranscription.ogg")); } } CustomEmoteParams val = new CustomEmoteParams(); val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim") }; val.audioLoops = looping; val.primaryAudioClips = list.ToArray(); val.secondaryAudioClips = null; val.syncAnim = sync; val.syncAudio = sync; val.lockType = lockType; val.internalName = customName; val.primaryDMCAFreeAudioClips = list2.ToArray(); val.willGetClaimedByDMCA = DMCA; val.audioLevel = audio; val.displayName = customName; EmoteImporter.ImportEmote(val); } internal void AddStartAndJoinAnim(string[] AnimClip, string startClip, bool looping, bool dimaudio, bool sync, LockType lockType, string customName, string dmcaStartClip, bool DMCA, float audio) { //IL_00e6: 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_00f7: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown if (customName == "") { customName = ((Object)Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip[0] + ".anim")).name; } AudioClip[] primaryAudioClips = (AudioClip[])(object)((!(startClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + startClip + ".ogg") } : null); AudioClip[] primaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaStartClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/" + dmcaStartClip + "_NNTranscription.ogg") } : null); List<AnimationClip> list = new List<AnimationClip>(); foreach (string text in AnimClip) { list.Add(Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + text + ".anim")); } EmoteImporter.ImportEmote(new CustomEmoteParams { primaryAnimationClips = list.ToArray(), audioLoops = looping, primaryAudioClips = primaryAudioClips, secondaryAudioClips = null, syncAnim = sync, syncAudio = sync, startPref = 0, joinPref = 1, lockType = lockType, internalName = customName, primaryDMCAFreeAudioClips = primaryDMCAFreeAudioClips, willGetClaimedByDMCA = DMCA, audioLevel = audio, displayName = customName }); } internal void AddStartAndJoinAnim(string[] AnimClip, string startClip, string[] AnimClip2, bool looping, bool dimaudio, bool sync, LockType lockType, string customName, string dmcaStartClip, bool DMCA, float audio) { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown if (customName == "") { customName = ((Object)Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip[0] + ".anim")).name; } AudioClip[] primaryAudioClips = (AudioClip[])(object)((!(startClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + startClip + ".ogg") } : null); AudioClip[] primaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaStartClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + dmcaStartClip + ".ogg") } : null); List<AnimationClip> list = new List<AnimationClip>(); foreach (string text in AnimClip) { list.Add(Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/DMCAMusic/" + text + "_NNTranscription.anim")); } List<AnimationClip> list2 = new List<AnimationClip>(); foreach (string text2 in AnimClip2) { list2.Add(Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/DMCAMusic/" + text2 + "_NNTranscription.anim")); } EmoteImporter.ImportEmote(new CustomEmoteParams { primaryAnimationClips = list.ToArray(), secondaryAnimationClips = list2.ToArray(), audioLoops = looping, primaryAudioClips = primaryAudioClips, syncAnim = sync, syncAudio = sync, startPref = 0, joinPref = 1, lockType = lockType, internalName = customName, primaryDMCAFreeAudioClips = primaryDMCAFreeAudioClips, willGetClaimedByDMCA = DMCA, audioLevel = audio, displayName = customName }); } } internal class HydrolicPressComponent : MonoBehaviour { private bool crushPlayer = false; private Transform pressTransform; internal BoneMapper boneMapper; private bool compressing = true; private Vector3 currentScale; private float doNotRevert; private bool spawnedFeathers = false; private void Start() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(CrushAfterSeconds(3.5f)); pressTransform = BadAssEmotesPlugin.pressMechanism.transform.Find("press"); BadAssEmotesPlugin.pressMechanism.transform.localScale = new Vector3(boneMapper.scale, boneMapper.scale, boneMapper.scale); } private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0294: 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_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) if (((Component)this).transform.localScale.y > 0.01f && compressing) { if (crushPlayer) { ((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x + 0.16f * Time.deltaTime, ((Component)this).transform.localScale.y - 0.16f * Time.deltaTime, ((Component)this).transform.localScale.z + 0.16f * Time.deltaTime); } pressTransform.localScale = new Vector3(pressTransform.localScale.x, pressTransform.localScale.y, pressTransform.localScale.z + 0.154f * Time.deltaTime); if (!spawnedFeathers && ((Component)this).transform.localScale.y < 0.107f) { int count = boneMapper.props.Count; GameObject val = Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/explosion press.prefab"); boneMapper.props.Add(Object.Instantiate<GameObject>(val)); boneMapper.props[count].transform.SetParent(((Component)boneMapper).transform); boneMapper.props[count].transform.localEulerAngles = new Vector3(270f, 0f, 0f); boneMapper.props[count].transform.localPosition = Vector3.zero; boneMapper.props[count].transform.SetParent((Transform)null); boneMapper.props[count].transform.localScale = new Vector3(boneMapper.scale, boneMapper.scale, boneMapper.scale); ((MonoBehaviour)BadAssEmotesPlugin.instance).StartCoroutine(BadAssEmotesPlugin.instance.WaitForSecondsThenDeleteGameObject(boneMapper.props[count], 10f)); boneMapper.props.RemoveAt(count); spawnedFeathers = true; } if (((Component)this).transform.localScale.y < 0.01f) { compressing = false; ((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x, 0.01f, ((Component)this).transform.localScale.z); currentScale = ((Component)this).transform.localScale; doNotRevert = 0f; ((Component)this).transform.parent = null; ((Component)this).transform.localScale = currentScale; pressTransform.localScale = new Vector3(0.8631962f, 0.8631962f, 0.8631962f); } } } private void OnDestroy() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)this).transform.parent == (Object)(object)pressTransform.parent) { pressTransform.localScale = new Vector3(0.8631962f, 0.8631962f, 0.8631962f); } } private IEnumerator CrushAfterSeconds(float time) { yield return (object)new WaitForSeconds(time); crushPlayer = true; } } internal class HydrolicPressMechanism : MonoBehaviour { public bool lowes = false; private static Texture lowesTex = Assets.Load<Texture>("assets/hydrolic/textures/lowes.jpg"); private static Texture homedepotTex = Assets.Load<Texture>("assets/hydrolic/textures/Home-Depot-Logo.jpg"); private void Start() { //IL_006d: 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) BadAssEmotesPlugin.pressMechanism = ((Component)this).gameObject; ((Renderer)((Component)this).GetComponentInChildren<MeshRenderer>()).sharedMaterials[0].mainTexture = (lowes ? lowesTex : homedepotTex); ((Renderer)((Component)this).GetComponentInChildren<MeshRenderer>()).sharedMaterials[4].color = (lowes ? new Color(3f / 85f, 0.20392157f, 31f / 85f) : new Color(0.75686276f, 0.30980393f, 0f)); } private void OnDestroy() { if ((Object)(object)BadAssEmotesPlugin.pressMechanism == (Object)(object)((Component)this).gameObject) { BadAssEmotesPlugin.pressMechanism = null; } } } public class LivingParticleArrayController : MonoBehaviour { public Transform[] affectors; private Vector4[] positions; private ParticleSystemRenderer psr; private void Start() { psr = ((Component)this).GetComponent<ParticleSystemRenderer>(); Vector4[] array = (Vector4[])(object)new Vector4[120]; ((Renderer)psr).material.SetVectorArray("_Affectors", array); } private void Update() { //IL_0063: 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_006d: 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_003f: 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) positions = (Vector4[])(object)new Vector4[affectors.Length]; for (int i = 0; i < positions.Length; i++) { if (Object.op_Implicit((Object)(object)affectors[i])) { positions[i] = Vector4.op_Implicit(affectors[i].position); } else { positions[i] = Vector4.op_Implicit(new Vector3(555f, 555f, 555f)); } } ((Renderer)psr).material.SetVectorArray("_Affectors", positions); ((Renderer)psr).material.SetInt("_AffectorCount", affectors.Length); } } public class LivingParticleController : MonoBehaviour { public Transform affector; private ParticleSystemRenderer psr; private void Start() { psr = ((Component)this).GetComponent<ParticleSystemRenderer>(); } private void Update() { //IL_0017: 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) ((Renderer)psr).material.SetVector("_Affector", Vector4.op_Implicit(affector.position)); } } public class ParticleGridGenerator : MonoBehaviour { public bool rewriteVertexStreams = true; public bool GPU = false; public float particleSize = 1f; public Color particleColor = Color.white; public Vector3 particleRotation3D; public bool randomColorAlpha = tru
plugins/BetterItemScan.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BetterItemScan")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterItemScan")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("04cd6816-7aba-4c14-a9a7-bf328df25692")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace BetterItemScan { [BepInPlugin("PopleZoo.BetterItemScan", "Better Item Scan", "2.1.0.0")] public class BetterItemScanModBase : BaseUnityPlugin { private const string modGUID = "PopleZoo.BetterItemScan"; private const string modName = "Better Item Scan"; private const string modVersion = "2.1.0.0"; private readonly Harmony harmony = new Harmony("PopleZoo.BetterItemScan"); public static BetterItemScanModBase Instance; public ManualLogSource mls; public static ConfigEntry<float> ItemScanRadius; public static ConfigEntry<float> AdjustScreenPositionXaxis; public static ConfigEntry<float> AdjustScreenPositionYaxis; public static ConfigEntry<float> ItemScaningUICooldown; public static ConfigEntry<float> FontSize; public static ConfigEntry<bool> ShowDebugMode; public static ConfigEntry<bool> ShowShipTotalOnShipOnly; public static ConfigEntry<bool> ShowTotalOnShipOnly; public static ConfigEntry<bool> CalculateForQuota; public static ConfigEntry<string> ItemTextColorHex; public static ConfigEntry<string> ItemTextCalculatorColorHex; public static ConfigEntry<bool> logAllScannedItems; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("PopleZoo.BetterItemScan"); mls.LogInfo((object)"Plugin BetterItemScan is loaded!"); LoadConfigs(); harmony.PatchAll(); } private void LoadConfigs() { ShowDebugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "ShowDebugMode", false, "Shows the change in width of the area to scan"); ShowShipTotalOnShipOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "ShowShipTotalOnShipOnly", false, "Whether or not to show the ship's total only in the ship"); ShowTotalOnShipOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "ShowTotalOnShipOnly", false, "Whether or not to show the total scanned in the ship only"); CalculateForQuota = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "CalculateForQuota", true, "Whether or not to calculate scanned items to see which meet the quota and if any do"); logAllScannedItems = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "logAllScannedItems", true, "outputs all scanned items and prices in the console"); ItemScanRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "ItemScanRadius", 20f, "The default width is 20"); FontSize = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "FontSize", 20f, "The default font size is 20, to make/see this change you may have to do this manually in the config file itself in the bepinex folder"); ItemTextColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "ItemTextColorHex", "#78FFAE", "The default text color for items that have been scanned, value must be a hexadecimal"); ItemTextCalculatorColorHex = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "ItemTextCalculatorColorHex", "#FF3333", "The default text color for items that meet the criteria, value must be a hexadecimal"); ItemScaningUICooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "ItemScaningUICooldown", 3f, "The default value is 5f, how long the ui stays on screen"); AdjustScreenPositionXaxis = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "AdjustScreenPositionXaxis", 0f, "The default value is 0, you will add or take away from its original position"); AdjustScreenPositionYaxis = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "AdjustScreenPositionYaxis", 0f, "The default value is 0, you will add or take away from its original position"); } } } namespace BetterItemScan.Patches { [HarmonyPatch] internal class HudManagerPatch_UI { private static GameObject _totalCounter; private static TextMeshProUGUI _textMesh; private static float _displayTimeLeft = BetterItemScanModBase.ItemScaningUICooldown.Value; private static float Totalsum = 0f; private static float Totalship = 0f; public static List<ScanNodeProperties> scannedNodeObjects = new List<ScanNodeProperties>(); public static Dictionary<string, (float, int)> meetQuotaItemNames = new Dictionary<string, (float, int)>(); public static Dictionary<string, (float, int)> NotmeetQuotaItemNames = new Dictionary<string, (float, int)>(); public static Dictionary<ScanNodeProperties, int> ItemsDictionary = new Dictionary<ScanNodeProperties, int>(); private static List<ScanNodeProperties> items; public static int MeetQuota(List<int> items, int quota) { items = items.Where((int item) => item >= quota).ToList(); if (!items.Any()) { return -1; } return items.Aggregate((int a, int b) => (Math.Abs(quota - a) < Math.Abs(quota - b)) ? a : b); } public static List<List<int>> FindCombinations(List<int> items, int quota) { List<List<int>> list = new List<List<int>>(); int count = items.Count; int num = int.MaxValue; for (int i = 0; i < 1 << count; i++) { List<int> list2 = new List<int>(); for (int j = 0; j < count; j++) { if ((i & (1 << j)) > 0) { list2.Add(items[j]); } } int num2 = list2.Sum(); int num3 = Math.Abs(quota - num2); if (num3 < num) { num = num3; list.Clear(); list.Add(list2); } else if (num3 == num) { list.Add(list2); } } list.Sort((List<int> a, List<int> b) => a.Count.CompareTo(b.Count)); return list; } private static bool IsHexColor(string value) { string pattern = "^#(?:[0-9a-fA-F]{3}){1,2}$"; return Regex.IsMatch(value, pattern); } [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] private static void OnScan(HUDManager __instance, CallbackContext context) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown Debug.Log((object)"Scan initiated!"); ItemsDictionary.Clear(); FieldInfo field = typeof(HUDManager).GetField("playerPingingScan", BindingFlags.Instance | BindingFlags.NonPublic); float num = (float)field.GetValue(__instance); MethodInfo method = typeof(HUDManager).GetMethod("CanPlayerScan", BindingFlags.Instance | BindingFlags.NonPublic); if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || !((CallbackContext)(ref context)).performed || !(bool)method.Invoke(__instance, null) || (double)num > -1.0) { return; } if (!Object.op_Implicit((Object)(object)_totalCounter)) { CopyValueCounter(); } if (!Object.op_Implicit((Object)(object)_textMesh)) { _textMesh = new TextMeshProUGUI(); } if (!Object.op_Implicit((Object)(object)_totalCounter) || !Object.op_Implicit((Object)(object)_textMesh)) { BetterItemScanModBase.Instance.mls.LogError((object)"Failed to find or instantiate UI objects!"); return; } meetQuotaItemNames.Clear(); NotmeetQuotaItemNames.Clear(); items = CalculateLootItems(); foreach (ScanNodeProperties item in items) { ItemsDictionary.Add(item, item.scrapValue); } int num2 = TimeOfDay.Instance.profitQuota - TimeOfDay.Instance.quotaFulfilled; List<int> list = ItemsDictionary.Values.ToList(); list.Sort(); list.Reverse(); int bestIndividualItem = MeetQuota(list, num2); List<List<int>> source = FindCombinations(list, num2); if (source.Any()) { int num3 = source.First().Sum(); if (Math.Abs(num2 - bestIndividualItem) <= Math.Abs(num2 - num3)) { if (bestIndividualItem != -1) { ScanNodeProperties key = ItemsDictionary.FirstOrDefault((KeyValuePair<ScanNodeProperties, int> x) => x.Value == bestIndividualItem).Key; if ((Object)(object)key != (Object)null) { if (!meetQuotaItemNames.ContainsKey(key.headerText)) { meetQuotaItemNames.Add(key.headerText, (key.scrapValue, 1)); } else { (float, int) tuple = meetQuotaItemNames[key.headerText]; meetQuotaItemNames[key.headerText] = (tuple.Item1 + (float)key.scrapValue, tuple.Item2 + 1); items.Remove(key); } } } } else { foreach (int combination in source.First()) { ScanNodeProperties key2 = ItemsDictionary.FirstOrDefault((KeyValuePair<ScanNodeProperties, int> x) => x.Value == combination).Key; if ((Object)(object)key2 != (Object)null) { if (!meetQuotaItemNames.ContainsKey(key2.headerText)) { meetQuotaItemNames.Add(key2.headerText, (key2.scrapValue, 1)); continue; } (float, int) tuple2 = meetQuotaItemNames[key2.headerText]; meetQuotaItemNames[key2.headerText] = (tuple2.Item1 + (float)key2.scrapValue, tuple2.Item2 + 1); items.Remove(key2); } } } } foreach (KeyValuePair<ScanNodeProperties, int> item2 in ItemsDictionary) { if (!NotmeetQuotaItemNames.ContainsKey(item2.Key.headerText)) { NotmeetQuotaItemNames.Add(item2.Key.headerText, (item2.Key.scrapValue, 1)); continue; } (float, int) tuple3 = NotmeetQuotaItemNames[item2.Key.headerText]; NotmeetQuotaItemNames[item2.Key.headerText] = (tuple3.Item1 + (float)item2.Key.scrapValue, tuple3.Item2 + 1); items.Remove(item2.Key); } ItemsDictionary.Clear(); string text = ""; string text2 = ""; foreach (ScanNodeProperties item3 in items) { if (meetQuotaItemNames.ContainsKey(item3.headerText)) { if (meetQuotaItemNames.TryGetValue(item3.headerText, out var value)) { text2 = $"{value.Item2}-{item3.headerText}: ${value.Item1}"; } if (BetterItemScanModBase.CalculateForQuota.Value) { if (IsHexColor(BetterItemScanModBase.ItemTextCalculatorColorHex.Value)) { text2 = "<color=" + BetterItemScanModBase.ItemTextCalculatorColorHex.Value + ">* " + text2 + "</color>"; } else { Debug.LogError((object)(BetterItemScanModBase.ItemTextCalculatorColorHex.Value + " is an invalid colour. Please remember the '#'")); text2 = "<color=#FF3333>* " + text2 + "</color>"; } } else if (IsHexColor(BetterItemScanModBase.ItemTextColorHex.Value)) { text2 = "<color=" + BetterItemScanModBase.ItemTextColorHex.Value + ">" + text2 + "</color>"; } else { Debug.LogError((object)(BetterItemScanModBase.ItemTextColorHex.Value + " is an invalid colour. Please remember the '#'")); text2 = "<color=#FF3333>* " + text2 + "</color>"; } } else if (NotmeetQuotaItemNames.ContainsKey(item3.headerText)) { if (NotmeetQuotaItemNames.TryGetValue(item3.headerText, out var value2)) { text2 = $"{value2.Item2}-{item3.headerText}: ${value2.Item1}"; } if (IsHexColor(BetterItemScanModBase.ItemTextColorHex.Value)) { text2 = "<color=" + BetterItemScanModBase.ItemTextColorHex.Value + ">" + text2 + "</color>"; } else { Debug.LogError((object)(BetterItemScanModBase.ItemTextColorHex.Value + " is an invalid colour. Please remember the '#'")); text2 = "<color=#FF3333>* " + text2 + "</color>"; } } text = text + text2 + "\n"; } ((TMP_Text)_textMesh).text = text; if (BetterItemScanModBase.ShowShipTotalOnShipOnly.Value) { if (!GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { TextMeshProUGUI textMesh = _textMesh; ((TMP_Text)textMesh).text = ((TMP_Text)textMesh).text + "\nTotal Scanned: " + Totalsum; } else { TextMeshProUGUI textMesh2 = _textMesh; ((TMP_Text)textMesh2).text = ((TMP_Text)textMesh2).text + "\nTotal Scanned: " + Totalsum + "\nShip Total: " + Totalship; } } else { TextMeshProUGUI textMesh2 = _textMesh; ((TMP_Text)textMesh2).text = ((TMP_Text)textMesh2).text + "\nTotal Scanned: " + Totalsum + "\nShip Total: " + Totalship; } if (BetterItemScanModBase.ShowTotalOnShipOnly.Value) { if (!GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { ((Component)_textMesh).gameObject.SetActive(false); ((Component)((TMP_Text)__instance.totalValueText).transform.parent).gameObject.SetActive(true); } else { ((Component)_textMesh).gameObject.SetActive(true); ((Component)((TMP_Text)__instance.totalValueText).transform.parent).gameObject.SetActive(false); } } if (BetterItemScanModBase.logAllScannedItems.Value) { Debug.Log((object)("BetterItemScan - log of all items scanned\n" + ((TMP_Text)_textMesh).text)); } _displayTimeLeft = BetterItemScanModBase.ItemScaningUICooldown.Value; if (!_totalCounter.activeSelf) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(ValueCoroutine()); } } private static List<ScanNodeProperties> CalculateLootItems() { List<GrabbableObject> source = GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>().Where(delegate(GrabbableObject obj) { if (((Object)obj).name == "ClipboardManual" || ((Object)obj).name == "StickyNoteItem") { return false; } if (((Object)obj).name == "GiftBoxItem") { GiftBoxItem component = ((Component)obj).GetComponent<GiftBoxItem>(); if ((Object)(object)component != (Object)null) { FieldInfo field = typeof(GiftBoxItem).GetField("hasUsedGift", BindingFlags.Instance | BindingFlags.NonPublic); bool flag = (bool)field.GetValue(component); return !flag; } } return true; }) .ToList(); List<ScanNodeProperties> list = scannedNodeObjects.Where((ScanNodeProperties obj) => obj.headerText != "ClipboardManual" && obj.headerText != "StickyNoteItem" && obj.scrapValue != 0).ToList(); Totalsum = list.Sum((ScanNodeProperties scrap) => scrap.scrapValue); Totalship = source.Sum((GrabbableObject scrap) => scrap.scrapValue); return list; } private static IEnumerator ValueCoroutine() { _totalCounter.SetActive(true); while ((double)_displayTimeLeft > 0.0) { float displayTimeLeft = _displayTimeLeft; _displayTimeLeft = 0f; Debug.Log((object)$"Waiting for {displayTimeLeft} seconds..."); yield return (object)new WaitForSeconds(displayTimeLeft); } _totalCounter.SetActive(false); Debug.Log((object)"Cooldown complete. Hiding UI."); } private static void CopyValueCounter() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/ValueCounter"); if (!Object.op_Implicit((Object)(object)val)) { BetterItemScanModBase.Instance.mls.LogError((object)"Failed to find ValueCounter object to copy!"); } _totalCounter = Object.Instantiate<GameObject>(val.gameObject, val.transform.parent, false); Vector3 localPosition = _totalCounter.transform.localPosition; float num = Mathf.Clamp(localPosition.x + BetterItemScanModBase.AdjustScreenPositionXaxis.Value + 50f, -6000f, (float)Screen.width); float num2 = Mathf.Clamp(localPosition.y + BetterItemScanModBase.AdjustScreenPositionYaxis.Value - 80f, -6000f, (float)Screen.height); _totalCounter.transform.localPosition = new Vector3(num, num2, localPosition.z); _textMesh = _totalCounter.GetComponentInChildren<TextMeshProUGUI>(); ((TMP_Text)_textMesh).fontSizeMin = 5f; ((TMP_Text)_textMesh).fontSize = BetterItemScanModBase.FontSize.Value; ((TMP_Text)_textMesh).ForceMeshUpdate(false, false); ((TMP_Text)_textMesh).alignment = (TextAlignmentOptions)1025; RectTransform rectTransform = ((TMP_Text)_textMesh).rectTransform; rectTransform.anchorMin = new Vector2(0.5f, 2f); rectTransform.anchorMax = new Vector2(0.5f, 2f); rectTransform.pivot = new Vector2(0.5f, 0f); Vector3 localPosition2 = ((Transform)rectTransform).localPosition; ((Transform)rectTransform).localPosition = new Vector3(localPosition2.x, localPosition2.y - 140f, localPosition2.z); } } [HarmonyPatch] public class PlayerControllerBPatch_A { private static LineRenderer lineRenderer; private static GameObject lineObject; private static float maxDistance = 80f; [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "AssignNewNodes")] private static bool AssignNewNodes_patch(HUDManager __instance, PlayerControllerB playerScript) { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_01dc: 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_01f3: 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) HudManagerPatch_UI.scannedNodeObjects.Clear(); if ((Object)(object)lineRenderer == (Object)null) { lineObject = new GameObject("LineObject"); lineRenderer = lineObject.AddComponent<LineRenderer>(); lineRenderer.positionCount = 2; lineObject.SetActive(false); } FieldInfo field = typeof(HUDManager).GetField("nodesOnScreen", BindingFlags.Instance | BindingFlags.NonPublic); List<ScanNodeProperties> list = field.GetValue(__instance) as List<ScanNodeProperties>; FieldInfo field2 = typeof(HUDManager).GetField("scannedScrapNum", BindingFlags.Instance | BindingFlags.NonPublic); object value = field2.GetValue(__instance); FieldInfo field3 = typeof(HUDManager).GetField("scanNodesHit", BindingFlags.Instance | BindingFlags.NonPublic); RaycastHit[] array = field3.GetValue(__instance) as RaycastHit[]; MethodInfo method = typeof(HUDManager).GetMethod("AttemptScanNode", BindingFlags.Instance | BindingFlags.NonPublic); int num = Physics.SphereCastNonAlloc(new Ray(((Component)playerScript.gameplayCamera).transform.position + ((Component)playerScript.gameplayCamera).transform.forward * 20f, ((Component)playerScript.gameplayCamera).transform.forward), BetterItemScanModBase.ItemScanRadius.Value, array, maxDistance, LayerMask.GetMask(new string[1] { "ScanNode" })); Vector3 val = new Vector3(((Component)playerScript.gameplayCamera).transform.position.x, ((Component)playerScript.gameplayCamera).transform.position.y - 2f, ((Component)playerScript.gameplayCamera).transform.position.z) + ((Component)playerScript.gameplayCamera).transform.forward; Vector3 forward = ((Component)playerScript.gameplayCamera).transform.forward; if (BetterItemScanModBase.ShowDebugMode.Value) { lineObject.SetActive(true); lineRenderer.SetPosition(0, val); lineRenderer.SetPosition(1, val + forward * maxDistance); LineRenderer obj = lineRenderer; float startWidth = (lineRenderer.endWidth = BetterItemScanModBase.ItemScanRadius.Value); obj.startWidth = startWidth; } if (num > __instance.scanElements.Length) { num = __instance.scanElements.Length; } list.Clear(); value = 0; if (num > __instance.scanElements.Length) { for (int i = 0; i < num; i++) { ScanNodeProperties component = ((Component)((RaycastHit)(ref array[i])).transform).gameObject.GetComponent<ScanNodeProperties>(); GrabbableObject component2 = ((Component)((RaycastHit)(ref array[i])).transform.parent).gameObject.GetComponent<GrabbableObject>(); if (component2.itemProperties.isScrap) { HudManagerPatch_UI.scannedNodeObjects.Add(component); } if (component.nodeType == 1 || component.nodeType == 2) { object[] parameters = new object[3] { component, i, playerScript }; method.Invoke(__instance, parameters); } } } if (list.Count < __instance.scanElements.Length) { for (int j = 0; j < num; j++) { ScanNodeProperties component3 = ((Component)((RaycastHit)(ref array[j])).transform).gameObject.GetComponent<ScanNodeProperties>(); object[] parameters2 = new object[3] { component3, j, playerScript }; method.Invoke(__instance, parameters2); } } return false; } } [HarmonyPatch] public class PlayerControllerBPatch_B { [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "AttemptScanNode")] private static bool AttemptScanNode_patch(HUDManager __instance, ScanNodeProperties node, int i, PlayerControllerB playerScript) { MethodInfo method = typeof(HUDManager).GetMethod("MeetsScanNodeRequirements", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method2 = typeof(HUDManager).GetMethod("AssignNodeToUIElement", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field = typeof(HUDManager).GetField("nodesOnScreen", BindingFlags.Instance | BindingFlags.NonPublic); List<ScanNodeProperties> list = field.GetValue(__instance) as List<ScanNodeProperties>; FieldInfo field2 = typeof(HUDManager).GetField("scannedScrapNum", BindingFlags.Instance | BindingFlags.NonPublic); int num = (int)field2.GetValue(__instance); FieldInfo field3 = typeof(HUDManager).GetField("playerPingingScan", BindingFlags.Instance | BindingFlags.NonPublic); float num2 = (float)field3.GetValue(__instance); object[] parameters = new object[2] { node, playerScript }; object[] parameters2 = new object[1] { node }; if (!(bool)method.Invoke(__instance, parameters)) { return false; } if (node.nodeType == 2) { num++; } if (!list.Contains(node)) { list.Add(node); } if (node.creatureScanID == -1) { HudManagerPatch_UI.scannedNodeObjects.Add(node); } if ((double)num2 < 0.0) { return false; } method2.Invoke(__instance, parameters2); return false; } } [HarmonyPatch] public class PlayerControllerBPatch_C { [HarmonyPostfix] [HarmonyPatch(typeof(HUDManager), "Update")] private static void Update_patch(HUDManager __instance) { FieldInfo field = typeof(HUDManager).GetField("addingToDisplayTotal", BindingFlags.Instance | BindingFlags.NonPublic); object value = field.GetValue(__instance); ((Component)((TMP_Text)__instance.totalValueText).transform.parent).gameObject.SetActive(false); value = false; } } }
plugins/BetterShotgunShells.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BuyableShells")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BuyableShells")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f1098099-7d96-4f78-bd10-8cf743e1f445")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace BuyableShells; [BepInPlugin("SalakStudios.BetterShotgunShells", "BetterShotgunShells", "1.0.2")] public class Plugin : BaseUnityPlugin { private const string modGUID = "SalakStudios.BetterShotgunShells"; private const string modName = "BetterShotgunShells"; private const string modVersion = "1.0.2"; private readonly Harmony harmony = new Harmony("SalakStudios.BetterShotgunShells"); internal static Plugin Instance; public static ManualLogSource mls; public bool added; public static ConfigEntry<int> ShellPrice; public static ConfigEntry<int> ItemRarityRend; public static ConfigEntry<int> ItemRarityDine; public static ConfigEntry<int> ItemRarityTitan; public List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Concat(Object.FindObjectsByType<Item>((FindObjectsInactive)1, (FindObjectsSortMode)1)).ToList(); public Item ShotgunShell => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name == "GunAmmo")); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(typeof(Plugin)); mls = Logger.CreateLogSource("SalakStudios.BetterShotgunShells"); mls.LogInfo((object)"BetterShotgunShells Enabled"); SceneManager.sceneLoaded += OnSceneLoaded; ShellPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Price", 80, "How many credits the shotgun shell costs"); ItemRarityRend = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Rend", 2, "How rare the shell is to find on Rend (Lower = Rarer, Higher = More Common)"); ItemRarityDine = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Dine", 3, "How rare the shell is to find on Dine (Lower = Rarer, Higher = More Common)"); ItemRarityTitan = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Rarity Titan", 5, "How rare the shell is to find on Titan (Lower = Rarer, Higher = More Common)"); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (!added && ((Scene)(ref scene)).name == "MainMenu") { added = true; ShotgunShell.itemName = "Shells"; ShotgunShell.creditsWorth = 0; Items.RegisterShopItem(ShotgunShell, ShellPrice.Value); Items.RegisterScrap(ShotgunShell, ItemRarityRend.Value, (LevelTypes)128); Items.RegisterScrap(ShotgunShell, ItemRarityDine.Value, (LevelTypes)256); Items.RegisterScrap(ShotgunShell, ItemRarityTitan.Value, (LevelTypes)512); } } }
plugins/BuyableShotgun.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("BuyableShotgun")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2023 MegaPiggy")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f4271793e57a966e00668122ac278845cc79146b")] [assembly: AssemblyProduct("BuyableShotgun")] [assembly: AssemblyTitle("BuyableShotgun")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BuyableShotgun { [BepInDependency("evaisa.lethallib", "0.13.2")] [BepInPlugin("MegaPiggy.BuyableShotgun", "Buyable Shotgun", "1.0.4")] public class BuyableShotgun : BaseUnityPlugin { private const string modGUID = "MegaPiggy.BuyableShotgun"; private const string modName = "Buyable Shotgun"; private const string modVersion = "1.0.4"; private readonly Harmony harmony = new Harmony("MegaPiggy.BuyableShotgun"); private static BuyableShotgun Instance; private ConfigEntry<int> ShotgunPriceConfig; private static Dictionary<string, TerminalNode> infoNodes = new Dictionary<string, TerminalNode>(); private static ManualLogSource LoggerInstance => ((BaseUnityPlugin)Instance).Logger; public List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Concat(Object.FindObjectsByType<Item>((FindObjectsInactive)1, (FindObjectsSortMode)1)).ToList(); public Item Shotgun => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name.Equals("Shotgun"))); public Item ShotgunClone { get; private set; } public int ShotgunPrice => ShotgunPriceConfig.Value; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); ShotgunPriceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "ShotgunPrice", 700, "Credits needed to buy shotgun"); SceneManager.sceneLoaded += OnSceneLoaded; ShotgunClone = MakeNonScrap(ShotgunPrice); AddToShop(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Buyable Shotgun is loaded with version 1.0.4!"); } private Item MakeNonScrap(int price) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) Item val = ScriptableObject.CreateInstance<Item>(); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).name = "Error"; val.itemName = "Error"; val.itemId = 6624; val.isScrap = false; val.creditsWorth = price; val.canBeGrabbedBeforeGameStart = true; val.automaticallySetUsingPower = false; val.batteryUsage = 300f; val.canBeInspected = false; val.isDefensiveWeapon = true; val.saveItemVariable = true; val.syncGrabFunction = false; val.twoHandedAnimation = true; val.verticalOffset = 0.25f; GameObject val2 = NetworkPrefabs.CreateNetworkPrefab("Cube"); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)3); val3.transform.SetParent(val2.transform, false); ((Renderer)val3.GetComponent<MeshRenderer>()).sharedMaterial.shader = Shader.Find("HDRP/Lit"); val2.AddComponent<BoxCollider>().size = Vector3.one * 2f; val2.AddComponent<AudioSource>(); PhysicsProp val4 = val2.AddComponent<PhysicsProp>(); ((GrabbableObject)val4).itemProperties = val; ((GrabbableObject)val4).grabbable = true; val.spawnPrefab = val2; val2.tag = "PhysicsProp"; val2.layer = LayerMask.NameToLayer("Props"); val3.layer = LayerMask.NameToLayer("Props"); try { GameObject val5 = Object.Instantiate<GameObject>(Items.scanNodePrefab, val2.transform); ((Object)val5).name = "ScanNode"; val5.transform.localPosition = new Vector3(0f, 0f, 0f); Transform transform = val5.transform; transform.localScale *= 2f; ScanNodeProperties component = val5.GetComponent<ScanNodeProperties>(); component.nodeType = 1; component.headerText = "Error"; component.subText = "A mod is incompatible with Buyable Shotgun"; } catch (Exception ex) { LoggerInstance.LogError((object)ex.ToString()); } val2.transform.localScale = Vector3.one / 2f; return val; } private void CloneNonScrap(Item original, Item clone, int price) { Object.DontDestroyOnLoad((Object)(object)original.spawnPrefab); CopyFields(original, clone); ((Object)clone).name = "Buyable" + ((Object)original).name; clone.creditsWorth = price; } public static void CopyFields(Item source, Item destination) { FieldInfo[] fields = typeof(Item).GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(destination, fieldInfo.GetValue(source)); } } private TerminalNode CreateInfoNode(string name, string description) { if (infoNodes.ContainsKey(name)) { return infoNodes[name]; } TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); Object.DontDestroyOnLoad((Object)(object)val); val.clearPreviousText = true; ((Object)val).name = name + "InfoNode"; val.displayText = description + "\n\n"; infoNodes.Add(name, val); return val; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { LoggerInstance.LogInfo((object)("Scene \"" + ((Scene)(ref scene)).name + "\" loaded with " + ((object)(LoadSceneMode)(ref mode)).ToString() + " mode.")); if (!((Object)(object)Shotgun == (Object)null)) { CloneNonScrap(Shotgun, ShotgunClone, ShotgunPrice); } } private void AddToShop() { Item shotgunClone = ShotgunClone; int shotgunPrice = ShotgunPrice; Items.RegisterShopItem(shotgunClone, (TerminalNode)null, (TerminalNode)null, CreateInfoNode("Shotgun", "Nutcracker's shotgun. Can hold 2 shells. Recommended to keep safety on while not using or it might shoot randomly."), shotgunPrice); LoggerInstance.LogInfo((object)$"Shotgun added to Shop for {ShotgunPrice} credits"); } } }
plugins/HelmetCamera.dll
Decompiled 10 months agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("HelmetCamera")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HelmetCamera")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b99c4d46-5f13-47b3-a5af-5e3f37772e77")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace HelmetCamera { [BepInPlugin("RickArg.lethalcompany.helmetcameras", "Helmet_Cameras", "2.1.5")] public class PluginInit : BaseUnityPlugin { public static Harmony _harmony; public static ConfigEntry<int> config_isHighQuality; public static ConfigEntry<int> config_renderDistance; public static ConfigEntry<int> config_cameraFps; private void Awake() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown config_isHighQuality = ((BaseUnityPlugin)this).Config.Bind<int>("MONITOR QUALITY", "monitorResolution", 0, "Low FPS affection. High Quality mode. 0 - vanilla (48x48), 1 - vanilla+ (128x128), 2 - mid quality (256x256), 3 - high quality (512x512), 4 - Very High Quality (1024x1024)"); config_renderDistance = ((BaseUnityPlugin)this).Config.Bind<int>("MONITOR QUALITY", "renderDistance", 20, "Low FPS affection. Render distance for helmet camera."); config_cameraFps = ((BaseUnityPlugin)this).Config.Bind<int>("MONITOR QUALITY", "cameraFps", 30, "Very high FPS affection. FPS for helmet camera. To increase YOUR fps, you should low cameraFps value."); _harmony = new Harmony("HelmetCamera"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Helmet_Cameras is loaded with version 2.1.5!"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"--------Helmet camera patch done.---------"); } } public static class PluginInfo { public const string PLUGIN_GUID = "RickArg.lethalcompany.helmetcameras"; public const string PLUGIN_NAME = "Helmet_Cameras"; public const string PLUGIN_VERSION = "2.1.5"; } public class Plugin : MonoBehaviour { private RenderTexture renderTexture; private bool isMonitorChanged = false; private GameObject helmetCameraNew; private bool isSceneLoaded = false; private bool isCoroutineStarted = false; private int currentTransformIndex; private int resolution = 0; private int renderDistance = 50; private float cameraFps = 30f; private float elapsed; private void Awake() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown resolution = PluginInit.config_isHighQuality.Value; renderDistance = PluginInit.config_renderDistance.Value; cameraFps = PluginInit.config_cameraFps.Value; switch (resolution) { case 0: renderTexture = new RenderTexture(48, 48, 24); break; case 1: renderTexture = new RenderTexture(128, 128, 24); break; case 2: renderTexture = new RenderTexture(256, 256, 24); break; case 3: renderTexture = new RenderTexture(512, 512, 24); break; case 4: renderTexture = new RenderTexture(1024, 1024, 24); break; } } public void Start() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) isCoroutineStarted = false; while ((Object)(object)helmetCameraNew == (Object)null) { helmetCameraNew = new GameObject("HelmetCamera"); } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "MainMenu") { activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "InitScene") { activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "InitSceneLaunchOptions") { isSceneLoaded = true; Debug.Log((object)"[HELMET_CAMERAS] Starting coroutine..."); ((MonoBehaviour)this).StartCoroutine(LoadSceneEnter()); return; } } } isSceneLoaded = false; isMonitorChanged = false; } private IEnumerator LoadSceneEnter() { Debug.Log((object)"[HELMET_CAMERAS] 5 seconds for init mode... Please wait..."); yield return (object)new WaitForSeconds(5f); isCoroutineStarted = true; if ((Object)(object)GameObject.Find("Environment/HangarShip/Cameras/ShipCamera") != (Object)null) { Debug.Log((object)"[HELMET_CAMERAS] Ship camera founded..."); if (!isMonitorChanged) { ((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube").GetComponent<MeshRenderer>()).materials[2].mainTexture = ((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001").GetComponent<MeshRenderer>()).materials[2].mainTexture; ((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001").GetComponent<MeshRenderer>()).materials[2].mainTexture = (Texture)(object)renderTexture; helmetCameraNew.AddComponent<Camera>(); ((Behaviour)helmetCameraNew.GetComponent<Camera>()).enabled = false; helmetCameraNew.GetComponent<Camera>().targetTexture = renderTexture; helmetCameraNew.GetComponent<Camera>().cullingMask = 20649983; helmetCameraNew.GetComponent<Camera>().farClipPlane = renderDistance; helmetCameraNew.GetComponent<Camera>().nearClipPlane = 0.55f; isMonitorChanged = true; Debug.Log((object)"[HELMET_CAMERAS] Monitors were changed..."); Debug.Log((object)"[HELMET_CAMERAS] Turning off vanilla internal ship camera"); ((Behaviour)GameObject.Find("Environment/HangarShip/Cameras/ShipCamera").GetComponent<Camera>()).enabled = false; } } } public void Update() { //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) bool flag = isSceneLoaded && isCoroutineStarted; if (flag && StartOfRound.Instance.localPlayerController.isInHangarShipRoom) { helmetCameraNew.SetActive(true); elapsed += Time.deltaTime; if (elapsed > 1f / cameraFps) { elapsed = 0f; ((Behaviour)helmetCameraNew.GetComponent<Camera>()).enabled = true; } else { ((Behaviour)helmetCameraNew.GetComponent<Camera>()).enabled = false; } GameObject val = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001/CameraMonitorScript"); currentTransformIndex = val.GetComponent<ManualCameraRenderer>().targetTransformIndex; TransformAndName val2 = val.GetComponent<ManualCameraRenderer>().radarTargets[currentTransformIndex]; if (!val2.isNonPlayer) { try { helmetCameraNew.transform.SetPositionAndRotation(val2.transform.Find("ScavengerModel/metarig/CameraContainer/MainCamera/HelmetLights").position + new Vector3(0f, 0f, 0f), val2.transform.Find("ScavengerModel/metarig/CameraContainer/MainCamera/HelmetLights").rotation * Quaternion.Euler(0f, 0f, 0f)); DeadBodyInfo[] array = Object.FindObjectsOfType<DeadBodyInfo>(); for (int i = 0; i < array.Length; i++) { if (array[i].playerScript.playerUsername == val2.name) { helmetCameraNew.transform.SetPositionAndRotation(((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003").position, ((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003").rotation * Quaternion.Euler(0f, 0f, 0f)); } } return; } catch (NullReferenceException) { Debug.Log((object)"[HELMET_CAMERAS] ERROR NULL REFERENCE"); return; } } helmetCameraNew.transform.SetPositionAndRotation(val2.transform.position + new Vector3(0f, 1.6f, 0f), val2.transform.rotation * Quaternion.Euler(0f, -90f, 0f)); } else if (flag && !StartOfRound.Instance.localPlayerController.isInHangarShipRoom) { helmetCameraNew.SetActive(false); } } } } namespace HelmetCamera.Patches { [HarmonyPatch] internal class HelmetCamera { public static void InitCameras() { GameObject val = GameObject.Find("Environment/HangarShip/Cameras/ShipCamera"); val.AddComponent<Plugin>(); } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] public static void InitCamera(ref ManualCameraRenderer __instance) { InitCameras(); } } }
plugins/HornMoan.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("HornMoan")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HornMoan")] [assembly: AssemblyTitle("HornMoan")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace HornMoan { [BepInPlugin("MetalPipeSFX.HornMoan", "HornMoan", "2.1.0")] public class HornMoanBase : BaseUnityPlugin { private const string modGUID = "MetalPipeSFX.HornMoan"; private const string modName = "HornMoan"; private const string modVersion = "2.1.0"; private static HornMoanBase Instance; private readonly Harmony harmony = new Harmony("MetalPipeSFX.HornMoan"); internal ManualLogSource mls = null; public void Awake() { mls = Logger.CreateLogSource("MetalPipeSFX.HornMoan"); mls.LogInfo((object)"The Moaning is Loading"); if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); mls.LogInfo((object)"Loaded The Moaning Successfully"); } } [HarmonyPatch(typeof(GrabbableObject))] internal class PipePatch { private static List<string> audios = new List<string> { "Moaning1.mp3", "MoaningFar.mp3" }; private static List<AudioClip> clips = new List<AudioClip>(); private static string uPath = Path.Combine(Paths.PluginPath + "\\MetalPipeSFX-HornMoan\\"); [HarmonyPatch("Start")] [HarmonyPostfix] private static void AudioPatch(GrabbableObject __instance) { ManualLogSource val = Logger.CreateLogSource("MetalPipeSFX.HornMoan"); for (int i = 0; i < audios.Count; i++) { LoadAudioClip(uPath + audios[i]); } if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).GetComponent<NoisemakerProp>() != (Object)null && ((Object)__instance.itemProperties).name == "Airhorn") { val.LogMessage((object)"We found an Airhorn!!"); ((Component)__instance).GetComponent<NoisemakerProp>().noiseSFX[0] = clips[0]; ((Component)__instance).GetComponent<NoisemakerProp>().noiseSFXFar[0] = clips[1]; val.LogMessage((object)((Object)((Component)__instance).GetComponent<NoisemakerProp>().noiseSFX[0]).name); val.LogMessage((object)((Object)((Component)__instance).GetComponent<NoisemakerProp>().noiseSFXFar[0]).name); } } private static void LoadAudioClip(string filepath) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 ManualLogSource val = Logger.CreateLogSource("MetalPipeSFX.HornMoan"); UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(filepath, (AudioType)13); audioClip.SendWebRequest(); while (!audioClip.isDone) { } if (audioClip.error != null) { val.LogError((object)("Error loading sounds: " + filepath + "\n" + audioClip.error)); } AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip); if (Object.op_Implicit((Object)(object)content) && (int)content.loadState == 2) { val.LogInfo((object)("Loaded " + filepath)); ((Object)content).name = Path.GetFileName(filepath); clips.Add(content); } } } }
plugins/LC_API.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LC_API.BundleAPI; using LC_API.ClientAPI; using LC_API.Comp; using LC_API.Data; using LC_API.Exceptions; using LC_API.Extensions; using LC_API.GameInterfaceAPI; using LC_API.GameInterfaceAPI.Events; using LC_API.GameInterfaceAPI.Events.Cache; using LC_API.GameInterfaceAPI.Events.EventArgs.Player; using LC_API.GameInterfaceAPI.Events.Handlers; using LC_API.GameInterfaceAPI.Features; using LC_API.ManualPatches; using LC_API.Networking; using LC_API.ServerAPI; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Steamworks; using Steamworks.Data; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("2018")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Utilities for plugin devs")] [assembly: AssemblyFileVersion("3.4.5.0")] [assembly: AssemblyInformationalVersion("3.4.5+ae2de74676f4f0d6440c82067f4c1a22389fe27b")] [assembly: AssemblyProduct("Lethal Company API")] [assembly: AssemblyTitle("LC_API")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LC_API { internal static class CheatDatabase { private const string SIG_REQ_GUID = "LC_API_ReqGUID"; private const string SIG_SEND_MODS = "LC_APISendMods"; private static Dictionary<string, PluginInfo> PluginsLoaded = new Dictionary<string, PluginInfo>(); public static void RunLocalCheatDetector() { PluginsLoaded = Chainloader.PluginInfos; using Dictionary<string, PluginInfo>.ValueCollection.Enumerator enumerator = PluginsLoaded.Values.GetEnumerator(); while (enumerator.MoveNext()) { switch (enumerator.Current.Metadata.GUID) { case "mikes.lethalcompany.mikestweaks": case "mom.llama.enhancer": case "Posiedon.GameMaster": case "LethalCompanyScalingMaster": case "verity.amberalert": ModdedServer.SetServerModdedOnly(); break; } } } public static void OtherPlayerCheatDetector() { Plugin.Log.LogWarning((object)"Asking all other players for their mod list.."); LC_API.GameInterfaceAPI.Features.Player.LocalPlayer.QueueTip("Mod List:", "Asking all other players for installed mods.."); LC_API.GameInterfaceAPI.Features.Player.LocalPlayer.QueueTip("Mod List:", "Check the logs for more detailed results.\n<size=13>(Note that if someone doesnt show up on the list, they may not have LC_API installed)</size>"); Network.Broadcast("LC_API_ReqGUID"); } [NetworkMessage("LC_APISendMods", false)] internal static void ReceivedModListHandler(ulong senderId, List<string> mods) { string text = LC_API.GameInterfaceAPI.Features.Player.Get(senderId).Username + " responded with these mods:\n" + string.Join("\n", mods); LC_API.GameInterfaceAPI.Features.Player.LocalPlayer.QueueTip("Mod List:", text); Plugin.Log.LogWarning((object)text); } [NetworkMessage("LC_API_ReqGUID", false)] internal static void ReceivedModListHandler(ulong senderId) { List<string> list = new List<string>(); foreach (PluginInfo value in PluginsLoaded.Values) { list.Add(value.Metadata.GUID); } Network.Broadcast("LC_APISendMods", list); } } [BepInPlugin("LC_API", "Lethal Company API", "3.4.5")] public sealed class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; private ConfigEntry<bool> configOverrideModServer; private ConfigEntry<bool> configLegacyAssetLoading; private ConfigEntry<bool> configDisableBundleLoader; internal static ConfigEntry<bool> configVanillaSupport; internal static Harmony Harmony; internal static Plugin Instance { get; private set; } public static bool Initialized { get; private set; } private void Awake() { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected O, but got Unknown //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Expected O, but got Unknown //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Expected O, but got Unknown //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Expected O, but got Unknown //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Expected O, but got Unknown Instance = this; configOverrideModServer = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Force modded server browser", false, "Should the API force you into the modded server browser?"); configLegacyAssetLoading = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Legacy asset bundle loading", false, "Should the BundleLoader use legacy asset loading? Turning this on may help with loading assets from older plugins."); configDisableBundleLoader = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable BundleLoader", false, "Should the BundleLoader be turned off? Enable this if you are having problems with mods that load assets using a different method from LC_API's BundleLoader."); configVanillaSupport = ((BaseUnityPlugin)this).Config.Bind<bool>("Compatibility", "Vanilla Compatibility", false, "Allows you to join vanilla servers, but disables many networking-related things and could cause mods to not work properly."); CommandHandler.commandPrefix = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Prefix", "/", "Command prefix"); Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogWarning((object)"\n.____ _________ _____ __________ .___ \r\n| | \\_ ___ \\ / _ \\ \\______ \\| | \r\n| | / \\ \\/ / /_\\ \\ | ___/| | \r\n| |___\\ \\____ / | \\| | | | \r\n|_______ \\\\______ /______\\____|__ /|____| |___| \r\n \\/ \\//_____/ \\/ \r\n "); ((BaseUnityPlugin)this).Logger.LogInfo((object)"LC_API Starting up.."); if (configOverrideModServer.Value) { ModdedServer.SetServerModdedOnly(); } if (configVanillaSupport.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"LC_API is starting with VANILLA SUPPORT ENABLED."); } Harmony = new Harmony("ModAPI"); MethodInfo methodInfo = AccessTools.Method(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyCreated", (Type[])null, (Type[])null); AccessTools.Method(typeof(GameNetworkManager), "LobbyDataIsJoinable", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(ServerPatch), "OnLobbyCreate", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(MenuManager), "Awake", (Type[])null, (Type[])null); MethodInfo methodInfo4 = AccessTools.Method(typeof(ServerPatch), "CacheMenuManager", (Type[])null, (Type[])null); AccessTools.Method(typeof(HUDManager), "AddChatMessage", (Type[])null, (Type[])null); MethodInfo methodInfo5 = AccessTools.Method(typeof(HUDManager), "SubmitChat_performed", (Type[])null, (Type[])null); MethodInfo methodInfo6 = AccessTools.Method(typeof(CommandHandler.SubmitChatPatch), "Transpiler", (Type[])null, (Type[])null); MethodInfo methodInfo7 = AccessTools.Method(typeof(GameNetworkManager), "Awake", (Type[])null, (Type[])null); MethodInfo methodInfo8 = AccessTools.Method(typeof(ServerPatch), "GameNetworkManagerAwake", (Type[])null, (Type[])null); MethodInfo methodInfo9 = AccessTools.Method(typeof(NetworkManager), "StartClient", (Type[])null, (Type[])null); MethodInfo methodInfo10 = AccessTools.Method(typeof(NetworkManager), "StartHost", (Type[])null, (Type[])null); MethodInfo methodInfo11 = AccessTools.Method(typeof(NetworkManager), "Shutdown", (Type[])null, (Type[])null); MethodInfo methodInfo12 = AccessTools.Method(typeof(RegisterPatch), "Postfix", (Type[])null, (Type[])null); MethodInfo methodInfo13 = AccessTools.Method(typeof(UnregisterPatch), "Postfix", (Type[])null, (Type[])null); Harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(methodInfo6), (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)methodInfo7, new HarmonyMethod(methodInfo8), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)methodInfo9, (HarmonyMethod)null, new HarmonyMethod(methodInfo12), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)methodInfo10, (HarmonyMethod)null, new HarmonyMethod(methodInfo12), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)methodInfo11, (HarmonyMethod)null, new HarmonyMethod(methodInfo13), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Network.Init(); Events.Patch(Harmony); } internal void Start() { Initialize(); } internal void OnDestroy() { Initialize(); } internal void Initialize() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (!Initialized) { Initialized = true; if (!configDisableBundleLoader.Value) { BundleLoader.Load(configLegacyAssetLoading.Value); } GameObject val = new GameObject("API"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<LC_APIManager>(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"LC_API Started!"); CheatDatabase.RunLocalCheatDetector(); } } internal static void PatchMethodManual(MethodInfo method, MethodInfo patch, Harmony harmony) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown harmony.Patch((MethodBase)method, new HarmonyMethod(patch), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } public static class Utils { public static string ReplaceWithCase(this string input, string toReplace, string replacement) { Dictionary<string, string> map = new Dictionary<string, string> { { toReplace, replacement } }; return input.ReplaceWithCase(map); } public static string ReplaceWithCase(this string input, Dictionary<string, string> map) { string text = input; foreach (KeyValuePair<string, string> item in map) { string key = item.Key; string value = item.Value; text = Regex.Replace(text, key, delegate(Match match) { string value2 = match.Value; char[] array = value2.ToCharArray(); string[] source = value2.Split(' '); bool flag = char.IsUpper(array[0]); bool flag2 = source.All((string w) => char.IsUpper(w[0]) || !char.IsLetter(w[0])); if (array.All((char c) => char.IsUpper(c) || !char.IsLetter(c))) { return value.ToUpper(); } if (flag2) { return Regex.Replace(value, "\\b\\w", (Match charMatch) => charMatch.Value.ToUpper()); } char[] array2 = value.ToCharArray(); array2[0] = (flag ? char.ToUpper(array2[0]) : char.ToLower(array2[0])); return new string(array2); }, RegexOptions.IgnoreCase); } return text; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LC_API"; public const string PLUGIN_NAME = "Lethal Company API"; public const string PLUGIN_VERSION = "3.4.5"; } } namespace LC_API.ServerAPI { public static class ModdedServer { private static bool moddedOnly; [Obsolete("Use SetServerModdedOnly() instead. This will be removed/private in a future update.")] public static bool setModdedOnly; public static int GameVersion { get; internal set; } public static bool ModdedOnly => moddedOnly; public static void SetServerModdedOnly() { moddedOnly = true; Plugin.Log.LogMessage((object)"A plugin has set your game to only allow you to play with other people who have mods!"); } public static void OnSceneLoaded() { if (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) && ModdedOnly) { GameNetworkManager instance = GameNetworkManager.Instance; instance.gameVersionNum += 16440; setModdedOnly = true; } } } [Obsolete("ServerAPI.Networking is obsolete and will be removed in future versions. Use LC_API.Networking.Network.")] public static class Networking { private sealed class Data<T> { public readonly string Signature; public readonly T Value; public Data(string signature, T value) { Signature = signature; Value = value; } } private const string StringMessageRegistrationName = "LCAPI_NET_LEGACY_STRING"; private const string ListStringMessageRegistrationName = "LCAPI_NET_LEGACY_LISTSTRING"; private const string IntMessageRegistrationName = "LCAPI_NET_LEGACY_INT"; private const string FloatMessageRegistrationName = "LCAPI_NET_LEGACY_FLOAT"; private const string Vector3MessageRegistrationName = "LCAPI_NET_LEGACY_VECTOR3"; private const string SyncVarMessageRegistrationName = "LCAPI_NET_LEGACY_SYNCVAR_SET"; public static Action<string, string> GetString = delegate { }; public static Action<List<string>, string> GetListString = delegate { }; public static Action<int, string> GetInt = delegate { }; public static Action<float, string> GetFloat = delegate { }; public static Action<Vector3, string> GetVector3 = delegate { }; private static Dictionary<string, string> syncStringVars = new Dictionary<string, string>(); public static void Broadcast(string data, string signature) { if (data.Contains("/")) { Plugin.Log.LogError((object)"Invalid character in broadcasted string event! ( / )"); } else { Network.Broadcast("LCAPI_NET_LEGACY_STRING", new Data<string>(signature, data)); } } public static void Broadcast(List<string> data, string signature) { string text = ""; foreach (string datum in data) { if (datum.Contains("/")) { Plugin.Log.LogError((object)"Invalid character in broadcasted string event! ( / )"); return; } if (datum.Contains("\n")) { Plugin.Log.LogError((object)"Invalid character in broadcasted string event! ( NewLine )"); return; } text = text + datum + "\n"; } Network.Broadcast("LCAPI_NET_LEGACY_LISTSTRING", new Data<string>(signature, text)); } public static void Broadcast(int data, string signature) { Network.Broadcast("LCAPI_NET_LEGACY_INT", new Data<int>(signature, data)); } public static void Broadcast(float data, string signature) { Network.Broadcast("LCAPI_NET_LEGACY_FLOAT", new Data<float>(signature, data)); } public static void Broadcast(Vector3 data, string signature) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Network.Broadcast("LCAPI_NET_LEGACY_VECTOR3", new Data<Vector3>(signature, data)); } public static void RegisterSyncVariable(string name) { if (!syncStringVars.ContainsKey(name)) { syncStringVars.Add(name, ""); } else { Plugin.Log.LogError((object)("Cannot register Sync Variable! A Sync Variable has already been registered with name " + name)); } } public static void SetSyncVariable(string name, string value) { if (syncStringVars.ContainsKey(name)) { syncStringVars[name] = value; Broadcast(new List<string> { name, value }, "LCAPI_NET_LEGACY_SYNCVAR_SET"); } else { Plugin.Log.LogError((object)("Cannot set the value of Sync Variable " + name + " as it is not registered!")); } } private static void SetSyncVariableB(string name, string value) { if (syncStringVars.ContainsKey(name)) { syncStringVars[name] = value; } else { Plugin.Log.LogError((object)("Cannot set the value of Sync Variable " + name + " as it is not registered!")); } } internal static void LCAPI_NET_SYNCVAR_SET(List<string> list, string arg2) { if (arg2 == "LCAPI_NET_LEGACY_SYNCVAR_SET") { SetSyncVariableB(list[0], list[1]); } } public static string GetSyncVariable(string name) { if (syncStringVars.ContainsKey(name)) { return syncStringVars[name]; } Plugin.Log.LogError((object)("Cannot get the value of Sync Variable " + name + " as it is not registered!")); return ""; } internal static void InitializeLegacyNetworking() { GetListString = (Action<List<string>, string>)Delegate.Combine(GetListString, new Action<List<string>, string>(LCAPI_NET_SYNCVAR_SET)); Network.RegisterMessage("LCAPI_NET_LEGACY_STRING", relayToSelf: false, delegate(ulong senderId, Data<string> data) { GetString(data.Value, data.Signature); }); Network.RegisterMessage("LCAPI_NET_LEGACY_LISTSTRING", relayToSelf: false, delegate(ulong senderId, Data<string> data) { GetListString(data.Value.Split('\n').ToList(), data.Signature); }); Network.RegisterMessage("LCAPI_NET_LEGACY_INT", relayToSelf: false, delegate(ulong senderId, Data<int> data) { GetInt(data.Value, data.Signature); }); Network.RegisterMessage("LCAPI_NET_LEGACY_FLOAT", relayToSelf: false, delegate(ulong senderId, Data<float> data) { GetFloat(data.Value, data.Signature); }); Network.RegisterMessage("LCAPI_NET_LEGACY_VECTOR3", relayToSelf: false, delegate(ulong senderId, Data<Vector3> data) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) GetVector3(data.Value, data.Signature); }); } } } namespace LC_API.Networking { public static class Network { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static HandleNamedMessageDelegate <>9__35_2; public static Events.CustomEventHandler <>9__35_0; public static Events.CustomEventHandler <>9__35_1; internal void <Init>b__35_0() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown StartedNetworking = true; if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>9__35_2; if (obj == null) { HandleNamedMessageDelegate val = delegate(ulong senderClientId, FastBufferReader reader) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) byte[] bytes = default(byte[]); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref bytes, default(ForPrimitives)); NetworkMessageWrapper networkMessageWrapper = bytes.ToObject<NetworkMessageWrapper>(); networkMessageWrapper.Sender = senderClientId; byte[] array = networkMessageWrapper.ToBytes(); FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(FastBufferWriter.GetWriteSize<byte>(array, -1, 0), (Allocator)2, -1); try { ((FastBufferWriter)(ref val2)).WriteValueSafe<byte>(array, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(networkMessageWrapper.UniqueName, val2, (NetworkDelivery)4); } finally { ((IDisposable)(FastBufferWriter)(ref val2)).Dispose(); } }; <>9__35_2 = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("LC_API_RELAY_MESSAGE", (HandleNamedMessageDelegate)obj); } RegisterAllMessages(); } internal void <Init>b__35_2(ulong senderClientId, FastBufferReader reader) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) byte[] bytes = default(byte[]); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref bytes, default(ForPrimitives)); NetworkMessageWrapper networkMessageWrapper = bytes.ToObject<NetworkMessageWrapper>(); networkMessageWrapper.Sender = senderClientId; byte[] array = networkMessageWrapper.ToBytes(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(FastBufferWriter.GetWriteSize<byte>(array, -1, 0), (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(array, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(networkMessageWrapper.UniqueName, val, (NetworkDelivery)4); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } internal void <Init>b__35_1() { StartedNetworking = false; if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("LC_API_RELAY_MESSAGE"); } UnregisterAllMessages(); } } internal const string MESSAGE_RELAY_UNIQUE_NAME = "LC_API_RELAY_MESSAGE"; private static MethodInfo _registerInfo = null; private static MethodInfo _registerInfoGeneric = null; internal static Dictionary<string, NetworkMessageFinalizerBase> NetworkMessageFinalizers { get; } = new Dictionary<string, NetworkMessageFinalizerBase>(); internal static bool StartedNetworking { get; set; } = false; internal static MethodInfo RegisterInfo { get { if (_registerInfo == null) { MethodInfo[] methods = typeof(Network).GetMethods(); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "RegisterMessage" && !methodInfo.IsGenericMethod) { _registerInfo = methodInfo; break; } } } return _registerInfo; } } internal static MethodInfo RegisterInfoGeneric { get { if (_registerInfoGeneric == null) { MethodInfo[] methods = typeof(Network).GetMethods(); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "RegisterMessage" && methodInfo.IsGenericMethod) { _registerInfoGeneric = methodInfo; break; } } } return _registerInfoGeneric; } } public static event Events.CustomEventHandler RegisterNetworkMessages; internal static event Events.CustomEventHandler UnregisterNetworkMessages; internal static byte[] ToBytes(this object @object) { if (@object == null) { return null; } return Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(@object)); } internal static T ToObject<T>(this byte[] bytes) where T : class { return JsonConvert.DeserializeObject<T>(Encoding.UTF8.GetString(bytes)); } internal static void OnRegisterNetworkMessages() { Network.RegisterNetworkMessages.InvokeSafely(); } internal static void OnUnregisterNetworkMessages() { Network.UnregisterNetworkMessages.InvokeSafely(); } internal static void RegisterAllMessages() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown foreach (NetworkMessageFinalizerBase value in NetworkMessageFinalizers.Values) { NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler(value.UniqueName, new HandleNamedMessageDelegate(value.Read)); } } internal static void UnregisterAllMessages() { foreach (string key in NetworkMessageFinalizers.Keys) { UnregisterMessage(key, andRemoveHandler: false); } } public static void RegisterAll() { Type[] typesFromAssembly = AccessTools.GetTypesFromAssembly(new StackTrace().GetFrame(1).GetMethod().ReflectedType.Assembly); for (int i = 0; i < typesFromAssembly.Length; i++) { RegisterAll(typesFromAssembly[i]); } } public static void RegisterAll(Type type) { if (!type.IsClass) { return; } NetworkMessage customAttribute = type.GetCustomAttribute<NetworkMessage>(); if (customAttribute != null) { if (type.BaseType.Name == "NetworkMessageHandler`1") { Type type2 = type.BaseType.GetGenericArguments()[0]; RegisterInfoGeneric.MakeGenericMethod(type2).Invoke(null, new object[3] { customAttribute.UniqueName, customAttribute.RelayToSelf, type.GetMethod("Handler").CreateDelegate(typeof(Action<, >).MakeGenericType(typeof(ulong), type2), Activator.CreateInstance(type)) }); } else if (type.BaseType.Name == "NetworkMessageHandler") { RegisterInfo.Invoke(null, new object[3] { customAttribute.UniqueName, customAttribute.RelayToSelf, type.GetMethod("Handler").CreateDelegate(typeof(Action<>).MakeGenericType(typeof(ulong)), Activator.CreateInstance(type)) }); } return; } MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { customAttribute = methodInfo.GetCustomAttribute<NetworkMessage>(); if (customAttribute != null) { if (!methodInfo.IsStatic) { throw new Exception("Detected NetworkMessage attribute on non-static method. All NetworkMessages on methods must be static."); } if (methodInfo.GetParameters().Length == 1) { RegisterInfo.Invoke(null, new object[3] { customAttribute.UniqueName, customAttribute.RelayToSelf, methodInfo.CreateDelegate(typeof(Action<>).MakeGenericType(typeof(ulong))) }); } else { Type parameterType = methodInfo.GetParameters()[1].ParameterType; RegisterInfoGeneric.MakeGenericMethod(parameterType).Invoke(null, new object[3] { customAttribute.UniqueName, customAttribute.RelayToSelf, methodInfo.CreateDelegate(typeof(Action<, >).MakeGenericType(typeof(ulong), parameterType)) }); } } } } public static void UnregisterAll(bool andRemoveHandler = true) { Type[] typesFromAssembly = AccessTools.GetTypesFromAssembly(new StackTrace().GetFrame(1).GetMethod().ReflectedType.Assembly); for (int i = 0; i < typesFromAssembly.Length; i++) { UnregisterAll(typesFromAssembly[i], andRemoveHandler); } } public static void UnregisterAll(Type type, bool andRemoveHandler = true) { if (!type.IsClass) { return; } NetworkMessage customAttribute = type.GetCustomAttribute<NetworkMessage>(); if (customAttribute != null) { UnregisterMessage(customAttribute.UniqueName, andRemoveHandler); return; } MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < methods.Length; i++) { customAttribute = methods[i].GetCustomAttribute<NetworkMessage>(); if (customAttribute != null) { UnregisterMessage(customAttribute.UniqueName, andRemoveHandler); } } } public static void RegisterMessage<T>(string uniqueName, bool relayToSelf, Action<ulong, T> onReceived) where T : class { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown if (NetworkMessageFinalizers.ContainsKey(uniqueName)) { throw new Exception(uniqueName + " already registered"); } NetworkMessageFinalizer<T> networkMessageFinalizer = new NetworkMessageFinalizer<T>(uniqueName, relayToSelf, onReceived); NetworkMessageFinalizers.Add(uniqueName, networkMessageFinalizer); if (StartedNetworking) { NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler(uniqueName, new HandleNamedMessageDelegate(networkMessageFinalizer.Read)); } } public static void RegisterMessage(string uniqueName, bool relayToSelf, Action<ulong> onReceived) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown if (NetworkMessageFinalizers.ContainsKey(uniqueName)) { throw new Exception(uniqueName + " already registered"); } NetworkMessageFinalizer networkMessageFinalizer = new NetworkMessageFinalizer(uniqueName, relayToSelf, onReceived); NetworkMessageFinalizers.Add(uniqueName, networkMessageFinalizer); if (StartedNetworking) { NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler(uniqueName, new HandleNamedMessageDelegate(networkMessageFinalizer.Read)); } } public static void UnregisterMessage(string uniqueName, bool andRemoveHandler = true) { if ((!andRemoveHandler && NetworkMessageFinalizers.ContainsKey(uniqueName)) || (andRemoveHandler && NetworkMessageFinalizers.Remove(uniqueName))) { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler(uniqueName); } } public static void Broadcast<T>(string uniqueName, T @object) where T : class { if (NetworkMessageFinalizers.TryGetValue(uniqueName, out var value)) { if (!(value is NetworkMessageFinalizer<T> networkMessageFinalizer)) { throw new Exception("Network handler for " + uniqueName + " was not broadcast with the right type!"); } networkMessageFinalizer.Send(@object); } } public static void Broadcast(string uniqueName) { if (NetworkMessageFinalizers.TryGetValue(uniqueName, out var value)) { if (!(value is NetworkMessageFinalizer networkMessageFinalizer)) { throw new Exception("Network handler for " + uniqueName + " was not broadcast with the right type!"); } networkMessageFinalizer.Send(); } } internal static void Init() { RegisterNetworkMessages += delegate { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown StartedNetworking = true; if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { CustomMessagingManager customMessagingManager = NetworkManager.Singleton.CustomMessagingManager; object obj = <>c.<>9__35_2; if (obj == null) { HandleNamedMessageDelegate val = delegate(ulong senderClientId, FastBufferReader reader) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) byte[] bytes = default(byte[]); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref bytes, default(ForPrimitives)); NetworkMessageWrapper networkMessageWrapper = bytes.ToObject<NetworkMessageWrapper>(); networkMessageWrapper.Sender = senderClientId; byte[] array = networkMessageWrapper.ToBytes(); FastBufferWriter val2 = default(FastBufferWriter); ((FastBufferWriter)(ref val2))..ctor(FastBufferWriter.GetWriteSize<byte>(array, -1, 0), (Allocator)2, -1); try { ((FastBufferWriter)(ref val2)).WriteValueSafe<byte>(array, default(ForPrimitives)); NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(networkMessageWrapper.UniqueName, val2, (NetworkDelivery)4); } finally { ((IDisposable)(FastBufferWriter)(ref val2)).Dispose(); } }; <>c.<>9__35_2 = val; obj = (object)val; } customMessagingManager.RegisterNamedMessageHandler("LC_API_RELAY_MESSAGE", (HandleNamedMessageDelegate)obj); } RegisterAllMessages(); }; UnregisterNetworkMessages += delegate { StartedNetworking = false; if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("LC_API_RELAY_MESSAGE"); } UnregisterAllMessages(); }; SetupNetworking(); RegisterAll(); LC_API.ServerAPI.Networking.InitializeLegacyNetworking(); } internal static void SetupNetworking() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = false)] public class NetworkMessage : Attribute { public string UniqueName { get; } public bool RelayToSelf { get; } public NetworkMessage(string uniqueName, bool relayToSelf = false) { UniqueName = uniqueName; RelayToSelf = relayToSelf; } } public abstract class NetworkMessageHandler<T> where T : class { public abstract void Handler(ulong sender, T message); } public abstract class NetworkMessageHandler { public abstract void Handler(ulong sender); } internal abstract class NetworkMessageFinalizerBase { internal abstract string UniqueName { get; } internal abstract bool RelayToSelf { get; } public abstract void Read(ulong sender, FastBufferReader reader); } internal class NetworkMessageFinalizer : NetworkMessageFinalizerBase { internal override string UniqueName { get; } internal override bool RelayToSelf { get; } internal Action<ulong> OnReceived { get; } public NetworkMessageFinalizer(string uniqueName, bool relayToSelf, Action<ulong> onReceived) { UniqueName = uniqueName; RelayToSelf = relayToSelf; OnReceived = onReceived; } public void Send() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_00b3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null || (Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null) { ((MonoBehaviour)NetworkManager.Singleton).StartCoroutine(SendLater()); return; } byte[] array = new NetworkMessageWrapper(UniqueName, LC_API.GameInterfaceAPI.Features.Player.LocalPlayer.ClientId).ToBytes(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(FastBufferWriter.GetWriteSize<byte>(array, -1, 0), (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(array, default(ForPrimitives)); if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(UniqueName, val, (NetworkDelivery)4); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("LC_API_RELAY_MESSAGE", LC_API.GameInterfaceAPI.Features.Player.HostPlayer.ClientId, val, (NetworkDelivery)4); } } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public override void Read(ulong fakeSender, FastBufferReader reader) { //IL_0021: 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_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null || (Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null) { ((MonoBehaviour)NetworkManager.Singleton).StartCoroutine(ReadLater(fakeSender, reader)); return; } byte[] bytes = default(byte[]); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref bytes, default(ForPrimitives)); NetworkMessageWrapper networkMessageWrapper = bytes.ToObject<NetworkMessageWrapper>(); if (RelayToSelf || LC_API.GameInterfaceAPI.Features.Player.LocalPlayer.ClientId != networkMessageWrapper.Sender) { OnReceived(networkMessageWrapper.Sender); } } private IEnumerator SendLater() { int timesWaited = 0; while ((Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null || (Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null) { yield return (object)new WaitForSeconds(0.1f); timesWaited++; if (timesWaited % 20 == 0) { Plugin.Log.LogWarning((object)$"Waiting to send network message. Waiting on host?: {(Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null} Waiting on local player?: {(Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null}"); } if (timesWaited >= 100) { Plugin.Log.LogError((object)"Dropping network message"); yield return null; } } Send(); } private IEnumerator ReadLater(ulong fakeSender, FastBufferReader reader) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) int timesWaited = 0; while ((Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null || (Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null) { yield return (object)new WaitForSeconds(0.1f); timesWaited++; if (timesWaited % 20 == 0) { Plugin.Log.LogWarning((object)$"Waiting to read network message. Waiting on host?: {(Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null} Waiting on local player?: {(Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null}"); } if (timesWaited >= 100) { Plugin.Log.LogError((object)"Dropping network message"); yield return null; } } Read(fakeSender, reader); } } internal class NetworkMessageFinalizer<T> : NetworkMessageFinalizerBase where T : class { internal override string UniqueName { get; } internal override bool RelayToSelf { get; } internal Action<ulong, T> OnReceived { get; } public NetworkMessageFinalizer(string uniqueName, bool relayToSelf, Action<ulong, T> onReceived) { UniqueName = uniqueName; RelayToSelf = relayToSelf; OnReceived = onReceived; } public void Send(T obj) { //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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null || (Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null) { ((MonoBehaviour)NetworkManager.Singleton).StartCoroutine(SendLater(obj)); return; } byte[] array = new NetworkMessageWrapper(UniqueName, LC_API.GameInterfaceAPI.Features.Player.LocalPlayer.ClientId, obj.ToBytes()).ToBytes(); FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(FastBufferWriter.GetWriteSize<byte>(array, -1, 0), (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<byte>(array, default(ForPrimitives)); if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost) { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessageToAll(UniqueName, val, (NetworkDelivery)4); } else { NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("LC_API_RELAY_MESSAGE", LC_API.GameInterfaceAPI.Features.Player.HostPlayer.ClientId, val, (NetworkDelivery)4); } } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public override void Read(ulong fakeSender, FastBufferReader reader) { //IL_0021: 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_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null || (Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null) { ((MonoBehaviour)NetworkManager.Singleton).StartCoroutine(ReadLater(fakeSender, reader)); return; } byte[] bytes = default(byte[]); ((FastBufferReader)(ref reader)).ReadValueSafe<byte>(ref bytes, default(ForPrimitives)); NetworkMessageWrapper networkMessageWrapper = bytes.ToObject<NetworkMessageWrapper>(); if (RelayToSelf || LC_API.GameInterfaceAPI.Features.Player.LocalPlayer.ClientId != networkMessageWrapper.Sender) { OnReceived(networkMessageWrapper.Sender, networkMessageWrapper.Message.ToObject<T>()); } } private IEnumerator SendLater(T obj) { int timesWaited = 0; while ((Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null || (Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null) { yield return (object)new WaitForSeconds(0.1f); timesWaited++; if (timesWaited % 20 == 0) { Plugin.Log.LogWarning((object)$"Waiting to send network message. Waiting on host?: {(Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null} Waiting on local player?: {(Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null}"); } if (timesWaited >= 100) { Plugin.Log.LogError((object)"Dropping network message"); yield return null; } } Send(obj); } private IEnumerator ReadLater(ulong fakeSender, FastBufferReader reader) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) int timesWaited = 0; while ((Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null || (Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null) { yield return (object)new WaitForSeconds(0.1f); timesWaited++; if (timesWaited % 20 == 0) { Plugin.Log.LogWarning((object)$"Waiting to read network message. Waiting on host?: {(Object)(object)LC_API.GameInterfaceAPI.Features.Player.HostPlayer == (Object)null} Waiting on local player?: {(Object)(object)LC_API.GameInterfaceAPI.Features.Player.LocalPlayer == (Object)null}"); } if (timesWaited >= 100) { Plugin.Log.LogError((object)"Dropping network message"); yield return null; } } Read(fakeSender, reader); } } internal class NetworkMessageWrapper { public string UniqueName { get; set; } public ulong Sender { get; set; } public byte[] Message { get; set; } internal NetworkMessageWrapper(string uniqueName, ulong sender) { UniqueName = uniqueName; Sender = sender; } internal NetworkMessageWrapper(string uniqueName, ulong sender, byte[] message) { UniqueName = uniqueName; Sender = sender; Message = message; } internal NetworkMessageWrapper() { } } internal static class RegisterPatch { internal static void Postfix() { Network.OnRegisterNetworkMessages(); } } internal static class UnregisterPatch { internal static void Postfix() { Network.OnUnregisterNetworkMessages(); } } } namespace LC_API.Networking.Serializers { public struct Vector2S { private Vector2? v2; public float x { get; set; } public float y { get; set; } [JsonIgnore] public Vector2 vector2 { get { //IL_002f: 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) if (!v2.HasValue) { v2 = new Vector2(x, y); } return v2.Value; } } public Vector2S(float x, float y) { v2 = null; this.x = x; this.y = y; } public static implicit operator Vector2(Vector2S vector2S) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return vector2S.vector2; } public static implicit operator Vector2S(Vector2 vector2) { //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 Vector2S(vector2.x, vector2.y); } } public struct Vector2IntS { private Vector2Int? v2; public int x { get; set; } public int y { get; set; } [JsonIgnore] public Vector2Int vector2 { get { //IL_002f: 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) if (!v2.HasValue) { v2 = new Vector2Int(x, y); } return v2.Value; } } public Vector2IntS(int x, int y) { v2 = null; this.x = x; this.y = y; } public static implicit operator Vector2Int(Vector2IntS vector2S) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return vector2S.vector2; } public static implicit operator Vector2IntS(Vector2Int vector2) { return new Vector2IntS(((Vector2Int)(ref vector2)).x, ((Vector2Int)(ref vector2)).y); } } public struct Vector3S { private Vector3? v3; public float x { get; set; } public float y { get; set; } public float z { get; set; } [JsonIgnore] public Vector3 vector3 { get { //IL_0035: 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) if (!v3.HasValue) { v3 = new Vector3(x, y, z); } return v3.Value; } } public Vector3S(float x, float y, float z) { v3 = null; this.x = x; this.y = y; this.z = z; } public static implicit operator Vector3(Vector3S vector3S) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return vector3S.vector3; } public static implicit operator Vector3S(Vector3 vector3) { //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_000c: Unknown result type (might be due to invalid IL or missing references) return new Vector3S(vector3.x, vector3.y, vector3.z); } } public struct Vector3IntS { private Vector3Int? v3; public int x { get; set; } public int y { get; set; } public int z { get; set; } [JsonIgnore] public Vector3Int vector3 { get { //IL_0035: 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) if (!v3.HasValue) { v3 = new Vector3Int(x, y, z); } return v3.Value; } } public Vector3IntS(int x, int y, int z) { v3 = null; this.x = x; this.y = y; this.z = z; } public static implicit operator Vector3Int(Vector3IntS vector3S) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return vector3S.vector3; } public static implicit operator Vector3IntS(Vector3Int vector3) { return new Vector3IntS(((Vector3Int)(ref vector3)).x, ((Vector3Int)(ref vector3)).y, ((Vector3Int)(ref vector3)).z); } } public struct Vector4S { private Vector4? v4; public float x { get; set; } public float y { get; set; } public float z { get; set; } public float w { get; set; } [JsonIgnore] public Vector4 Vector4 { get { //IL_003b: 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) if (!v4.HasValue) { v4 = new Vector4(x, y, z, w); } return v4.Value; } } public Vector4S(float x, float y, float z, float w) { v4 = null; this.x = x; this.y = y; this.z = z; this.w = w; } public static implicit operator Vector4(Vector4S vector4S) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return vector4S.Vector4; } public static implicit operator Vector4S(Vector4 vector4) { //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_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) return new Vector4S(vector4.x, vector4.y, vector4.z, vector4.w); } } public struct QuaternionS { private Quaternion? q; public float x { get; set; } public float y { get; set; } public float z { get; set; } public float w { get; set; } [JsonIgnore] public Quaternion Quaternion { get { //IL_003b: 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) if (!q.HasValue) { q = new Quaternion(x, y, z, w); } return q.Value; } } public QuaternionS(float x, float y, float z, float w) { q = null; this.x = x; this.y = y; this.z = z; this.w = w; } public static implicit operator Quaternion(QuaternionS quaternionS) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return quaternionS.Quaternion; } public static implicit operator QuaternionS(Quaternion quaternion) { //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_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) return new QuaternionS(quaternion.x, quaternion.y, quaternion.z, quaternion.w); } } public struct ColorS { private Color? c; public float r { get; set; } public float g { get; set; } public float b { get; set; } public float a { get; set; } [JsonIgnore] public Color Color { get { //IL_003b: 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) if (!c.HasValue) { c = new Color(r, g, b, a); } return c.Value; } } public ColorS(float r, float g, float b, float a) { c = null; this.r = r; this.g = g; this.b = b; this.a = a; } public static implicit operator Color(ColorS colorS) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return colorS.Color; } public static implicit operator ColorS(Color color) { //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_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) return new ColorS(color.r, color.g, color.b, color.a); } } public struct Color32S { private Color32? c; public byte r { get; set; } public byte g { get; set; } public byte b { get; set; } public byte a { get; set; } [JsonIgnore] public Color32 Color { get { //IL_003b: 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) if (!c.HasValue) { c = new Color32(r, g, b, a); } return c.Value; } } public Color32S(byte r, byte g, byte b, byte a) { c = null; this.r = r; this.g = g; this.b = b; this.a = a; } public static implicit operator Color32(Color32S colorS) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return colorS.Color; } public static implicit operator Color32S(Color32 color) { //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_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) return new Color32S(color.r, color.g, color.b, color.a); } } public struct RayS { private Ray? r; public Vector3S origin { get; set; } public Vector3S direction { get; set; } [JsonIgnore] public Ray Ray { get { //IL_0039: 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_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) if (!r.HasValue) { r = new Ray((Vector3)origin, (Vector3)direction); } return r.Value; } } public RayS(Vector3 origin, Vector3 direction) { //IL_000d: 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) r = null; this.origin = origin; this.direction = direction; } public static implicit operator Ray(RayS rayS) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return rayS.Ray; } public static implicit operator RayS(Ray ray) { //IL_0002: 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) return new RayS(((Ray)(ref ray)).origin, ((Ray)(ref ray)).direction); } } public struct Ray2DS { private Ray2D? r; public Vector2S origin { get; set; } public Vector2S direction { get; set; } [JsonIgnore] public Ray2D Ray { get { //IL_0039: 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_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) if (!r.HasValue) { r = new Ray2D((Vector2)origin, (Vector2)direction); } return r.Value; } } public Ray2DS(Vector2 origin, Vector2 direction) { //IL_000d: 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) r = null; this.origin = origin; this.direction = direction; } public static implicit operator Ray2D(Ray2DS ray2DS) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return ray2DS.Ray; } public static implicit operator Ray2DS(Ray2D ray2D) { //IL_0002: 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) return new Ray2DS(((Ray2D)(ref ray2D)).origin, ((Ray2D)(ref ray2D)).direction); } } } namespace LC_API.ManualPatches { internal static class ServerPatch { internal static bool OnLobbyCreate(GameNetworkManager __instance, Result result, Lobby lobby) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0009: Unknown result type (might be due to invalid IL or missing references) if ((int)result != 1) { Debug.LogError((object)$"Lobby could not be created! {result}", (Object)(object)__instance); } __instance.lobbyHostSettings.lobbyName = "[MODDED]" + __instance.lobbyHostSettings.lobbyName.ToString(); Plugin.Log.LogMessage((object)"server pre-setup success"); return true; } internal static bool CacheMenuManager(MenuManager __instance) { LC_APIManager.MenuManager = __instance; return true; } internal static bool ChatCommands(HUDManager __instance, CallbackContext context) { if (__instance.chatTextField.text.ToLower().Contains("/modcheck")) { CheatDatabase.OtherPlayerCheatDetector(); return false; } return true; } internal static void GameNetworkManagerAwake(GameNetworkManager __instance) { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { ModdedServer.GameVersion = __instance.gameVersionNum; } } } } namespace LC_API.GameInterfaceAPI { public static class GameState { private static readonly Action NothingAction = delegate { }; public static int AlivePlayerCount { get; private set; } public static ShipState ShipState { get; private set; } public static event Action PlayerDied; public static event Action LandOnMoon; public static event Action WentIntoOrbit; public static event Action ShipStartedLeaving; internal static void GSUpdate() { if (!((Object)(object)StartOfRound.Instance == (Object)null)) { if (StartOfRound.Instance.shipHasLanded && ShipState != ShipState.OnMoon) { ShipState = ShipState.OnMoon; GameState.LandOnMoon.InvokeActionSafe(); } if (StartOfRound.Instance.inShipPhase && ShipState != 0) { ShipState = ShipState.InOrbit; GameState.WentIntoOrbit.InvokeActionSafe(); } if (StartOfRound.Instance.shipIsLeaving && ShipState != ShipState.LeavingMoon) { ShipState = ShipState.LeavingMoon; GameState.ShipStartedLeaving.InvokeActionSafe(); } if (AlivePlayerCount < StartOfRound.Instance.livingPlayers) { GameState.PlayerDied.InvokeActionSafe(); } AlivePlayerCount = StartOfRound.Instance.livingPlayers; } } static GameState() { GameState.PlayerDied = NothingAction; GameState.LandOnMoon = NothingAction; GameState.WentIntoOrbit = NothingAction; GameState.ShipStartedLeaving = NothingAction; } } [Obsolete("Use Player::QueueTip instead.")] public class GameTips { private static List<string> tipHeaders = new List<string>(); private static List<string> tipBodys = new List<string>(); private static float lastMessageTime; public static void ShowTip(string header, string body) { tipHeaders.Add(header); tipBodys.Add(body); } public static void UpdateInternal() { lastMessageTime -= Time.deltaTime; if ((tipHeaders.Count > 0) & (lastMessageTime < 0f)) { lastMessageTime = 5f; if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.DisplayTip(tipHeaders[0], tipBodys[0], false, false, "LC_Tip1"); } tipHeaders.RemoveAt(0); tipBodys.RemoveAt(0); } } } } namespace LC_API.GameInterfaceAPI.Features { public class Item : NetworkBehaviour { private bool hasNewProps; internal static GameObject ItemNetworkPrefab { get; set; } public static Dictionary<GrabbableObject, Item> Dictionary { get; } = new Dictionary<GrabbableObject, Item>(); public static IReadOnlyCollection<Item> List => Dictionary.Values; public GrabbableObject GrabbableObject { get; private set; } public Item ItemProperties => GrabbableObject.itemProperties; public ScanNodeProperties ScanNodeProperties { get; set; } public bool IsHeld => GrabbableObject.isHeld; public bool IsTwoHanded => ItemProperties.twoHanded; public Player Holder { get { if (!IsHeld) { return null; } if (!Player.Dictionary.TryGetValue(GrabbableObject.playerHeldBy, out var value)) { return null; } return value; } } public string Name { get { return ItemProperties.itemName; } set { if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to set item name on client."); } string oldName = ItemProperties.itemName.ToLower(); CloneProperties(); ItemProperties.itemName = value; OverrideTooltips(oldName, value.ToLower()); ScanNodeProperties.headerText = value; SetGrabbableNameClientRpc(value); } } public Vector3 Position { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return ((Component)GrabbableObject).transform.position; } set { //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to set item position on client."); } GrabbableObject.startFallingPosition = value; GrabbableObject.targetFloorPosition = value; ((Component)GrabbableObject).transform.position = value; SetItemPositionClientRpc(value); } } public Quaternion Rotation { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return ((Component)GrabbableObject).transform.rotation; } set { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)GrabbableObject).transform.rotation = value; } } public Vector3 Scale { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return ((Component)GrabbableObject).transform.localScale; } set { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)GrabbableObject).transform.localScale = value; } } public bool IsScrap { get { return ItemProperties.isScrap; } set { if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to set item name on client."); } CloneProperties(); ItemProperties.isScrap = value; SetIsScrapClientRpc(value); } } public int ScrapValue { get { return GrabbableObject.scrapValue; } set { if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to set scrap value on client."); } GrabbableObject.SetScrapValue(value); SetScrapValueClientRpc(value); } } [ClientRpc] private void SetGrabbableNameClientRpc(string name) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(66243798u, val, (RpcDelivery)0); bool flag = name != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(name, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 66243798u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { string oldName = ItemProperties.itemName.ToLower(); CloneProperties(); ItemProperties.itemName = name; OverrideTooltips(oldName, name.ToLower()); ScanNodeProperties.headerText = name; } } private void OverrideTooltips(string oldName, string newName) { for (int i = 0; i < ItemProperties.toolTips.Length; i++) { ItemProperties.toolTips[i] = ItemProperties.toolTips[i].ReplaceWithCase(oldName, newName); } if (IsHeld && (Object)(object)Holder == (Object)(object)Player.LocalPlayer) { GrabbableObject.SetControlTipsForItem(); } } [ClientRpc] private void SetItemPositionClientRpc(Vector3 pos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(949135576u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 949135576u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { GrabbableObject.startFallingPosition = pos; GrabbableObject.targetFloorPosition = pos; ((Component)GrabbableObject).transform.position = pos; } } } public void SetAndSyncRotation(Quaternion rotation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to sync item rotation from client."); } SetItemRotationClientRpc(rotation); } [ClientRpc] private void SetItemRotationClientRpc(Quaternion rotation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_00c9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1528367091u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotation); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1528367091u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Rotation = rotation; } } } public void SetAndSyncScale(Vector3 scale) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to sync item scale from client."); } SetItemScaleClientRpc(scale); } [ClientRpc] private void SetItemScaleClientRpc(Vector3 scale) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_00c9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2688253945u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref scale); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2688253945u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Scale = scale; } } } [ClientRpc] private void SetIsScrapClientRpc(bool isScrap) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4227417717u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isScrap, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4227417717u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { CloneProperties(); ItemProperties.isScrap = isScrap; } } } [ClientRpc] private void SetScrapValueClientRpc(int scrapValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3866863385u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, scrapValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3866863385u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { GrabbableObject.SetScrapValue(scrapValue); } } } public void RemoveFromHolder(Vector3 position = default(Vector3), Quaternion rotation = default(Quaternion)) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to remove item from player on client."); } if (IsHeld) { ((NetworkBehaviour)this).NetworkObject.RemoveOwnership(); Holder.Inventory.RemoveItem(this); RemoveFromHolderClientRpc(); Position = position; Rotation = rotation; } } [ClientRpc] private void RemoveFromHolderClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1050513218u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1050513218u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && IsHeld) { Holder.Inventory.RemoveItem(this); } } } public void EnablePhysics(bool enable) { GrabbableObject.EnablePhysics(enable); } public void EnableMeshes(bool enable) { GrabbableObject.EnableItemMeshes(enable); } public void FallToGround(bool randomizePosition = false) { GrabbableObject.FallToGround(randomizePosition); } public bool PocketItem() { if (!IsHeld || (Object)(object)Holder.HeldItem != (Object)(object)this || IsTwoHanded) { return false; } GrabbableObject.PocketItem(); return true; } public bool GiveTo(Player player, bool switchTo = true) { if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to give item to player on client."); } return player.Inventory.TryAddItem(this, switchTo); } public void InitializeScrap() { if (RoundManager.Instance.AnomalyRandom != null) { InitializeScrap((int)((float)RoundManager.Instance.AnomalyRandom.Next(ItemProperties.minValue, ItemProperties.maxValue) * RoundManager.Instance.scrapValueMultiplier)); } else { InitializeScrap((int)((float)Random.Range(ItemProperties.minValue, ItemProperties.maxValue) * RoundManager.Instance.scrapValueMultiplier)); } } public void InitializeScrap(int scrapValue) { if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to initialize scrap on client."); } ScrapValue = scrapValue; InitializeScrapClientRpc(); } [ClientRpc] private void InitializeScrapClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1334565671u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1334565671u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } MeshFilter val3 = default(MeshFilter); if (((Component)GrabbableObject).gameObject.TryGetComponent<MeshFilter>(ref val3) && ItemProperties.meshVariants != null && ItemProperties.meshVariants.Length != 0) { if (RoundManager.Instance.ScrapValuesRandom != null) { val3.mesh = ItemProperties.meshVariants[RoundManager.Instance.ScrapValuesRandom.Next(ItemProperties.meshVariants.Length)]; } else { val3.mesh = ItemProperties.meshVariants[0]; } } MeshRenderer val4 = default(MeshRenderer); if (((Component)GrabbableObject).gameObject.TryGetComponent<MeshRenderer>(ref val4) && ItemProperties.materialVariants != null && ItemProperties.materialVariants.Length != 0) { if (RoundManager.Instance.ScrapValuesRandom != null) { ((Renderer)val4).sharedMaterial = ItemProperties.materialVariants[RoundManager.Instance.ScrapValuesRandom.Next(ItemProperties.materialVariants.Length)]; } else { ((Renderer)val4).sharedMaterial = ItemProperties.materialVariants[0]; } } } public static Item CreateAndSpawnItem(string itemName, bool andInitialize = true, Vector3 position = default(Vector3), Quaternion rotation = default(Quaternion)) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to create and spawn item on client."); } string name = itemName.ToLower(); GameObject val = ((IEnumerable<Item>)StartOfRound.Instance.allItemsList.itemsList).FirstOrDefault((Func<Item, bool>)((Item i) => i.itemName.ToLower().Contains(name)))?.spawnPrefab; if ((Object)(object)val != (Object)null) { GameObject obj = Object.Instantiate<GameObject>(val, position, rotation); obj.GetComponent<NetworkObject>().Spawn(false); Item component = obj.GetComponent<Item>(); if (component.IsScrap && andInitialize) { component.InitializeScrap(); } return component; } return null; } public static Item CreateAndGiveItem(string itemName, Player player, bool andInitialize = true, bool switchTo = true) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to create and give item on client."); } string name = itemName.ToLower(); GameObject val = ((IEnumerable<Item>)StartOfRound.Instance.allItemsList.itemsList).FirstOrDefault((Func<Item, bool>)((Item i) => i.itemName.ToLower().Contains(name)))?.spawnPrefab; if ((Object)(object)val != (Object)null) { GameObject obj = Object.Instantiate<GameObject>(val, Vector3.zero, default(Quaternion)); obj.GetComponent<NetworkObject>().Spawn(false); Item component = obj.GetComponent<Item>(); if (component.IsScrap && andInitialize) { component.InitializeScrap(); } component.GiveTo(player, switchTo); return component; } return null; } private void Awake() { GrabbableObject = ((Component)this).GetComponent<GrabbableObject>(); ScanNodeProperties = ((Component)GrabbableObject).gameObject.GetComponentInChildren<ScanNodeProperties>(); Dictionary.Add(GrabbableObject, this); } private void CloneProperties() { Item itemProperties = Object.Instantiate<Item>(ItemProperties); if (hasNewProps) { Object.Destroy((Object)(object)ItemProperties); } GrabbableObject.itemProperties = itemProperties; hasNewProps = true; } public override void OnDestroy() { Dictionary.Remove(GrabbableObject); ((NetworkBehaviour)this).OnDestroy(); } public static Item GetOrAdd(GrabbableObject grabbableObject) { if (Dictionary.TryGetValue(grabbableObject, out var value)) { return value; } return ((Component)grabbableObject).gameObject.AddComponent<Item>(); } public static Item Get(GrabbableObject grabbableObject) { if (Dictionary.TryGetValue(grabbableObject, out var value)) { return value; } return null; } public static bool TryGet(GrabbableObject grabbableObject, out Item item) { return Dictionary.TryGetValue(grabbableObject, out item); } public static Item Get(ulong netId) { return List.FirstOrDefault((Item i) => ((NetworkBehaviour)i).NetworkObjectId == netId); } public static bool TryGet(ulong netId, out Item item) { item = Get(netId); return (Object)(object)item != (Object)null; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Item() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(66243798u, new RpcReceiveHandler(__rpc_handler_66243798)); NetworkManager.__rpc_func_table.Add(949135576u, new RpcReceiveHandler(__rpc_handler_949135576)); NetworkManager.__rpc_func_table.Add(1528367091u, new RpcReceiveHandler(__rpc_handler_1528367091)); NetworkManager.__rpc_func_table.Add(2688253945u, new RpcReceiveHandler(__rpc_handler_2688253945)); NetworkManager.__rpc_func_table.Add(4227417717u, new RpcReceiveHandler(__rpc_handler_4227417717)); NetworkManager.__rpc_func_table.Add(3866863385u, new RpcReceiveHandler(__rpc_handler_3866863385)); NetworkManager.__rpc_func_table.Add(1050513218u, new RpcReceiveHandler(__rpc_handler_1050513218)); NetworkManager.__rpc_func_table.Add(1334565671u, new RpcReceiveHandler(__rpc_handler_1334565671)); } private static void __rpc_handler_66243798(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string grabbableNameClientRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref grabbableNameClientRpc, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((Item)(object)target).SetGrabbableNameClientRpc(grabbableNameClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_949135576(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 itemPositionClientRpc = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemPositionClientRpc); target.__rpc_exec_stage = (__RpcExecStage)2; ((Item)(object)target).SetItemPositionClientRpc(itemPositionClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1528367091(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Quaternion itemRotationClientRpc = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemRotationClientRpc); target.__rpc_exec_stage = (__RpcExecStage)2; ((Item)(object)target).SetItemRotationClientRpc(itemRotationClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2688253945(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 itemScaleClientRpc = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemScaleClientRpc); target.__rpc_exec_stage = (__RpcExecStage)2; ((Item)(object)target).SetItemScaleClientRpc(itemScaleClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4227417717(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool isScrapClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isScrapClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((Item)(object)target).SetIsScrapClientRpc(isScrapClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3866863385(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int scrapValueClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValueClientRpc); target.__rpc_exec_stage = (__RpcExecStage)2; ((Item)(object)target).SetScrapValueClientRpc(scrapValueClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1050513218(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((Item)(object)target).RemoveFromHolderClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1334565671(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((Item)(object)target).InitializeScrapClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Item"; } } public class Player : NetworkBehaviour { public class PlayerInventory : NetworkBehaviour { public Player Player { get; private set; } public Item[] Items => Player.PlayerController.ItemSlots.Select((GrabbableObject i) => (!((Object)(object)i != (Object)null)) ? null : Item.Dictionary[i]).ToArray(); public int CurrentSlot { get { return Player.PlayerController.currentItemSlot; } set { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (Player.IsLocalPlayer) { SetSlotServerRpc(value); } else if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { SetSlotClientRpc(value); } } } [ServerRpc(RequireOwnership = false)] private void SetSlotServerRpc(int slot, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00c8: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1475903090u, serverRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, slot); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1475903090u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && serverRpcParams.Receive.SenderClientId == Player.ClientId) { SetSlotClientRpc(slot); } } } [ClientRpc] private void SetSlotClientRpc(int slot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2977994897u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, slot); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2977994897u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Player.PlayerController.SwitchToItemSlot(slot, (GrabbableObject)null); } } } public int GetFirstEmptySlot() { return Player.PlayerController.FirstEmptyItemSlot(); } public bool TryGetFirstEmptySlot(out int slot) { slot = Player.PlayerController.FirstEmptyItemSlot(); return slot != -1; } public bool TryAddItem(Item item, bool switchTo = true) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to add item from client."); } if (TryGetFirstEmptySlot(out var slot)) { if (item.IsTwoHanded && !Player.HasFreeHands) { return false; } if (item.IsHeld) { item.RemoveFromHolder(); } ((NetworkBehaviour)item).NetworkObject.ChangeOwnership(Player.ClientId); if (item.IsTwoHanded) { SetSlotAndItemClientRpc(slot, ((NetworkBehaviour)item).NetworkObjectId); } else if (switchTo && Player.HasFreeHands) { SetSlotAndItemClientRpc(slot, ((NetworkBehaviour)item).NetworkObjectId); } else if (Player.PlayerController.currentItemSlot == slot) { SetSlotAndItemClientRpc(slot, ((NetworkBehaviour)item).NetworkObjectId); } else { SetItemInSlotClientRpc(slot, ((NetworkBehaviour)item).NetworkObjectId); } return true; } return false; } public bool TryAddItemToSlot(Item item, int slot, bool switchTo = true) { //IL_007a: 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_0083: 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) if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost) { throw new NoAuthorityException("Tried to add item from client."); } if (slot < Player.PlayerController.ItemSlots.Length && (Object)(object)Player.PlayerController.ItemSlots[slot] == (Object)null) { if (item.IsTwoHanded && !Player.HasFreeHands) { return false; }
plugins/LethalClunk/LethalClunk.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalClunk")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Mod to replace the Large Axle drop sound with the metal bar meme sound")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+32ab32b67da71ea7b44296192ba03dfcf26f159a")] [assembly: AssemblyProduct("LethalClunk")] [assembly: AssemblyTitle("LethalClunk")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public static class ExtensionMethods { public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOp) { TaskCompletionSource<object?> tcs = new TaskCompletionSource<object>(); asyncOp.completed += delegate { tcs.SetResult(null); }; return ((Task)tcs.Task).GetAwaiter(); } } namespace LethalClunk { [BepInPlugin("LethalClunk", "LethalClunk", "1.1.1")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("LethalClunk"); private readonly ManualLogSource logger; public Plugin() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown logger = Logger.CreateLogSource("LethalClunk"); } public void Awake() { harmony.PatchAll(); logger.LogInfo((object)"Plugin LethalClunk is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalClunk"; public const string PLUGIN_NAME = "LethalClunk"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace LethalClunk.Patches { [HarmonyPatch(typeof(GrabbableObject))] internal class LethalClunkPatch { private static ManualLogSource logger = Logger.CreateLogSource("LethalClunk"); [HarmonyPatch("Start")] [HarmonyPostfix] private static async void ReplaceLargeAxleSFX(GrabbableObject __instance) { Item item = __instance.itemProperties; AudioClip audioClip = await LoadAudioClip("metal_bar.wav"); if (item.itemName == "Large axle") { logger.LogInfo((object)"Large Axle Spawned"); if ((Object)(object)audioClip != (Object)null) { item.dropSFX = audioClip; } } } private static async Task<AudioClip?> LoadAudioClip(string clipName) { string fullPath = GetAssemblyFullPath(clipName); UnityWebRequest audioClipReq = UnityWebRequestMultimedia.GetAudioClip(fullPath, (AudioType)20); await (AsyncOperation)(object)audioClipReq.SendWebRequest(); if (audioClipReq.error != null) { logger.LogError((object)audioClipReq.error); logger.LogError((object)"Failed to load audio clip for LethalClunk, sound will not be replaced"); return null; } AudioClip audioClip = DownloadHandlerAudioClip.GetContent(audioClipReq); ((Object)audioClip).name = Path.GetFileName(fullPath); return audioClip; } private static string GetAssemblyFullPath(string? additionalPath) { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string path = ((additionalPath != null) ? Path.Combine(directoryName, ".\\" + additionalPath) : directoryName); return Path.GetFullPath(path); } } }
plugins/LethalCompanyInputUtils/LethalCompanyInputUtils.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalCompanyInputUtils.Components; using LethalCompanyInputUtils.Components.Section; using LethalCompanyInputUtils.Data; using LethalCompanyInputUtils.Glyphs; using LethalCompanyInputUtils.Utils; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Utilities; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalCompanyInputUtils")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+913017c58a6ad55b5050a44817920ad9c63ce200")] [assembly: AssemblyProduct("LethalCompanyInputUtils")] [assembly: AssemblyTitle("LethalCompanyInputUtils")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalCompanyInputUtils { public static class LcInputActionApi { private static readonly Dictionary<string, LcInputActions> InputActionsMap = new Dictionary<string, LcInputActions>(); internal static bool PrefabLoaded; internal static RemapContainerController? ContainerInstance; internal static IReadOnlyCollection<LcInputActions> InputActions => InputActionsMap.Values; internal static void LoadIntoUI(KepRemapPanel panel) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) AdjustSizeAndPos(panel); LayoutElement val = EnsureLayoutElement(panel); panel.LoadKeybindsUI(); float horizontalOffset = panel.horizontalOffset; Rect rect = ((Component)((Transform)panel.keyRemapContainer).parent).GetComponent<RectTransform>().rect; float num = Mathf.Floor(((Rect)(ref rect)).width / horizontalOffset); int count = panel.keySlots.Count; int num2 = NumberOfActualKeys(panel.keySlots); int num3 = count - num2; panel.maxVertical = (float)num2 / num + (float)num3; if (ContainerInstance != null && ContainerInstance.legacyButton != null) { ((TMP_Text)((Component)ContainerInstance.legacyButton).GetComponentInChildren<TextMeshProUGUI>()).SetText($"> Show Legacy Controls ({num2} present)", true); } if (count == 0) { return; } val.minHeight = (panel.maxVertical + 1f) * panel.verticalOffset; int num4 = 0; int num5 = 0; foreach (GameObject keySlot in panel.keySlots) { if ((float)num5 > num) { num4++; num5 = 0; } keySlot.GetComponent<RectTransform>().anchoredPosition = new Vector2((float)num5 * panel.horizontalOffset, (float)num4 * (0f - panel.verticalOffset)); if (keySlot.GetComponentInChildren<SettingsOption>() == null) { num5 = 0; num4++; } else { num5++; } } } public static bool RemapContainerVisible() { if (ContainerInstance == null) { return false; } return ContainerInstance.LayerShown > 0; } private static int NumberOfActualKeys(List<GameObject> keySlots) { int num = 0; foreach (GameObject keySlot in keySlots) { if (keySlot.GetComponentInChildren<SettingsOption>() != null) { num++; } } return num; } internal static void CloseContainerLayer() { if (ContainerInstance != null) { ContainerInstance.HideHighestLayer(); } } private static void AdjustSizeAndPos(KepRemapPanel panel) { GameObject gameObject = ((Component)((Transform)panel.keyRemapContainer).parent).gameObject; if (gameObject.GetComponent<ContentSizeFitter>() == null) { panel.keyRemapContainer.SetPivotY(1f); panel.keyRemapContainer.SetAnchorMinY(1f); panel.keyRemapContainer.SetAnchorMaxY(1f); panel.keyRemapContainer.SetAnchoredPosY(0f); panel.keyRemapContainer.SetLocalPosY(0f); ContentSizeFitter obj = gameObject.AddComponent<ContentSizeFitter>(); obj.horizontalFit = (FitMode)0; obj.verticalFit = (FitMode)1; } } private static LayoutElement EnsureLayoutElement(KepRemapPanel panel) { GameObject gameObject = ((Component)((Transform)panel.keyRemapContainer).parent).gameObject; LayoutElement component = gameObject.GetComponent<LayoutElement>(); if (component != null) { return component; } return gameObject.AddComponent<LayoutElement>(); } internal static void CalculateVerticalMaxForGamepad(KepRemapPanel panel) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) int num = panel.remappableKeys.Count((RemappableKey key) => key.gamepadOnly); float horizontalOffset = panel.horizontalOffset; Rect rect = ((Component)((Transform)panel.keyRemapContainer).parent).GetComponent<RectTransform>().rect; float num2 = Mathf.Floor(((Rect)(ref rect)).width / horizontalOffset); panel.maxVertical = (float)num / num2; LayoutElement obj = EnsureLayoutElement(panel); obj.minHeight += (panel.maxVertical + 3f) * panel.verticalOffset; } internal static void ResetLoadedInputActions() { PrefabLoaded = false; foreach (LcInputActions inputAction in InputActions) { inputAction.Loaded = false; } } internal static void RegisterInputActions(LcInputActions lcInputActions, InputActionMapBuilder builder) { if (!InputActionsMap.TryAdd(lcInputActions.Id, lcInputActions)) { Logging.Warn("The mod [" + lcInputActions.Plugin.GUID + "] instantiated an Actions class [" + lcInputActions.GetType().Name + "] more than once!\n\t These classes should be treated as singletons!, do not instantiate more than once!"); } else { lcInputActions.CreateInputActions(in builder); InputActionSetupExtensions.AddActionMap(lcInputActions.GetAsset(), builder.Build()); lcInputActions.GetAsset().Enable(); lcInputActions.OnAssetLoaded(); lcInputActions.Load(); lcInputActions.BuildActionRefs(); } } internal static void DisableForRebind() { foreach (LcInputActions inputAction in InputActions) { if (inputAction.Enabled) { inputAction.Disable(); } } } internal static void ReEnableFromRebind() { foreach (LcInputActions inputAction in InputActions) { if (inputAction.WasEnabled) { inputAction.Enable(); } } } internal static void SaveOverrides() { foreach (LcInputActions inputAction in InputActions) { inputAction.Save(); } } internal static void LoadOverrides() { foreach (LcInputActions inputAction in InputActions) { inputAction.Load(); } } } [BepInPlugin("com.rune580.LethalCompanyInputUtils", "Lethal Company Input Utils", "0.6.3")] public class LethalCompanyInputUtilsPlugin : BaseUnityPlugin { public const string ModId = "com.rune580.LethalCompanyInputUtils"; public const string ModName = "Lethal Company Input Utils"; public const string ModVersion = "0.6.3"; private Harmony? _harmony; private void Awake() { Logging.SetLogSource(((BaseUnityPlugin)this).Logger); _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.rune580.LethalCompanyInputUtils"); SceneManager.activeSceneChanged += OnSceneChanged; InputSystem.onDeviceChange += OnDeviceChanged; LoadAssetBundles(); ControllerGlyph.LoadGlyphs(); FsUtils.EnsureControlsDir(); RegisterExtendedMouseLayout(); Logging.Info("InputUtils 0.6.3 has finished loading!"); } private void LoadAssetBundles() { Assets.AddBundle("ui-assets"); } private static void OnSceneChanged(Scene current, Scene next) { LcInputActionApi.ResetLoadedInputActions(); CameraUtils.ClearUiCameraReference(); BindsListController.OffsetCompensation = ((((Scene)(ref next)).name != "MainMenu") ? 20 : 0); } private static void OnDeviceChanged(InputDevice device, InputDeviceChange state) { RebindButton.ReloadGlyphs(); } private static void RegisterExtendedMouseLayout() { InputSystem.RegisterLayoutOverride("{\n \"name\": \"InputUtilsExtendedMouse\",\n \"extend\": \"Mouse\",\n \"controls\": [\n {\n \"name\": \"scroll/up\",\n \"layout\": \"Button\",\n \"useStateFrom\": \"scroll/up\",\n \"format\": \"BIT\",\n \"synthetic\": true\n },\n {\n \"name\": \"scroll/down\",\n \"layout\": \"Button\",\n \"useStateFrom\": \"scroll/down\",\n \"format\": \"BIT\",\n \"synthetic\": true\n },\n {\n \"name\": \"scroll/left\",\n \"layout\": \"Button\",\n \"useStateFrom\": \"scroll/left\",\n \"format\": \"BIT\",\n \"synthetic\": true\n },\n {\n \"name\": \"scroll/right\",\n \"layout\": \"Button\",\n \"useStateFrom\": \"scroll/right\",\n \"format\": \"BIT\",\n \"synthetic\": true\n }\n ]\n}", (string)null); Logging.Info("Registered InputUtilsExtendedMouse Layout Override!"); } } } namespace LethalCompanyInputUtils.Utils { internal static class AssemblyUtils { public static BepInPlugin? GetBepInPlugin(this Assembly assembly) { foreach (Type validType in assembly.GetValidTypes()) { BepInPlugin customAttribute = ((MemberInfo)validType).GetCustomAttribute<BepInPlugin>(); if (customAttribute != null) { return customAttribute; } } return null; } public static IEnumerable<Type> GetValidTypes(this Assembly assembly) { try { return assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type type) => (object)type != null); } } } internal static class Assets { private static readonly List<AssetBundle> AssetBundles = new List<AssetBundle>(); private static readonly Dictionary<string, int> AssetIndices = new Dictionary<string, int>(); public static void AddBundle(string bundleName) { AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(FsUtils.AssetBundlesDir, bundleName)); int count = AssetBundles.Count; AssetBundles.Add(val); string[] allAssetNames = val.GetAllAssetNames(); for (int i = 0; i < allAssetNames.Length; i++) { string text = allAssetNames[i].ToLowerInvariant(); if (text.StartsWith("assets/")) { string text2 = text; int length = "assets/".Length; text = text2.Substring(length, text2.Length - length); } AssetIndices[text] = count; } } public static T? Load<T>(string assetName) where T : Object { try { assetName = assetName.ToLowerInvariant(); if (assetName.StartsWith("assets/")) { string text = assetName; int length = "assets/".Length; assetName = text.Substring(length, text.Length - length); } int index = AssetIndices[assetName]; return AssetBundles[index].LoadAsset<T>("assets/" + assetName); } catch (Exception arg) { Logging.Error($"Couldn't load asset [{assetName}] exception: {arg}"); return default(T); } } } internal static class CameraUtils { private static Camera? _uiCamera; public static Camera GetBestUiCamera() { //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) if (_uiCamera != null && Object.op_Implicit((Object)(object)_uiCamera)) { return _uiCamera; } _uiCamera = null; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "MainMenu") { GameObject val = ((IEnumerable<GameObject>)((Scene)(ref activeScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject go) => ((Object)go).name == "UICamera")); if (val == null) { Logging.Warn("Failed to find UICamera at MainMenu, falling back to Camera.current!"); return Camera.current; } Camera component = val.GetComponent<Camera>(); if (component == null) { Logging.Warn("Failed to find Camera component on UICamera, falling back to Camera.current!"); return Camera.current; } _uiCamera = component; } else { GameObject val2 = ((IEnumerable<GameObject>)((Scene)(ref activeScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject go) => ((Object)go).name == "Systems")); if (val2 == null) { Logging.Warn("Failed to find UICamera in active scene, falling back to Camera.current!"); return Camera.current; } Transform val3 = val2.transform.Find("UI/UICamera"); if (val3 == null) { Logging.Warn("Failed to find UICamera at MainMenu, falling back to Camera.current!"); return Camera.current; } Camera component2 = ((Component)val3).GetComponent<Camera>(); if (component2 == null) { Logging.Warn("Failed to find Camera component on UICamera, falling back to Camera.current!"); return Camera.current; } _uiCamera = component2; } return _uiCamera; } public static void ClearUiCameraReference() { _uiCamera = null; } } internal static class DebugUtils { public static string ToPrettyString<TKey, TValue>(this IDictionary<TKey, TValue> dictionary) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("{"); using (IEnumerator<KeyValuePair<TKey, TValue>> enumerator = dictionary.GetEnumerator()) { string[] obj; object obj3; for (; enumerator.MoveNext(); obj[3] = (string)obj3, obj[4] = "\",", stringBuilder.AppendLine(string.Concat(obj))) { enumerator.Current.Deconstruct(out var key, out var value); TKey val = key; TValue val2 = value; obj = new string[5] { "\t\"", null, null, null, null }; ref TKey reference = ref val; key = default(TKey); object obj2; if (key == null) { key = reference; reference = ref key; if (key == null) { obj2 = null; goto IL_007c; } } obj2 = reference.ToString(); goto IL_007c; IL_007c: obj[1] = (string)obj2; obj[2] = "\": \""; ref TValue reference2 = ref val2; value = default(TValue); if (value == null) { value = reference2; reference2 = ref value; if (value == null) { obj3 = null; continue; } } obj3 = reference2.ToString(); } } stringBuilder.Remove(stringBuilder.Length - 1, 1); stringBuilder.AppendLine("}"); return stringBuilder.ToString(); } public static void DrawGizmoUiRectWorld(this RectTransform rectTransform) { //IL_0001: 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) //IL_0017: 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_0037: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) float z = ((Transform)rectTransform).position.z; Rect val = rectTransform.UiBoundsWorld(); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(((Rect)(ref val)).min.x, ((Rect)(ref val)).min.y, z); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(((Rect)(ref val)).min.x, ((Rect)(ref val)).max.y, z); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(((Rect)(ref val)).max.x, ((Rect)(ref val)).max.y, z); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(((Rect)(ref val)).max.x, ((Rect)(ref val)).min.y, z); Gizmos.DrawLine(val2, val3); Gizmos.DrawLine(val3, val4); Gizmos.DrawLine(val4, val5); Gizmos.DrawLine(val5, val2); } public static void DrawGizmoUiRect(this RectTransform rectTransform, Vector3 position) { //IL_0000: 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) float z = position.z; Rect val = rectTransform.UiBounds(position); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(((Rect)(ref val)).min.x, ((Rect)(ref val)).min.y, z); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(((Rect)(ref val)).min.x, ((Rect)(ref val)).max.y, z); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(((Rect)(ref val)).max.x, ((Rect)(ref val)).max.y, z); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(((Rect)(ref val)).max.x, ((Rect)(ref val)).min.y, z); Gizmos.DrawLine(val2, val3); Gizmos.DrawLine(val3, val4); Gizmos.DrawLine(val4, val5); Gizmos.DrawLine(val5, val2); } public static void DrawGizmoRect(this Rect rect, Vector3 position) { //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) //IL_0015: 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_0028: 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_0043: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) float z = position.z; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Rect)(ref rect)).min.x + position.x, ((Rect)(ref rect)).min.y + position.y, z); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(((Rect)(ref rect)).min.x + position.x, ((Rect)(ref rect)).max.y + position.y, z); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(((Rect)(ref rect)).max.x + position.x, ((Rect)(ref rect)).max.y + position.y, z); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(((Rect)(ref rect)).max.x + position.x, ((Rect)(ref rect)).min.y + position.y, z); Gizmos.DrawLine(val, val2); Gizmos.DrawLine(val2, val3); Gizmos.DrawLine(val3, val4); Gizmos.DrawLine(val4, val); } } internal static class DeconstructUtils { public static void Deconstruct(this Rect rect, out Vector2 min, out Vector2 max) { //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) //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) min = new Vector2(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMin); max = new Vector2(((Rect)(ref rect)).xMax, ((Rect)(ref rect)).yMax); } public static void Deconstruct(this Vector3 vector, out float x, out float y, out float z) { //IL_0001: 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_0011: Unknown result type (might be due to invalid IL or missing references) x = vector.x; y = vector.y; z = vector.z; } } internal static class FsUtils { private static string? _assetBundlesDir; public static string SaveDir { get; } = GetSaveDir(); public static string Pre041ControlsDir { get; } = Path.Combine(Paths.BepInExRootPath, "controls"); public static string ControlsDir { get; } = Path.Combine(Paths.ConfigPath, "controls"); public static string AssetBundlesDir { get { if (_assetBundlesDir == null) { _assetBundlesDir = GetAssetBundlesDir(); } if (string.IsNullOrEmpty(_assetBundlesDir)) { string text = Chainloader.PluginInfos.ToPrettyString(); Logging.Warn("InputUtils is loading in an invalid state!\n\tOne of the following mods may be the culprit:\n" + text); return ""; } return _assetBundlesDir; } } private static string GetSaveDir() { string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); return Path.Combine(folderPath, "AppData", "LocalLow", "ZeekerssRBLX", "Lethal Company"); } public static void EnsureControlsDir() { if (!Directory.Exists(ControlsDir)) { Directory.CreateDirectory(ControlsDir); } } private static string? GetAssetBundlesDir() { if (!Chainloader.PluginInfos.TryGetValue("com.rune580.LethalCompanyInputUtils", out var value)) { return null; } string text = Path.Combine((Directory.GetParent(value.Location) ?? throw new NotSupportedException(BadInstallError())).FullName, "AssetBundles"); if (!Directory.Exists(text)) { throw new NotSupportedException(BadInstallError()); } return text; static string BadInstallError() { Logging.Error("InputUtils can't find it's required AssetBundles! This will cause many issues!\nThis either means your mod manager incorrectly installed InputUtilsor if you've manually installed InputUtils, you've done so incorrectly. If you manually installed don't bother reporting the issue, I only provide support to people who use mod managers."); return "InputUtils can't find it's required AssetBundles! This will cause many issues!\nThis either means your mod manager incorrectly installed InputUtilsor if you've manually installed InputUtils, you've done so incorrectly. If you manually installed don't bother reporting the issue, I only provide support to people who use mod managers."; } } } internal static class InputSystemUtils { public static bool IsGamepadOnly(this InputAction action) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return ((IEnumerable<InputBinding>)(object)action.bindings).All((InputBinding binding) => !binding.IsKbmBind()); } public static bool IsKbmBind(this InputBinding binding) { string path = ((InputBinding)(ref binding)).path; if (string.Equals(path, "<InputUtils-Kbm-Not-Bound>")) { return true; } if (path.StartsWith("<Keyboard>", StringComparison.InvariantCultureIgnoreCase)) { return true; } if (path.StartsWith("<Mouse>", StringComparison.InvariantCultureIgnoreCase)) { return true; } return false; } } internal static class Logging { private static ManualLogSource? _logSource; internal static void SetLogSource(ManualLogSource logSource) { _logSource = logSource; } public static void Error(object data) { Error(data.ToString()); } public static void Warn(object data) { Warn(data.ToString()); } public static void Info(object data) { Info(data.ToString()); } public static void Error(string msg) { if (_logSource == null) { Debug.LogError((object)("[Lethal Company Input Utils] [Error] " + msg)); } else { _logSource.LogError((object)msg); } } public static void Warn(string msg) { if (_logSource == null) { Debug.LogWarning((object)("[Lethal Company Input Utils] [Warning] " + msg)); } else { _logSource.LogWarning((object)msg); } } public static void Info(string msg) { if (_logSource == null) { Debug.Log((object)("[Lethal Company Input Utils] [Info] " + msg)); } else { _logSource.LogInfo((object)msg); } } } internal static class RectTransformExtensions { public static void SetLocalPosX(this RectTransform rectTransform, float x) { //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) //IL_000f: 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) Vector3 localPosition = ((Transform)rectTransform).localPosition; ((Transform)rectTransform).localPosition = new Vector3(x, localPosition.y, localPosition.z); } public static void SetLocalPosY(this RectTransform rectTransform, float y) { //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_0008: 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_0015: Unknown result type (might be due to invalid IL or missing references) Vector3 localPosition = ((Transform)rectTransform).localPosition; ((Transform)rectTransform).localPosition = new Vector3(localPosition.x, y, localPosition.z); } public static void SetPivotY(this RectTransform rectTransform, float y) { //IL_0002: 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) rectTransform.pivot = new Vector2(rectTransform.pivot.x, y); } public static void SetAnchorMinY(this RectTransform rectTransform, float y) { //IL_0002: 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) rectTransform.anchorMin = new Vector2(rectTransform.anchorMin.x, y); } public static void SetAnchorMaxY(this RectTransform rectTransform, float y) { //IL_0002: 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) rectTransform.anchorMax = new Vector2(rectTransform.anchorMax.x, y); } public static void SetAnchoredPosX(this RectTransform rectTransform, float x) { //IL_0003: 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) rectTransform.anchoredPosition = new Vector2(x, rectTransform.anchoredPosition.y); } public static void SetAnchoredPosY(this RectTransform rectTransform, float y) { //IL_0002: 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) rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, y); } public static void SetSizeDeltaX(this RectTransform rectTransform, float x) { //IL_0003: 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) rectTransform.sizeDelta = new Vector2(x, rectTransform.sizeDelta.y); } public static Rect UiBoundsWorld(this RectTransform rectTransform) { //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_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_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) //IL_001c: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Transform)rectTransform).position; Rect rect = rectTransform.rect; Vector3 lossyScale = ((Transform)rectTransform).lossyScale; return new Rect(((Rect)(ref rect)).x * lossyScale.x + position.x, ((Rect)(ref rect)).y * lossyScale.y + position.y, ((Rect)(ref rect)).width * lossyScale.x, ((Rect)(ref rect)).height * lossyScale.y); } [Obsolete("Use GetRelativeRect")] public static Rect UiBounds(this RectTransform rectTransform, Vector3 position) { //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_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_0015: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) Rect rect = rectTransform.rect; Vector3 lossyScale = ((Transform)rectTransform).lossyScale; return new Rect(((Rect)(ref rect)).x * lossyScale.x + position.x, ((Rect)(ref rect)).y * lossyScale.y + position.y, ((Rect)(ref rect)).width * lossyScale.x, ((Rect)(ref rect)).height * lossyScale.y); } public static Rect GetRelativeRect(this RectTransform rectTransform, RectTransform worldRectTransform) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) Camera bestUiCamera = CameraUtils.GetBestUiCamera(); Vector3[] array = (Vector3[])(object)new Vector3[4]; worldRectTransform.GetWorldCorners(array); Vector2[] array2 = (Vector2[])(object)new Vector2[4]; for (int i = 0; i < array.Length; i++) { array2[i] = RectTransformUtility.WorldToScreenPoint(bestUiCamera, array[i]); } Vector2[] array3 = (Vector2[])(object)new Vector2[4]; for (int j = 0; j < array2.Length; j++) { RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, array2[j], bestUiCamera, ref array3[j]); } Vector2 val = array3[0]; Vector2 val2 = array3[0]; Vector2[] array4 = array3; foreach (Vector2 val3 in array4) { val = Vector2.Min(val, val3); val2 = Vector2.Max(val2, val3); } Vector2 val4 = val2 - val; return new Rect(val.x, val.y, val4.x, val4.y); } public static Vector2 WorldToLocalPoint(this RectTransform rectTransform, Vector3 worldPoint) { //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_000d: 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_0019: Unknown result type (might be due to invalid IL or missing references) Camera bestUiCamera = CameraUtils.GetBestUiCamera(); Vector2 val = RectTransformUtility.WorldToScreenPoint(bestUiCamera, worldPoint); Vector2 result = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, val, bestUiCamera, ref result); return result; } public static Vector2 WorldToLocalPoint(this RectTransform rectTransform, RectTransform other) { //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) return rectTransform.WorldToLocalPoint(((Transform)other).position); } public static float WorldMaxY(this RectTransform rectTransform) { //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) Rect val = rectTransform.UiBoundsWorld(); return ((Rect)(ref val)).max.y; } public static float WorldMinY(this RectTransform rectTransform) { //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) Rect val = rectTransform.UiBoundsWorld(); return ((Rect)(ref val)).min.y; } } internal static class RectUtils { public static Vector2 CenteredPos(this Rect rect) { //IL_0002: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) return ((Rect)(ref rect)).min + ((Rect)(ref rect)).size / 2f; } } internal static class RuntimeHelper { public static Vector3 LocalPositionRelativeTo(this Transform transform, Transform parent) { //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_0008: 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_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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; Transform val2 = transform; do { val += transform.localPosition; val2 = val2.parent; } while ((Object)(object)val2 != (Object)(object)parent); return val; } public static void DisableKeys(this IEnumerable<RemappableKey> keys) { foreach (RemappableKey key in keys) { key.currentInput.action.Disable(); } } public static void EnableKeys(this IEnumerable<RemappableKey> keys) { foreach (RemappableKey key in keys) { key.currentInput.action.Enable(); } } } internal static class VectorUtils { public static Vector3 Mul(this Vector3 left, Vector3 right) { //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_000d: 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_001a: 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_0027: Unknown result type (might be due to invalid IL or missing references) return new Vector3(left.x * right.x, left.y * right.y, left.z * right.z); } } } namespace LethalCompanyInputUtils.Utils.Anim { public interface ITweenValue { bool IgnoreTimeScale { get; } float Duration { get; } void TweenValue(float percentage); bool ValidTarget(); } public class TweenRunner<T> where T : struct, ITweenValue { protected MonoBehaviour? CoroutineContainer; protected IEnumerator? Tween; private static IEnumerator Start(T tweenValue) { if (tweenValue.ValidTarget()) { float elapsedTime = 0f; while (elapsedTime < tweenValue.Duration) { elapsedTime += (tweenValue.IgnoreTimeScale ? Time.unscaledDeltaTime : Time.deltaTime); float percentage = Mathf.Clamp01(elapsedTime / tweenValue.Duration); tweenValue.TweenValue(percentage); yield return null; } tweenValue.TweenValue(1f); } } public void Init(MonoBehaviour coroutineContainer) { CoroutineContainer = coroutineContainer; } public void StartTween(T tweenValue) { if (CoroutineContainer != null) { if (Tween != null) { CoroutineContainer.StopCoroutine(Tween); Tween = null; } if (!((Component)CoroutineContainer).gameObject.activeInHierarchy) { tweenValue.TweenValue(1f); return; } Tween = Start(tweenValue); CoroutineContainer.StartCoroutine(Tween); } } public void StopTween() { if (Tween != null && CoroutineContainer != null) { CoroutineContainer.StopCoroutine(Tween); Tween = null; } } } } namespace LethalCompanyInputUtils.Utils.Anim.TweenValues { public struct Vector3Tween : ITweenValue { private class Vector3TweenCallback : UnityEvent<Vector3> { } private Vector3TweenCallback? _target; public float Duration { get; set; } public Vector3 StartValue { get; set; } public Vector3 TargetValue { get; set; } public bool IgnoreTimeScale { get; set; } public void TweenValue(float percentage) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (ValidTarget()) { Vector3 val = Vector3.Lerp(StartValue, TargetValue, percentage); ((UnityEvent<Vector3>)_target).Invoke(val); } } public void AddOnChangedCallback(UnityAction<Vector3> callback) { if (_target == null) { _target = new Vector3TweenCallback(); } ((UnityEvent<Vector3>)_target).AddListener(callback); } public bool ValidTarget() { return _target != null; } } } namespace LethalCompanyInputUtils.Patches { public static class InGamePlayerSettingsPatches { [HarmonyPatch(typeof(IngamePlayerSettings), "SaveChangedSettings")] public static class SaveChangedSettingsPatch { public static void Prefix() { LcInputActionApi.SaveOverrides(); } } [HarmonyPatch(typeof(IngamePlayerSettings), "DiscardChangedSettings")] public static class DiscardChangedSettingsPatch { public static void Prefix() { LcInputActionApi.LoadOverrides(); } } } public static class InputControlPathPatches { [HarmonyPatch] public static class ToHumanReadableStringPatch { public static IEnumerable<MethodBase> TargetMethods() { return from method in AccessTools.GetDeclaredMethods(typeof(InputControlPath)) where method.Name == "ToHumanReadableString" && method.ReturnType == typeof(string) select method; } public static void Postfix(ref string __result) { string text = __result; if ((text == "<InputUtils-Gamepad-Not-Bound>" || text == "<InputUtils-Kbm-Not-Bound>") ? true : false) { __result = ""; } } } } public static class KeyRemapPanelPatches { [HarmonyPatch(typeof(KepRemapPanel), "OnEnable")] public static class LoadKeybindsUIPatch { [CompilerGenerated] private static class <>O { public static UnityAction <0>__CloseContainerLayer; } public static void Prefix(KepRemapPanel __instance) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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_0202: Expected O, but got Unknown //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown LcInputActionApi.DisableForRebind(); if (LcInputActionApi.PrefabLoaded && LcInputActionApi.ContainerInstance != null) { LcInputActionApi.ContainerInstance.baseGameKeys.DisableKeys(); return; } GameObject val = Object.Instantiate<GameObject>(Assets.Load<GameObject>("Prefabs/InputUtilsRemapContainer.prefab"), ((Component)__instance).transform); GameObject val2 = Object.Instantiate<GameObject>(Assets.Load<GameObject>("Prefabs/Legacy Holder.prefab"), ((Component)__instance).transform); if (val == null || val2 == null) { return; } Transform val3 = ((Component)__instance).transform.Find("Scroll View"); if (val3 != null) { val3.SetParent(val2.transform); List<RemappableKey> remappableKeys = __instance.remappableKeys; __instance.remappableKeys = new List<RemappableKey>(); val2.SetActive(false); GameObject gameObject = ((Component)((Component)__instance).transform.Find("Back")).gameObject; Button component = gameObject.GetComponent<Button>(); GameObject obj = Object.Instantiate<GameObject>(gameObject, val2.transform, true); Object.DestroyImmediate((Object)(object)obj.GetComponentInChildren<SettingsOption>()); Button component2 = obj.GetComponent<Button>(); component2.onClick = new ButtonClickedEvent(); ButtonClickedEvent onClick = component2.onClick; object obj2 = <>O.<0>__CloseContainerLayer; if (obj2 == null) { UnityAction val4 = LcInputActionApi.CloseContainerLayer; <>O.<0>__CloseContainerLayer = val4; obj2 = (object)val4; } ((UnityEvent)onClick).AddListener((UnityAction)obj2); GameObject obj3 = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent); Object.DestroyImmediate((Object)(object)obj3.GetComponentInChildren<SettingsOption>()); Button component3 = obj3.GetComponent<Button>(); component3.onClick = new ButtonClickedEvent(); RectTransform component4 = obj3.GetComponent<RectTransform>(); component4.SetAnchoredPosY(component4.anchoredPosition.y + 25f); component4.SetSizeDeltaX(component4.sizeDelta.x + 180f); RectTransform component5 = ((Component)((Transform)component4).Find("SelectionHighlight")).GetComponent<RectTransform>(); component5.SetSizeDeltaX(410f); component5.offsetMax = new Vector2(410f, component5.offsetMax.y); component5.offsetMin = new Vector2(0f, component5.offsetMin.y); RemapContainerController component6 = val.GetComponent<RemapContainerController>(); component6.baseGameKeys = remappableKeys; component6.backButton = component; component6.legacyButton = component3; component6.legacyHolder = val2; component6.baseGameKeys.DisableKeys(); ((UnityEvent)component3.onClick).AddListener(new UnityAction(component6.ShowLegacyUi)); component6.LoadUi(); Button component7 = ((Component)((Component)__instance).transform.Find("SetDefault")).gameObject.GetComponent<Button>(); ((UnityEventBase)component7.onClick).RemoveAllListeners(); ((UnityEvent)component7.onClick).AddListener(new UnityAction(component6.OnSetToDefault)); val2.transform.SetAsLastSibling(); LcInputActionApi.PrefabLoaded = true; } } public static void Postfix(KepRemapPanel __instance) { LcInputActionApi.LoadIntoUI(__instance); } } [HarmonyPatch(typeof(KepRemapPanel), "OnDisable")] public static class UnloadKeybindsUIPatch { public static void Prefix() { if (LcInputActionApi.ContainerInstance != null) { LcInputActionApi.ContainerInstance.baseGameKeys.EnableKeys(); } } } } public static class QuickMenuManagerPatches { [HarmonyPatch(typeof(QuickMenuManager), "CloseQuickMenu")] public static class OpenMenuPerformedPatch { public static bool Prefix(QuickMenuManager __instance) { if (LcInputActionApi.RemapContainerVisible() && __instance.isMenuOpen) { LcInputActionApi.CloseContainerLayer(); return false; } return true; } } } public static class SettingsOptionPatches { [HarmonyPatch(typeof(SettingsOption), "SetBindingToCurrentSetting")] public static class SetBindingToCurrentSettingPatch { public static bool Prefix(SettingsOption __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //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) if ((int)__instance.optionType != 6) { return true; } Enumerator<InputBinding> enumerator = __instance.rebindableAction.action.bindings.GetEnumerator(); try { while (enumerator.MoveNext()) { InputBinding current = enumerator.Current; if (__instance.gamepadOnlyRebinding) { if (!string.Equals(((InputBinding)(ref current)).effectivePath, "<InputUtils-Gamepad-Not-Bound>")) { continue; } } else if (!string.Equals(((InputBinding)(ref current)).effectivePath, "<InputUtils-Kbm-Not-Bound>")) { continue; } ((TMP_Text)__instance.currentlyUsedKeyText).SetText("", true); return false; } } finally { ((IDisposable)enumerator).Dispose(); } return true; } } } } namespace LethalCompanyInputUtils.Glyphs { [CreateAssetMenu] public class ControllerGlyph : ScriptableObject { public List<string> validGamepadTypes = new List<string>(); public List<GlyphDef> glyphSet = new List<GlyphDef>(); private readonly Dictionary<string, Sprite?> _glyphLut = new Dictionary<string, Sprite>(); private static readonly List<ControllerGlyph> Instances = new List<ControllerGlyph>(); private static bool _loaded; public static ControllerGlyph? MouseGlyphs { get; private set; } public bool IsCurrent { get { Gamepad current = Gamepad.current; if (current == null) { return false; } return validGamepadTypes.Any((string gamepadTypeName) => string.Equals(gamepadTypeName, ((object)current).GetType().Name)); } } public Sprite this[string controlPath] { get { if (_glyphLut.Count == 0) { UpdateLut(); } return _glyphLut.GetValueOrDefault(controlPath, null); } } public static ControllerGlyph? GetBestMatching() { if (Instances.Count == 0) { return null; } foreach (ControllerGlyph instance in Instances) { if (instance.IsCurrent) { return instance; } } return Instances[0]; } internal static void LoadGlyphs() { if (!_loaded) { Assets.Load<ControllerGlyph>("controller glyphs/xbox series x glyphs.asset"); Assets.Load<ControllerGlyph>("controller glyphs/dualsense glyphs.asset"); MouseGlyphs = Assets.Load<ControllerGlyph>("controller glyphs/mouse glyphs.asset"); _loaded = true; } } private void Awake() { if (!Instances.Contains(this)) { Instances.Add(this); } } private void UpdateLut() { foreach (GlyphDef item in glyphSet) { _glyphLut[item.controlPath] = item.glyphSprite; } } private void OnDestroy() { if (Instances.Contains(this)) { Instances.Remove(this); } } } [CreateAssetMenu] public class GlyphDef : ScriptableObject { public string controlPath = ""; public Sprite? glyphSprite; } } namespace LethalCompanyInputUtils.Data { [Serializable] public struct BindingOverride { public string? action; public string? origPath; public string? path; } [Serializable] public class BindingOverrides { public List<BindingOverride> overrides; private BindingOverrides() { overrides = new List<BindingOverride>(); } public BindingOverrides(IEnumerable<InputBinding> bindings) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) overrides = new List<BindingOverride>(); foreach (InputBinding binding in bindings) { InputBinding current = binding; if (((InputBinding)(ref current)).hasOverrides) { BindingOverride item = new BindingOverride { action = ((InputBinding)(ref current)).action, origPath = ((InputBinding)(ref current)).path, path = ((InputBinding)(ref current)).overridePath }; overrides.Add(item); } } } public void LoadInto(InputActionAsset asset) { foreach (BindingOverride @override in overrides) { InputAction obj = asset.FindAction(@override.action, false); if (obj != null) { InputActionRebindingExtensions.ApplyBindingOverride(obj, @override.path, (string)null, @override.origPath); } } } public static BindingOverrides FromJson(string json) { BindingOverrides bindingOverrides = new BindingOverrides(); JToken value = JsonConvert.DeserializeObject<JObject>(json).GetValue("overrides"); bindingOverrides.overrides = value.ToObject<List<BindingOverride>>(); return bindingOverrides; } } } namespace LethalCompanyInputUtils.Components { [RequireComponent(typeof(RectTransform))] public class BindsListController : MonoBehaviour { public GameObject? sectionHeaderPrefab; public GameObject? sectionAnchorPrefab; public GameObject? rebindItemPrefab; public GameObject? spacerPrefab; public ScrollRect? scrollRect; public RectTransform? headerContainer; public UnityEvent<int> OnSectionChanged = new UnityEvent<int>(); public static float OffsetCompensation; private RectTransform? _rectTransform; private RectTransform? _scrollRectTransform; private RectTransform? _content; private VerticalLayoutGroup? _verticalLayoutGroup; private int _currentSection; private float _sectionHeight; private float _spacing; private readonly List<SectionHeaderAnchor> _anchors = new List<SectionHeaderAnchor>(); private void Awake() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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) if (_rectTransform == null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } if (scrollRect == null) { scrollRect = ((Component)this).GetComponentInChildren<ScrollRect>(); } if (_verticalLayoutGroup == null) { _verticalLayoutGroup = ((Component)scrollRect.content).GetComponent<VerticalLayoutGroup>(); } _spacing = ((HorizontalOrVerticalLayoutGroup)_verticalLayoutGroup).spacing; if (sectionAnchorPrefab != null && rebindItemPrefab != null && spacerPrefab != null) { _sectionHeight = sectionAnchorPrefab.GetComponent<RectTransform>().sizeDelta.y; _scrollRectTransform = ((Component)scrollRect).GetComponent<RectTransform>(); _content = scrollRect.content; if (headerContainer != null) { headerContainer.drivenByObject = (Object)(object)this; headerContainer.drivenProperties = (DrivenTransformProperties)3840; headerContainer.anchorMin = new Vector2(0f, 1f); headerContainer.anchorMax = Vector2.one; ((UnityEvent<Vector2>)(object)scrollRect.onValueChanged).AddListener((UnityAction<Vector2>)OnScroll); OnScroll(Vector2.zero); } } } private void Start() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) OnScroll(Vector2.zero); } private void OnEnable() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) OnScroll(Vector2.zero); } public void JumpTo(int sectionIndex) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (_content == null || scrollRect == null || _scrollRectTransform == null) { return; } int count = _anchors.Count; if (sectionIndex < count && sectionIndex >= 0) { Canvas.ForceUpdateCanvases(); scrollRect.StopMovement(); if (sectionIndex == 0) { scrollRect.verticalNormalizedPosition = 1f; } else { SectionHeaderAnchor sectionHeaderAnchor = _anchors[sectionIndex]; float y = Vector2.op_Implicit(((Transform)_scrollRectTransform).InverseTransformPoint(((Transform)_content).position) - ((Transform)_scrollRectTransform).InverseTransformPoint(((Transform)sectionHeaderAnchor.RectTransform).position)).y + _sectionHeight / 2f - _spacing; _content.SetAnchoredPosY(y); } if (_currentSection != sectionIndex) { OnSectionChanged.Invoke(sectionIndex); } _currentSection = sectionIndex; } } public void AddSection(string sectionName) { //IL_0070: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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) if (((Behaviour)this).isActiveAndEnabled && sectionHeaderPrefab != null && sectionAnchorPrefab != null && scrollRect != null) { SectionHeaderAnchor component = Object.Instantiate<GameObject>(sectionAnchorPrefab, (Transform)(object)_content).GetComponent<SectionHeaderAnchor>(); SectionHeader component2 = Object.Instantiate<GameObject>(sectionHeaderPrefab, (Transform)(object)headerContainer).GetComponent<SectionHeader>(); RectTransform rectTransform = component2.RectTransform; rectTransform.drivenByObject = (Object)(object)this; rectTransform.drivenProperties = (DrivenTransformProperties)1286; rectTransform.anchorMin = new Vector2(0f, rectTransform.anchorMin.y); rectTransform.anchorMax = new Vector2(1f, rectTransform.anchorMax.y); component2.anchor = component; component.sectionHeader = component2; component2.SetText(sectionName); OnScroll(Vector2.zero); if (_anchors.Count == 0) { component.RectTransform.sizeDelta = default(Vector2); } _currentSection = _anchors.Count; _anchors.Add(component); } } public void AddBinds(RemappableKey? kbmKey, RemappableKey? gamepadKey, bool isBaseGame = false, string controlName = "") { if (((Behaviour)this).isActiveAndEnabled && rebindItemPrefab != null && scrollRect != null) { if (kbmKey != null && string.IsNullOrEmpty(controlName)) { controlName = kbmKey.ControlName; } else if (gamepadKey != null && string.IsNullOrEmpty(controlName)) { controlName = gamepadKey.ControlName; } Object.Instantiate<GameObject>(rebindItemPrefab, (Transform)(object)_content).GetComponent<RebindItem>().SetBind(controlName, kbmKey, gamepadKey, isBaseGame); } } public void AddFooter() { if (((Behaviour)this).isActiveAndEnabled && spacerPrefab != null) { Object.Instantiate<GameObject>(spacerPrefab, (Transform)(object)_content); } } private void OnScroll(Vector2 delta) { //IL_00af: 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) if (_scrollRectTransform == null || headerContainer == null || _rectTransform == null) { return; } float maxY = GetMaxY(headerContainer); int num = -1; for (int i = 0; i < _anchors.Count; i++) { SectionHeaderAnchor sectionHeaderAnchor = _anchors[i]; SectionHeader sectionHeader = sectionHeaderAnchor.sectionHeader; if (i == 0) { sectionHeader.RectTransform.SetLocalPosY(maxY - (_sectionHeight / 2f - _spacing)); num = i; continue; } SectionHeader sectionHeader2 = _anchors[i - 1].sectionHeader; float num2 = CalculateHeaderRawYPos(sectionHeaderAnchor); sectionHeader.RectTransform.SetLocalPosY(num2); float num3 = GetMaxY(sectionHeader.RectTransform) + ((Transform)sectionHeader.RectTransform).localPosition.y; float num4 = GetMinY(sectionHeader2.RectTransform) + ((Transform)sectionHeader2.RectTransform).localPosition.y; if (num3 + _sectionHeight / 2f + _spacing >= num4) { sectionHeader2.RectTransform.SetLocalPosY(num2 + _sectionHeight); } if (num3 + _spacing / 2f >= maxY - _sectionHeight / 2f) { num = i; sectionHeader.RectTransform.SetLocalPosY(maxY - (_sectionHeight / 2f - _spacing)); } } if (_currentSection != num) { OnSectionChanged.Invoke(num); } _currentSection = num; } private float CalculateHeaderRawYPos(SectionHeaderAnchor anchor) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (_content == null || headerContainer == null || _scrollRectTransform == null) { return 0f; } float num = GetMaxY(headerContainer) - GetMaxY(_scrollRectTransform); num += _sectionHeight / 2f; num -= OffsetCompensation; return ((Transform)anchor.RectTransform).localPosition.y - (num + 50f) + ((Transform)_content).localPosition.y; } private void OnDrawGizmos() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (_rectTransform != null && headerContainer != null) { Color color = Gizmos.color; _rectTransform.DrawGizmoUiRectWorld(); Gizmos.color = color; } } private float GetMaxY(RectTransform element) { //IL_0015: 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_0022: Unknown result type (might be due to invalid IL or missing references) if (_rectTransform == null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } Rect val = element.UiBounds(Vector3.zero); return ((Rect)(ref val)).max.y; } private float GetMinY(RectTransform element) { //IL_0015: 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_0022: Unknown result type (might be due to invalid IL or missing references) if (_rectTransform == null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } Rect val = element.UiBounds(Vector3.zero); return ((Rect)(ref val)).min.y; } } public class RebindButton : MonoBehaviour { public Selectable? button; public TextMeshProUGUI? bindLabel; public Image? glyphLabel; public Image? notSupportedImage; public RebindIndicator? rebindIndicator; public Button? resetButton; public Button? removeButton; public float timeout = 5f; private RemappableKey? _key; private bool _isBaseGame; private RebindingOperation? _rebindingOperation; private bool _rebinding; private float _timeoutTimer; private static MethodInfo? _setChangesNotAppliedMethodInfo; private static readonly List<RebindButton> Instances = new List<RebindButton>(); public void SetKey(RemappableKey? key, bool isBaseGame) { _key = key; _isBaseGame = isBaseGame; UpdateState(); } public void UpdateState() { //IL_005a: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (bindLabel == null || glyphLabel == null || button == null || notSupportedImage == null || resetButton == null || removeButton == null) { return; } if (_key == null) { SetAsUnsupported(); return; } int rebindingIndex = GetRebindingIndex(); InputAction action = _key.currentInput.action; if (rebindingIndex >= action.bindings.Count) { SetAsUnsupported(); return; } GameObject gameObject = ((Component)resetButton).gameObject; InputBinding val = action.bindings[rebindingIndex]; gameObject.SetActive(((InputBinding)(ref val)).hasOverrides); val = action.bindings[rebindingIndex]; string effectivePath = ((InputBinding)(ref val)).effectivePath; string bindPath = InputControlPath.ToHumanReadableString(effectivePath, (HumanReadableStringOptions)2, (InputControl)null); if (_key.gamepadOnly) { ((TMP_Text)bindLabel).SetText("", true); if (effectivePath == "<InputUtils-Gamepad-Not-Bound>") { ((Component)removeButton).gameObject.SetActive(false); ((Behaviour)glyphLabel).enabled = false; return; } ((Component)removeButton).gameObject.SetActive(true); ControllerGlyph bestMatching = ControllerGlyph.GetBestMatching(); if (bestMatching == null) { ((TMP_Text)bindLabel).SetText(effectivePath, true); ((Behaviour)glyphLabel).enabled = false; return; } Sprite val2 = bestMatching[effectivePath]; if (val2 == null) { ((TMP_Text)bindLabel).SetText(effectivePath, true); ((Behaviour)glyphLabel).enabled = false; } else { glyphLabel.sprite = val2; ((Behaviour)glyphLabel).enabled = true; } } else { ((Component)removeButton).gameObject.SetActive(!string.Equals(effectivePath, "<InputUtils-Kbm-Not-Bound>")); HandleKbmGlyphOrLabel(effectivePath, bindPath); } } private void HandleKbmGlyphOrLabel(string effectivePath, string bindPath) { if (bindLabel == null || glyphLabel == null) { return; } if (ControllerGlyph.MouseGlyphs != null) { Sprite val = ControllerGlyph.MouseGlyphs[effectivePath]; if (val != null) { ((TMP_Text)bindLabel).SetText("", true); glyphLabel.sprite = val; ((Behaviour)glyphLabel).enabled = true; return; } } ((Behaviour)glyphLabel).enabled = false; ((TMP_Text)bindLabel).SetText(bindPath, true); } private void SetAsUnsupported() { if (button != null && bindLabel != null && glyphLabel != null && notSupportedImage != null && resetButton != null && removeButton != null) { button.interactable = false; button.targetGraphic.raycastTarget = false; ((Behaviour)button.targetGraphic).enabled = false; ((TMP_Text)bindLabel).SetText("", true); ((Behaviour)glyphLabel).enabled = false; ((Component)notSupportedImage).gameObject.SetActive(true); ((Component)resetButton).gameObject.SetActive(false); ((Component)removeButton).gameObject.SetActive(false); } } private int GetRebindingIndex() { //IL_001c: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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 (_key == null) { return -1; } InputAction action = _key.currentInput.action; if (action.controls.Count == 0) { if (action.bindings.Count == 0) { return -1; } if (_key.gamepadOnly && action.bindings.Count > 1) { return 1; } return 0; } if (_key.rebindingIndex >= 0) { return _key.rebindingIndex; } return InputActionRebindingExtensions.GetBindingIndexForControl(action, action.controls[0]); } public void StartRebinding() { if (_key != null && bindLabel != null && glyphLabel != null && rebindIndicator != null && resetButton != null && removeButton != null) { int rebindingIndex = GetRebindingIndex(); ((Selectable)resetButton).interactable = false; ((Selectable)removeButton).interactable = false; ((Behaviour)glyphLabel).enabled = false; if (_key.gamepadOnly) { ((Behaviour)rebindIndicator).enabled = true; RebindGamepad(_key.currentInput, rebindingIndex); } else { ((TMP_Text)bindLabel).SetText("", true); ((Behaviour)rebindIndicator).enabled = true; RebindKbm(_key.currentInput, rebindingIndex); } _timeoutTimer = timeout; _rebinding = true; } } private void FinishRebinding() { if (_key != null && rebindIndicator != null && resetButton != null && removeButton != null) { ((Behaviour)rebindIndicator).enabled = false; _rebinding = false; if (_rebindingOperation != null) { _rebindingOperation = null; } ((Selectable)resetButton).interactable = true; ((Selectable)removeButton).interactable = true; UpdateState(); } } public void ResetToDefault() { //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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) FinishRebinding(); if (_key == null) { return; } int rebindingIndex = GetRebindingIndex(); InputAction action = _key.currentInput.action; InputBinding val = action.bindings[rebindingIndex]; if (((InputBinding)(ref val)).hasOverrides) { InputActionRebindingExtensions.RemoveBindingOverride(action, rebindingIndex); if (_isBaseGame) { BaseGameUnsavedChanges(); } MarkSettingsAsDirty(); UpdateState(); } } public void RemoveBind() { FinishRebinding(); if (_key != null) { int rebindingIndex = GetRebindingIndex(); InputActionRebindingExtensions.ApplyBindingOverride(_key.currentInput.action, rebindingIndex, _key.gamepadOnly ? "<InputUtils-Gamepad-Not-Bound>" : "<InputUtils-Kbm-Not-Bound>"); if (_isBaseGame) { BaseGameUnsavedChanges(); } MarkSettingsAsDirty(); UpdateState(); } } private void OnEnable() { Instances.Add(this); if (_key != null) { UpdateState(); } } private void OnDisable() { FinishRebinding(); Instances.Remove(this); } private void Update() { if (!_rebinding) { return; } _timeoutTimer -= Time.deltaTime; if (!(_timeoutTimer > 0f)) { if (_rebindingOperation == null) { FinishRebinding(); return; } _rebindingOperation.Cancel(); FinishRebinding(); } } private void RebindKbm(InputActionReference inputActionRef, int rebindIndex) { _rebindingOperation = InputActionRebindingExtensions.PerformInteractiveRebinding(inputActionRef.action, rebindIndex).OnMatchWaitForAnother(0.1f).WithControlsHavingToMatchPath("<Keyboard>") .WithControlsHavingToMatchPath("<Mouse>") .WithControlsHavingToMatchPath("<InputUtilsExtendedMouse>") .WithControlsExcluding("<Mouse>/scroll/y") .WithControlsExcluding("<Mouse>/scroll/x") .WithCancelingThrough("<Keyboard>/escape") .OnComplete((Action<RebindingOperation>)delegate(RebindingOperation operation) { OnRebindComplete(operation, this); }) .OnCancel((Action<RebindingOperation>)delegate { FinishRebinding(); }) .Start(); } private void RebindGamepad(InputActionReference inputActionRef, int rebindIndex) { _rebindingOperation = InputActionRebindingExtensions.PerformInteractiveRebinding(inputActionRef.action, rebindIndex).OnMatchWaitForAnother(0.1f).WithControlsHavingToMatchPath("<Gamepad>") .OnComplete((Action<RebindingOperation>)delegate(RebindingOperation operation) { OnRebindComplete(operation, this); }) .Start(); } private static void OnRebindComplete(RebindingOperation operation, RebindButton instance) { if (operation.completed) { if (instance._isBaseGame) { BaseGameUnsavedChanges(); } MarkSettingsAsDirty(); instance.FinishRebinding(); } } private static void BaseGameUnsavedChanges() { IngamePlayerSettings.Instance.unsavedSettings.keyBindings = InputActionRebindingExtensions.SaveBindingOverridesAsJson((IInputActionCollection2)(object)IngamePlayerSettings.Instance.playerInput.actions); } private static void MarkSettingsAsDirty() { if ((object)_setChangesNotAppliedMethodInfo == null) { _setChangesNotAppliedMethodInfo = AccessTools.Method(typeof(IngamePlayerSettings), "SetChangesNotAppliedTextVisible", (Type[])null, (Type[])null); } _setChangesNotAppliedMethodInfo.Invoke(IngamePlayerSettings.Instance, new object[1] { true }); } public static void ReloadGlyphs() { foreach (RebindButton instance in Instances) { instance.UpdateState(); } } public static void ResetAllToDefaults() { foreach (RebindButton instance in Instances) { instance.ResetToDefault(); } } } public class RebindIndicator : MonoBehaviour { public TextMeshProUGUI? label; public int maxTicks = 5; public float timeBetweenTicks = 1f; private int _ticks = 1; private float _timer; private void OnEnable() { _ticks = 1; _timer = timeBetweenTicks; ((TMP_Text)label).SetText(GetText(), true); } private void OnDisable() { _ticks = 1; _timer = timeBetweenTicks; ((TMP_Text)label).SetText("", true); } private void Update() { _timer -= Time.unscaledDeltaTime; if (!(_timer > 0f)) { _ticks++; if (_ticks > maxTicks) { _ticks = 1; } ((TMP_Text)label).SetText(GetText(), true); _timer = timeBetweenTicks; } } private string GetText() { string text = ""; for (int i = 0; i < _ticks; i++) { text += "."; } return text; } } public class RebindItem : MonoBehaviour { public TextMeshProUGUI? controlNameLabel; public RebindButton? kbmButton; public RebindButton? gamepadButton; public void SetBind(string controlName, RemappableKey? kbmKey, RemappableKey? gamepadKey, bool isBaseGame = false) { if (controlNameLabel != null) { ((TMP_Text)controlNameLabel).SetText(controlName, true); if (kbmButton != null) { kbmButton.SetKey(kbmKey, isBaseGame); } if (gamepadButton != null) { gamepadButton.SetKey(gamepadKey, isBaseGame); } } } } public class RemapContainerController : MonoBehaviour { public BindsListController? bindsList; public SectionListController? sectionList; public Button? backButton; public Button? legacyButton; public GameObject? legacyHolder; public List<RemappableKey> baseGameKeys = new List<RemappableKey>(); internal int LayerShown; private void Awake() { if (bindsList == null) { bindsList = ((Component)this).GetComponentInChildren<BindsListController>(); } if (sectionList == null) { sectionList = ((Component)this).GetComponentInChildren<SectionListController>(); } bindsList.OnSectionChanged.AddListener((UnityAction<int>)HandleSectionChanged); LcInputActionApi.ContainerInstance = this; } public void JumpTo(int sectionIndex) { if (bindsList != null) { bindsList.JumpTo(sectionIndex); } } public void LoadUi() { GenerateBaseGameSection(); GenerateApiSections(); FinishUi(); } private void GenerateBaseGameSection() { if (bindsList == null || sectionList == null) { return; } Dictionary<string, (RemappableKey, RemappableKey)> dictionary = new Dictionary<string, (RemappableKey, RemappableKey)>(); string key; foreach (RemappableKey baseGameKey in baseGameKeys) { RemappableKey item = null; RemappableKey item2 = null; string text = baseGameKey.ControlName.ToLower(); if (text.StartsWith("walk")) { key = text; text = "move" + key.Substring(4, key.Length - 4); } baseGameKey.ControlName = baseGameKey.ControlName.Replace("primary", "Primary"); if (dictionary.TryGetValue(text, out var value)) { if (baseGameKey.gamepadOnly) { (item, _) = value; } else { item2 = value.Item2; } } if (baseGameKey.gamepadOnly) { item2 = baseGameKey; } else { item = baseGameKey; } dictionary[text] = (item, item2); } bindsList.AddSection("Lethal Company"); sectionList.AddSection("Lethal Company"); foreach (KeyValuePair<string, (RemappableKey, RemappableKey)> item3 in dictionary) { item3.Deconstruct(out key, out var value2); var (kbmKey, gamepadKey) = value2; bindsList.AddBinds(kbmKey, gamepadKey, isBaseGame: true); } } public void OnSetToDefault() { RebindButton.ResetAllToDefaults(); } public void HideHighestLayer() { if (backButton != null && legacyHolder != null) { if (LayerShown > 1) { legacyHolder.SetActive(false); LayerShown--; } else if (LayerShown > 0) { ((UnityEvent)backButton.onClick).Invoke(); } } } public void ShowLegacyUi() { if (((Behaviour)this).isActiveAndEnabled && legacyHolder != null) { legacyHolder.SetActive(true); LayerShown++; } } private void GenerateApiSections() { //IL_00af: 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_00be: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0113: Expected O, but got Unknown if (bindsList == null || sectionList == null) { return; } foreach (IGrouping<string, LcInputActions> item in from lc in LcInputActionApi.InputActions group lc by lc.Plugin.Name) { bindsList.AddSection(item.Key); sectionList.AddSection(item.Key); foreach (LcInputActions item2 in item) { if (item2.Loaded) { continue; } foreach (InputActionReference actionRef in item2.ActionRefs) { InputAction action = actionRef.action; InputBinding val = ((IEnumerable<InputBinding>)(object)action.bindings).First(); string name = ((InputBinding)(ref val)).name; RemappableKey kbmKey = new RemappableKey { ControlName = name, currentInput = actionRef, rebindingIndex = 0, gamepadOnly = false }; RemappableKey val2 = new RemappableKey { ControlName = name, currentInput = actionRef, rebindingIndex = 1, gamepadOnly = true }; if (action.IsGamepadOnly()) { val2.rebindingIndex = 0; bindsList.AddBinds(null, val2); } else { bindsList.AddBinds(kbmKey, val2); } } item2.Loaded = true; } } } private void FinishUi() { if (bindsList != null) { bindsList.AddFooter(); JumpTo(0); } } private void HandleSectionChanged(int sectionIndex) { if (sectionList != null && bindsList != null) { sectionList.SelectSection(sectionIndex); } } private void OnEnable() { JumpTo(0); LayerShown = 1; } private void OnDisable() { LcInputActionApi.ReEnableFromRebind(); LayerShown = 0; } private void OnDestroy() { LcInputActionApi.ContainerInstance = null; LayerShown = 0; } } } namespace LethalCompanyInputUtils.Components.Section { [RequireComponent(typeof(Button), typeof(RectTransform))] public class SectionEntry : MonoBehaviour { public TextMeshProUGUI? indicator; public TextMeshProUGUI? label; public Button? button; public int sectionIndex; public UnityEvent<int> OnEntrySelected = new UnityEvent<int>(); private RectTransform? _rectTransform; public RectTransform RectTransform { get { if (_rectTransform == null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } return _rectTransform; } } private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (button == null) { button = ((Component)this).GetComponent<Button>(); } ((UnityEvent)button.onClick).AddListener(new UnityAction(SelectEntry)); } public void SetText(string text) { if (label != null) { ((TMP_Text)label).SetText(text, true); } } public void SetIndicator(bool indicated) { if (indicator != null) { ((Behaviour)indicator).enabled = indicated; } } private void SelectEntry() { OnEntrySelected.Invoke(sectionIndex); } } [RequireComponent(typeof(RectTransform))] public class SectionHeader : MonoBehaviour { public SectionHeaderAnchor? anchor; public TextMeshProUGUI? label; private RectTransform? _rectTransform; public RectTransform RectTransform { get { if (_rectTransform == null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } return _rectTransform; } } public void SetText(string text) { if (label != null) { ((TMP_Text)label).SetText(text, true); } } } [RequireComponent(typeof(RectTransform))] public class SectionHeaderAnchor : MonoBehaviour { public SectionHeader? sectionHeader; private RectTransform? _rectTransform; public RectTransform RectTransform { get { if (_rectTransform == null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } return _rectTransform; } } private void Awake() { if (_rectTransform == null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } } } public class SectionListController : MonoBehaviour { public GameObject? sectionEntryPrefab; public ScrollRect? scrollRect; public RemapContainerController? remapContainer; private RectTransform? _viewport; private RectTransform? _content; private readonly List<SectionEntry> _sectionEntries = new List<SectionEntry>(); private void Awake() { if (remapContainer == null) { remapContainer = ((Component)this).GetComponentInParent<RemapContainerController>(); } if (scrollRect == null) { scrollRect = ((Component)this).GetComponentInChildren<ScrollRect>(); } _viewport = scrollRect.viewport; _content = scrollRect.content; } public void AddSection(string sectionName) { if (_content != null && sectionEntryPrefab != null) { SectionEntry component = Object.Instantiate<GameObject>(sectionEntryPrefab, (Transform)(object)_content).GetComponent<SectionEntry>(); component.SetText(sectionName); component.sectionIndex = _sectionEntries.Count; component.OnEntrySelected.AddListener((UnityAction<int>)OnSectionEntryPressed); _sectionEntries.Add(component); } } public void SelectSection(int sectionIndex) { int count = _sectionEntries.Count; if (sectionIndex >= count || sectionIndex < 0) { return; } foreach (SectionEntry sectionEntry2 in _sectionEntries) { sectionEntry2.SetIndicator(indicated: false); } SectionEntry sectionEntry = _sectionEntries[sectionIndex]; sectionEntry.SetIndicator(indicated: true); if (scrollRect != null) { UpdateScrollPosToFit(sectionEntry); } } private void UpdateScrollPosToFit(SectionEntry sectionEntry) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (_viewport == null || _content == null || scrollRect == null) { return; } RectTransform rectTransform = sectionEntry.RectTransform; float num = rectTransform.WorldMinY(); float num2 = rectTransform.WorldMaxY(); float num3 = _viewport.WorldMinY(); float num4 = _viewport.WorldMaxY(); if (!(num > num3) || !(num2 < num4)) { scrollRect.StopMovement(); float num5 = 0f; if (num2 > num4) { num5 = num4 - num2 - rectTransform.sizeDelta.y; } else if (num < num3) { num5 = num3 - num + rectTransform.sizeDelta.y; } float y = _content.anchoredPosition.y; _content.SetAnchoredPosY(y + num5); } } private void OnSectionEntryPressed(int sectionIndex) { if (remapContainer != null) { remapContainer.JumpTo(sectionIndex); } } } } namespace LethalCompanyInputUtils.Components.PopOvers { [RequireComponent(typeof(RectTransform))] public class PopOver : MonoBehaviour { public enum Placement { Top, Bottom, Left, Right } public RectTransform? popOverLayer; public PopOverTextContainer? textContainer; public RectTransform? pivotPoint; public GameObject? background; public PopOverArrow? arrow; public CanvasGroup? canvasGroup; public float maxWidth = 300f; private RectTransform? _rectTransform; private RectTransform? _target; private Placement _placement; public void SetTarget(RectTransform target, Placement placement) { if (background != null && canvasGroup != null) { background.SetActive(true); _target = target; _placement = placement; SetPivot(); SetArrow(); } } public void ClearTarget() { if (background != null && canvasGroup != null) { canvasGroup.alpha = 0f; _target = null; background.SetActive(false); } } private void MoveTo(RectTransform target) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0021: 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_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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) if (pivotPoint != null) { Vector3 val = Vector2.op_Implicit(GetTargetPosition(target)); Vector3 val2 = Vector2.op_Implicit(GetTargetPivotOffset(target)); Vector3 val3 = Vector2.op_Implicit(GetLabelPivotOffset()); Vector3 targetPos = val + val2 + val3; MovePopOverToTarget(targetPos); AdjustArrowPosToTarget(target); } } private void SetPivot() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_007e: Unknown result type (might be due to invalid IL or missing references) if (pivotPoint != null) { RectTransform val = pivotPoint; val.pivot = (Vector2)(_placement switch { Placement.Top => new Vector2(0.5f, 0f), Placement.Bottom => new Vector2(0.5f, 1f), Placement.Left => new Vector2(1f, 0.5f), Placement.Right => new Vector2(0f, 0.5f), _ => throw new ArgumentOutOfRangeException(), }); } } private void SetArrow() { if (arrow != null) { switch (_placement) { case Placement.Top: arrow.PointToBottom(); break; case Placement.Bottom: arrow.PointToTop(); break; case Placement.Left: arrow.PointToRight(); break; case Placement.Right: arrow.PointToLeft(); break; default: throw new ArgumentOutOfRangeException(); } } } private Vector2 GetTargetPosition(RectTransform target) { //IL_0015: 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) if (popOverLayer == null) { return Vector2.zero; } return popOverLayer.WorldToLocalPoint(target); } private Vector2 GetTargetPivotOffset(RectTransform target) { //IL_0015: 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_0008: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (popOverLayer == null) { return Vector2.zero; } Rect relativeRect = popOverLayer.GetRelativeRect(target); return (Vector2)(_placement switch { Placement.Top => new Vector2(0f, 2f + ((Rect)(ref relativeRect)).height / 2f), Placement.Bottom => new Vector2(0f, -2f + (0f - ((Rect)(ref relativeRect)).height) / 2f), Placement.Left => new Vector2(-2f + (0f - ((Rect)(ref relativeRect)).width) / 2f, 0f), Placement.Right => new Vector2(2f + ((Rect)(ref relativeRect)).width / 2f, 0f), _ => throw new ArgumentOutOfRangeException(), }); } private Vector2 GetLabelPivotOffset() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0053: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (textContainer == null || textContainer.rectTransform == null || _rectTransform == null || popOverLayer == null) { return Vector2.zero; } Rect relativeRect = popOverLayer.GetRelativeRect(_rectTransform); Rect relativeRect2 = popOverLayer.GetRelativeRect(textContainer.rectTransform); return (Vector2)(_placement switch { Placement.Top => new Vector2(0f, 0f - (((Rect)(ref relativeRect)).height - ((Rect)(ref relativeRect2)).height) / 2f), Placement.Bottom => new Vector2(0f, (((Rect)(ref relativeRect)).height - ((Rect)(ref relativeRect2)).height) / 2f), Placement.Left => new Vector2((((Rect)(ref relativeRect)).width - ((Rect)(ref relativeRect2)).width) / 2f, 0f), Placement.Right => new Vector2(0f - (((Rect)(ref relativeRect)).width - ((Rect)(ref relativeRect2)).width) / 2f, 0f), _ => throw new ArgumentOutOfRangeException(), }); } private void MovePopOverToTarget(Vector3 targetPos) { //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_0025: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid
plugins/LethalEmotesApi/LethalEmotesAPI.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using AdvancedCompany.Game; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EmotesAPI; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalEmotesAPI; using LethalEmotesAPI.Core; using LethalEmotesAPI.Data; using LethalEmotesAPI.Patches; using LethalEmotesAPI.Patches.ModCompat; using LethalEmotesAPI.Utils; using LethalEmotesApi.Ui; using LethalEmotesApi.Ui.Data; using LethalEmotesApi.Ui.Db; using LethalVRM; using Microsoft.CodeAnalysis; using ModelReplacement; using MonoMod.RuntimeDetour; using MoreCompany.Cosmetics; using Newtonsoft.Json; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AdvancedCompany")] [assembly: IgnoresAccessChecksTo("AdvancedCompany.Preloader")] [assembly: IgnoresAccessChecksTo("AdvancedCompany.Unity")] [assembly: IgnoresAccessChecksTo("LethalVRM")] [assembly: IgnoresAccessChecksTo("MToon")] [assembly: IgnoresAccessChecksTo("UniGLTF")] [assembly: IgnoresAccessChecksTo("UniGLTF.Utils")] [assembly: IgnoresAccessChecksTo("UniHumanoid")] [assembly: IgnoresAccessChecksTo("VRM10")] [assembly: IgnoresAccessChecksTo("VrmLib")] [assembly: IgnoresAccessChecksTo("VRMShaders.GLTF.IO.Runtime")] [assembly: IgnoresAccessChecksTo("VRMShaders.VRM.IO.Runtime")] [assembly: IgnoresAccessChecksTo("VRMShaders.VRM10.Format.Runtime")] [assembly: IgnoresAccessChecksTo("VRMShaders.VRM10.MToon10.Runtime")] [assembly: AssemblyCompany("LethalEmotesAPI")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ac9af00520b342a064c8a94d95cc8a7a2f6e3894")] [assembly: AssemblyProduct("LethalEmotesAPI")] [assembly: AssemblyTitle("LethalEmotesAPI")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } internal static class AnimationReplacements { internal static GameObject g; internal static bool setup; internal static void RunAll() { ChangeAnims(); } internal static BoneMapper Import(GameObject prefab, string skeleton, int[] pos, bool hidemesh = true) { GameObject val = Object.Instantiate<GameObject>(Assets.Load<GameObject>("@CustomEmotesAPI_customemotespackage:assets/animationreplacements/commando.prefab")); GameObject val2 = Object.Instantiate<GameObject>(Assets.Load<GameObject>(skeleton)); val2.GetComponent<Animator>().runtimeAnimatorController = val.GetComponent<Animator>().runtimeAnimatorController; BoneMapper result = ApplyAnimationStuff(prefab, val2, pos, hidemesh, jank: false, revertBonePositions: true); val.transform.SetParent(val2.transform); return result; } public static void DebugBones(GameObject fab) { SkinnedMeshRenderer[] componentsInChildren = fab.GetComponentsInChildren<SkinnedMeshRenderer>(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"rendererererer: {componentsInChildren[0]}\n"); stringBuilder.Append($"bone count: {componentsInChildren[0].bones.Length}\n"); stringBuilder.Append($"mesh count: {componentsInChildren.Length}\n"); stringBuilder.Append("root bone: " + ((Object)componentsInChildren[0].rootBone).name + "\n"); stringBuilder.Append(((object)fab).ToString() + ":\n"); SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val in array) { if (val.bones.Length == 0) { stringBuilder.Append("No bones"); } else { stringBuilder.Append("["); Transform[] bones = val.bones; foreach (Transform val2 in bones) { stringBuilder.Append("'" + ((Object)val2).name + "', "); } stringBuilder.Remove(stringBuilder.Length - 2, 2); stringBuilder.Append("]"); } stringBuilder.Append("\n\n"); DebugClass.Log(stringBuilder.ToString()); } } internal static void ChangeAnims() { } internal static void ApplyAnimationStuff(GameObject bodyPrefab, string resource, int[] pos) { GameObject animcontroller = Assets.Load<GameObject>(resource); ApplyAnimationStuff(bodyPrefab, animcontroller, pos); } internal static BoneMapper ApplyAnimationStuff(GameObject bodyPrefab, GameObject animcontroller, int[] pos, bool hidemeshes = true, bool jank = false, bool revertBonePositions = false) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) try { if (!animcontroller.GetComponentInChildren<Animator>().avatar.isHuman) { DebugClass.Log($"{animcontroller}'s avatar isn't humanoid, please fix it in unity!"); return null; } } catch (Exception arg) { DebugClass.Log($"Had issue checking if avatar was humanoid: {arg}"); throw; } try { if (hidemeshes) { SkinnedMeshRenderer[] componentsInChildren = animcontroller.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val in componentsInChildren) { val.sharedMesh = null; } MeshFilter[] componentsInChildren2 = animcontroller.GetComponentsInChildren<MeshFilter>(); foreach (MeshFilter val2 in componentsInChildren2) { val2.sharedMesh = null; } } } catch (Exception arg2) { DebugClass.Log($"Had trouble while hiding meshes: {arg2}"); throw; } Transform transform = ((Component)bodyPrefab.GetComponentInChildren<Animator>()).transform; try { animcontroller.transform.parent = transform; animcontroller.transform.localPosition = Vector3.zero; animcontroller.transform.eulerAngles = bodyPrefab.transform.eulerAngles; animcontroller.transform.localScale = Vector3.one; } catch (Exception arg3) { DebugClass.Log($"Had trouble setting emote skeletons parent: {arg3}"); throw; } SkinnedMeshRenderer[] array = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[pos.Length]; SkinnedMeshRenderer emoteSkeletonSMR; try { emoteSkeletonSMR = animcontroller.GetComponentsInChildren<SkinnedMeshRenderer>()[0]; } catch (Exception arg4) { DebugClass.Log($"Had trouble setting emote skeletons SkinnedMeshRenderer: {arg4}"); throw; } try { for (int k = 0; k < pos.Length; k++) { array[k] = bodyPrefab.GetComponentsInChildren<SkinnedMeshRenderer>()[pos[k]]; } } catch (Exception arg5) { DebugClass.Log($"Had trouble setting the original skeleton's skinned mesh renderer: {arg5}"); throw; } BoneMapper boneMapper = animcontroller.AddComponent<BoneMapper>(); try { boneMapper.jank = jank; boneMapper.emoteSkeletonSMR = emoteSkeletonSMR; boneMapper.basePlayerModelSMR = array; boneMapper.bodyPrefab = bodyPrefab; boneMapper.basePlayerModelAnimator = ((Component)transform).GetComponentInChildren<Animator>(); boneMapper.emoteSkeletonAnimator = animcontroller.GetComponentInChildren<Animator>(); } catch (Exception arg6) { DebugClass.Log($"Had issue when setting up BoneMapper settings 1: {arg6}"); throw; } try { GameObject val3 = Assets.Load<GameObject>("assets/customstuff/scavEmoteSkeleton.prefab"); float num = Vector3.Distance(val3.GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)10).position, val3.GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)5).position); float num2 = Vector3.Distance(animcontroller.GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)10).position, animcontroller.GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)5).position); boneMapper.scale = num2 / num; boneMapper.model = ((Component)transform).gameObject; } catch (Exception arg7) { DebugClass.Log($"Had issue when setting up BoneMapper settings 2: {arg7}"); throw; } boneMapper.revertTransform = revertBonePositions; return boneMapper; } } public struct WorldProp { internal GameObject prop; internal JoinSpot[] joinSpots; public WorldProp(GameObject _prop, JoinSpot[] _joinSpots) { prop = _prop; joinSpots = _joinSpots; } } public enum TempThirdPerson { none, on, off } public class BoneMapper : MonoBehaviour { public static List<AudioClip[]> primaryAudioClips = new List<AudioClip[]>(); public static List<AudioClip[]> secondaryAudioClips = new List<AudioClip[]>(); public static List<AudioClip[]> primaryDMCAFreeAudioClips = new List<AudioClip[]>(); public static List<AudioClip[]> secondaryDMCAFreeAudioClips = new List<AudioClip[]>(); public GameObject audioObject; public SkinnedMeshRenderer emoteSkeletonSMR; public SkinnedMeshRenderer[] basePlayerModelSMR; public Animator basePlayerModelAnimator; public Animator emoteSkeletonAnimator; public int h; public List<BonePair> pairs = new List<BonePair>(); public float timer = 0f; public GameObject model; private bool twopart = false; public static Dictionary<string, CustomAnimationClip> animClips = new Dictionary<string, CustomAnimationClip>(); public CustomAnimationClip currentClip = null; public string currentClipName = "none"; public string prevClipName = "none"; public CustomAnimationClip prevClip = null; internal static float Current_MSX = 69f; internal static List<BoneMapper> allMappers = new List<BoneMapper>(); internal static List<WorldProp> allWorldProps = new List<WorldProp>(); public bool local = false; internal static bool moving = false; internal static bool attacking = false; public bool jank = false; public List<GameObject> props = new List<GameObject>(); public float scale = 1f; internal int desiredEvent = 0; public int currEvent = 0; public float autoWalkSpeed = 0f; public bool overrideMoveSpeed = false; public bool autoWalk = false; public GameObject currentEmoteSpot = null; public GameObject reservedEmoteSpot = null; public bool worldProp = false; public bool ragdolling = false; public GameObject bodyPrefab; public int uniqueSpot = -1; public bool preserveProps = false; public bool preserveParent = false; internal bool useSafePositionReset = false; public List<EmoteLocation> emoteLocations = new List<EmoteLocation>(); private List<string> dontAnimateUs = new List<string>(); public bool enableAnimatorOnDeath = true; public bool revertTransform = false; public bool oneFrameAnimatorLeeWay = false; public GameObject mapperBody; public PlayerControllerB playerController; public EnemyAI enemyController; public Transform mapperBodyTransform; public static bool firstMapperSpawn = true; public static List<List<AudioSource>> listOfCurrentEmoteAudio = new List<List<AudioSource>>(); public List<EmoteConstraint> cameraConstraints = new List<EmoteConstraint>(); public List<EmoteConstraint> itemHolderConstraints = new List<EmoteConstraint>(); public Transform itemHolderPosition; public List<EmoteConstraint> additionalConstraints = new List<EmoteConstraint>(); public EmoteConstraint thirdPersonConstraint; public static Dictionary<string, string> customNamePairs = new Dictionary<string, string>(); public Vector3 positionBeforeRootMotion = new Vector3(69f, 69f, 69f); public Quaternion rotationBeforeRootMotion = Quaternion.identity; public float currentAudioLevel = 0f; public TempThirdPerson temporarilyThirdPerson = TempThirdPerson.none; internal int originalCullingMask; internal bool needToTurnOffRenderingThing = false; public BoneMapper currentlyLockedBoneMapper; public static Dictionary<GameObject, BoneMapper> playersToMappers = new Dictionary<GameObject, BoneMapper>(); public AudioSource personalAudioSource; public bool isServer = false; public int networkId; public bool canThirdPerson = true; internal bool canEmote = false; public GameObject parentGameObject; public bool positionLock; public bool rotationLock; public bool scaleLock; private Vector3 ogScale = new Vector3(-69f, -69f, -69f); private Vector3 scaleDiff = Vector3.one; public GameObject rotationPoint; public GameObject desiredCameraPos; public GameObject realCameraPos; private bool ranSinceLastAnim = false; public Vector3 deltaPos = new Vector3(0f, 0f, 0f); public Quaternion deltaRot = Quaternion.identity; public Vector3 prevPosition = Vector3.zero; public Quaternion prevRotation = Quaternion.identity; public Vector3 prevMapperPos = new Vector3(69f, 69f, 69f); public Vector3 prevMapperRot = default(Vector3); public bool justSwitched = false; public bool isEnemy = false; public bool isInThirdPerson = false; public int originalLayer = -1; internal bool needToTurnOffShadows = true; internal bool needToTurnOffCosmetics = true; public static string GetRealAnimationName(string animationName) { if (customNamePairs.ContainsKey(animationName)) { return customNamePairs[animationName]; } return animationName; } private IEnumerator lockBonesAfterAFrame() { yield return (object)new WaitForEndOfFrame(); LockBones(); } public void PlayAnim(string s, int pos, int eventNum) { desiredEvent = eventNum; s = GetRealAnimationName(s); PlayAnim(s, pos); } public void PlayAnim(string s, int pos) { //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Expected O, but got Unknown ranSinceLastAnim = false; s = GetRealAnimationName(s); prevClipName = currentClipName; if (s != "none") { if (!animClips.ContainsKey(s)) { DebugClass.Log("No emote bound to the name [" + s + "]"); return; } if (animClips[s] == null || !animClips[s].animates) { CustomEmotesAPI.Changed(s, this); return; } } ((Behaviour)emoteSkeletonAnimator).enabled = true; dontAnimateUs.Clear(); try { ((object)currentClip.clip[0]).ToString(); try { if (currentClip.syncronizeAnimation || currentClip.syncronizeAudio) { CustomAnimationClip.syncPlayerCount[currentClip.syncPos]--; } audioObject.GetComponent<AudioManager>().Stop(); } catch (Exception arg) { DebugClass.Log($"had issue turning off audio before new audio played step 1: {arg}"); } try { if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null && currentClip.syncronizeAudio) { try { listOfCurrentEmoteAudio[currentClip.syncPos].Remove(audioObject.GetComponent<AudioSource>()); } catch (Exception arg2) { DebugClass.Log($"had issue turning off audio before new audio played step 2: {arg2}"); try { DebugClass.Log($"{prevClip.syncPos}"); DebugClass.Log($"{currentClip.syncPos}"); DebugClass.Log(listOfCurrentEmoteAudio[currentClip.syncPos]); } catch (Exception) { } try { DebugClass.Log("going to try a brute force method to avoid audio desync issues"); foreach (List<AudioSource> item in listOfCurrentEmoteAudio) { if (item.Contains(audioObject.GetComponent<AudioSource>())) { item.Remove(audioObject.GetComponent<AudioSource>()); } } } catch (Exception arg3) { DebugClass.Log($"wow {arg3}"); } } } } catch (Exception ex2) { DebugClass.Log($"had issue turning off audio before new audio played step 3: {primaryAudioClips[currentClip.syncPos]} {currentClip.syncPos} {currEvent} {ex2}"); } try { if (uniqueSpot != -1 && CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot]) { CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot] = false; uniqueSpot = -1; } } catch (Exception arg4) { DebugClass.Log($"had issue turning off audio before new audio played step 4: {arg4}"); } } catch (Exception) { } currEvent = 0; currentClipName = s; if (s != "none") { prevClip = currentClip; currentClip = animClips[s]; try { ((object)currentClip.clip[0]).ToString(); } catch (Exception) { return; } if (pos == -2) { pos = ((CustomAnimationClip.syncPlayerCount[animClips[s].syncPos] != 0) ? animClips[s].joinPref : animClips[s].startPref); } if (pos == -2) { for (int i = 0; i < CustomAnimationClip.uniqueAnimations[currentClip.syncPos].Count; i++) { if (!CustomAnimationClip.uniqueAnimations[currentClip.syncPos][i]) { pos = i; uniqueSpot = pos; CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot] = true; break; } } if (uniqueSpot == -1) { pos = -1; } } if (pos == -1) { pos = Random.Range(0, currentClip.clip.Length); } ((MonoBehaviour)this).StartCoroutine(lockBonesAfterAFrame()); } if (s == "none") { emoteSkeletonAnimator.Play("none", -1, 0f); twopart = false; prevClip = currentClip; currentClip = null; NewAnimation(null); CustomEmotesAPI.Changed(s, this); return; } AnimatorOverrideController animController = new AnimatorOverrideController(emoteSkeletonAnimator.runtimeAnimatorController); if (currentClip.syncronizeAnimation || currentClip.syncronizeAudio) { CustomAnimationClip.syncPlayerCount[currentClip.syncPos]++; } if (currentClip.syncronizeAnimation && CustomAnimationClip.syncPlayerCount[currentClip.syncPos] == 1) { CustomAnimationClip.syncTimer[currentClip.syncPos] = 0f; } if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null) { if (CustomAnimationClip.syncPlayerCount[currentClip.syncPos] == 1 && currentClip.syncronizeAudio) { if (desiredEvent != -1) { currEvent = desiredEvent; } else { currEvent = Random.Range(0, primaryAudioClips[currentClip.syncPos].Length); } foreach (BoneMapper allMapper in allMappers) { allMapper.currEvent = currEvent; } if (currentClip.customPostEventCodeSync != null) { currentClip.customPostEventCodeSync(this); } } else if (!currentClip.syncronizeAudio) { currEvent = Random.Range(0, primaryAudioClips[currentClip.syncPos].Length); if (currentClip.customPostEventCodeNoSync != null) { currentClip.customPostEventCodeNoSync(this); } } currentAudioLevel = currentClip.audioLevel; audioObject.GetComponent<AudioManager>().Play(currentClip.syncPos, currEvent, currentClip.looping, currentClip.syncronizeAudio, currentClip.willGetClaimed); if (currentClip.syncronizeAudio && (Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null) { listOfCurrentEmoteAudio[currentClip.syncPos].Add(audioObject.GetComponent<AudioSource>()); } } SetAnimationSpeed(1f); StartAnimations(animController, pos, emoteSkeletonAnimator); if (local && CustomEmotesAPI.hudObject != null) { if (currentClip.displayName != "") { ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = currentClip.displayName; } else if (currentClip.customInternalName != "") { ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = currentClip.customInternalName; } else if (!currentClip.visibility) { ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = ""; } else { ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = currentClipName; } } twopart = false; NewAnimation(currentClip.joinSpots); if (currentClip.usesNewImportSystem) { CustomEmotesAPI.Changed(currentClip.customInternalName, this); } else { CustomEmotesAPI.Changed(s, this); } } public void StartAnimations(AnimatorOverrideController animController, int pos, Animator animator) { if (currentClip.secondaryClip != null && currentClip.secondaryClip.Length != 0) { bool flag = true; if (CustomAnimationClip.syncTimer[currentClip.syncPos] > currentClip.clip[pos].length) { animController["Floss"] = currentClip.secondaryClip[pos]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController; animator.Play("Loop", -1, (CustomAnimationClip.syncTimer[currentClip.syncPos] - currentClip.clip[pos].length) % currentClip.secondaryClip[pos].length / currentClip.secondaryClip[pos].length); } else { animController["Dab"] = currentClip.clip[pos]; animController["nobones"] = currentClip.secondaryClip[pos]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController; animator.Play("PoopToLoop", -1, CustomAnimationClip.syncTimer[currentClip.syncPos] % currentClip.clip[pos].length / currentClip.clip[pos].length); } } else if (((Motion)currentClip.clip[0]).isLooping) { animController["Floss"] = currentClip.clip[pos]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController; if (currentClip.clip[pos].length != 0f) { animator.Play("Loop", -1, CustomAnimationClip.syncTimer[currentClip.syncPos] % currentClip.clip[pos].length / currentClip.clip[pos].length); } else { animator.Play("Loop", -1, 0f); } } else { animController["Default Dance"] = currentClip.clip[pos]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController; animator.Play("Poop", -1, CustomAnimationClip.syncTimer[currentClip.syncPos] % currentClip.clip[pos].length / currentClip.clip[pos].length); } } public static void PreviewAnimations(Animator animator, string animation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown AnimatorOverrideController val = new AnimatorOverrideController(animator.runtimeAnimatorController); CustomAnimationClip customAnimationClip = animClips[GetRealAnimationName(animation)]; if (customAnimationClip != null && customAnimationClip.animates) { int num = 0; if (customAnimationClip.secondaryClip != null && customAnimationClip.secondaryClip.Length != 0) { val["Dab"] = customAnimationClip.clip[num]; val["nobones"] = customAnimationClip.secondaryClip[num]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)val; animator.Play("PoopToLoop", -1, 0f); } else if (((Motion)customAnimationClip.clip[0]).isLooping) { val["Floss"] = customAnimationClip.clip[num]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)val; animator.Play("Loop", -1, 0f); } else { val["Default Dance"] = customAnimationClip.clip[num]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)val; animator.Play("Poop", -1, 0f); } } } public void SetAnimationSpeed(float speed) { emoteSkeletonAnimator.speed = speed; } internal void NewAnimation(JoinSpot[] locations) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) try { try { if (local) { ((Component)itemHolderPosition).gameObject.GetComponent<EmoteConstraint>().DeactivateConstraints(); } } catch (Exception) { } try { emoteLocations.Clear(); autoWalkSpeed = 0f; autoWalk = false; overrideMoveSpeed = false; if (Object.op_Implicit((Object)(object)parentGameObject) && !preserveParent) { parentGameObject = null; } } catch (Exception) { } try { useSafePositionReset = currentClip.useSafePositionReset; } catch (Exception) { useSafePositionReset = true; } try { if (preserveParent) { preserveParent = false; } else { mapperBody.gameObject.transform.localEulerAngles = new Vector3(0f, mapperBody.gameObject.transform.localEulerAngles.y, 0f); if (ogScale != new Vector3(-69f, -69f, -69f)) { mapperBody.transform.localScale = ogScale; ogScale = new Vector3(-69f, -69f, -69f); } Collider[] componentsInChildren = mapperBody.GetComponentsInChildren<Collider>(); foreach (Collider val in componentsInChildren) { val.enabled = true; } if (Object.op_Implicit((Object)(object)mapperBody.GetComponent<CharacterController>())) { ((Collider)mapperBody.GetComponent<CharacterController>()).enabled = true; } } } catch (Exception) { } if (preserveProps) { preserveProps = false; } else { foreach (GameObject prop in props) { if (Object.op_Implicit((Object)(object)prop)) { Object.Destroy((Object)(object)prop); } } props.Clear(); } if (locations != null) { for (int j = 0; j < locations.Length; j++) { SpawnJoinSpot(locations[j]); } } } catch (Exception arg) { DebugClass.Log($"error during new animation: {arg}"); } } public void ScaleProps() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject prop in props) { if (Object.op_Implicit((Object)(object)prop)) { Transform parent = prop.transform.parent; prop.transform.SetParent((Transform)null); prop.transform.localScale = new Vector3(scale * 1.15f, scale * 1.15f, scale * 1.15f); prop.transform.SetParent(parent); } } } internal IEnumerator preventEmotesInSpawnAnimation() { yield return (object)new WaitForSeconds(3f); canEmote = true; } private void Start() { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) if (worldProp) { return; } if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform).GetComponentInParent<PlayerControllerB>())) { mapperBody = ((Component)((Component)((Component)this).transform).GetComponentInParent<PlayerControllerB>()).gameObject; networkId = (int)((NetworkBehaviour)mapperBody.GetComponent<PlayerControllerB>()).NetworkObjectId; } else if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform).GetComponentInParent<EnemyAI>())) { mapperBody = ((Component)((Component)((Component)this).transform).GetComponentInParent<EnemyAI>()).gameObject; networkId = -1; isEnemy = CustomEmotesAPI.localMapper.isServer; } else { networkId = -1; mapperBody = ((Component)this).gameObject; } playerController = mapperBody.GetComponent<PlayerControllerB>(); if (playerController == null) { enemyController = mapperBody.GetComponent<EnemyAI>(); } playersToMappers.Add(mapperBody, this); mapperBodyTransform = mapperBody.transform; allMappers.Add(this); GameObject val = Object.Instantiate<GameObject>(Assets.Load<GameObject>("assets/source1.prefab")); ((Object)val).name = ((Object)this).name + "_AudioObject"; val.transform.SetParent(mapperBody.transform); val.transform.localPosition = Vector3.zero; val.AddComponent<SphereCollider>().radius = 0.01f; val.layer = 6; personalAudioSource = val.GetComponent<AudioSource>(); val.AddComponent<AudioManager>().Setup(personalAudioSource, this); personalAudioSource.playOnAwake = false; personalAudioSource.volume = Settings.EmotesVolume.Value / 100f; audioObject = val; int num = 0; if (true) { SkinnedMeshRenderer[] array = basePlayerModelSMR; foreach (SkinnedMeshRenderer val2 in array) { int num2 = 0; for (int j = 0; j < emoteSkeletonSMR.bones.Length; j++) { for (int k = num2; k < val2.bones.Length; k++) { if (((Object)emoteSkeletonSMR.bones[j]).name == ((Object)val2.bones[k]).name && !Object.op_Implicit((Object)(object)((Component)val2.bones[k]).gameObject.GetComponent<EmoteConstraint>())) { num2 = k; EmoteConstraint emoteConstraint = ((Component)val2.bones[k]).gameObject.AddComponent<EmoteConstraint>(); emoteConstraint.AddSource(ref val2.bones[k], ref emoteSkeletonSMR.bones[j]); emoteConstraint.revertTransform = revertTransform; break; } if (k == num2 - 1) { break; } if (num2 > 0 && k == val2.bones.Length - 1) { k = -1; } } } } } if (jank) { SkinnedMeshRenderer[] array2 = basePlayerModelSMR; foreach (SkinnedMeshRenderer val3 in array2) { for (int m = 0; m < val3.bones.Length; m++) { try { if (Object.op_Implicit((Object)(object)((Component)val3.bones[m]).gameObject.GetComponent<EmoteConstraint>())) { ((Component)val3.bones[m]).gameObject.GetComponent<EmoteConstraint>().ActivateConstraints(); } } catch (Exception arg) { DebugClass.Log($"{arg}"); } } } } ((Component)this).transform.localPosition = Vector3.zero; CustomEmotesAPI.MapperCreated(this); if (playerController != null) { ((MonoBehaviour)this).StartCoroutine(SetupHandConstraint()); } ((MonoBehaviour)this).StartCoroutine(preventEmotesInSpawnAnimation()); } public IEnumerator SetupHandConstraint() { while (!Object.op_Implicit((Object)(object)CustomEmotesAPI.localMapper)) { yield return (object)new WaitForEndOfFrame(); } itemHolderPosition = ((Component)this).GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)18).Find("ServerItemHolder"); itemHolderConstraints.Add(EmoteConstraint.AddConstraint(((Component)playerController.serverItemHolder).gameObject, this, itemHolderPosition, needToFix: true)); itemHolderConstraints.Add(EmoteConstraint.AddConstraint(((Component)playerController.localItemHolder).gameObject, this, itemHolderPosition, needToFix: true)); ((Component)itemHolderPosition).gameObject.AddComponent<EmoteConstraint>(); } public void AssignParentGameObject(GameObject youAreTheFather, bool lockPosition, bool lockRotation, bool lockScale, bool scaleAsScavenger = true, bool disableCollider = true) { //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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0048: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)parentGameObject)) { NewAnimation(null); } ogScale = mapperBody.transform.localScale; if (scaleAsScavenger) { scaleDiff = ogScale / scale; } else { scaleDiff = ogScale; } parentGameObject = youAreTheFather; positionLock = lockPosition; rotationLock = lockRotation; scaleLock = lockScale; Collider[] componentsInChildren = mapperBody.GetComponentsInChildren<Collider>(); foreach (Collider val in componentsInChildren) { val.enabled = !disableCollider; } if (Object.op_Implicit((Object)(object)mapperBody.GetComponent<CharacterController>())) { ((Collider)mapperBody.GetComponent<CharacterController>()).enabled = !disableCollider; } if (disableCollider && Object.op_Implicit((Object)(object)currentEmoteSpot)) { if (currentEmoteSpot.GetComponent<EmoteLocation>().validPlayers != 0) { currentEmoteSpot.GetComponent<EmoteLocation>().validPlayers--; } currentEmoteSpot.GetComponent<EmoteLocation>().SetColor(); currentEmoteSpot = null; } } private void LocalFunctions() { if (currentClip == null) { return; } try { if (moving && currentClip.stopOnMove) { CustomEmotesAPI.PlayAnimation("none"); } } catch (Exception) { } } private void GetLocal() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_0166: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) try { if (Object.op_Implicit((Object)(object)CustomEmotesAPI.localMapper) || !((Object)(object)playerController == (Object)(object)StartOfRound.Instance.localPlayerController)) { return; } CustomEmotesAPI.localMapper = this; local = true; isServer = ((NetworkBehaviour)playerController).IsServer && ((NetworkBehaviour)playerController).IsOwner; HealthbarAnimator.Setup(this); FixLocalArms(); Camera gameplayCamera = playerController.gameplayCamera; if (gameplayCamera != null) { rotationPoint = new GameObject(); rotationPoint.transform.SetParent(((Component)gameplayCamera).transform.parent.parent.parent.parent); rotationPoint.transform.localPosition = new Vector3(0f, 0.8f, 0f); rotationPoint.transform.localEulerAngles = Vector3.zero; desiredCameraPos = new GameObject(); desiredCameraPos.transform.SetParent(rotationPoint.transform); desiredCameraPos.transform.localPosition = new Vector3(0.3f, 1f, -3f); desiredCameraPos.transform.localEulerAngles = Vector3.zero; realCameraPos = new GameObject(); realCameraPos.transform.SetParent(desiredCameraPos.transform); realCameraPos.transform.localPosition = Vector3.zero; realCameraPos.transform.localEulerAngles = Vector3.zero; thirdPersonConstraint = EmoteConstraint.AddConstraint(((Component)((Component)gameplayCamera).transform.parent).gameObject, this, realCameraPos.transform, needToFix: false); thirdPersonConstraint.debug = true; if (((Object)basePlayerModelSMR[0].bones[32]).name == "spine.004") { cameraConstraints.Add(EmoteConstraint.AddConstraint(((Component)((Component)gameplayCamera).transform.parent).gameObject, this, basePlayerModelSMR[0].bones[32], needToFix: false)); } else { cameraConstraints.Add(EmoteConstraint.AddConstraint(((Component)((Component)gameplayCamera).transform.parent).gameObject, this, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10), needToFix: false)); } GameObject val = new GameObject(); val.transform.SetParent(((Component)gameplayCamera).transform); val.transform.localPosition = new Vector3(0.01f, -0.048f, -0.053f); val.transform.localEulerAngles = new Vector3(270f, 0f, 0f); cameraConstraints.Add(EmoteConstraint.AddConstraint(((Component)StartOfRound.Instance.localPlayerController.localVisor).gameObject, this, val.transform, needToFix: false)); } } catch (Exception message) { DebugClass.Log(message); } } internal void FixLocalArms() { int i = 0; for (int j = 0; j < basePlayerModelSMR[1].bones.Length; j++) { EmoteConstraint component = ((Component)basePlayerModelSMR[1].bones[j]).GetComponent<EmoteConstraint>(); if (component == null) { continue; } int num = i; for (; i < basePlayerModelSMR[0].bones.Length; i++) { if (((Object)basePlayerModelSMR[1].bones[j]).name == ((Object)basePlayerModelSMR[0].bones[i]).name) { component.AddSource(basePlayerModelSMR[1].bones[j], basePlayerModelSMR[0].bones[i]); component.forceGlobalTransforms = true; break; } if (i == num - 1) { break; } if (num > 0 && i == basePlayerModelSMR[0].bones.Length - 1) { i = -1; } } } } private void TwoPartThing() { //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) AnimatorStateInfo currentAnimatorStateInfo = emoteSkeletonAnimator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("none")) { if (ranSinceLastAnim) { return; } if (twopart) { ranSinceLastAnim = true; if (((Behaviour)emoteSkeletonAnimator).enabled && !jank) { UnlockBones(); } if (!ragdolling) { ((Behaviour)basePlayerModelAnimator).enabled = true; oneFrameAnimatorLeeWay = true; } ((Behaviour)emoteSkeletonAnimator).enabled = false; try { currentClip.clip.ToString(); CustomEmotesAPI.Changed("none", this); NewAnimation(null); if (currentClip.syncronizeAnimation || currentClip.syncronizeAudio) { CustomAnimationClip.syncPlayerCount[currentClip.syncPos]--; } if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null) { audioObject.GetComponent<AudioManager>().Stop(); if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null && currentClip.syncronizeAudio) { listOfCurrentEmoteAudio[currentClip.syncPos].Remove(audioObject.GetComponent<AudioSource>()); } } prevClip = currentClip; currentClip = null; return; } catch (Exception) { return; } } twopart = true; } else { twopart = false; } } private void Health() { if (playerController == null || !playerController.isPlayerDead || !local || currentClip == null) { return; } CustomEmotesAPI.PlayAnimation("none"); foreach (GameObject prop in props) { if (Object.op_Implicit((Object)(object)prop)) { Object.Destroy((Object)(object)prop); } } props.Clear(); } private void WorldPropAndParent() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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) if (!Object.op_Implicit((Object)(object)parentGameObject)) { return; } if (positionLock) { mapperBody.gameObject.transform.position = parentGameObject.transform.position + new Vector3(0f, 1f, 0f); mapperBody.transform.position = parentGameObject.transform.position; PlayerControllerB obj = playerController; if (obj != null) { obj.ResetFallGravity(); } } if (rotationLock) { mapperBody.transform.rotation = parentGameObject.transform.rotation; } if (scaleLock) { mapperBody.transform.localScale = new Vector3(parentGameObject.transform.localScale.x * scaleDiff.x, parentGameObject.transform.localScale.y * scaleDiff.y, parentGameObject.transform.localScale.z * scaleDiff.z); } } private void Update() { if (!worldProp) { WorldPropAndParent(); if (local) { LocalFunctions(); } else { GetLocal(); } TwoPartThing(); Health(); SetDeltaPosition(); RootMotion(); CameraControls(); } } internal bool ThirdPersonCheck() { return !CustomEmotesAPI.LCThirdPersonPresent && currentClip != null && (((currentClip.thirdPerson || Settings.thirdPersonType.Value == ThirdPersonType.All) && Settings.thirdPersonType.Value != ThirdPersonType.None) || temporarilyThirdPerson == TempThirdPerson.on) && canThirdPerson; } public void CameraControls() { //IL_0029: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if (local && isInThirdPerson) { Ray val = default(Ray); ((Ray)(ref val))..ctor(emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).position, desiredCameraPos.transform.position - emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).position); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, ref val2, 10f, 268437761, (QueryTriggerInteraction)1)) { realCameraPos.transform.position = ((Ray)(ref val)).GetPoint(((RaycastHit)(ref val2)).distance - 0.25f); } else { realCameraPos.transform.position = ((Ray)(ref val)).GetPoint(10f); } if (Vector3.Distance(realCameraPos.transform.position, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).position) > Vector3.Distance(desiredCameraPos.transform.position, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).position)) { realCameraPos.transform.position = desiredCameraPos.transform.position; } } } private void SetDeltaPosition() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) deltaPos = ((Component)this).transform.position - prevPosition; deltaRot = ((Component)this).transform.rotation * Quaternion.Inverse(prevRotation); prevPosition = ((Component)this).transform.position; prevRotation = ((Component)this).transform.rotation; } public void RootMotion() { //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0203: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_027a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: 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) try { if (!((Behaviour)emoteSkeletonAnimator).enabled) { return; } if (justSwitched) { justSwitched = false; } else { if (currentClip.lockType != AnimationClipParams.LockType.rootMotion) { return; } if (local || isEnemy) { if (Settings.rootMotionType.Value != RootMotionType.None || isEnemy) { Vector3 position = ((Component)this).transform.position; Quaternion rotation = ((Component)this).transform.rotation; mapperBody.transform.position = new Vector3(emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)7).position.x, mapperBody.transform.position.y, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)7).position.z); if (isEnemy || !isInThirdPerson) { mapperBody.transform.eulerAngles = new Vector3(mapperBody.transform.eulerAngles.x, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).eulerAngles.y, mapperBody.transform.eulerAngles.z); } ((Component)this).transform.position = position; ((Component)this).transform.rotation = rotation; if (positionBeforeRootMotion != new Vector3(69f, 69f, 69f)) { mapperBody.transform.position = positionBeforeRootMotion; mapperBody.transform.rotation = rotationBeforeRootMotion; positionBeforeRootMotion = new Vector3(69f, 69f, 69f); } } if (deltaPos != Vector3.zero || deltaRot != Quaternion.identity) { if (isEnemy) { EmoteNetworker.instance.SyncBoneMapperPos(((NetworkBehaviour)enemyController).NetworkObjectId, ((Component)this).transform.position, ((Component)this).transform.eulerAngles); } else { EmoteNetworker.instance.SyncBoneMapperPos(((NetworkBehaviour)playerController).NetworkObjectId, ((Component)this).transform.position, ((Component)this).transform.eulerAngles); } } } else { ((Component)this).transform.position = prevMapperPos; ((Component)this).transform.eulerAngles = prevMapperRot; } } } catch (Exception) { } } public int SpawnJoinSpot(JoinSpot joinSpot) { DebugClass.Log("Spawning Join Spot"); props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@CustomEmotesAPI_customemotespackage:assets/emotejoiner/JoinVisual.prefab"))); props[props.Count - 1].transform.SetParent(((Component)this).transform); ((Object)props[props.Count - 1]).name = joinSpot.name; EmoteLocation emoteLocation = props[props.Count - 1].AddComponent<EmoteLocation>(); emoteLocation.joinSpot = joinSpot; emoteLocation.owner = this; emoteLocations.Add(emoteLocation); return props.Count - 1; } public void JoinEmoteSpot() { if (Object.op_Implicit((Object)(object)reservedEmoteSpot)) { if (Object.op_Implicit((Object)(object)currentEmoteSpot)) { if (currentEmoteSpot.GetComponent<EmoteLocation>().validPlayers != 0) { currentEmoteSpot.GetComponent<EmoteLocation>().validPlayers--; } currentEmoteSpot.GetComponent<EmoteLocation>().SetColor(); } currentEmoteSpot = reservedEmoteSpot; reservedEmoteSpot = null; } int i; for (i = 0; i < ((Component)currentEmoteSpot.transform.parent).GetComponentsInChildren<EmoteLocation>().Length && !((Object)(object)((Component)currentEmoteSpot.transform.parent).GetComponentsInChildren<EmoteLocation>()[i] == (Object)(object)currentEmoteSpot.GetComponent<EmoteLocation>()); i++) { } EmoteNetworker.instance.SyncJoinSpot(mapperBody.GetComponent<NetworkObject>().NetworkObjectId, currentEmoteSpot.GetComponentInParent<NetworkObject>().NetworkObjectId, currentEmoteSpot.GetComponent<EmoteLocation>().owner.worldProp, i); } public void RemoveProp(int propPos) { Object.Destroy((Object)(object)props[propPos]); } public void SetAutoWalk(float speed, bool overrideBaseMovement, bool autoWalk) { autoWalkSpeed = speed; overrideMoveSpeed = overrideBaseMovement; this.autoWalk = autoWalk; } public void SetAutoWalk(float speed, bool overrideBaseMovement) { autoWalkSpeed = speed; overrideMoveSpeed = overrideBaseMovement; autoWalk = true; } internal IEnumerator waitForTwoFramesThenDisableA1() { yield return (object)new WaitForEndOfFrame(); } private void OnDestroy() { if (worldProp) { return; } playersToMappers.Remove(mapperBody); try { ((object)currentClip.clip[0]).ToString(); NewAnimation(null); if ((currentClip.syncronizeAnimation || currentClip.syncronizeAudio) && CustomAnimationClip.syncPlayerCount[currentClip.syncPos] > 0) { CustomAnimationClip.syncPlayerCount[currentClip.syncPos]--; } if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null) { audioObject.GetComponent<AudioManager>().Stop(); if (currentClip.syncronizeAudio) { listOfCurrentEmoteAudio[currentClip.syncPos].Remove(audioObject.GetComponent<AudioSource>()); } } if (uniqueSpot != -1 && CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot]) { CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot] = false; uniqueSpot = -1; } allMappers.Remove(this); prevClip = currentClip; currentClip = null; } catch (Exception) { allMappers.Remove(this); } } public void UnlockBones(bool animatorEnabled = true) { //IL_0007: 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) ((Component)this).transform.localPosition = Vector3.zero; ((Component)this).transform.eulerAngles = bodyPrefab.transform.eulerAngles; SkinnedMeshRenderer[] array = basePlayerModelSMR; foreach (SkinnedMeshRenderer val in array) { for (int j = 0; j < val.bones.Length; j++) { try { if (Object.op_Implicit((Object)(object)((Component)val.bones[j]).gameObject.GetComponent<EmoteConstraint>())) { ((Component)val.bones[j]).gameObject.GetComponent<EmoteConstraint>().DeactivateConstraints(); } } catch (Exception) { break; } } } foreach (EmoteConstraint cameraConstraint in cameraConstraints) { cameraConstraint.DeactivateConstraints(); } foreach (EmoteConstraint itemHolderConstraint in itemHolderConstraints) { itemHolderConstraint.DeactivateConstraints(); } foreach (EmoteConstraint additionalConstraint in additionalConstraints) { additionalConstraint.DeactivateConstraints(); } if (thirdPersonConstraint != null) { thirdPersonConstraint.DeactivateConstraints(); } DeThirdPerson(); } public void LockBones() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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) UnlockBones(); ((Component)this).transform.localPosition = Vector3.zero; foreach (HumanBodyBones soloIgnoredBone in currentClip.soloIgnoredBones) { if (Object.op_Implicit((Object)(object)emoteSkeletonAnimator.GetBoneTransform(soloIgnoredBone))) { dontAnimateUs.Add(((Object)emoteSkeletonAnimator.GetBoneTransform(soloIgnoredBone)).name); } } foreach (HumanBodyBones rootIgnoredBone in currentClip.rootIgnoredBones) { if (Object.op_Implicit((Object)(object)emoteSkeletonAnimator.GetBoneTransform(rootIgnoredBone))) { dontAnimateUs.Add(((Object)emoteSkeletonAnimator.GetBoneTransform(rootIgnoredBone)).name); } Transform[] componentsInChildren = ((Component)emoteSkeletonAnimator.GetBoneTransform(rootIgnoredBone)).GetComponentsInChildren<Transform>(); foreach (Transform val in componentsInChildren) { dontAnimateUs.Add(((Object)val).name); } } if (!jank) { ((Renderer)emoteSkeletonSMR).enabled = true; SkinnedMeshRenderer[] array = basePlayerModelSMR; foreach (SkinnedMeshRenderer val2 in array) { for (int k = 0; k < val2.bones.Length; k++) { try { if (Object.op_Implicit((Object)(object)((Component)val2.bones[k]).gameObject.GetComponent<EmoteConstraint>()) && !dontAnimateUs.Contains(((Object)val2.bones[k]).name)) { EmoteConstraint component = ((Component)val2.bones[k]).gameObject.GetComponent<EmoteConstraint>(); component.ActivateConstraints(); if ((Object)(object)val2 == (Object)(object)basePlayerModelSMR.First()) { component.SetLocalTransforms(currentClip.localTransforms); } } else if (dontAnimateUs.Contains(((Object)val2.bones[k]).name)) { ((Component)val2.bones[k]).gameObject.GetComponent<EmoteConstraint>().DeactivateConstraints(); } } catch (Exception arg) { DebugClass.Log($"{arg}"); } } } foreach (EmoteConstraint itemHolderConstraint in itemHolderConstraints) { itemHolderConstraint.ActivateConstraints(); } foreach (EmoteConstraint additionalConstraint in additionalConstraints) { additionalConstraint.ActivateConstraints(); } LockCameraStuff(local && ThirdPersonCheck()); } else { ((MonoBehaviour)this).StartCoroutine(waitForTwoFramesThenDisableA1()); } } public void LockCameraStuff(bool thirdPersonLock) { if (thirdPersonLock) { TurnOnThirdPerson(); return; } if (Settings.rootMotionType.Value != RootMotionType.None && (currentClip.lockType == AnimationClipParams.LockType.rootMotion || Settings.rootMotionType.Value == RootMotionType.All || currentClip.lockType == AnimationClipParams.LockType.lockHead)) { foreach (EmoteConstraint cameraConstraint in cameraConstraints) { cameraConstraint.ActivateConstraints(); } return; } if (currentClip.lockType != AnimationClipParams.LockType.headBobbing) { return; } foreach (EmoteConstraint cameraConstraint2 in cameraConstraints) { cameraConstraint2.ActivateConstraints(); if ((Object)(object)cameraConstraint2 != (Object)(object)cameraConstraints[cameraConstraints.Count - 1]) { cameraConstraint2.onlyY = true; } } } public void UnlockCameraStuff() { foreach (EmoteConstraint cameraConstraint in cameraConstraints) { cameraConstraint.DeactivateConstraints(); } thirdPersonConstraint.DeactivateConstraints(); DeThirdPerson(); } public void TurnOnThirdPerson() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 ((Component)playerController.localVisor).gameObject.SetActive(false); if ((int)((Renderer)playerController.thisPlayerModel).shadowCastingMode == 1) { needToTurnOffShadows = false; } ((Renderer)playerController.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1; ((Renderer)playerController.thisPlayerModelArms).shadowCastingMode = (ShadowCastingMode)3; if (originalLayer == -1) { originalLayer = ((Component)playerController.thisPlayerModel).gameObject.layer; originalCullingMask = playerController.gameplayCamera.cullingMask; } ((Component)playerController.thisPlayerModel).gameObject.layer = 1; playerController.grabDistance = 5.65f; playerController.gameplayCamera.cullingMask = StartOfRound.Instance.spectateCamera.cullingMask; thirdPersonConstraint.ActivateConstraints(); isInThirdPerson = true; if (CustomEmotesAPI.MoreCompanyPresent) { try { needToTurnOffCosmetics = true; MoreCompanyCompat.TurnOnCosmetics(this); } catch (Exception arg) { DebugClass.Log($"couldn't turn on cosmetics: {arg}"); } } } public void DeThirdPerson() { if (!isInThirdPerson) { return; } playerController.gameplayCamera.cullingMask = originalCullingMask; if (needToTurnOffShadows) { ((Renderer)playerController.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)3; } needToTurnOffShadows = true; ((Renderer)playerController.thisPlayerModelArms).shadowCastingMode = (ShadowCastingMode)1; ((Component)playerController.localVisor).gameObject.SetActive(true); ((Component)playerController.thisPlayerModel).gameObject.layer = originalLayer; playerController.grabDistance = 3f; isInThirdPerson = false; if (CustomEmotesAPI.MoreCompanyPresent && needToTurnOffCosmetics) { try { MoreCompanyCompat.TurnOffCosmetics(this); } catch (Exception arg) { DebugClass.Log($"couldn't clear cosmetics: {arg}"); } } } public void AttachItemHolderToTransform(Transform target) { ((Component)itemHolderPosition).gameObject.GetComponent<EmoteConstraint>().AddSource(itemHolderPosition, target); ((Component)itemHolderPosition).gameObject.GetComponent<EmoteConstraint>().ActivateConstraints(); } } public class CustomAnimationClip : MonoBehaviour { public AnimationClip[] clip; public AnimationClip[] secondaryClip; public bool looping; public string wwiseEvent; public bool syncronizeAudio; public List<HumanBodyBones> soloIgnoredBones; public List<HumanBodyBones> rootIgnoredBones; public bool dimAudioWhenClose; public bool stopOnAttack; public bool stopOnMove; public bool visibility; public int startPref; public int joinPref; public JoinSpot[] joinSpots; public bool useSafePositionReset; public string customInternalName; public Action<BoneMapper> customPostEventCodeSync; public Action<BoneMapper> customPostEventCodeNoSync; public bool syncronizeAnimation; public int syncPos; public static List<float> syncTimer = new List<float>(); public static List<int> syncPlayerCount = new List<int>(); public static List<List<bool>> uniqueAnimations = new List<List<bool>>(); public bool vulnerableEmote = false; public AnimationClipParams.LockType lockType = AnimationClipParams.LockType.none; public bool willGetClaimed = false; public float audioLevel = 0.5f; public bool thirdPerson = false; public string displayName = ""; public bool localTransforms = false; public BepInPlugin ownerPlugin; public bool usesNewImportSystem = false; public bool animates = true; public bool preventsMovement = false; internal CustomAnimationClip(AnimationClip[] _clip, bool _loop, AudioClip[] primaryAudioClips = null, AudioClip[] secondaryAudioClips = null, HumanBodyBones[] rootBonesToIgnore = null, HumanBodyBones[] soloBonesToIgnore = null, AnimationClip[] _secondaryClip = null, bool dimWhenClose = false, bool stopWhenMove = false, bool stopWhenAttack = false, bool visible = true, bool syncAnim = false, bool syncAudio = false, int startPreference = -1, int joinPreference = -1, JoinSpot[] _joinSpots = null, bool safePositionReset = false, string customName = "", Action<BoneMapper> _customPostEventCodeSync = null, Action<BoneMapper> _customPostEventCodeNoSync = null, AnimationClipParams.LockType lockType = AnimationClipParams.LockType.none, AudioClip[] primaryDMCAFreeAudioClips = null, AudioClip[] secondaryDMCAFreeAudioClips = null, bool willGetClaimed = false, float audioLevel = 0.5f, bool thirdPerson = false, string displayName = "", BepInPlugin ownerPlugin = null, bool localTransforms = false, bool usesNewImportSystem = false, bool animates = true, bool preventsMovement = false) { if (rootBonesToIgnore == null) { rootBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[0]; } if (soloBonesToIgnore == null) { soloBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[0]; } clip = _clip; secondaryClip = _secondaryClip; looping = _loop; dimAudioWhenClose = dimWhenClose; stopOnAttack = stopWhenAttack; stopOnMove = stopWhenMove; visibility = visible; joinPref = joinPreference; startPref = startPreference; customPostEventCodeSync = _customPostEventCodeSync; customPostEventCodeNoSync = _customPostEventCodeNoSync; if (primaryAudioClips == null) { BoneMapper.primaryAudioClips.Add((AudioClip[])(object)new AudioClip[1]); } else { BoneMapper.primaryAudioClips.Add(primaryAudioClips); } if (secondaryAudioClips == null) { BoneMapper.secondaryAudioClips.Add((AudioClip[])(object)new AudioClip[1]); } else { BoneMapper.secondaryAudioClips.Add(secondaryAudioClips); } if (primaryDMCAFreeAudioClips == null) { BoneMapper.primaryDMCAFreeAudioClips.Add((AudioClip[])(object)new AudioClip[1]); } else { BoneMapper.primaryDMCAFreeAudioClips.Add(primaryDMCAFreeAudioClips); } if (secondaryDMCAFreeAudioClips == null) { BoneMapper.secondaryDMCAFreeAudioClips.Add((AudioClip[])(object)new AudioClip[1]); } else { BoneMapper.secondaryDMCAFreeAudioClips.Add(secondaryDMCAFreeAudioClips); } if (soloBonesToIgnore.Length != 0) { soloIgnoredBones = new List<HumanBodyBones>(soloBonesToIgnore); } else { soloIgnoredBones = new List<HumanBodyBones>(); } if (rootBonesToIgnore.Length != 0) { rootIgnoredBones = new List<HumanBodyBones>(rootBonesToIgnore); } else { rootIgnoredBones = new List<HumanBodyBones>(); } syncronizeAnimation = syncAnim; syncronizeAudio = syncAudio; syncPos = syncTimer.Count; syncTimer.Add(0f); syncPlayerCount.Add(0); if (_clip != null) { List<bool> list = new List<bool>(); for (int i = 0; i < _clip.Length; i++) { list.Add(item: false); } uniqueAnimations.Add(list); } if (_joinSpots == null) { _joinSpots = new JoinSpot[0]; } joinSpots = _joinSpots; useSafePositionReset = safePositionReset; customInternalName = customName; this.usesNewImportSystem = usesNewImportSystem; if (!usesNewImportSystem && customName != "") { BoneMapper.customNamePairs.Add(customName, ((Object)_clip[0]).name); } BoneMapper.listOfCurrentEmoteAudio.Add(new List<AudioSource>()); this.lockType = lockType; this.willGetClaimed = willGetClaimed; this.audioLevel = audioLevel; this.thirdPerson = thirdPerson; this.displayName = displayName; if (displayName == "") { DebugClass.Log("display name wasn't set, using " + customInternalName); this.displayName = customInternalName; } this.ownerPlugin = ownerPlugin; this.localTransforms = localTransforms; this.animates = animates; this.preventsMovement = preventsMovement; } } [DefaultExecutionOrder(-2)] public class EmoteConstraint : MonoBehaviour { public Transform originalBone; public Transform emoteBone; private Vector3 originalPosition; private Quaternion originalRotation; public bool constraintActive = false; public bool revertTransform; private bool firstTime = true; private bool firstTime2 = true; private bool hasEverActivatedConstraints = false; public bool onlyY = false; public bool debug = false; public bool forceGlobalTransforms = false; internal bool needToFix = true; public bool localTransforms { get; private set; } = false; public bool SetLocalTransforms(bool input) { localTransforms = !forceGlobalTransforms && input; return localTransforms; } private void LateUpdate() { ActUponConstraints(); } public void ActUponConstraints() { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!constraintActive) { return; } if (localTransforms) { if (onlyY) { originalBone.localPosition = new Vector3(originalBone.localPosition.x, emoteBone.localPosition.y, originalBone.localPosition.z); return; } originalBone.localPosition = emoteBone.localPosition; originalBone.localRotation = emoteBone.localRotation; } else if (onlyY) { originalBone.position = new Vector3(originalBone.position.x, emoteBone.position.y, originalBone.position.z); } else { originalBone.position = emoteBone.position; originalBone.rotation = emoteBone.rotation; } } public void ActivateConstraints() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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) if (!constraintActive && emoteBone != null) { if (firstTime2) { firstTime2 = false; ((Component)this).gameObject.GetComponent<MonoBehaviour>().StartCoroutine(FirstTimeActiveFix(this)); return; } originalPosition = originalBone.localPosition; originalRotation = originalBone.localRotation; hasEverActivatedConstraints = true; constraintActive = true; onlyY = false; } } internal IEnumerator FirstTimeActiveFix(EmoteConstraint e) { ((Behaviour)e).enabled = false; yield return (object)new WaitForEndOfFrame(); ((Behaviour)e).enabled = true; if (e.onlyY) { e.ActivateConstraints(); e.onlyY = true; } else { e.ActivateConstraints(); } } public void DeactivateConstraints() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) constraintActive = false; if (firstTime || !revertTransform || !hasEverActivatedConstraints) { firstTime = false; return; } originalBone.localPosition = originalPosition; originalBone.localRotation = originalRotation; } internal void AddSource(ref Transform originalBone, ref Transform emoteBone) { this.originalBone = originalBone; this.emoteBone = emoteBone; } internal void AddSource(Transform originalBone, Transform emoteBone) { this.originalBone = originalBone; this.emoteBone = emoteBone; } internal static EmoteConstraint AddConstraint(GameObject gameObject, BoneMapper mapper, Transform target, bool needToFix) { EmoteConstraint emoteConstraint = gameObject.AddComponent<EmoteConstraint>(); emoteConstraint.AddSource(gameObject.transform, target); emoteConstraint.revertTransform = mapper.revertTransform; emoteConstraint.needToFix = needToFix; return emoteConstraint; } private void Start() { ((MonoBehaviour)this).StartCoroutine(FixConstraints()); } private IEnumerator FixConstraints() { yield return (object)new WaitForEndOfFrame(); if (needToFix) { ActivateConstraints(); yield return (object)new WaitForEndOfFrame(); DeactivateConstraints(); } } } public struct JoinSpot { public string name; public Vector3 position; public Vector3 rotation; public Vector3 scale; public JoinSpot(string _name, Vector3 _position, Vector3 _rotation, Vector3 _scale) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) name = _name; position = _position; rotation = _rotation; scale = _scale; } public JoinSpot(string _name, Vector3 _position) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) name = _name; position = _position; rotation = Vector3.zero; scale = Vector3.one; } } public class EmoteLocation : MonoBehaviour { public static List<EmoteLocation> emoteLocations = new List<EmoteLocation>(); public static bool visibile = true; public int spot; public int validPlayers = 0; public BoneMapper owner; public BoneMapper emoter; public JoinSpot joinSpot; public static void HideAllSpots() { visibile = false; foreach (EmoteLocation emoteLocation in emoteLocations) { try { Renderer[] componentsInChildren = ((Component)emoteLocation).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { val.enabled = false; } ParticleSystemRenderer[] componentsInChildren2 = ((Component)emoteLocation).GetComponentsInChildren<ParticleSystemRenderer>(); foreach (ParticleSystemRenderer val2 in componentsInChildren2) { ((Renderer)val2).enabled = false; } } catch (Exception) { } } } public static void ShowAllSpots() { visibile = true; foreach (EmoteLocation emoteLocation in emoteLocations) { try { Renderer[] componentsInChildren = ((Component)emoteLocation).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { val.enabled = true; } ParticleSystemRenderer[] componentsInChildren2 = ((Component)emoteLocation).GetComponentsInChildren<ParticleSystemRenderer>(); foreach (ParticleSystemRenderer val2 in componentsInChildren2) { ((Renderer)val2).enabled = true; } } catch (Exception) { } } } private void Start() { SetColor(); emoteLocations.Add(this); ((MonoBehaviour)this).StartCoroutine(setScale()); if (!visibile) { Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { val.enabled = false; } ParticleSystemRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<ParticleSystemRenderer>(); foreach (ParticleSystemRenderer val2 in componentsInChildren2) { ((Renderer)val2).enabled = false; } } } private void OnDestroy() { emoteLocations.Remove(this); } public void SetEmoterAndHideLocation(BoneMapper boneMapper) { if (!Object.op_Implicit((Object)(object)emoter)) { emoter = boneMapper; SetVisible(visibility: false); } } public IEnumerator setScale() { yield return (object)new WaitForSeconds(0.1f); _ = Vector3.one; Vector3 scal = ((!Object.op_Implicit((Object)(object)owner.emoteSkeletonSMR)) ? ((Component)owner).transform.lossyScale : ((Component)owner).transform.parent.lossyScale); ((Component)this).transform.localPosition = new Vector3(joinSpot.position.x / scal.x, joinSpot.position.y / scal.y, joinSpot.position.z / scal.z); ((Component)this).transform.localEulerAngles = joinSpot.rotation; ((Component)this).transform.localScale = new Vector3(joinSpot.scale.x / scal.x, joinSpot.scale.y / scal.y, joinSpot.scale.z / scal.z); } internal void SetVisible(bool visibility) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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 (visibility) { Transform transform = ((Component)this).gameObject.transform; transform.localPosition += new Vector3(5000f, 5000f, 5000f); } else { Transform transform2 = ((Component)this).gameObject.transform; transform2.localPosition -= new Vector3(5000f, 5000f, 5000f); } } private void OnTriggerEnter(Collider other) { if (Object.op_Implicit((Object)(object)((Component)other).GetComponentInChildren<BoneMapper>()) && (Object)(object)((Component)other).GetComponentInChildren<BoneMapper>() != (Object)(object)owner) { BoneMapper componentInChildren = ((Component)other).GetComponentInChildren<BoneMapper>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { validPlayers++; SetColor(); componentInChildren.currentEmoteSpot = ((Component)this).gameObject; CustomEmotesAPI.JoinSpotEntered(componentInChildren, owner); } } } private void OnTriggerExit(Collider other) { if (!Object.op_Implicit((Object)(object)((Component)other).GetComponentInChildren<BoneMapper>()) || !((Object)(object)((Component)other).GetComponentInChildren<BoneMapper>() != (Object)(object)owner)) { return; } BoneMapper componentInChildren = ((Component)other).GetComponentInChildren<BoneMapper>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { if (validPlayers != 0) { validPlayers--; } SetColor(); if ((Object)(object)componentInChildren.currentEmoteSpot == (Object)(object)((Component)this).gameObject) { componentInChildren.currentEmoteSpot = null; } } } internal void SetColor() { //IL_010d: 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_0149: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (validPlayers > 0) { ((Component)this).GetComponentsInChildren<Renderer>()[((Component)this).GetComponentsInChildren<Renderer>().Length - 1].material.color = Color.green; Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { val.material.SetColor("_EmissionColor", Color.green); } ParticleSystemRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<ParticleSystemRenderer>(); foreach (ParticleSystemRenderer val2 in componentsInChildren2) { ((Renderer)val2).material.SetColor("_EmissionColor", Color.green); } ParticleSystem[] componentsInChildren3 = ((Component)this).GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val3 in componentsInChildren3) { TrailModule trails = val3.trails; ((TrailModule)(ref trails)).colorOverTrail = MinMaxGradient.op_Implicit(Color.green); } } else { ((Component)this).GetComponentsInChildren<Renderer>()[((Component)this).GetComponentsInChildren<Renderer>().Length - 1].material.color = new Color(0.003921569f, 52f / 85f, 38f / 51f); Renderer[] componentsInChildren4 = ((Component)this).GetComponentsInChildren<Renderer>(); foreach (Renderer val4 in componentsInChildren4) { val4.material.SetColor("_EmissionColor", new Color(0.003921569f, 52f / 85f, 38f / 51f)); } ParticleSystemRenderer[] componentsInChildren5 = ((Component)this).GetComponentsInChildren<ParticleSystemRenderer>(); foreach (ParticleSystemRenderer val5 in componentsInChildren5) { ((Renderer)val5).material.SetColor("_EmissionColor", new Color(0.003921569f, 52f / 85f, 38f / 51f)); } ParticleSystem[] componentsInChildren6 = ((Component)this).GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val6 in componentsInChildren6) { TrailModule trails2 = val6.trails; ((TrailModule)(ref trails2)).colorOverTrail = MinMaxGradient.op_Implicit(new Color(0.003921569f, 52f / 85f, 38f / 51f)); } } } } public class AudioContainer : MonoBehaviour { internal List<GameObject> playingObjects = new List<GameObject>(); } public class AudioObject : MonoBehaviour { internal int spot; internal int playerCount; internal GameObject audioObject; internal int activeObjectsSpot; } public class BonePair { public Transform original; public Transform newiginal; public BonePair(Transform n, Transform o) { newiginal = n; original = o; } public void test() { } } public static class DebugClass { private static ManualLogSource Logger; public static void SetLogger(ManualLogSource logSource) { Logger = logSource; } public static void Log(object message) { Logger.Log((LogLevel)16, (object)$"{message}"); } } public class EmoteNetworker : NetworkBehaviour { public static EmoteNetworker instance; private void Awake() { ((Object)this).name = "Bigma Lalls"; instance = this; } public void SyncEmote(ulong playerId, string animation, int pos) { if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsServer) { SyncEmoteToClients(playerId, animation, pos); } else { SyncEmoteToServerRpc(playerId, animation, pos); } } public void SyncEmoteToClients(ulong playerId, string animation, int pos) { GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject; if (!Object.op_Implicit((Object)(object)gameObject)) { DebugClass.Log("Body is null!!!"); } int eventNum = -1; CustomAnimationClip customAnimationClip = BoneMapper.animClips[animation]; try { ((object)customAnimationClip.clip[0]).ToString(); eventNum = Random.Range(0, BoneMapper.primaryAudioClips[customAnimationClip.syncPos].Length); } catch (Exception) { } SyncEmoteToClientRpc(playerId, animation, pos, eventNum); } [ClientRpc] public void SyncEmoteToClientRpc(ulong playerId, string animation, int pos, int eventNum) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00e1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1218916340u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); bool flag = animation != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animation, false); } BytePacker.WriteValueBitPacked(val2, pos); BytePacker.WriteValueBitPacked(val2, eventNum); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1218916340u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject; if (!Object.op_Implicit((Object)(object)gameObject)) { DebugClass.Log("Body is null!!!"); } BoneMapper componentInChildren = gameObject.GetComponentInChildren<BoneMapper>(); if (componentInChildren.playerController != null && animation != "none") { componentInChildren.playerController.performingEmote = false; if (((NetworkBehaviour)componentInChildren.playerController).IsOwner) { componentInChildren.playerController.StopPerformingEmoteServerRpc(); } } DebugClass.Log($"Recieved message to play {animation} on client. Playing on {gameObject}"); componentInChildren.PlayAnim(animation, pos, eventNum); } [ServerRpc(RequireOwnership = false)] public void SyncEmoteToServerRpc(ulong playerId, string animation, int pos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1304595851u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); bool flag = animation != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animation, false); } BytePacker.WriteValueBitPacked(val2, pos); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1304595851u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SyncEmoteToClients(playerId, animation, pos); } } public void SyncJoinSpot(ulong playerId, ulong joinSpotId, bool worldProp, int posInArray) { if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsServer) { SyncJoinSpotToClientRpc(playerId, joinSpotId, worldProp, posInArray); } else { SyncJoinSpotToServerRpc(playerId, joinSpotId, worldProp, posInArray); } } [ClientRpc] public void SyncJoinSpotToClientRpc(ulong playerId, ulong joinSpotId, bool worldProp, int posInArray) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(770217386u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, joinSpotId); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref worldProp, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, posInArray); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 770217386u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject; GameObject gameObject2 = ((Component)((NetworkBehaviour)this).GetNetworkObject(joinSpotId)).gameObject; if (!Object.op_Implicit((Object)(object)gameObject)) { DebugClass.Log("Body is null!!!"); } if (!Object.op_Implicit((Object)(object)gameObject2)) { DebugClass.Log("spotObject is null!!!"); } BoneMapper componentInChildren = gameObject.GetComponentInChildren<BoneMapper>(); componentInChildren.PlayAnim("none", 0, -1); componentInChildren.currentEmoteSpot = ((Component)gameObject2.GetComponentsInChildren<EmoteLocation>()[posInArray]).gameObject; if (worldProp) { CustomEmotesAPI.JoinedProp(componentInChildren.currentEmoteSpot, componentInChildren, componentInChildren.currentEmoteSpot.GetComponent<EmoteLocation>().owner); } else { CustomEmotesAPI.JoinedBody(componentInChildren.currentEmoteSpot, componentInChildren, componentInChildren.currentEmoteSpot.GetComponent<EmoteLocation>().owner); } } } [ServerRpc(RequireOwnership = false)] public void SyncJoinSpotToServerRpc(ulong playerId, ulong joinSpotId, bool worldProp, int posInArray) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(711293682u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, joinSpotId); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref worldProp, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, posInArray); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 711293682u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SyncJoinSpotToClientRpc(playerId, joinSpotId, worldProp, posInArray); } } } public void SyncBoneMapperPos(ulong playerId, Vector3 pos, Vector3 rot) { //IL_0027: 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_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) if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsServer) { SyncBoneMapperPosToClientRpc(playerId, pos, rot); } else { SyncBoneMapperPosToServerRpc(playerId, pos, rot); } } [ClientRpc] public void SyncBoneMapperPosToClientRpc(ulong playerId, Vector3 pos, Vector3 rot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1678486976u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1678486976u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject; if (!Object.op_Implicit((Object)(object)gameObject)) { DebugClass.Log("Body is null!!!"); } BoneMapper componentInChildren = gameObject.GetComponentInChildren<BoneMapper>(); if (!((Object)(object)componentInChildren == (Object)(object)CustomEmotesAPI.localMapper)) { componentInChildren.prevMapperPos = pos; componentInChildren.prevMapperRot = rot; } } } [ServerRpc(RequireOwnership = false)] public void SyncBoneMapperPosToServerRpc(ulong playerId, Vector3 pos, Vector3 rot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2977327148u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2977327148u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SyncBoneMapperPosToClientRpc(playerId, pos, rot); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_EmoteNetworker() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1218916340u, new RpcReceiveHandler(__rpc_handler_1218916340)); NetworkManager.__rpc_func_table.Add(1304595851u, new RpcReceiveHandler(__rpc_handler_1304595851)); NetworkManager.__rpc_func_table.Add(770217386u, new RpcReceiveHandler(__rpc_handler_770217386)); NetworkManager.__rpc_func_table.Add(711293682u, new RpcReceiveHandler(__rpc_handler_711293682)); NetworkManager.__rpc_func_table.Add(1678486976u, new RpcReceiveHandler(__rpc_handler_1678486976)); NetworkManager.__rpc_func_table.Add(2977327148u, new RpcReceiveHandler(__rpc_handler_2977327148)); } private static void __rpc_handler_1218916340(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animation = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animation, false); } int pos = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref pos); int eventNum = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref eventNum); target.__rpc_exec_stage = (__RpcExecStage)2; ((EmoteNetworker)(object)target).SyncEmoteToClientRpc(playerId, animation, pos, eventNum); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1304595851(NetworkBehaviour
plugins/LethalEmotesApi/LethalEmotesApi.Ui.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using LethalEmotesApi.Ui.Animation; using LethalEmotesApi.Ui.Customize; using LethalEmotesApi.Ui.Customize.DragDrop; using LethalEmotesApi.Ui.Customize.Preview; using LethalEmotesApi.Ui.Customize.Wheel; using LethalEmotesApi.Ui.Data; using LethalEmotesApi.Ui.Db; using LethalEmotesApi.Ui.Elements; using LethalEmotesApi.Ui.Wheel; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalEmotesApi.Ui")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ac9af00520b342a064c8a94d95cc8a7a2f6e3894")] [assembly: AssemblyProduct("LethalEmotesApi.Ui")] [assembly: AssemblyTitle("LethalEmotesApi.Ui")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalEmotesApi.Ui { internal static class DebugUtils { public static string ToPrettyString<T>(this IEnumerable<T> enumerable) { StringBuilder stringBuilder = new StringBuilder(); int num = 0; stringBuilder.AppendLine("{"); num++; int num2 = 0; foreach (T item in enumerable) { if (item != null) { for (int i = 0; i < num; i++) { stringBuilder.Append(" "); } stringBuilder.AppendLine($"[{num2}]: {item.ToString()}"); num2++; } } stringBuilder.AppendLine("}"); return stringBuilder.ToString(); } } public static class EmoteUiManager { internal static IEmoteUiStateController? _stateController; internal static EmoteUiPanel? EmoteUiInstance; internal static IReadOnlyCollection<string> EmoteKeys => _stateController.EmoteDb.EmoteKeys; internal static IReadOnlyCollection<string> RandomPoolBlacklist => _stateController.RandomPoolBlacklist; public static float EmoteVolume { get { return _stateController.EmoteVolume; } set { _stateController.EmoteVolume = value; } } public static bool HideJoinSpots { get { return _stateController.HideJoinSpots; } set { _stateController.HideJoinSpots = value; } } public static int RootMotionType { get { return _stateController.RootMotionType; } set { _stateController.RootMotionType = value; } } public static bool EmotesAlertEnemies { get { return _stateController.EmotesAlertEnemies; } set { _stateController.EmotesAlertEnemies = value; } } public static int DmcaFree { get { return _stateController.DmcaFree; } set { _stateController.DmcaFree = value; } } public static int ThirdPerson { get { return _stateController.ThirdPerson; } set { _stateController.ThirdPerson = value; } } public static void RegisterStateController(IEmoteUiStateController stateController) { _stateController = stateController; } public static IEmoteUiStateController? GetStateController() { return _stateController; } internal static void PlayEmote(string emoteKey) { try { _stateController?.PlayEmote(emoteKey); } catch { Debug.Log((object)"Emote selected might not exist"); } } internal static void LockMouseInput() { _stateController?.LockMouseInput(); } internal static void UnlockMouseInput() { _stateController?.UnlockMouseInput(); } internal static void LockPlayerInput() { _stateController?.LockPlayerInput(); } internal static void UnlockPlayerInput() { _stateController?.UnlockPlayerInput(); } internal static void PlayAnimationOn(Animator animator, string emoteKey) { _stateController?.PlayAnimationOn(animator, emoteKey); } internal static string GetEmoteName(string emoteKey) { return _stateController.EmoteDb.GetEmoteName(emoteKey); } internal static string GetEmoteModName(string emoteKey) { return _stateController.EmoteDb.GetModName(emoteKey); } internal static void AddToRandomPoolBlacklist(string emoteKey) { _stateController?.AddToRandomPoolBlacklist(emoteKey); } internal static void RemoveFromRandomPoolBlacklist(string emoteKey) { _stateController?.RemoveFromRandomPoolBlacklist(emoteKey); } internal static EmoteWheelSetData LoadEmoteWheelSetData() { return _stateController.LoadEmoteWheelSetData(); } internal static void SaveEmoteWheelSetData(EmoteWheelSetData dataToSave) { _stateController.SaveEmoteWheelSetData(dataToSave); if (EmoteUiInstance != null) { EmoteUiInstance.ReloadData(); } } public static bool IsEmoteWheelsOpen() { EmoteUiPanel emoteUiInstance = EmoteUiInstance; return emoteUiInstance != null && emoteUiInstance.IsOpen && emoteUiInstance.CurrentView == EmoteUiPanel.UiView.EmoteWheels; } public static bool IsCustomizePanelOpen() { EmoteUiPanel emoteUiInstance = EmoteUiInstance; return emoteUiInstance != null && emoteUiInstance.IsOpen && emoteUiInstance.CurrentView == EmoteUiPanel.UiView.Customize; } public static bool CanOpenEmoteWheels() { if (_stateController == null) { return false; } return _stateController.CanOpenEmoteUi() && !IsCustomizePanelOpen(); } public static void OnLeftWheel() { if (EmoteUiInstance != null && EmoteUiInstance.emoteWheelsController != null && IsEmoteWheelsOpen()) { EmoteUiInstance.emoteWheelsController.PrevWheel(); } } public static void OnRightWheel() { if (EmoteUiInstance != null && EmoteUiInstance.emoteWheelsController != null && IsEmoteWheelsOpen()) { EmoteUiInstance.emoteWheelsController.NextWheel(); } } public static void OpenEmoteWheels() { if (EmoteUiInstance != null && CanOpenEmoteWheels()) { EmoteUiInstance.Show(); } } public static void CloseEmoteWheels() { if (EmoteUiInstance != null && IsEmoteWheelsOpen()) { EmoteUiInstance.Hide(); } } public static void CloseCustomizationPanel() { if (EmoteUiInstance != null && IsCustomizePanelOpen()) { EmoteUiInstance.Hide(); } } public static void CloseUiGracefully() { CloseCustomizationPanel(); if (EmoteUiInstance != null && IsEmoteWheelsOpen()) { EmoteUiInstance.CloseGracefully(); } } } public class EmoteUiPanel : MonoBehaviour { internal enum UiView { EmoteWheels, Customize } public EmoteWheelsController? emoteWheelsController; public CustomizePanel? customizePanel; public RectTransform? customizeButton; private TextMeshProUGUI? _customizeButtonLabel; public bool IsOpen { get; private set; } internal UiView CurrentView { get; private set; } = UiView.EmoteWheels; private void Awake() { EmoteUiManager.EmoteUiInstance = this; if (customizeButton != null && _customizeButtonLabel == null) { _customizeButtonLabel = ((Component)customizeButton).GetComponentInChildren<TextMeshProUGUI>(); } } private void OnEnable() { if (customizeButton != null && _customizeButtonLabel == null) { _customizeButtonLabel = ((Component)customizeButton).GetComponentInChildren<TextMeshProUGUI>(); } } public void ReloadData() { if (emoteWheelsController != null) { emoteWheelsController.ReloadWheels(); } } public void Show() { CurrentView = UiView.EmoteWheels; UpdateCustomizeButton(); ShowCustomizeButton(); ShowEmoteWheels(); EmoteUiManager.LockMouseInput(); IsOpen = true; } public void Hide() { HideCustomizePanel(); HideCustomizeButton(); HideEmoteWheels(); CurrentView = UiView.EmoteWheels; EmoteUiManager.UnlockMouseInput(); EmoteUiManager.UnlockPlayerInput(); IsOpen = false; } public void CloseGracefully() { HideCustomizePanel(); HideCustomizeButton(); CloseEmoteWheelsGracefully(); CurrentView = UiView.EmoteWheels; } public void ToggleCustomizePanel() { if (emoteWheelsController != null) { if (CurrentView == UiView.EmoteWheels) { CloseEmoteWheelsGracefully(); ShowCustomizePanel(); CurrentView = UiView.Customize; EmoteUiManager.LockPlayerInput(); } else if (CurrentView == UiView.Customize) { Hide(); } UpdateCustomizeButton(); } } public void ShowEmoteWheels() { if (emoteWheelsController != null) { emoteWheelsController.Show(); ((Component)emoteWheelsController.wheelLabel).gameObject.SetActive(true); } } public void HideEmoteWheels() { if (emoteWheelsController != null) { emoteWheelsController.Hide(); ((Component)emoteWheelsController.wheelLabel).gameObject.SetActive(false); } } public void CloseEmoteWheelsGracefully() { if (emoteWheelsController != null) { emoteWheelsController.CloseGracefully(); ((Component)emoteWheelsController.wheelLabel).gameObject.SetActive(false); } } public void ShowCustomizePanel() { if (customizePanel != null) { ((Component)customizePanel).gameObject.SetActive(true); } } public void HideCustomizePanel() { if (customizePanel != null) { customizePanel.dragDropController.CancelDrag(); ((Component)customizePanel).gameObject.SetActive(false); EmoteUiManager.UnlockPlayerInput(); EmoteUiManager.UnlockMouseInput(); } } public void ShowCustomizeButton() { if (customizeButton != null) { ((Component)customizeButton).gameObject.SetActive(true); } } public void HideCustomizeButton() { if (customizeButton != null) { ((Component)customizeButton).gameObject.SetActive(false); } } private void UpdateCustomizeButton() { if (_customizeButtonLabel != null) { ((TMP_Text)_customizeButtonLabel).SetText((CurrentView == UiView.EmoteWheels) ? "Customize" : "Close", true); } } private void OnDestroy() { EmoteUiManager.EmoteUiInstance = null; } } [ExecuteAlways] public class WheelSegmentGen : MonoBehaviour { public Material segmentMat; public ColorBlock colorBlock; [Range(1f, 20f)] public int segments = 8; [Range(-90f, 90f)] public float offset; [Range(0f, 700f)] public float maxRadius = 300f; [Range(0f, 699f)] public float minRadius = 100f; private void OnDrawGizmos() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if (minRadius >= maxRadius) { minRadius = maxRadius - 1f; } Vector3 position = ((Component)this).transform.position; float num = (float)(Math.PI * 2.0 / (double)segments); Vector3 val = default(Vector3); Vector3 val2 = default(Vector3); for (int i = 0; i < segments; i++) { float num2 = (float)i * num + MathF.PI / 180f * offset; float num3 = ((float)i * num + (float)(i + 1) * num) / 2f + MathF.PI / 180f * offset; float num4 = (float)((double)position.x + Math.Cos(num2) * (double)maxRadius); float num5 = (float)((double)position.y + Math.Sin(num2) * (double)maxRadius); float num6 = (float)((double)position.x + Math.Cos(num2) * (double)minRadius); float num7 = (float)((double)position.y + Math.Sin(num2) * (double)minRadius); ((Vector3)(ref val))..ctor(num6, num7, position.z); ((Vector3)(ref val2))..ctor(num4, num5, position.z); Gizmos.DrawLine(val, val2); } } } } namespace LethalEmotesApi.Ui.Wheel { [RequireComponent(typeof(CanvasGroup))] public class EmoteWheel : MonoBehaviour, IPointerMoveHandler, IEventSystemHandler { private class EmoteSelectedCallback : UnityEvent<string> { } private readonly TweenRunner<AnimCurveTween<Vector3Tween>> _posTweenRunner = new TweenRunner<AnimCurveTween<Vector3Tween>>(); private readonly TweenRunner<AnimCurveTween<FloatTween>> _alphaTweenRunner = new TweenRunner<AnimCurveTween<FloatTween>>(); private readonly DelayedActionRunner<DelayedAction> _delayedActionRunner = new DelayedActionRunner<DelayedAction>(); public CanvasGroup? canvasGroup; public WheelStopEmote? wheelStopEmote; public ColorBlock colors; [Range(1f, 2f)] public float scaleMultiplier; public int segmentCount = 8; public float segmentRotOffset = 22.5f; public float minRadius = 100f; public float maxRadius = 300f; public List<EmoteWheelSegment> wheelSegments = new List<EmoteWheelSegment>(); public string[] emoteArray; private int _currentSegmentIndex = -1; private RectTransform? _rectTransform; private readonly EmoteSelectedCallback _emoteSelectedCallback = new EmoteSelectedCallback(); private bool _focused; public bool Focused { get { return _focused; } set { _focused = value; foreach (EmoteWheelSegment wheelSegment in wheelSegments) { wheelSegment.focused = _focused; } if (!_focused) { ((UnityEventBase)_emoteSelectedCallback).RemoveAllListeners(); } } } protected EmoteWheel() { emoteArray = new string[segmentCount]; _posTweenRunner.Init((MonoBehaviour)(object)this); _alphaTweenRunner.Init((MonoBehaviour)(object)this); _delayedActionRunner.Init((MonoBehaviour)(object)this); } private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) _rectTransform = ((Component)this).GetComponent<RectTransform>(); if (canvasGroup == null) { canvasGroup = ((Component)this).GetComponent<CanvasGroup>(); } foreach (EmoteWheelSegment wheelSegment in wheelSegments) { wheelSegment.colors = colors; wheelSegment.scaleMultiplier = scaleMultiplier; wheelSegment.targetGraphic.segmentCount = segmentCount; wheelSegment.targetGraphic.segmentRotOffset = segmentRotOffset; wheelSegment.targetGraphic.minRadius = minRadius; wheelSegment.targetGraphic.maxRadius = maxRadius; wheelSegment.ResetState(); } } private void OnEnable() { ResetState(); } public void OnPointerMove(PointerEventData eventData) { //IL_001c: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00ae: Unknown result type (might be due to invalid IL or missing references) if (!_focused) { return; } Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(_rectTransform, eventData.position, eventData.enterEventCamera, ref val); Rect rect = _rectTransform.rect; float num = Vector2.Distance(Vector2.zero, val); if (num < minRadius) { DeSelectAll(); ((UnityEvent<string>)(object)_emoteSelectedCallback).Invoke("none"); wheelStopEmote.OnPointerEnter(eventData); return; } if (val.x > ((Rect)(ref rect)).xMax || val.x < ((Rect)(ref rect)).xMin || val.y > ((Rect)(ref rect)).yMax || val.y < ((Rect)(ref rect)).yMin) { DeSelectAll(); ((UnityEvent<string>)(object)_emoteSelectedCallback).Invoke(""); return; } int closestSegmentIndex = GetClosestSegmentIndex(val); if (closestSegmentIndex != _currentSegmentIndex) { wheelStopEmote.OnPointerExit(eventData); if (_currentSegmentIndex > -1) { wheelSegments[_currentSegmentIndex].OnPointerExit(eventData); } _currentSegmentIndex = closestSegmentIndex; wheelSegments[closestSegmentIndex].OnPointerEnter(eventData); ((UnityEvent<string>)(object)_emoteSelectedCallback).Invoke(emoteArray[_currentSegmentIndex]); } } public void DeSelectAll() { _currentSegmentIndex = -1; foreach (EmoteWheelSegment wheelSegment in wheelSegments) { wheelSegment.DeSelect(); } } public void ResetState() { _currentSegmentIndex = -1; foreach (EmoteWheelSegment wheelSegment in wheelSegments) { wheelSegment.ResetState(); } _posTweenRunner.StopTween(); _alphaTweenRunner.StopTween(); _delayedActionRunner.StopAction(); canvasGroup.alpha = 1f; } public void LoadEmotes(string[] emotes) { emoteArray = emotes; for (int i = 0; i < emoteArray.Length; i++) { wheelSegments[i].targetLabel?.SetEmote(emoteArray[i]); } } private int GetClosestSegmentIndex(Vector2 mousePos) { //IL_0021: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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_003f: Unknown result type (might be due to invalid IL or missing references) int result = -1; float num = float.MaxValue; for (int i = 0; i < wheelSegments.Count; i++) { EmoteWheelSegment emoteWheelSegment = wheelSegments[i]; Vector2 val = Vector2.op_Implicit(((Transform)emoteWheelSegment.segmentRectTransform).position - ((Transform)_rectTransform).position); float num2 = Vector2.Distance(val, mousePos); if (num2 < num) { num = num2; result = i; } } return result; } public void AddOnEmoteSelectedCallback(UnityAction<string> callback) { ((UnityEvent<string>)(object)_emoteSelectedCallback).AddListener(callback); } public void TweenPos(Vector3 targetPos, AnimationCurve curve, float duration, bool ignoreTimeScale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (((Component)this).transform.localPosition == targetPos) { _posTweenRunner.StopTween(); return; } Vector3Tween vector3Tween = default(Vector3Tween); vector3Tween.Duration = duration; vector3Tween.StartValue = ((Component)this).transform.localPosition; vector3Tween.TargetValue = targetPos; vector3Tween.IgnoreTimeScale = ignoreTimeScale; Vector3Tween wrappedTweenValue = vector3Tween; wrappedTweenValue.AddOnChangedCallback(TweenPosChanged); AnimCurveTween<Vector3Tween> animCurveTween = default(AnimCurveTween<Vector3Tween>); animCurveTween.WrappedTweenValue = wrappedTweenValue; animCurveTween.Curve = curve; AnimCurveTween<Vector3Tween> tweenValue = animCurveTween; _posTweenRunner.StartTween(tweenValue); } private void TweenPosChanged(Vector3 pos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localPosition = pos; } public void TweenAlpha(float targetAlpha, AnimationCurve curve, float duration, bool ignoreTimeScale) { if (canvasGroup != null) { if (canvasGroup.alpha == targetAlpha) { _alphaTweenRunner.StopTween(); return; } FloatTween floatTween = default(FloatTween); floatTween.Duration = duration; floatTween.StartValue = canvasGroup.alpha; floatTween.TargetValue = targetAlpha; floatTween.IgnoreTimeScale = ignoreTimeScale; FloatTween wrappedTweenValue = floatTween; wrappedTweenValue.AddOnChangedCallback(TweenAlphaChanged); AnimCurveTween<FloatTween> animCurveTween = default(AnimCurveTween<FloatTween>); animCurveTween.WrappedTweenValue = wrappedTweenValue; animCurveTween.Curve = curve; AnimCurveTween<FloatTween> tweenValue = animCurveTween; _alphaTweenRunner.StartTween(tweenValue); } } private void TweenAlphaChanged(float alpha) { canvasGroup.alpha = alpha; } public void DisableAfterDuration(float duration, bool ignoreTimeScale) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown if (!((Component)this).gameObject.activeInHierarchy) { _delayedActionRunner.StopAction(); return; } DelayedAction delayedAction = default(DelayedAction); delayedAction.Duration = duration; delayedAction.IgnoreTimeScale = ignoreTimeScale; delayedAction.Action = new UnityAction(DelayedDisable); DelayedAction delayedAction2 = delayedAction; _delayedActionRunner.StartAction(delayedAction2); } private void DelayedDisable() { ((Component)this).gameObject.SetActive(false); } } public class EmoteWheelsController : MonoBehaviour { public GameObject? wheelPrefab; public RectTransform? wheelContainer; public TextMeshProUGUI? wheelLabel; public float fadeDist = 500f; public float fadeDuration = 0.5f; public AnimationCurve? fadeCurve; private EmoteWheel[] _wheels = Array.Empty<EmoteWheel>(); private int _currentWheelIndex; private string _selectedEmote = ""; private bool _wheelLock; private EmoteWheelSetData WheelSetData => EmoteUiManager.LoadEmoteWheelSetData(); public void Start() { InitWheels(); } private void OnEnable() { ReloadWheels(); } public void ReloadWheels() { if (WheelSetData.EmoteWheels.Length != _wheels.Length) { EmoteWheel[] wheels = _wheels; foreach (EmoteWheel emoteWheel in wheels) { Object.DestroyImmediate((Object)(object)((Component)emoteWheel).gameObject); } InitWheels(); } else { for (int j = 0; j < _wheels.Length; j++) { EmoteWheel emoteWheel2 = _wheels[j]; EmoteWheelData emoteWheelData = WheelSetData.EmoteWheels[j]; ((Component)emoteWheel2).gameObject.SetActive(true); emoteWheel2.LoadEmotes(emoteWheelData.Emotes); } } } public void LockWheels() { _wheelLock = true; if (_currentWheelIndex >= 0) { _wheels[_currentWheelIndex].DeSelectAll(); } } public void UnlockWheels() { _wheelLock = false; } private void InitWheels() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (wheelPrefab == null || wheelContainer == null) { return; } int num = WheelSetData.EmoteWheels.Length; if (_wheels.Length != num) { _wheels = new EmoteWheel[num]; for (int i = 0; i < _wheels.Length; i++) { GameObject val = Object.Instantiate<GameObject>(wheelPrefab, (Transform)(object)wheelContainer); val.transform.localPosition = Vector3.zero; EmoteWheel component = val.GetComponent<EmoteWheel>(); EmoteWheelData emoteWheelData = WheelSetData.EmoteWheels[i]; component.LoadEmotes(emoteWheelData.Emotes); component.Focused = false; ((Component)component).gameObject.SetActive(false); _wheels[i] = component; } _currentWheelIndex = 0; int num2 = WheelSetData.IndexOfDefault(); if (num2 >= 0) { _currentWheelIndex = num2; } UpdateWheelState(); } } public void NextWheel() { if (!_wheelLock) { int currentWheelIndex = _currentWheelIndex; _currentWheelIndex++; if (_currentWheelIndex >= _wheels.Length) { _currentWheelIndex = 0; } EmoteWheel emoteWheel = _wheels[currentWheelIndex]; emoteWheel.Focused = false; emoteWheel.DeSelectAll(); FadeWheelLeft(currentWheelIndex); UpdateWheelState(); } } public void PrevWheel() { if (!_wheelLock) { int currentWheelIndex = _currentWheelIndex; _currentWheelIndex--; if (_currentWheelIndex < 0) { _currentWheelIndex = _wheels.Length - 1; } EmoteWheel emoteWheel = _wheels[currentWheelIndex]; emoteWheel.Focused = false; emoteWheel.DeSelectAll(); FadeWheelRight(currentWheelIndex); UpdateWheelState(); } } public void Show() { UnlockWheels(); if (wheelContainer != null) { int num = WheelSetData.IndexOfDefault(); if (num >= 0) { _currentWheelIndex = num; } EmoteWheel currentWheel = GetCurrentWheel(); ((Component)currentWheel).gameObject.SetActive(true); ((Component)wheelContainer).gameObject.SetActive(true); if (wheelLabel != null) { ((Component)wheelLabel).gameObject.SetActive(true); UpdateWheelState(); } } } public void Hide() { UnlockWheels(); if (wheelContainer == null) { return; } EmoteWheel[] wheels = _wheels; foreach (EmoteWheel emoteWheel in wheels) { ((Component)emoteWheel).gameObject.SetActive(false); } ((Component)wheelContainer).gameObject.SetActive(false); if (!string.IsNullOrEmpty(_selectedEmote)) { EmoteUiManager.PlayEmote(_selectedEmote); _selectedEmote = "none"; if (wheelLabel != null) { ((Component)wheelLabel).gameObject.SetActive(false); } } } public void CloseGracefully() { if (wheelContainer != null) { EmoteWheel[] wheels = _wheels; foreach (EmoteWheel emoteWheel in wheels) { ((Component)emoteWheel).gameObject.SetActive(false); } ((Component)wheelContainer).gameObject.SetActive(false); _selectedEmote = ""; if (wheelLabel != null) { ((Component)wheelLabel).gameObject.SetActive(false); } } } private EmoteWheel GetCurrentWheel() { return _wheels[_currentWheelIndex]; } private void UpdateWheelState() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) EmoteWheel currentWheel = GetCurrentWheel(); ((Component)currentWheel).gameObject.SetActive(true); Transform transform = ((Component)currentWheel).transform; transform.SetAsLastSibling(); transform.localPosition = Vector3.zero; currentWheel.ResetState(); currentWheel.Focused = true; currentWheel.AddOnEmoteSelectedCallback(UpdateSelectedEmote); EmoteWheelData emoteWheelData = WheelSetData.EmoteWheels[_currentWheelIndex]; ((TMP_Text)wheelLabel).SetText(emoteWheelData.Name, true); } private void UpdateSelectedEmote(string selectedEmote) { _selectedEmote = selectedEmote; } private void FadeWheelLeft(int wheelIndex, bool instant = false) { FadeWheel(wheelIndex, left: true, instant); } private void FadeWheelRight(int wheelIndex, bool instant = false) { FadeWheel(wheelIndex, left: false, instant); } private void FadeWheel(int wheelIndex, bool left, bool instant = false) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (fadeCurve != null) { EmoteWheel emoteWheel = _wheels[wheelIndex]; Vector3 targetPos = default(Vector3); ((Vector3)(ref targetPos))..ctor(left ? (0f - fadeDist) : fadeDist, 0f, 0f); emoteWheel.TweenPos(targetPos, fadeCurve, instant ? 0f : fadeDuration, ignoreTimeScale: true); emoteWheel.TweenAlpha(0f, fadeCurve, instant ? 0f : fadeDuration, ignoreTimeScale: true); emoteWheel.DisableAfterDuration(instant ? 0f : fadeDuration, ignoreTimeScale: true); } } } [DisallowMultipleComponent] [RequireComponent(typeof(RectTransform))] [ExecuteAlways] public class EmoteWheelSegment : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public WheelSegmentGraphic? targetGraphic; public SegmentLabel? targetLabel; public RectTransform? segmentRectTransform; public ColorBlock colors; [Range(1f, 2f)] public float scaleMultiplier; public bool selected; public bool focused; private bool IsSelected() { return selected && focused; } protected override void Awake() { ((UIBehaviour)this).Awake(); if (targetGraphic == null) { targetGraphic = ((Component)this).GetComponentInChildren<WheelSegmentGraphic>(); } if (targetLabel == null) { targetLabel = ((Component)this).GetComponentInChildren<SegmentLabel>(); } } protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); UpdateState(requireFocus: false, instant: true); } public void OnPointerEnter(PointerEventData eventData) { selected = true; UpdateState(); } public void OnPointerExit(PointerEventData eventData) { selected = false; UpdateState(); } public void DeSelect() { selected = false; UpdateState(requireFocus: false); } public void ResetState() { selected = false; UpdateState(requireFocus: false, instant: true); } private Color GetColor() { //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_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_0027: Unknown result type (might be due to invalid IL or missing references) if (IsSelected()) { return ((ColorBlock)(ref colors)).selectedColor; } return ((ColorBlock)(ref colors)).normalColor; } private float GetScale() { if (IsSelected()) { return scaleMultiplier; } return 1f; } private void UpdateState(bool requireFocus = true, bool instant = false) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) if (!(!focused && requireFocus)) { Color color = GetColor(); StartColorTween(color * ((ColorBlock)(ref colors)).colorMultiplier, instant); StartScaleTween(GetScale(), instant); } } private void StartColorTween(Color targetColor, bool instant) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (targetGraphic != null) { ((Graphic)targetGraphic).CrossFadeColor(targetColor, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true); } } private void StartScaleTween(float targetScale, bool instant) { //IL_0024: 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) if (targetGraphic != null && targetLabel != null) { targetGraphic.TweenScale(new Vector3(targetScale, targetScale, targetScale), instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true); targetLabel.TweenScale(new Vector3(targetScale, targetScale, targetScale), instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true); } } } [DisallowMultipleComponent] [RequireComponent(typeof(RectTransform))] [ExecuteAlways] public class SegmentLabel : UIBehaviour { private readonly TweenRunner<Vector3Tween> _scaleTweenRunner = new TweenRunner<Vector3Tween>(); public RectTransform? targetLabel; public TextMeshProUGUI? targetText; private RectTransform? _rectTransform; private string? _emoteKey; protected DrivenRectTransformTracker Tracker; public RectTransform RectTransform { get { if (_rectTransform == null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } return _rectTransform; } } protected SegmentLabel() { _scaleTweenRunner.Init((MonoBehaviour)(object)this); } protected override void OnEnable() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) ((UIBehaviour)this).OnEnable(); if (targetLabel != null) { ((DrivenRectTransformTracker)(ref Tracker)).Add((Object)(object)this, targetLabel, (DrivenTransformProperties)16); Vector3 eulerAngles = ((Transform)RectTransform).eulerAngles; ((Transform)targetLabel).localEulerAngles = -eulerAngles; UpdateText(); } } protected override void OnDisable() { ((UIBehaviour)this).OnDisable(); ((DrivenRectTransformTracker)(ref Tracker)).Clear(); } public void SetEmote(string? emoteKey) { _emoteKey = emoteKey; UpdateText(); } private void UpdateText() { if (targetText != null && _emoteKey != null) { ((TMP_Text)targetText).SetText(EmoteUiManager.GetEmoteName(_emoteKey), true); } } public void TweenScale(Vector3 targetScale, float duration, bool ignoreTimeScale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (((Component)this).transform.localScale == targetScale) { _scaleTweenRunner.StopTween(); return; } Vector3Tween vector3Tween = default(Vector3Tween); vector3Tween.Duration = duration; vector3Tween.StartValue = ((Component)this).transform.localScale; vector3Tween.TargetValue = targetScale; vector3Tween.IgnoreTimeScale = ignoreTimeScale; Vector3Tween tweenValue = vector3Tween; tweenValue.AddOnChangedCallback(TweenScaleChanged); _scaleTweenRunner.StartTween(tweenValue); } private void TweenScaleChanged(Vector3 scale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localScale = scale; } } [DisallowMultipleComponent] [RequireComponent(typeof(CanvasRenderer))] [ExecuteAlways] public class WheelSegmentGraphic : Graphic { private readonly TweenRunner<Vector3Tween> _scaleTweenRunner = new TweenRunner<Vector3Tween>(); public int segmentCount = 8; public float segmentRotOffset = 22.5f; public float minRadius = 100f; public float maxRadius = 300f; protected WheelSegmentGraphic() { _scaleTweenRunner.Init((MonoBehaviour)(object)this); } protected override void OnEnable() { ((Graphic)this).OnEnable(); ((Graphic)this).raycastTarget = false; } protected override void OnPopulateMesh(VertexHelper vh) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0124: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) vh.Clear(); Color32 val = Color32.op_Implicit(((Graphic)this).color); float num = (float)(Math.PI * 2.0 / (double)segmentCount); float num2 = num + MathF.PI / 180f * segmentRotOffset; int num3 = 0; float num4 = MathF.PI / 180f; Vector3 val2 = CosSin(num2, minRadius); Vector3 val3 = CosSin(num2 + num, minRadius); Vector3 val4 = -Vector3.Lerp(val2, val3, 0.5f); float num5 = num + num4 / 2f - num4; for (float num6 = 0f; num6 < num5; num6 += num4) { float rad = num2 + num6; Vector3 val5 = CosSin(rad, minRadius) + val4; Vector3 val6 = CosSin(rad, maxRadius) + val4; rad = num2 + num6 + num4; Vector3 val7 = CosSin(rad, minRadius) + val4; Vector3 val8 = CosSin(rad, maxRadius) + val4; float num7 = num6 / num5; float num8 = (num6 + num4) / num5; vh.AddVert(val5, val, Vector4.op_Implicit(new Vector2(num7, 0f))); vh.AddVert(val6, val, Vector4.op_Implicit(new Vector2(num7, 1f))); vh.AddVert(val7, val, Vector4.op_Implicit(new Vector2(num8, 0f))); vh.AddVert(val8, val, Vector4.op_Implicit(new Vector2(num8, 1f))); vh.AddTriangle(num3 + 2, num3 + 1, num3); vh.AddTriangle(num3 + 3, num3 + 1, num3 + 2); num3 += 4; } } private static Vector3 CosSin(float rad, float dist) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) float num = (float)(Math.Cos(rad) * (double)dist); float num2 = (float)(Math.Sin(rad) * (double)dist); return new Vector3(num, num2, 0f); } public void TweenScale(Vector3 targetScale, float duration, bool ignoreTimeScale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (((Component)this).transform.localScale == targetScale) { _scaleTweenRunner.StopTween(); return; } Vector3Tween vector3Tween = default(Vector3Tween); vector3Tween.Duration = duration; vector3Tween.StartValue = ((Component)this).transform.localScale; vector3Tween.TargetValue = targetScale; vector3Tween.IgnoreTimeScale = ignoreTimeScale; Vector3Tween tweenValue = vector3Tween; tweenValue.AddOnChangedCallback(TweenScaleChanged); _scaleTweenRunner.StartTween(tweenValue); } private void TweenScaleChanged(Vector3 scale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localScale = scale; } } [DisallowMultipleComponent] [RequireComponent(typeof(RectTransform))] [ExecuteAlways] public class WheelStopEmote : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public WheelStopEmoteGraphic? backgroundGraphic; public Graphic? foregroundGraphic; public LeUiScaleTweener? scaleTweener; public ColorBlock colors; [Range(1f, 2f)] public float scaleMultiplier; public bool selected; protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); UpdateState(instant: true); } public void OnPointerEnter(PointerEventData eventData) { selected = true; UpdateState(); } public void OnPointerExit(PointerEventData eventData) { selected = false; UpdateState(); } private Color GetBackgroundColor() { //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_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_0027: Unknown result type (might be due to invalid IL or missing references) if (selected) { return ((ColorBlock)(ref colors)).selectedColor; } return ((ColorBlock)(ref colors)).normalColor; } private Color GetForegroundColor() { //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_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_0027: Unknown result type (might be due to invalid IL or missing references) if (selected) { return ((ColorBlock)(ref colors)).highlightedColor; } return ((ColorBlock)(ref colors)).disabledColor; } private float GetScale() { if (selected) { return scaleMultiplier; } return 1f; } private void UpdateState(bool instant = false) { //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) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0021: 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) Color backgroundColor = GetBackgroundColor(); Color foregroundColor = GetForegroundColor(); StartColorTween(foregroundColor * ((ColorBlock)(ref colors)).colorMultiplier, backgroundColor * ((ColorBlock)(ref colors)).colorMultiplier, instant); float scale = GetScale(); StartScaleTween(scale, instant); } private void StartColorTween(Color foregroundColor, Color backgroundColor, bool instant) { //IL_0007: 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) ((Graphic)backgroundGraphic).CrossFadeColor(backgroundColor, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true); foregroundGraphic.CrossFadeColor(foregroundColor, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true); } private void StartScaleTween(float scale, bool instant) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (scaleTweener != null) { Vector3 targetScale = default(Vector3); ((Vector3)(ref targetScale))..ctor(scale, scale, scale); scaleTweener.TweenScale(targetScale, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true); } } } [DisallowMultipleComponent] [RequireComponent(typeof(CanvasRenderer))] [ExecuteAlways] public class WheelStopEmoteGraphic : Graphic { public float radius = 95f; protected override void OnPopulateMesh(VertexHelper vh) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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) vh.Clear(); Color32 val = Color32.op_Implicit(((Graphic)this).color); float num = MathF.PI * 2f; int num2 = 0; float num3 = MathF.PI / 180f; for (float num4 = 0f; num4 + num3 < num; num4 += num3) { float rad = num4; Vector3 val2 = CosSin(rad, radius); rad = num4 + num3; Vector3 val3 = CosSin(rad, radius); vh.AddVert(Vector3.zero, val, Vector4.op_Implicit(new Vector2(0f, 0f))); vh.AddVert(val2, val, Vector4.op_Implicit(new Vector2(0f, 1f))); vh.AddVert(Vector3.zero, val, Vector4.op_Implicit(new Vector2(1f, 0f))); vh.AddVert(val3, val, Vector4.op_Implicit(new Vector2(1f, 1f))); vh.AddTriangle(num2 + 2, num2 + 1, num2); vh.AddTriangle(num2 + 3, num2 + 1, num2 + 2); num2 += 4; } } private static Vector3 CosSin(float rad, float dist) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) float num = (float)(Math.Cos(rad) * (double)dist); float num2 = (float)(Math.Sin(rad) * (double)dist); return new Vector3(num, num2, 0f); } } } namespace LethalEmotesApi.Ui.Options { public class DmcaFreeDropdown : LeUiDropdown { protected override int GetCurrentValue() { return EmoteUiManager.DmcaFree; } protected override void SetCurrentValue(int value) { EmoteUiManager.DmcaFree = value; } } public class EmotesAlertEnemies : LeUiToggle { protected override bool GetCurrentValue() { return EmoteUiManager.EmotesAlertEnemies; } protected override void SetCurrentValue(bool value) { EmoteUiManager.EmotesAlertEnemies = value; } } public class EmoteVolumeSlider : MonoBehaviour { public Slider? volumeSlider; private bool _hasListener; private void Awake() { UpdateSliderValue(); EnsureListener(); } private void Start() { UpdateSliderValue(); EnsureListener(); } private void OnEnable() { UpdateSliderValue(); EnsureListener(); } private void UpdateSliderValue() { if (volumeSlider != null) { volumeSlider.value = EmoteUiManager.EmoteVolume; } } private void EnsureListener() { if (volumeSlider != null && !_hasListener) { ((UnityEvent<float>)(object)volumeSlider.onValueChanged).AddListener((UnityAction<float>)SliderChanged); _hasListener = true; } } private void SliderChanged(float value) { EmoteUiManager.EmoteVolume = value; SetValueWithoutNotify(value); } private void SetValueWithoutNotify(float value) { if (volumeSlider != null) { volumeSlider.SetValueWithoutNotify(value); } } } public class HideJoinSpots : LeUiToggle { protected override bool GetCurrentValue() { return EmoteUiManager.HideJoinSpots; } protected override void SetCurrentValue(bool value) { EmoteUiManager.HideJoinSpots = value; } } public abstract class LeUiDropdown : MonoBehaviour { public TMP_Dropdown? dropdown; private bool _hasListener; private void Awake() { UpdateDropdown(); EnsureListener(); } private void Start() { UpdateDropdown(); EnsureListener(); } private void OnEnable() { UpdateDropdown(); EnsureListener(); } private void UpdateDropdown() { if (dropdown != null) { dropdown.value = GetCurrentValue(); } } private void EnsureListener() { if (dropdown != null && !_hasListener) { ((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)DropdownChanged); _hasListener = true; } } private void DropdownChanged(int value) { SetCurrentValue(value); SetValueWithoutNotify(value); } protected abstract int GetCurrentValue(); protected abstract void SetCurrentValue(int value); private void SetValueWithoutNotify(int value) { if (dropdown != null) { dropdown.SetValueWithoutNotify(value); } } } public abstract class LeUiToggle : MonoBehaviour { public Image? checkboxImage; private void Awake() { UpdateCheckbox(); } private void Start() { UpdateCheckbox(); } private void OnEnable() { UpdateCheckbox(); } public void Toggle() { SetCurrentValue(!GetCurrentValue()); UpdateCheckbox(); } private void UpdateCheckbox() { if (checkboxImage != null) { ((Behaviour)checkboxImage).enabled = GetCurrentValue(); } } protected abstract bool GetCurrentValue(); protected abstract void SetCurrentValue(bool value); } public class RootMotionTypeDropdown : LeUiDropdown { protected override int GetCurrentValue() { return EmoteUiManager.RootMotionType; } protected override void SetCurrentValue(int value) { EmoteUiManager.RootMotionType = value; } } public class ThirdPersonDropdown : LeUiDropdown { protected override int GetCurrentValue() { return EmoteUiManager.ThirdPerson; } protected override void SetCurrentValue(int value) { EmoteUiManager.ThirdPerson = value; } } } namespace LethalEmotesApi.Ui.Elements { [DisallowMultipleComponent] public class LeUiButton : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler { public Graphic? targetGraphic; public LeUiScaleTweener? scaleTweener; public ColorBlock colors; [Range(0f, 2f)] public float scaleSelected; [Range(0f, 2f)] public float scalePressed; public UnityEvent onClick = new UnityEvent(); public UnityEvent onEnter = new UnityEvent(); public UnityEvent onExit = new UnityEvent(); private bool _selected; private bool _pressed; protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); UpdateState(instant: true); } public void OnPointerEnter(PointerEventData eventData) { _selected = true; onEnter.Invoke(); UpdateState(); } public void OnPointerExit(PointerEventData eventData) { _selected = false; onExit.Invoke(); UpdateState(); } public void OnPointerDown(PointerEventData eventData) { _pressed = _selected; UpdateState(); } public void OnPointerUp(PointerEventData eventData) { _pressed = false; UpdateState(); } public void OnPointerClick(PointerEventData eventData) { onClick.Invoke(); } private Color GetColor() { //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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (_pressed) { return ((ColorBlock)(ref colors)).pressedColor; } if (_selected) { return ((ColorBlock)(ref colors)).selectedColor; } return ((ColorBlock)(ref colors)).normalColor; } private float GetScale() { if (_pressed) { return scalePressed; } if (_selected) { return scaleSelected; } return 1f; } private void UpdateState(bool instant = false) { //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) //IL_000e: 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) Color color = GetColor(); targetGraphic.CrossFadeColor(color, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true); float scale = GetScale(); Vector3 targetScale = default(Vector3); ((Vector3)(ref targetScale))..ctor(scale, scale, scale); scaleTweener.TweenScale(targetScale, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true); } } [DisallowMultipleComponent] [ExecuteAlways] public class LeUiScaleTweener : MonoBehaviour { private readonly TweenRunner<Vector3Tween> _scaleTweenRunner = new TweenRunner<Vector3Tween>(); private Vector3 _internalScale = Vector3.one; public List<RectTransform> targets = new List<RectTransform>(); protected LeUiScaleTweener() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) _scaleTweenRunner.Init((MonoBehaviour)(object)this); } public void TweenScale(Vector3 targetScale, float duration, bool ignoreTimeScale) { //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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (_internalScale == targetScale) { _scaleTweenRunner.StopTween(); return; } Vector3Tween vector3Tween = default(Vector3Tween); vector3Tween.Duration = duration; vector3Tween.IgnoreTimeScale = ignoreTimeScale; vector3Tween.StartValue = _internalScale; vector3Tween.TargetValue = targetScale; Vector3Tween tweenValue = vector3Tween; tweenValue.AddOnChangedCallback(TweenScaleChanged); _scaleTweenRunner.StartTween(tweenValue); } private void TweenScaleChanged(Vector3 scale) { //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) //IL_0020: Unknown result type (might be due to invalid IL or missing references) _internalScale = scale; foreach (RectTransform target in targets) { ((Transform)target).localScale = scale; } } } public class LeUiSelectOutline : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public Image? selectImage; public void OnPointerEnter(PointerEventData eventData) { if (selectImage != null) { ((Behaviour)selectImage).enabled = true; } } public void OnPointerExit(PointerEventData eventData) { if (selectImage != null) { ((Behaviour)selectImage).enabled = false; } } } } namespace LethalEmotesApi.Ui.Db { public interface IEmoteDb { IReadOnlyCollection<string> EmoteKeys { get; } IReadOnlyCollection<string> EmoteModNames { get; } string GetEmoteName(string emoteKey); void AssociateEmoteKeyWithMod(string emoteKey, string modName); string GetModName(string emoteKey); } } namespace LethalEmotesApi.Ui.Data { [Serializable] public class EmoteWheelData { public string Name { get; set; } public bool? IsDefault { get; set; } public string[] Emotes { get; set; } public EmoteWheelData(string name) { Name = name; IsDefault = false; Emotes = new string[8]; base..ctor(); } public bool IsDefaultWheel() { return IsDefault.HasValue && IsDefault.Value; } public static EmoteWheelData CreateDefault(int wheelIndex = 0) { EmoteWheelData emoteWheelData = new EmoteWheelData($"Wheel {wheelIndex + 1}"); Array.Fill(emoteWheelData.Emotes, "none"); return emoteWheelData; } } [Serializable] public class EmoteWheelSetData { public EmoteWheelData[] EmoteWheels { get; set; } = Array.Empty<EmoteWheelData>(); public int IndexOfDefault() { int result = -1; for (int i = 0; i < EmoteWheels.Length; i++) { if (EmoteWheels[i].IsDefaultWheel()) { result = i; break; } } return result; } public static EmoteWheelSetData Default() { EmoteWheelSetData emoteWheelSetData = new EmoteWheelSetData(); emoteWheelSetData.EmoteWheels = new EmoteWheelData[1] { EmoteWheelData.CreateDefault() }; return emoteWheelSetData; } } public interface IEmoteUiStateController { IEmoteDb EmoteDb { get; } IReadOnlyCollection<string> RandomPoolBlacklist { get; } float EmoteVolume { get; set; } bool HideJoinSpots { get; set; } int RootMotionType { get; set; } bool EmotesAlertEnemies { get; set; } int DmcaFree { get; set; } int ThirdPerson { get; set; } void PlayEmote(string emoteKey); void LockMouseInput(); void UnlockMouseInput(); void LockPlayerInput(); void UnlockPlayerInput(); bool CanOpenEmoteUi(); void PlayAnimationOn(Animator animator, string emoteKey); void AddToRandomPoolBlacklist(string emoteKey); void RemoveFromRandomPoolBlacklist(string emoteKey); EmoteWheelSetData LoadEmoteWheelSetData(); void SaveEmoteWheelSetData(EmoteWheelSetData dataToSave); } public class SearchableEmoteArray : IReadOnlyList<string>, IEnumerable<string>, IEnumerable, IReadOnlyCollection<string> { public enum SortOrder { Descending, Ascending } private readonly struct CacheState : IEquatable<CacheState> { public readonly SortOrder Order; public readonly string Filter; public CacheState(SortOrder order, string filter) { Order = order; Filter = filter; } public bool Equals(CacheState other) { return Order == other.Order && Filter == other.Filter; } public override bool Equals(object? obj) { return obj is CacheState other && Equals(other); } public override int GetHashCode() { return HashCode.Combine((int)Order, Filter); } public static bool operator ==(CacheState left, CacheState right) { return left.Equals(right); } public static bool operator !=(CacheState left, CacheState right) { return !(left == right); } } private readonly string[] _emoteKeys; private CacheState _state; private int[] _lut = null; private string[] _cachedKeys = Array.Empty<string>(); public int Count => _cachedKeys.Length; public string this[int index] => _cachedKeys[index]; public SortOrder Order { get { return _state.Order; } set { CacheState state = _state; _state = new CacheState(value, _state.Filter); if (_state != state) { UpdateCachedKeys(); } } } public string Filter { get { return _state.Filter; } set { CacheState state = _state; _state = new CacheState(_state.Order, value); if (_state != state) { UpdateCachedKeys(); } } } public SearchableEmoteArray(string[] emoteKeys) { _emoteKeys = emoteKeys; _state = new CacheState(SortOrder.Descending, ""); UpdateCachedKeys(); } private int[] CreateLut(IEnumerable<string> emoteKeys) { return (from kvp in emoteKeys.Select((string key, int index) => new KeyValuePair<string, int>(key, index)) orderby EmoteUiManager.GetEmoteName(kvp.Key) where MatchesFilter(kvp.Key, Filter) select kvp.Value).ToArray(); } private void UpdateCachedKeys() { _lut = CreateLut(_emoteKeys); _cachedKeys = new string[_lut.Length]; for (int i = 0; i < _lut.Length; i++) { _cachedKeys[i] = _emoteKeys[_lut[i]]; } } public IEnumerator<string> GetEnumerator() { return ((IEnumerable<string>)_cachedKeys).GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } private static bool MatchesFilter(string emoteKey, string filter) { if (string.IsNullOrEmpty(filter)) { return true; } if (filter.StartsWith('@')) { string emoteModName = EmoteUiManager.GetEmoteModName(emoteKey); string value = filter.Substring(1, filter.Length - 1); return emoteModName.Contains(value, StringComparison.InvariantCultureIgnoreCase); } string emoteName = EmoteUiManager.GetEmoteName(emoteKey); return emoteKey.Contains(filter, StringComparison.InvariantCultureIgnoreCase) || emoteName.Contains(filter, StringComparison.InvariantCultureIgnoreCase); } } } namespace LethalEmotesApi.Ui.Customize { [DisallowMultipleComponent] [RequireComponent(typeof(EmoteDragDropController))] public class CustomizePanel : MonoBehaviour { public EmoteDragDropController? dragDropController; public PreviewController? previewController; private void Awake() { if (dragDropController == null) { dragDropController = ((Component)this).GetComponent<EmoteDragDropController>(); } if (previewController == null) { previewController = ((Component)this).GetComponentInChildren<PreviewController>(); } } } public class DeleteWheelPopup : UIBehaviour { public CustomizeWheelController? customizeWheelController; public void Cancel() { Object.Destroy((Object)(object)((Component)this).gameObject); } public void Confirm() { if (customizeWheelController == null) { Cancel(); } else { customizeWheelController.DeleteWheel(); } } } } namespace LethalEmotesApi.Ui.Customize.Wheel { [DisallowMultipleComponent] [RequireComponent(typeof(RectTransform))] public class CustomizeWheel : UIBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IPointerEnterHandler, IPointerMoveHandler { public class EmoteChangedCallback : UnityEvent<int, string> { } public class EmotesSwappedCallback : UnityEvent<int, int> { } public PreviewController? previewController; public EmoteDragDropController? dragDropController; public ColorBlock colors; [Range(1f, 2f)] public float scaleMultiplier; public Material? segmentMaterial; public WheelDefaultButton? defaultButton; public float minDist = 100f; public List<CustomizeWheelSegment> wheelSegments = new List<CustomizeWheelSegment>(); public EmoteChangedCallback OnEmoteChanged = new EmoteChangedCallback(); public EmotesSwappedCallback OnEmotesSwapped = new EmotesSwappedCallback(); private string[] _emoteArray = Array.Empty<string>(); private int _currentSegmentIndex = -1; private RectTransform? _rectTransform; public RectTransform RectTransform { get { if (_rectTransform == null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } return _rectTransform; } } protected override void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) ((UIBehaviour)this).Awake(); if (dragDropController == null) { dragDropController = ((Component)this).GetComponentInParent<EmoteDragDropController>(); } if (previewController == null) { previewController = ((Component)this).GetComponentInParent<CustomizePanel>().previewController; } foreach (CustomizeWheelSegment wheelSegment in wheelSegments) { wheelSegment.colors = colors; wheelSegment.scaleMultiplier = scaleMultiplier; if (segmentMaterial != null) { ((Graphic)wheelSegment.targetGraphic).material = segmentMaterial; } wheelSegment.ResetState(); } } protected override void Start() { ((UIBehaviour)this).Start(); ResetState(); } protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); ResetState(); } public void OnBeginDrag(PointerEventData eventData) { StartDrag(eventData); } public void OnDrag(PointerEventData eventData) { StartDrag(eventData); } public void OnPointerEnter(PointerEventData eventData) { OnPointerMove(eventData); } public void OnPointerMove(PointerEventData eventData) { //IL_001a: 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) if (dragDropController == null) { return; } Vector2 mousePos = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(RectTransform, eventData.position, eventData.enterEventCamera, ref mousePos); int currentSegmentIndex = _currentSegmentIndex; DetectSegmentFromMouse(mousePos); if (_currentSegmentIndex < 0) { dragDropController.OnNotGrab(); return; } dragDropController.OnCanGrab(); if (dragDropController.DragState == EmoteDragDropController.DragDropState.Ready && previewController != null && currentSegmentIndex != _currentSegmentIndex) { previewController.PlayEmote(_emoteArray[_currentSegmentIndex]); } } private void StartDrag(PointerEventData eventData) { if (dragDropController != null) { if (_currentSegmentIndex < 0) { dragDropController.OnNotGrab(); return; } dragDropController.StartWheelGrab(_currentSegmentIndex, _emoteArray[_currentSegmentIndex], eventData); GameObject val = (eventData.pointerDrag = ((Component)dragDropController).gameObject); ExecuteEvents.Execute<IDragHandler>(val, (BaseEventData)(object)eventData, ExecuteEvents.dragHandler); } } public void LoadEmoteData(EmoteWheelData emoteData) { if (defaultButton != null) { defaultButton.SetDefault(emoteData.IsDefaultWheel()); _emoteArray = emoteData.Emotes; ResetState(); } } public void DetectSegmentFromMouse(Vector2 mousePos) { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) float num = Vector2.Distance(Vector2.zero, mousePos); if (num < minDist) { DeSelectAll(); return; } Rect rect = RectTransform.rect; if (mousePos.x > ((Rect)(ref rect)).xMax || mousePos.x < ((Rect)(ref rect)).xMin || mousePos.y > ((Rect)(ref rect)).yMax || mousePos.y < ((Rect)(ref rect)).yMin) { DeSelectAll(); return; } int closestSegmentIndex = GetClosestSegmentIndex(mousePos); if (closestSegmentIndex != _currentSegmentIndex && _currentSegmentIndex >= 0) { wheelSegments[_currentSegmentIndex].DeSelect(); } _currentSegmentIndex = closestSegmentIndex; SelectSegment(); } public void DropEmote(string emoteKey) { if (_currentSegmentIndex >= 0) { wheelSegments[_currentSegmentIndex].DeSelect(); ((UnityEvent<int, string>)(object)OnEmoteChanged).Invoke(_currentSegmentIndex, emoteKey); } } public void SwapSegmentEmotes(int fromIndex) { if (fromIndex >= 0) { if (_currentSegmentIndex < 0) { ((UnityEvent<int, string>)(object)OnEmoteChanged).Invoke(fromIndex, "none"); return; } ref string reference = ref _emoteArray[_currentSegmentIndex]; ref string reference2 = ref _emoteArray[fromIndex]; string text = _emoteArray[fromIndex]; string text2 = _emoteArray[_currentSegmentIndex]; reference = text; reference2 = text2; ((UnityEvent<int, int>)OnEmotesSwapped).Invoke(fromIndex, _currentSegmentIndex); } } private void SelectSegment() { if (_currentSegmentIndex >= 0) { wheelSegments[_currentSegmentIndex].Select(); } } public void DeSelectAll() { _currentSegmentIndex = -1; foreach (CustomizeWheelSegment wheelSegment in wheelSegments) { wheelSegment.DeSelect(); } } public void ResetState() { _currentSegmentIndex = -1; foreach (CustomizeWheelSegment wheelSegment in wheelSegments) { wheelSegment.ResetState(); } UpdateLabels(); } private int GetClosestSegmentIndex(Vector2 mousePos) { //IL_0021: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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_003f: Unknown result type (might be due to invalid IL or missing references) int result = -1; float num = float.MaxValue; for (int i = 0; i < wheelSegments.Count; i++) { CustomizeWheelSegment customizeWheelSegment = wheelSegments[i]; Vector2 val = Vector2.op_Implicit(((Transform)customizeWheelSegment.segmentRectTransform).position - ((Transform)RectTransform).position); float num2 = Vector2.Distance(val, mousePos); if (num2 < num) { num = num2; result = i; } } return result; } private void UpdateLabels() { if (_emoteArray.Length == wheelSegments.Count) { for (int i = 0; i < wheelSegments.Count; i++) { wheelSegments[i].SetLabel(_emoteArray[i]); } } } } public class CustomizeWheelController : UIBehaviour, IScrollHandler, IEventSystemHandler { public CustomizeWheel? customizeWheel; public TMP_InputField? wheelLabel; public GameObject? deleteConfirmationPrefab; private DeleteWheelPopup? _deleteWheelPopupInstance; private EmoteUiPanel? _emoteUiPanel; private int _wheelIndex = -1; private EmoteWheelSetData WheelSetData => EmoteUiManager.LoadEmoteWheelSetData(); private int WheelCount => WheelSetData.EmoteWheels.Length; private bool HasWheels => WheelCount > 0; protected override void Awake() { ((UIBehaviour)this).Awake(); if (_emoteUiPanel == null) { _emoteUiPanel = ((Component)this).GetComponentInParent<EmoteUiPanel>(); } if (customizeWheel != null && wheelLabel != null) { ((UnityEvent<int, string>)(object)customizeWheel.OnEmoteChanged).AddListener((UnityAction<int, string>)EmoteAtIndexChanged); ((UnityEvent<int, int>)customizeWheel.OnEmotesSwapped).AddListener((UnityAction<int, int>)EmotesSwapped); ((UnityEvent<string>)(object)wheelLabel.onValueChanged).AddListener((UnityAction<string>)WheelLabelChanged); if (HasWheels) { _wheelIndex = 0; UpdateState(); } } } protected override void OnDisable() { ((UIBehaviour)this).OnDisable(); if (_deleteWheelPopupInstance != null) { Object.DestroyImmediate((Object)(object)((Component)_deleteWheelPopupInstance).gameObject); _deleteWheelPopupInstance = null; } } public void NextWheel() { if (customizeWheel != null) { _wheelIndex++; if (_wheelIndex >= WheelCount) { _wheelIndex = 0; } UpdateState(); } } public void PrevWheel() { if (customizeWheel != null) { _wheelIndex--; if (_wheelIndex < 0) { _wheelIndex = WheelCount - 1; } UpdateState(); } } public void NewWheel() { if (customizeWheel != null) { int num = _wheelIndex + 1; EmoteWheelData[] emoteWheels = WheelSetData.EmoteWheels; EmoteWheelData emoteWheelData = EmoteWheelData.CreateDefault(emoteWheels.Length); IEnumerable<EmoteWheelData> enumerable = emoteWheels[..num].Concat(new <>z__ReadOnlyArray<EmoteWheelData>(new EmoteWheelData[1] { emoteWheelData })); if (num < emoteWheels.Length) { enumerable = enumerable.Concat(emoteWheels[num..]); } EmoteWheelSetData dataToSave = new EmoteWheelSetData { EmoteWheels = enumerable.ToArray() }; EmoteUiManager.SaveEmoteWheelSetData(dataToSave); _wheelIndex = num; UpdateState(); } } public void TryDelete() { if (deleteConfirmationPrefab != null) { GameObject val = Object.Instantiate<GameObject>(deleteConfirmationPrefab, ((Component)_emoteUiPanel).transform); _deleteWheelPopupInstance = val.GetComponent<DeleteWheelPopup>(); _deleteWheelPopupInstance.customizeWheelController = this; } } public void DeleteWheel() { if (_deleteWheelPopupInstance == null) { return; } Object.DestroyImmediate((Object)(object)((Component)_deleteWheelPopupInstance).gameObject); _deleteWheelPopupInstance = null; if (customizeWheel == null || _wheelIndex < 0) { return; } EmoteWheelData[] emoteWheels = WheelSetData.EmoteWheels; if (emoteWheels.Length == 0) { return; } if (emoteWheels.Length == 1) { emoteWheels[0] = EmoteWheelData.CreateDefault(); EmoteWheelSetData dataToSave = new EmoteWheelSetData { EmoteWheels = emoteWheels }; EmoteUiManager.SaveEmoteWheelSetData(dataToSave); _wheelIndex = 0; UpdateState(); return; } EmoteWheelData[] array = new EmoteWheelData[emoteWheels.Length - 1]; int num = 0; int num2 = 0; do { if (num == _wheelIndex) { num2 = 1; num++; } else { array[num - num2] = emoteWheels[num]; num++; } } while (num < emoteWheels.Length); EmoteWheelSetData dataToSave2 = new EmoteWheelSetData { EmoteWheels = array }; EmoteUiManager.SaveEmoteWheelSetData(dataToSave2); PrevWheel(); } public void ToggleDefault() { if (_wheelIndex < 0 || customizeWheel == null) { return; } EmoteWheelData[] emoteWheels = WheelSetData.EmoteWheels; int num = WheelSetData.IndexOfDefault(); if (num < 0) { emoteWheels[_wheelIndex].IsDefault = true; EmoteWheelSetData dataToSave = new EmoteWheelSetData { EmoteWheels = emoteWheels }; EmoteUiManager.SaveEmoteWheelSetData(dataToSave); UpdateState(); return; } emoteWheels[num].IsDefault = false; if (num != _wheelIndex) { emoteWheels[_wheelIndex].IsDefault = true; } EmoteWheelSetData dataToSave2 = new EmoteWheelSetData { EmoteWheels = emoteWheels }; EmoteUiManager.SaveEmoteWheelSetData(dataToSave2); UpdateState(); } public void LoadWheelIndex(int wheelIndex) { if (customizeWheel != null) { EmoteWheelData emoteWheelData = WheelSetData.EmoteWheels[wheelIndex]; customizeWheel.LoadEmoteData(emoteWheelData); if (wheelLabel != null) { wheelLabel.SetTextWithoutNotify(emoteWheelData.Name); _wheelIndex = wheelIndex; } } } private void WheelLabelChanged(string wheelName) { EmoteWheelSetData wheelSetData = WheelSetData; wheelSetData.EmoteWheels[_wheelIndex].Name = wheelName; EmoteUiManager.SaveEmoteWheelSetData(wheelSetData); UpdateState(); } private void EmoteAtIndexChanged(int segmentIndex, string emoteKey) { EmoteWheelSetData wheelSetData = WheelSetData; wheelSetData.EmoteWheels[_wheelIndex].Emotes[segmentIndex] = emoteKey; EmoteUiManager.SaveEmoteWheelSetData(wheelSetData); UpdateState(); } private void EmotesSwapped(int fromIndex, int toIndex) { EmoteWheelData[] emoteWheels = WheelSetData.EmoteWheels; string[] emotes = emoteWheels[_wheelIndex].Emotes; ref string reference = ref emotes[fromIndex]; ref string reference2 = ref emotes[toIndex]; string text = emotes[toIndex]; string text2 = emotes[fromIndex]; reference = text; reference2 = text2; emoteWheels[_wheelIndex].Emotes = emotes; EmoteWheelSetData dataToSave = new EmoteWheelSetData { EmoteWheels = emoteWheels }; EmoteUiManager.SaveEmoteWheelSetData(dataToSave); UpdateState(); } private void UpdateState() { LoadWheelIndex(_wheelIndex); } public void OnScroll(PointerEventData eventData) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!((Behaviour)this).isActiveAndEnabled) { return; } float y = eventData.scrollDelta.y; float num = y; float num2 = num; if (!(num2 > 0f)) { if (num2 < 0f) { NextWheel(); } } else { PrevWheel(); } } } [DisallowMultipleComponent] [RequireComponent(typeof(RectTransform))] public class CustomizeWheelSegment : UIBehaviour { public WheelSegmentGraphic? targetGraphic; public SegmentLabel? targetLabel; public RectTransform? segmentRectTransform; public ColorBlock colors; [Range(1f, 2f)] public float scaleMultiplier; public bool selected; protected override void Awake() { ((UIBehaviour)this).Awake(); if (targetGraphic == null) { targetGraphic = ((Component)this).GetComponentInChildren<WheelSegmentGraphic>(); } if (targetLabel == null) { targetLabel = ((Component)this).GetComponentInChildren<SegmentLabel>(); } } protected override void Start() { ((UIBehaviour)this).Start(); UpdateState(instant: true); } protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); UpdateState(instant: true); } public void SetLabel(string text) { if (targetLabel != null) { targetLabel.SetEmote(text); } } public void Select() { selected = true; UpdateState(); } public void DeSelect() { selected = false; UpdateState(); } public void ResetState() { selected = false; UpdateState(instant: true); } private Color GetColor() { //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_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_0027: Unknown result type (might be due to invalid IL or missing references) if (selected) { return ((ColorBlock)(ref colors)).selectedColor; } return ((ColorBlock)(ref colors)).normalColor; } private float GetScale() { if (selected) { return scaleMultiplier; } return 1f; } private void UpdateState(bool instant = false) { //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) //IL_0009: 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) Color color = GetColor(); StartColorTween(color * ((ColorBlock)(ref colors)).colorMultiplier, instant); StartScaleTween(GetScale(), instant); } private void StartColorTween(Color targetColor, bool instant) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (targetGraphic != null) { ((Graphic)targetGraphic).CrossFadeColor(targetColor, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true); } } private void StartScaleTween(float targetScale, bool instant) { //IL_0024: 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) if (targetGraphic != null && targetLabel != null) { targetGraphic.TweenScale(new Vector3(targetScale, targetScale, targetScale), instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true); targetLabel.TweenScale(new Vector3(targetScale, targetScale, targetScale), instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true); } } } [DisallowMultipleComponent] [RequireComponent(typeof(RectTransform))] [ExecuteAlways] public class WheelDefaultButton : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler { public WheelStopEmoteGraphic? targetGraphic; public LeUiScaleTweener? scaleTweener; public TextMeshProUGUI? targetLabel; public ColorBlock colors; [Range(1f, 2f)] public float scaleMultiplier = 1f; public UnityEvent onClick = new UnityEvent(); private bool _isDefault; public bool selected; protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); UpdateState(instant: true); } public void OnPointerEnter(PointerEventData eventData) { selected = true; UpdateState(); } public void OnPointerExit(PointerEventData eventData) { selected = false; UpdateState(); } public void OnPointerClick(PointerEventData eventData) { onClick.Invoke(); } public void SetDefault(bool isDefault, bool instant = false) { _isDefault = isDefault; UpdateState(instant); } private Color GetColor() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_004e: 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_0051: Unknown result type (might be due to invalid IL or missing references) if (selected) { return _isDefault ? ((ColorBlock)(ref colors)).selectedColor : ((ColorBlock)(ref colors)).disabledColor; } return _isDefault ? ((ColorBlock)(ref colors)).highlightedColor : ((ColorBlock)(ref colors)).normalColor; } private float GetScale() { if (selected) { return scaleMultiplier; } return 1f; } private void UpdateLabel() { if (targetLabel != null) { ((TMP_Text)targetLabel).text = (_isDefault ? "Unset as Default Wheel" : "Set as Default Wheel"); } } private void UpdateState(bool instant = false) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) UpdateLabel(); Color color = GetColor(); StartColorTween(color * ((ColorBlock)(ref colors)).colorMultiplier, instant); float scale = GetScale(); StartScaleTween(scale, instant); } private void StartColorTween(Color color, bool instant) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Graphic)targetGraphic).CrossFadeColor(color, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true); } private void StartScaleTween(float scale, bool instant) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (scaleTweener != null) { Vector3 targetScale = default(Vector3); ((Vector3)(ref targetScale))..ctor(scale, scale, scale); scaleTweener.TweenScale(targetScale, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true); } } } } namespace LethalEmotesApi.Ui.Customize.Preview { public class PreviewController : UIBehaviour, IDragHandler, IEventSystemHandler, IScrollHandler { public GameObject? previewPrefab; private GameObject? _previewObjectInstance; private Animator? _previewAnimator; private PreviewRig? _previewRig; private float rotSpeed = 25f; protected override void Start() { ((UIBehaviour)this).Start(); ResetPreviewInstance(); } protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); ResetPreviewInstance(); } protected override void OnDisable() { ((UIBehaviour)this).OnDisable(); DestroyPreviewInstance(); } protected override void OnDestroy() { ((UIBehaviour)this).OnDestroy(); DestroyPreviewInstance(); } public void PlayEmote(string emoteKey) { if (_previewAnimator != null) { EmoteUiManager.PlayAnimationOn(_previewAnimator, emoteKey); } } private void ResetPreviewInstance() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (previewPrefab != null) { DestroyPreviewInstance(); _previewObjectInstance = Object.Instantiate<GameObject>(previewPrefab, ((Component)this).transform.position + new Vector3(0f, -10000f, 0f), Quaternion.Euler(0f, 0f, 0f)); _previewObjectInstance.SetActive(true); _previewAnimator = _previewObjectInstance.GetComponentInChildren<Animator>(); _previewRig = _previewObjectInstance.GetComponentInChildren<PreviewRig>(); } } private void DestroyPreviewInstance() { if (_previewObjectInstance != null) { _previewObjectInstance.SetActive(false); Object.DestroyImmediate((Object)(object)_previewObjectInstance); _previewObjectInstance = null; _previewAnimator = null; _previewRig = null; } } public void OnDrag(PointerEventData data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) float vInput = data.delta.y * Time.deltaTime * rotSpeed; float hInput = data.delta.x * Time.deltaTime * rotSpeed; _previewRig.Orbit(vInput, hInput); } public void OnScroll(PointerEventData eventData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) float dir = eventData.scrollDelta.y * 4f; _previewRig.Zoom(dir); } } public class PreviewRig : MonoBehaviour { private readonly TweenRunner<FloatTween> _zoomTweenRunner = new TweenRunner<FloatTween>(); public Camera? cam; protected PreviewRig() { _zoomTweenRunner.Init((MonoBehaviour)(object)this); } public void Orbit(float vInput, float hInput) { //IL_0007: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.Rotate(Vector3.right, vInput); ((Component)this).transform.Rotate(Vector3.up, hInput, (Space)0); float num = ClampAngle(((Component)this).transform.localEulerAngles.x, -60f, 60f); ((Component)this).transform.localEulerAngles = new Vector3(num, ((Component)this).transform.localEulerAngles.y, ((Component)this).transform.localEulerAngles.z); } private static float ClampAngle(float angle, float min, float max) { if (min < 0f && max > 0f && (angle > max || angle < min)) { angle -= 360f; if (angle > max || angle < min) { if (Mathf.Abs(Mathf.DeltaAngle(angle, min)) < Mathf.Abs(Mathf.DeltaAngle(angle, max))) { return min; } return max; } } else if (min > 0f && (angle > max || angle < min)) { angle += 360f; if (angle > max || angle < min) { if (Mathf.Abs(Mathf.DeltaAngle(angle, min)) < Mathf.Abs(Mathf.DeltaAngle(angle, max))) { return min; } return max; } } if (angle < min) { return min; } if (angle > max) { return max; } return angle; } public void Zoom(float dir) { float fieldOfView = cam.fieldOfView; fieldOfView -= dir; fieldOfView = Mathf.Clamp(fieldOfView, 2f, 154f); FloatTween floatTween = default(FloatTween); floatTween.Duration = 0.2f; floatTween.StartValue = cam.fieldOfView; floatTween.TargetValue = fieldOfView; floatTween.IgnoreTimeScale = true; FloatTween tweenValue = floatTween; tweenValue.AddOnChangedCallback(CameraFovTween); _zoomTweenRunner.StartTween(tweenValue); } private void CameraFovTween(float fov) { cam.fieldOfView = fov; } } } namespace LethalEmotesApi.Ui.Customize.List { [DisallowMultipleComponent] public class EmoteBlacklistToggle : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler { public EmoteListItem? emoteListItem; public Image? toggleImage; private string? _emoteKey; private bool InBlacklist => EmoteUiManager.RandomPoolBlacklist.Contains<string>(_emoteKey); protected override void Start() { ((UIBehaviour)this).Awake(); UpdateState(); } protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); UpdateState(); } public void SetEmoteKey(string emoteKey) { _emoteKey = emoteKey; UpdateState(); } public void Toggle() { if (!string.IsNullOrEmpty(_emoteKey)) { if (InBlacklist) { EmoteUiManager.RemoveFromRandomPoolBlacklist(_emoteKey); } else { EmoteUiManager.AddToRandomPoolBlacklist(_emoteKey); } UpdateState(); } } private void UpdateState() { if (!string.IsNullOrEmpty(_emoteKey) && toggleImage != null) { ((Behaviour)toggleImage).enabled = InBlacklist; } } public void OnPointerEnter(PointerEventData eventData) { emoteListItem.OnPointerExit(eventData); } public void OnPointerExit(PointerEventData eventData) { emoteListItem.OnPointerEnter(eventData); } public void OnPointerClick(PointerEventData eventData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)eventData.button <= 0) { Toggle(); } } } [DisallowMultipleComponent] public class EmoteList : UIBehaviour { public RectTransform? listContentContainer; public TMP_InputField? searchInputField; public GameObject? entryPrefab; private CustomizePanel? _customizePanel; private readonly List<GameObject> _listObjects = new List<GameObject>(); private SearchableEmoteArray? _searchableEmoteArray; protected override void Awake() { ((UIBehaviour)this).Awake(); if (searchInputField != null) { ((UnityEvent<string>)(object)searchInputField.onValueChanged).AddListener((UnityAction<string>)SearchFieldUpdated); } } protected override void Start() { ((UIBehaviour)this).Start(); _searchableEmoteArray = new SearchableEmoteArray(EmoteUiManager.EmoteKeys.ToArray()); if (_customizePanel == null) { _customizePanel = ((Component)this).GetComponentInParent<CustomizePanel>(); } InitList(); } protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); _searchableEmoteArray = new SearchableEmoteArray(EmoteUiManager.EmoteKeys.ToArray()); if (_customizePanel == null) { _customizePanel = ((Component)this).GetComponentInParent<CustomizePanel>(); } InitList(); } protected override void OnDisable() { ((UIBehaviour)this).OnDisable(); if (searchInputField != null) { searchInputField.text = ""; if (_searchableEmoteArray != null) { _searchableEmoteArray.Filter = ""; } } } private void InitList() { if (listContentContainer == null || entryPrefab == null || _listObjects.Count > 0) { return; } SearchableEmoteArray searchableEmoteArray = _searchableEmoteArray; foreach (string item in searchableEmoteArray) { GameObject val = Object.Instantiate<GameObject>(entryPrefab, (Transform)(object)listContentContainer); EmoteListItem component = val.GetComponent<EmoteListItem>(); component.dragDropController = _customizePanel.dragDropController; component.previewController = _customizePanel.previewController; component.SetEmoteKey(item); _listObjects.Add(val); } } private void ClearList() { foreach (GameObject listObject in _listObjects) { Object.DestroyImmediate((Object)(object)listObject); } _listObjects.Clear(); } private void SearchFieldUpdated(string filter) { if (_searchableEmoteArray != null) { _searchableEmoteArray.Filter = filter; ClearList(); InitList(); } } } public class EmoteListItem : UIBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IPointerEnterHandler, IPointerExitHandler { public TextMeshProUGUI? label; public EmoteBlacklistToggle? blacklistToggle; public Image? selectImage; public TextMeshProUGUI? modLabel; public EmoteDragDropController? dragDropController; public PreviewController? previewController; public string? EmoteKey { get; private set; } protected override void Start() { ((UIBehaviour)this).Start(); UpdateState(); } protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); UpdateState(); } public void OnBeginDrag(PointerEventData eventData) { StartDrag(eventData); } public void OnDrag(PointerEventData eventData) { StartDrag(eventData); } private void StartDrag(PointerEventData eventData) { if (EmoteKey == null) { EmoteKey = ((TMP_Text)label).text; } dragDropController.StartDrag(EmoteKey, eventData); GameObject val = (eventData.pointerDrag = ((Component)dragDropController).gameObject); ExecuteEvents.Execute<IDragHandler>(val, (BaseEventData)(object)eventData, ExecuteEvents.dragHandler); } public void SetEmoteKey(string emoteKey) { EmoteKey = emoteKey; UpdateState(); } private void UpdateState() { if (EmoteKey == null || label == null) { return; } ((TMP_Text)label).SetText(EmoteUiManager.GetEmoteName(EmoteKey), true); if (modLabel != null) { ((TMP_Text)modLabel).SetText(EmoteUiManager.GetEmoteModName(EmoteKey), true); if (blacklistToggle != null) { blacklistToggle.SetEmoteKey(EmoteKey); } } } public void OnPointerEnter(PointerEventData eventData) { if (selectImage == null) { return; } ((Behaviour)selectImage).enabled = true; if (EmoteKey != null) { dragDropController.OnCanGrab(); if (dragDropController.DragState == EmoteDragDropController.DragDropState.Ready) { previewController.PlayEmote(EmoteKey); } } } public void OnPointerExit(PointerEventData eventData) { if (selectImage != null) { ((Behaviour)selectImage).enabled = false; dragDropController.OnNotGrab(); } } } public class EmoteListScrollRect : ScrollRect { public override void OnBeginDrag(PointerEventData eventData) { } public override void OnDrag(PointerEventData eventData) { } public override void OnEndDrag(PointerEventData eventData) { } } } namespace LethalEmotesApi.Ui.Customize.DragDrop { public class DragDropItem : UIBehaviour { public TextMeshProUGUI? label; public string? EmoteKey { get; private set; } protected override void Start() { ((UIBehaviour)this).Start(); UpdateState(); } protected override void OnEnable() { ((UIBehaviour)this).OnEnable(); UpdateState(); } public void SetEmoteKey(string emoteKey) { EmoteKey = emoteKey; UpdateState(); } private void UpdateState() { if (EmoteKey == null || label == null) { return; } try { ((TMP_Text)label).SetText(EmoteUiManager.GetEmoteName(EmoteKey), true); } catch { ((TMP_Text)label).SetText(EmoteKey, true); } } } [DisallowMultipleComponent] [RequireComponent(typeof(RectTransform))] public class EmoteDragDropController : UIBehaviour, IPointerMoveHandler, IEventSystemHandler, IPointerClickHandler, IDragHandler, IEndDragHandler { public e
plugins/LethalEscape/LethalEscape.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("LethalEscape")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalEscape")] [assembly: AssemblyTitle("LethalEscape")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalEscape { internal class LETimerFunctions : MonoBehaviour { public static float MinuteEscapeTimerPuffer; public static float MinuteEscapeTimerBracken; public static float MinuteEscapeTimerHoardingBug; public static LETimerFunctions instance; private void Awake() { instance = this; } private void Update() { MinuteEscapeTimerBracken += Time.deltaTime; MinuteEscapeTimerHoardingBug += Time.deltaTime; MinuteEscapeTimerPuffer += Time.deltaTime; } } [BepInPlugin("xCeezy.LethalEscape", "Lethal Escape", "0.8.2")] public class Plugin : BaseUnityPlugin { public static GameObject ExtraValues; private const string modGUID = "xCeezy.LethalEscape"; private const string modName = "Lethal Escape"; private const string modVersion = "0.8.2"; private Harmony _harmony = new Harmony("LethalEscape"); public static ManualLogSource mls; public static float TimeStartTeleport; public static ConfigEntry<bool> CanThumperEscape; public static ConfigEntry<bool> CanBrackenEscape; public static ConfigEntry<bool> CanJesterEscape; public static ConfigEntry<bool> CanHoardingBugEscape; public static ConfigEntry<bool> CanCoilHeadEscape; public static ConfigEntry<bool> CanSpiderEscape; public static ConfigEntry<bool> CanNutCrackerEscape; public static ConfigEntry<bool> CanHygrodereEscape; public static ConfigEntry<bool> CanPufferEscape; public static float JesterSpeedWindup; public static ConfigEntry<float> BrackenChanceToEscapeEveryMinute; public static ConfigEntry<float> PufferChanceToEscapeEveryMinute; public static ConfigEntry<float> HoardingBugChanceToEscapeEveryMinute; public static ConfigEntry<float> HoardingBugChanceToNestNearShip; public static ConfigEntry<float> HoardingBugChanceToSpawnOutside; public static ConfigEntry<float> BrackenChanceToSpawnOutside; public static ConfigEntry<float> PufferChanceToSpawnOutside; public static ConfigEntry<float> JesterChanceToSpawnOutside; public static ConfigEntry<float> HygrodereChanceToSpawnOutside; public static ConfigEntry<float> NutCrackerChanceToSpawnOutside; public static ConfigEntry<float> ThumperChanceToSpawnOutside; public static ConfigEntry<float> SpiderChanceToSpawnOutside; public static ConfigEntry<float> JesterSpeedIncreasePerSecond; public static ConfigEntry<float> MaxJesterOutsideSpeed; public static ConfigEntry<float> BrackenEscapeDelay; public static ConfigEntry<float> ThumperEscapeDelay; public static ConfigEntry<int> SpiderMinWebsOutside; public static ConfigEntry<int> SpiderMaxWebsOutside; private void Awake() { //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Expected O, but got Unknown CanThumperEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "ThumperEscape", true, "Whether or not the Thumper can escape"); CanBrackenEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "BrackenEscape", true, "Whether or not the Bracken can escape"); CanJesterEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "JesterEscape", true, "Whether or not the Jester can escape"); CanHoardingBugEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "HoardingBugEscape", true, "Whether or not the Hoarding Bugs can escape"); CanCoilHeadEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "CoilHeadEscape", true, "Whether or not Coil Head can escape"); CanSpiderEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "SpiderEscape", true, "Whether or not the Spider can escape"); CanNutCrackerEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "NutCrackerEscape", true, "Whether or not the Nut Cracker can escape"); CanHygrodereEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "HygrodereEscape", false, "Whether or not the Hygrodere/Slime can escape"); CanPufferEscape = ((BaseUnityPlugin)this).Config.Bind<bool>("Can Monster Escape", "CanPufferEscape", true, "Whether or not the Puffer/Spore Lizard can escape"); ThumperChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "ThumperSpawnOutsideChance", 5f, "The chance that the Thumper will spawn outside"); BrackenChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "BrackenSpawnOutsideChance", 10f, "The chance that the Bracken will spawn outside"); JesterChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "JesterSpawnOutsideChance", 0f, "The chance that the Jester will spawn outside"); HoardingBugChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "HoardingBugSpawnOutsideChance", 30f, "The chance that the Hoarding Bug will spawn outside"); SpiderChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "SpiderSpawnOutsideChance", 5f, "The chance that the Spider will spawn outside"); NutCrackerChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "NutCrackerSpawnOutsideChance", 5f, "The chance that the NutCracker will spawn outside"); HygrodereChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "HygrodereSpawnOutsideChance", 0f, "The chance that the Hygrodere will spawn outside"); PufferChanceToSpawnOutside = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn Escape Settings", "PufferSpawnOutsideChance", 5f, "The chance that the Puffer will spawn outside"); PufferChanceToEscapeEveryMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Puffer Escape Chance", 10f, "The chance that the Puffer/Spore Lizard will escape randomly every minute"); BrackenChanceToEscapeEveryMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Bracken Escape Chance", 10f, "The chance that the Bracken will escape randomly every minute"); HoardingBugChanceToEscapeEveryMinute = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "HoardingBug Escape Chance", 15f, "The chance that the Hoarding Bug will escape randomly every minute"); HoardingBugChanceToNestNearShip = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "HoardingBugShipNestChance", 50f, "The chance that the Hoarding Bug will make their nest at/near the ship"); BrackenEscapeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Bracken Escape Delay", 5f, "Time it takes for the Bracken to follow a player outside"); ThumperEscapeDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Thumper Escape Delay", -5f, "Time it takes for the Thumper to follow a player outside which is based on how long the player was seen minus this value (Might break when under -15 and will force thumper outside when it sees someone when above 0)"); SpiderMaxWebsOutside = ((BaseUnityPlugin)this).Config.Bind<int>("Escape Settings", "Max Spider Webs Outside", 28, "The maximum amount of spider webs the game will allow the spider to create webs outside (Vanilla game is 7 or 9 if update 47)"); SpiderMinWebsOutside = ((BaseUnityPlugin)this).Config.Bind<int>("Escape Settings", "Min Spider Webs Outside", 20, "The minimum amount of spider webs the game will allow the spider to create webs outside (Vanilla game is 4 or 6 if update 47)"); JesterSpeedIncreasePerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Jester Speed Increase", 1.35f, "How much speed the jester gets per second"); MaxJesterOutsideSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Escape Settings", "Jester Outside Speed", 10f, "The max speed the Jester moves while outside (5 is the speed its at while in the box and 18 is jesters max speed inside the facility)"); if ((Object)(object)ExtraValues == (Object)null) { ExtraValues = new GameObject(); Object.DontDestroyOnLoad((Object)(object)ExtraValues); ((Object)ExtraValues).hideFlags = (HideFlags)61; ExtraValues.AddComponent<LETimerFunctions>(); } mls = Logger.CreateLogSource("GameMaster"); mls.LogInfo((object)"Loaded xCeezy.LethalEscape. Patching."); _harmony.PatchAll(typeof(Plugin)); } [HarmonyPatch(typeof(CrawlerAI), "Update")] [HarmonyPrefix] private static void CrawlerLEPrefixAI(CrawlerAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanThumperEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if (((EnemyAI)__instance).currentBehaviourStateIndex != 0 && __instance.noticePlayerTimer < ThumperEscapeDelay.Value && (Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance); } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(CrawlerAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void ThumperAILEOutsideAttack(CrawlerAI __instance, ref Collider other) { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !((double)__instance.timeSinceHittingPlayer <= 0.65) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f)) { __instance.timeSinceHittingPlayer = 0f; ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); component.DamagePlayer(40, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); component.DamagePlayerFromOtherClientServerRpc(40, Vector3.zero, -1); ((EnemyAI)__instance).agent.speed = 0f; __instance.HitPlayerServerRpc((int)component.playerClientId); component.JumpToFearLevel(1f, true); } } } [HarmonyPatch(typeof(CrawlerAI), "Start")] [HarmonyPostfix] private static void CrawlerAILEPostfixStart(CrawlerAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ThumperChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= ThumperChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(JesterAI), "Update")] [HarmonyPrefix] private static void JesterLEPrefixAI(JesterAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanJesterEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if (((EnemyAI)__instance).currentBehaviourStateIndex == 2 && (Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { JesterSpeedWindup = 0f; SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(JesterAI), "Update")] [HarmonyPostfix] private static void JesterLEPostfixAI(JesterAI __instance) { if (!CanJesterEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost || !((EnemyAI)__instance).isOutside) { return; } if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } bool flag = false; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if (StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled && !StartOfRound.Instance.allPlayerScripts[i].isInsideFactory) { flag = true; } } if (flag) { ((EnemyAI)__instance).SwitchToBehaviourState(2); ((EnemyAI)__instance).agent.stoppingDistance = 0f; } JesterSpeedWindup = Mathf.Clamp(JesterSpeedWindup + Time.deltaTime * JesterSpeedIncreasePerSecond.Value, 0f, MaxJesterOutsideSpeed.Value); ((EnemyAI)__instance).agent.speed = JesterSpeedWindup; } [HarmonyPatch(typeof(JesterAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void JesterAILEOutsideAttack(JesterAI __instance, ref Collider other) { if (!((EnemyAI)__instance).isEnemyDead && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ((EnemyAI)__instance).isOutside) { if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>()) && ((EnemyAI)__instance).currentBehaviourStateIndex == 2) { __instance.KillPlayerServerRpc((int)component.playerClientId); } } } [HarmonyPatch(typeof(JesterAI), "Start")] [HarmonyPostfix] private static void JesterAILEPostfixStart(JesterAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && JesterChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= JesterChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(FlowermanAI), "Update")] [HarmonyPrefix] private static void FlowermanAILEPrefixAI(FlowermanAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanBrackenEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory && (((EnemyAI)__instance).currentBehaviourStateIndex == 1 || __instance.evadeStealthTimer > 0f) && Time.time - TimeStartTeleport >= BrackenEscapeDelay.Value + 5f) { TimeStartTeleport = Time.time; } if (Time.time - TimeStartTeleport > BrackenEscapeDelay.Value && Time.time - TimeStartTeleport < BrackenEscapeDelay.Value + 5f) { SendEnemyOutside((EnemyAI)(object)__instance); } else if (LETimerFunctions.MinuteEscapeTimerBracken >= 60f && (Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null) { LETimerFunctions.MinuteEscapeTimerBracken = 0f; if (BrackenChanceToEscapeEveryMinute.Value != 0f && (float)Random.Range(1, 100) <= BrackenChanceToEscapeEveryMinute.Value) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); } } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(FlowermanAI), "Update")] [HarmonyPostfix] private static void FlowermanAILEPostfixAI(FlowermanAI __instance) { if (!((EnemyAI)__instance).isEnemyDead && CanBrackenEscape.Value && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(FlowermanAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void FlowerManAILEOutsideAttack(FlowermanAI __instance, ref Collider other, bool ___startingKillAnimationLocalClient) { if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !__instance.inKillAnimation && !___startingKillAnimationLocalClient) { __instance.KillPlayerAnimationServerRpc((int)component.playerClientId); ___startingKillAnimationLocalClient = true; } } } [HarmonyPatch(typeof(FlowermanAI), "Start")] [HarmonyPostfix] private static void FlowermanAILEPostfixStart(FlowermanAI __instance) { TimeStartTeleport = 0f; if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && BrackenChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= BrackenChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(HoarderBugAI), "Update")] [HarmonyPrefix] private static void HoardingBugAILEPrefixAI(HoarderBugAI __instance) { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)__instance).isEnemyDead || !CanHoardingBugEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory && __instance.searchForPlayer.inProgress) { SendEnemyOutside((EnemyAI)(object)__instance); } else { if (!(LETimerFunctions.MinuteEscapeTimerHoardingBug >= 60f) || !((Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null)) { return; } LETimerFunctions.MinuteEscapeTimerHoardingBug = 0f; if ((float)Random.Range(1, 100) <= HoardingBugChanceToEscapeEveryMinute.Value / (float)Object.FindObjectsOfType(typeof(HoarderBugAI)).Length) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); if (HoardingBugChanceToNestNearShip.Value != 0f && (float)Random.Range(1, 100) <= HoardingBugChanceToNestNearShip.Value) { StartOfRound val = (StartOfRound)Object.FindObjectOfType(typeof(StartOfRound)); Transform val2 = ((EnemyAI)__instance).ChooseClosestNodeToPosition(val.elevatorTransform.position, false, 0); __instance.nestPosition = val2.position; } } } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(HoarderBugAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void HoardingBugAILEOutsideAttack(HoarderBugAI __instance, ref Collider other) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !((double)__instance.timeSinceHittingPlayer <= 0.5) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f) && __instance.inChase) { __instance.timeSinceHittingPlayer = 0f; component.DamagePlayer(30, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); component.DamagePlayerFromOtherClientServerRpc(30, Vector3.zero, -1); __instance.HitPlayerServerRpc(); } } } [HarmonyPatch(typeof(HoarderBugAI), "Start")] [HarmonyPostfix] private static void HoardingBugAILEPostfixStart(HoarderBugAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && HoardingBugChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= HoardingBugChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(SpringManAI), "Update")] [HarmonyPrefix] private static void CoilHeadAILEPrefixAI(SpringManAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanCoilHeadEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(SpringManAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void CoilHeadAILEOutsideAttack(SpringManAI __instance, ref Collider other) { //IL_00df: 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_00f0: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !__instance.stoppingMovement && ((EnemyAI)__instance).currentBehaviourStateIndex == 1 && !(__instance.timeSinceHittingPlayer >= 0f) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f)) { __instance.timeSinceHittingPlayer = 0.2f; component.DamagePlayer(90, true, true, (CauseOfDeath)6, 2, false, default(Vector3)); component.DamagePlayerFromOtherClientServerRpc(90, Vector3.zero, -1); component.JumpToFearLevel(1f, true); } } } [HarmonyPatch(typeof(SandSpiderAI), "Update")] [HarmonyPrefix] private static void SpiderAILEPrefixAI(SandSpiderAI __instance) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)__instance).isEnemyDead || !CanSpiderEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); __instance.meshContainerPosition = ((EnemyAI)__instance).serverPosition; __instance.meshContainerTarget = ((EnemyAI)__instance).serverPosition; __instance.maxWebTrapsToPlace += Random.Range(SpiderMinWebsOutside.Value, SpiderMaxWebsOutside.Value); } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(SandSpiderAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void SpiderAILEOutsideAttack(SandSpiderAI __instance, ref Collider other) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !__instance.onWall && !(__instance.timeSinceHittingPlayer <= 1f) && !(((EnemyAI)__instance).stunNormalizedTimer > 0f)) { __instance.timeSinceHittingPlayer = 0f; component.DamagePlayer(90, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); component.DamagePlayerFromOtherClientServerRpc(90, Vector3.zero, -1); __instance.HitPlayerServerRpc((int)component.playerClientId); } } } [HarmonyPatch(typeof(SandSpiderAI), "Start")] [HarmonyPostfix] private static void SpiderAILEPostfixStart(SandSpiderAI __instance) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && SpiderChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= SpiderChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); __instance.meshContainerPosition = ((EnemyAI)__instance).serverPosition; __instance.meshContainerTarget = ((EnemyAI)__instance).serverPosition; __instance.maxWebTrapsToPlace = Random.Range(SpiderMinWebsOutside.Value, SpiderMaxWebsOutside.Value); } } [HarmonyPatch(typeof(NutcrackerEnemyAI), "Update")] [HarmonyPrefix] private static void NutCrackerAILEPrefixAI(NutcrackerEnemyAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanNutCrackerEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance); } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(NutcrackerEnemyAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void NutCrackerAILEOutsideAttack(NutcrackerEnemyAI __instance, ref Collider other) { if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !(((EnemyAI)__instance).stunNormalizedTimer >= 0f) && !(__instance.timeSinceHittingPlayer < 1f)) { __instance.timeSinceHittingPlayer = 0f; __instance.LegKickPlayerServerRpc((int)component.playerClientId); } } } [HarmonyPatch(typeof(NutcrackerEnemyAI), "Start")] [HarmonyPostfix] private static void NutCrackerAILEPostfixStart(NutcrackerEnemyAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && NutCrackerChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= NutCrackerChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } [HarmonyPatch(typeof(BlobAI), "Update")] [HarmonyPrefix] private static void BlobAILEPrefixAI(BlobAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanHygrodereEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); __instance.centerPoint = ((Component)__instance).transform; } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(BlobAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void BlobAILEOutsideAttack(BlobAI __instance, ref Collider other) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) if (((EnemyAI)__instance).isEnemyDead || !((EnemyAI)__instance).isOutside || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !(__instance.timeSinceHittingLocalPlayer < 0.25f) && (!(__instance.tamedTimer > 0f) || !(__instance.angeredTimer < 0f))) { __instance.timeSinceHittingLocalPlayer = 0f; component.DamagePlayerFromOtherClientServerRpc(35, Vector3.zero, -1); component.DamagePlayer(35, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); if (component.isPlayerDead) { __instance.SlimeKillPlayerEffectServerRpc((int)component.playerClientId); } } } [HarmonyPatch(typeof(BlobAI), "Start")] [HarmonyPostfix] private static void HygrodereAILEPostfixStart(BlobAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && HygrodereChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= HygrodereChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); __instance.centerPoint = ((Component)__instance).transform; } } [HarmonyPatch(typeof(PufferAI), "Update")] [HarmonyPrefix] private static void PufferAILEPrefixAI(PufferAI __instance) { if (((EnemyAI)__instance).isEnemyDead || !CanPufferEscape.Value || !((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { return; } if (!((EnemyAI)__instance).isOutside) { if ((Object)(object)((EnemyAI)__instance).targetPlayer != (Object)null && !((EnemyAI)__instance).targetPlayer.isInsideFactory) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); } else if (LETimerFunctions.MinuteEscapeTimerPuffer >= 60f && (Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null) { LETimerFunctions.MinuteEscapeTimerPuffer = 0f; if (PufferChanceToEscapeEveryMinute.Value != 0f && (float)Random.Range(1, 100) <= PufferChanceToEscapeEveryMinute.Value) { SendEnemyOutside((EnemyAI)(object)__instance, SpawnOnDoor: false); } } } else if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { ((EnemyAI)__instance).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } } [HarmonyPatch(typeof(PufferAI), "OnCollideWithPlayer")] [HarmonyPostfix] public static void PufferAILEOutsideAttack(PufferAI __instance, ref Collider other) { //IL_009f: 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_00b0: Unknown result type (might be due to invalid IL or missing references) if (!((EnemyAI)__instance).isEnemyDead && ((EnemyAI)__instance).isOutside && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost) { PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null && !component.isPlayerDead && component.isPlayerControlled && (Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && !(__instance.timeSinceHittingPlayer <= 1f)) { __instance.timeSinceHittingPlayer = 0f; component.DamagePlayer(20, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); component.DamagePlayerFromOtherClientServerRpc(20, Vector3.zero, -1); __instance.BitePlayerServerRpc((int)component.playerClientId); } } } [HarmonyPatch(typeof(PufferAI), "Start")] [HarmonyPostfix] private static void PufferAILEPostfixStart(PufferAI __instance) { if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && PufferChanceToSpawnOutside.Value != 0f && (float)Random.Range(1, 100) <= PufferChanceToSpawnOutside.Value) { SendEnemyOutside((EnemyAI)(object)__instance); } } public static void SendEnemyInside(EnemyAI __instance) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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) __instance.isOutside = false; __instance.allAINodes = GameObject.FindGameObjectsWithTag("AINode"); EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false); for (int i = 0; i < array.Length; i++) { if (array[i].entranceId == 0 && !array[i].isEntranceToBuilding) { __instance.serverPosition = array[i].entrancePoint.position; break; } } Transform val = __instance.ChooseClosestNodeToPosition(__instance.serverPosition, false, 0); if (Vector3.Magnitude(val.position - __instance.serverPosition) > 10f) { __instance.serverPosition = val.position; ((Component)__instance).transform.position = __instance.serverPosition; } ((Component)__instance).transform.position = __instance.serverPosition; __instance.agent.Warp(__instance.serverPosition); __instance.SyncPositionToClients(); } public static void SendEnemyOutside(EnemyAI __instance, bool SpawnOnDoor = true) { //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) __instance.isOutside = true; __instance.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false); float num = 999f; for (int i = 0; i < array.Length; i++) { if (!array[i].isEntranceToBuilding) { continue; } for (int j = 0; j < StartOfRound.Instance.connectedPlayersAmount + 1; j++) { if (!StartOfRound.Instance.allPlayerScripts[j].isInsideFactory & (Vector3.Magnitude(((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position - array[i].entrancePoint.position) < num)) { num = Vector3.Magnitude(((Component)StartOfRound.Instance.allPlayerScripts[j]).transform.position - array[i].entrancePoint.position); __instance.serverPosition = array[i].entrancePoint.position; } } } if (((NetworkBehaviour)__instance).OwnerClientId != GameNetworkManager.Instance.localPlayerController.actualClientId) { __instance.ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } Transform val = __instance.ChooseClosestNodeToPosition(__instance.serverPosition, false, 0); if (Vector3.Magnitude(val.position - __instance.serverPosition) > 10f || !SpawnOnDoor) { __instance.serverPosition = val.position; } ((Component)__instance).transform.position = __instance.serverPosition; __instance.agent.Warp(__instance.serverPosition); __instance.SyncPositionToClients(); if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { __instance.EnableEnemyMesh(!StartOfRound.Instance.hangarDoorsClosed || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom, false); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
plugins/LethalExpansion.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Adapters; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LethalExpansion.Extenders; using LethalExpansion.Patches; using LethalExpansion.Patches.Monsters; using LethalExpansion.Utils; using LethalExpansion.Utils.HUD; using LethalSDK.Component; using LethalSDK.Editor; using LethalSDK.ScriptableObjects; using LethalSDK.Utils; using TMPro; using Unity.AI.Navigation; using Unity.Netcode; using Unity.Netcode.Components; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.ProBuilder; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Mono.Security")] [assembly: IgnoresAccessChecksTo("Newtonsoft.Json")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.AccessibilityModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AndroidJNIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AnimationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AssetBundleModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.AudioModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClothModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClusterInputModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ClusterRendererModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ContentLoadModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.CrashReportingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.DirectorModule")] [assembly: IgnoresAccessChecksTo("UnityEngine")] [assembly: IgnoresAccessChecksTo("UnityEngine.DSPGraphModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GameCenterModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.GridModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.HotReloadModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ImageConversionModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.IMGUIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputLegacyModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.InputModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.JSONSerializeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.LocalizationModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ParticleSystemModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PerformanceReportingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.Physics2DModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PhysicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ProfilerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.PropertiesModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.ScreenCaptureModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SharedInternalsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpriteMaskModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpriteShapeModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.StreamingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SubstanceModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SubsystemsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TerrainModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TerrainPhysicsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreFontEngineModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreTextEngineModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TextRenderingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TilemapModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.TLSModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIElementsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UIModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UmbraModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsCommonModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityAnalyticsModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityConnectModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityCurlModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityTestProtocolModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAssetBundleModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestAudioModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestTextureModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UnityWebRequestWWWModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VehiclesModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VFXModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VideoModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VirtualTexturingModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.VRModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.WindModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.XRModule")] [assembly: AssemblyCompany("LethalExpansion")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+0d1e9935dad978282ca6d7387d33772b4ae32190")] [assembly: AssemblyProduct("LethalExpansion")] [assembly: AssemblyTitle("LethalExpansion")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] public class AutoScrollText : MonoBehaviour { public TextMeshProUGUI textMeshPro; public float scrollSpeed = 15f; private Vector2 startPosition; private float textHeight; private bool startScrolling = false; private bool isWaitingToReset = false; private float displayHeight; private float fontSize; private void Start() { textMeshPro = ((Component)this).GetComponent<TextMeshProUGUI>(); InitializeScrolling(); } private void InitializeScrolling() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)textMeshPro != (Object)null) { startPosition = ((TMP_Text)textMeshPro).rectTransform.anchoredPosition; textHeight = ((TMP_Text)textMeshPro).preferredHeight; displayHeight = ((TMP_Text)textMeshPro).rectTransform.sizeDelta.y; fontSize = ((TMP_Text)textMeshPro).fontSize; } ((MonoBehaviour)this).StartCoroutine(WaitBeforeScrolling(5f)); } private IEnumerator WaitBeforeScrolling(float waitTime) { yield return (object)new WaitForSeconds(waitTime); startScrolling = true; } private IEnumerator WaitBeforeResetting(float waitTime) { isWaitingToReset = true; yield return (object)new WaitForSeconds(waitTime); ((TMP_Text)textMeshPro).rectTransform.anchoredPosition = startPosition; isWaitingToReset = false; ((MonoBehaviour)this).StartCoroutine(WaitBeforeScrolling(5f)); } private void Update() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) if ((Object)(object)textMeshPro != (Object)null && startScrolling && !isWaitingToReset) { RectTransform rectTransform = ((TMP_Text)textMeshPro).rectTransform; rectTransform.anchoredPosition += new Vector2(0f, scrollSpeed * Time.deltaTime); if (((TMP_Text)textMeshPro).rectTransform.anchoredPosition.y >= startPosition.y + textHeight - displayHeight - fontSize) { startScrolling = false; ((MonoBehaviour)this).StartCoroutine(WaitBeforeResetting(5f)); } } } public void ResetScrolling() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StopAllCoroutines(); if ((Object)(object)textMeshPro != (Object)null) { ((TMP_Text)textMeshPro).rectTransform.anchoredPosition = startPosition; } isWaitingToReset = false; InitializeScrolling(); } } public class TooltipHandler : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { private string description; private string netinfo; public static RectTransform ModSettingsToolTipPanel; public static TMP_Text ModSettingsToolTipPanelDescription; public static TMP_Text ModSettingsToolTipPanelNetInfo; public int index; private float delay = 0.5f; private bool isPointerOver = false; public void OnPointerEnter(PointerEventData eventData) { isPointerOver = true; ((MonoBehaviour)this).StartCoroutine(ShowTooltipAfterDelay()); } public void OnPointerExit(PointerEventData eventData) { isPointerOver = false; ((Component)ModSettingsToolTipPanel).gameObject.SetActive(false); } private IEnumerator ShowTooltipAfterDelay() { yield return (object)new WaitForSeconds(delay); if (isPointerOver) { ModSettingsToolTipPanel.anchoredPosition = new Vector2(-30f, ((Component)this).GetComponent<RectTransform>().anchoredPosition.y + -80f); description = ConfigManager.Instance.FindDescription(index); (bool, bool) info = ConfigManager.Instance.FindNetInfo(index); netinfo = "Network synchronization: " + (info.Item1 ? "Yes" : "No") + "\nMod required by clients: " + (info.Item2 ? "No" : "Yes"); ModSettingsToolTipPanelDescription.text = description; ModSettingsToolTipPanelNetInfo.text = netinfo; ((Component)ModSettingsToolTipPanel).gameObject.SetActive(true); } } } public class ConfigItem { public string Key { get; set; } public Type type { get; set; } public object Value { get; set; } public object DefaultValue { get; set; } public string Tab { get; set; } public string Description { get; set; } public object MinValue { get; set; } public object MaxValue { get; set; } public bool Sync { get; set; } public bool Hidden { get; set; } public bool Optional { get; set; } public bool RequireRestart { get; set; } public ConfigItem(string key, object defaultValue, string tab, string description, object minValue = null, object maxValue = null, bool sync = true, bool optional = false, bool hidden = false, bool requireRestart = false) { Key = key; DefaultValue = defaultValue; type = defaultValue.GetType(); Tab = tab; Description = description; if (minValue != null && maxValue != null) { if (minValue.GetType() == type && maxValue.GetType() == type) { MinValue = minValue; MaxValue = maxValue; } } else { MinValue = null; MaxValue = null; } Sync = sync; Optional = optional; Hidden = hidden; Value = DefaultValue; RequireRestart = requireRestart; } } namespace LethalExpansion { [BepInPlugin("LethalExpansion", "LethalExpansion", "1.3.37")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LethalExpansion : BaseUnityPlugin { private enum compatibility { unknown, perfect, good, medium, bad, critical } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<PluginInfo, bool> <>9__31_1; public static UnityAction <>9__31_0; public static Func<PluginInfo, bool> <>9__31_2; public static Func<AudioMixerGroup, bool> <>9__32_0; public static Func<GameObject, bool> <>9__32_1; public static Func<AudioMixerGroup, bool> <>9__32_2; public static Func<AudioMixerGroup, bool> <>9__32_3; public static Func<AudioMixerGroup, bool> <>9__32_4; public static Func<PluginInfo, bool> <>9__35_0; public static Func<PluginInfo, bool> <>9__35_1; public static Func<PluginInfo, bool> <>9__35_2; public static Func<PluginInfo, bool> <>9__35_3; public static Func<PluginInfo, bool> <>9__35_4; public static Func<PluginInfo, bool> <>9__35_5; internal bool <OnSceneLoaded>b__31_1(PluginInfo p) { return p.Metadata.GUID == "CoomfyDungeon"; } internal void <OnSceneLoaded>b__31_0() { ConfigManager.Instance.SetItemValue("CoomfyDungeonCompatibility", value: true); ConfigManager.Instance.SetEntryValue("CoomfyDungeonCompatibility", value: true); } internal bool <OnSceneLoaded>b__31_2(PluginInfo p) { return p.Metadata.GUID == "BiggerLobby"; } internal bool <LoadCustomMoon>b__32_0(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <LoadCustomMoon>b__32_1(GameObject o) { //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) Scene scene = o.scene; return ((Scene)(ref scene)).name != "InitSceneLaunchOptions"; } internal bool <LoadCustomMoon>b__32_2(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <LoadCustomMoon>b__32_3(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <LoadCustomMoon>b__32_4(AudioMixerGroup a) { return ((Object)a).name == "Master"; } internal bool <waitForSession>b__35_0(PluginInfo p) { return p.Metadata.GUID == "BrutalCompanyPlus"; } internal bool <waitForSession>b__35_1(PluginInfo p) { return p.Metadata.GUID == "LethalAdjustments"; } internal bool <waitForSession>b__35_2(PluginInfo p) { return p.Metadata.GUID == "CoomfyDungeon"; } internal bool <waitForSession>b__35_3(PluginInfo p) { return p.Metadata.GUID == "299792458.MoreMoneyStart"; } internal bool <waitForSession>b__35_4(PluginInfo p) { return p.Metadata.GUID == "ExtraDaysToDeadline"; } internal bool <waitForSession>b__35_5(PluginInfo p) { return p.Metadata.GUID == "AdvancedCompany"; } } private const string PluginGUID = "LethalExpansion"; private const string PluginName = "LethalExpansion"; private const string VersionString = "1.3.37"; public static readonly Version ModVersion = new Version("1.3.37"); public static readonly int[] CompatibleGameVersions = new int[4] { 45, 47, 48, 49 }; private readonly Dictionary<string, compatibility> CompatibleMods = new Dictionary<string, compatibility> { { "com.sinai.unityexplorer", compatibility.medium }, { "HDLethalCompany", compatibility.good }, { "LC_API", compatibility.good }, { "me.swipez.melonloader.morecompany", compatibility.medium }, { "BrutalCompanyPlus", compatibility.medium }, { "MoonOfTheDay", compatibility.good }, { "Television_Controller", compatibility.bad }, { "beeisyou.LandmineFix", compatibility.perfect }, { "LethalAdjustments", compatibility.good }, { "CoomfyDungeon", compatibility.bad }, { "BiggerLobby", compatibility.critical }, { "KoderTech.BoomboxController", compatibility.good }, { "299792458.MoreMoneyStart", compatibility.good }, { "ExtraDaysToDeadline", compatibility.good }, { "AdvancedCompany", compatibility.unknown } }; public static List<PluginInfo> loadedPlugins = new List<PluginInfo>(); public static bool sessionWaiting = true; public static bool hostDataWaiting = true; public static bool ishost = false; public static bool alreadypatched = false; public static bool weathersReadyToShare = false; public static bool isInGame = false; public static bool dungeonGeneratorReady = false; public static int delayedLevelChange = -1; public static string lastKickReason = string.Empty; private static readonly Harmony Harmony = new Harmony("LethalExpansion"); public static ManualLogSource Log = new ManualLogSource("LethalExpansion"); public static ConfigFile config; public GameObject SpaceLight; public GameObject terrainfixer; public static Transform currentWaterSurface; private int width = 256; private int height = 256; private int depth = 20; private float scale = 20f; private void Awake() { //IL_0cc1: Unknown result type (might be due to invalid IL or missing references) //IL_0cc7: Expected O, but got Unknown //IL_0d10: Unknown result type (might be due to invalid IL or missing references) //IL_0d1d: Expected O, but got Unknown //IL_0d22: Unknown result type (might be due to invalid IL or missing references) //IL_0d2f: Expected O, but got Unknown //IL_0d96: Unknown result type (might be due to invalid IL or missing references) //IL_0da3: Expected O, but got Unknown //IL_0daa: Unknown result type (might be due to invalid IL or missing references) //IL_0db7: Expected O, but got Unknown //IL_0dd5: Unknown result type (might be due to invalid IL or missing references) //IL_0dda: Unknown result type (might be due to invalid IL or missing references) //IL_0de6: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: LethalExpansion, VersionString: 1.3.37 is loading..."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Getting other plugins list"); loadedPlugins = GetLoadedPlugins(); foreach (PluginInfo loadedPlugin in loadedPlugins) { if (!(loadedPlugin.Metadata.GUID != "LethalExpansion")) { continue; } if (CompatibleMods.ContainsKey(loadedPlugin.Metadata.GUID)) { switch (CompatibleMods[loadedPlugin.Metadata.GUID]) { case compatibility.unknown: Console.BackgroundColor = ConsoleColor.Gray; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.perfect: Console.BackgroundColor = ConsoleColor.Blue; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.good: Console.BackgroundColor = ConsoleColor.Green; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.medium: Console.BackgroundColor = ConsoleColor.Yellow; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.bad: Console.BackgroundColor = ConsoleColor.Red; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogError((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; case compatibility.critical: Console.BackgroundColor = ConsoleColor.Magenta; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogFatal((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; default: Console.BackgroundColor = ConsoleColor.Gray; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {CompatibleMods[loadedPlugin.Metadata.GUID]}"); break; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"------------------------------"); } else { Console.BackgroundColor = ConsoleColor.Gray; ((BaseUnityPlugin)this).Logger.LogInfo((object)" "); Console.ResetColor(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Plugin: {loadedPlugin.Metadata.Name} - Version: {loadedPlugin.Metadata.Version} - Compatibility: {compatibility.unknown}"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"------------------------------"); } } config = ((BaseUnityPlugin)this).Config; ConfigManager.Instance.AddItem(new ConfigItem("GlobalTimeSpeedMultiplier", 1.4f, "Time", "Change the global time speed", 0.1f, 3f)); ConfigManager.Instance.AddItem(new ConfigItem("NumberOfHours", 18, "Time", "Max lenght of an Expedition in hours. (Begin at 6 AM | 18 = Midnight)", 6, 20)); ConfigManager.Instance.AddItem(new ConfigItem("DeadlineDaysAmount", 3, "Expeditions", "Change amount of days for the Quota.", 1, 9)); ConfigManager.Instance.AddItem(new ConfigItem("StartingCredits", 60, "Expeditions", "Change amount of starting Credit.", 0, 1000)); ConfigManager.Instance.AddItem(new ConfigItem("MoonsRoutePricesMultiplier", 1f, "Moons", "Change the Cost of the Moon Routes.", 0f, 5f)); ConfigManager.Instance.AddItem(new ConfigItem("StartingQuota", 130, "Expeditions", "Change the starting Quota.", 0, 1000, sync: true, optional: true)); ConfigManager.Instance.AddItem(new ConfigItem("ScrapAmountMultiplier", 1f, "Dungeons", "Change the amount of Scraps in dungeons.", 0f, 10f)); ConfigManager.Instance.AddItem(new ConfigItem("ScrapValueMultiplier", 0.4f, "Dungeons", "Change the value of Scraps.", 0f, 10f)); ConfigManager.Instance.AddItem(new ConfigItem("MapSizeMultiplier", 1.5f, "Dungeons", "Change the size of the Dungeons. (Can crash when under 1.0)", 0.8f, 10f)); ConfigManager.Instance.AddItem(new ConfigItem("PreventMineToExplodeWithItems", false, "Dungeons", "Prevent Landmines to explode by dropping items on them")); ConfigManager.Instance.AddItem(new ConfigItem("MineActivationWeight", 0.15f, "Dungeons", "Set the minimal weight to prevent Landmine's explosion (0.15 = 16 lb, Player = 2.0)", 0.01f, 5f)); ConfigManager.Instance.AddItem(new ConfigItem("WeightUnit", 0, "HUD", "Change the carried Weight unit : 0 = Pounds (lb), 1 = Kilograms (kg) and 2 = Both", 0, 2, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("ConvertPoundsToKilograms", true, "HUD", "Convert Pounds into Kilograms (16 lb = 7 kg) (Only effective if WeightUnit = 1)", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("PreventScrapWipeWhenAllPlayersDie", false, "Expeditions", "Prevent the Scraps Wipe when all players die.")); ConfigManager.Instance.AddItem(new ConfigItem("24HoursClock", false, "HUD", "Display a 24h clock instead of 12h.", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("ClockAlwaysVisible", false, "HUD", "Display clock while inside of the Ship.")); ConfigManager.Instance.AddItem(new ConfigItem("AutomaticDeadline", false, "Expeditions", "Automatically increase the Deadline depending of the required quota.")); ConfigManager.Instance.AddItem(new ConfigItem("AutomaticDeadlineStage", 300, "Expeditions", "Increase the quota deadline of one day each time the quota exceeds this value.", 100, 3000)); ConfigManager.Instance.AddItem(new ConfigItem("LoadModules", true, "Modules", "Load SDK Modules that add new content to the game. Disable it to play with Vanilla players. (RESTART REQUIRED)", null, null, sync: false, optional: false, hidden: false, requireRestart: true)); ConfigManager.Instance.AddItem(new ConfigItem("MaxItemsInShip", 45, "Expeditions", "Change the Items cap can be kept in the ship.", 10, 500)); ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonWeatherInCatalogue", true, "HUD", "Display the current weather of Moons in the Terminal's Moon Catalogue.")); ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonRankInCatalogue", false, "HUD", "Display the rank of Moons in the Terminal's Moon Catalogue.")); ConfigManager.Instance.AddItem(new ConfigItem("ShowMoonPriceInCatalogue", false, "HUD", "Display the route price of Moons in the Terminal's Moon Catalogue.")); ConfigManager.Instance.AddItem(new ConfigItem("QuotaIncreaseSteepness", 16, "Expeditions", "Change the Quota Increase Steepness. (Highter = less steep exponential increase)", 0, 32)); ConfigManager.Instance.AddItem(new ConfigItem("QuotaBaseIncrease", 100, "Expeditions", "Change the Quota Base Increase.", 0, 300)); ConfigManager.Instance.AddItem(new ConfigItem("KickPlayerWithoutMod", false, "Lobby", "Kick the players without Lethal Expansion installer. (Will be kicked anyway if LoadModules is True)")); ConfigManager.Instance.AddItem(new ConfigItem("BrutalCompanyPlusCompatibility", false, "Compatibility", "Leave Brutal Company Plus control the Quota settings.")); ConfigManager.Instance.AddItem(new ConfigItem("LethalAdjustmentsCompatibility", false, "Compatibility", "Leave Lethal Adjustments control the Dungeon settings.")); ConfigManager.Instance.AddItem(new ConfigItem("CoomfyDungeonCompatibility", false, "Compatibility", "Let Coomfy Dungeons control the Dungeon size & scrap settings.")); ConfigManager.Instance.AddItem(new ConfigItem("MoreMoneyStartCompatibility", false, "Compatibility", "Let MoreMoneyStart control the Starting credits amount.")); ConfigManager.Instance.AddItem(new ConfigItem("SettingsDebug", false, "Debug", "Show an output of every settings in the Console. (The Console must listen Info messages)", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("LegacyMoonLoading", false, "Modules", "Roll back to Synchronous moon loading. (Freeze the game longer and highter chance of crash)")); ConfigManager.Instance.AddItem(new ConfigItem("ExtraDaysToDeadline", false, "Compatibility", "Leave ExtraDaysToDeadline control the deadline days amount. (not effect automatic deadlines)")); ConfigManager.Instance.AddItem(new ConfigItem("HideModSettingsMenu", false, "HUD", "Hide the ModSettings menu from the Main Menu, you still can open the menu by pressing O in Main Menu. (Restart Required)", null, null, sync: false)); ConfigManager.Instance.AddItem(new ConfigItem("AdvancedCompanyCompatibility", false, "Compatibility", "Let AdvancedCompany control some settings.")); ConfigManager.Instance.ReadConfig(); ((BaseUnityPlugin)this).Config.SettingChanged += ConfigSettingChanged; AssetBundlesManager.Instance.LoadAllAssetBundles(); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; Harmony.PatchAll(typeof(GameNetworkManager_Patch)); Harmony.PatchAll(typeof(Terminal_Patch)); Harmony.PatchAll(typeof(MenuManager_Patch)); Harmony.PatchAll(typeof(GrabbableObject_Patch)); Harmony.PatchAll(typeof(RoundManager_Patch)); Harmony.PatchAll(typeof(TimeOfDay_Patch)); Harmony.PatchAll(typeof(HUDManager_Patch)); Harmony.PatchAll(typeof(StartOfRound_Patch)); Harmony.PatchAll(typeof(EntranceTeleport_Patch)); Harmony.PatchAll(typeof(Landmine_Patch)); Harmony.PatchAll(typeof(AudioReverbTrigger_Patch)); Harmony.PatchAll(typeof(InteractTrigger_Patch)); Harmony.PatchAll(typeof(RuntimeDungeon)); Harmony val = new Harmony("LethalExpansion"); MethodInfo methodInfo = AccessTools.Method(typeof(BaboonBirdAI), "GrabScrap", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(HoarderBugAI), "GrabItem", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "MonsterGrabItem", (Type[])null, (Type[])null); val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(methodInfo3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo4 = AccessTools.Method(typeof(HoarderBugAI), "DropItem", (Type[])null, (Type[])null); MethodInfo methodInfo5 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "MonsterDropItem_Patch", (Type[])null, (Type[])null); MethodInfo methodInfo6 = AccessTools.Method(typeof(HoarderBugAI), "KillEnemy", (Type[])null, (Type[])null); MethodInfo methodInfo7 = AccessTools.Method(typeof(MonsterGrabItem_Patch), "KillEnemy_Patch", (Type[])null, (Type[])null); val.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(methodInfo5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(methodInfo7), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; HDRenderPipelineAsset val2 = (HDRenderPipelineAsset)(object)((currentRenderPipeline is HDRenderPipelineAsset) ? currentRenderPipeline : null); if ((Object)(object)val2 != (Object)null) { RenderPipelineSettings currentPlatformRenderPipelineSettings = val2.currentPlatformRenderPipelineSettings; currentPlatformRenderPipelineSettings.supportWater = true; val2.currentPlatformRenderPipelineSettings = currentPlatformRenderPipelineSettings; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Water support applied to the HDRenderPipelineAsset."); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"HDRenderPipelineAsset not found."); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: LethalExpansion, VersionString: 1.3.37 is loaded."); } private List<PluginInfo> GetLoadedPlugins() { return Chainloader.PluginInfos.Values.ToList(); } private float[,] GenerateHeights() { float[,] array = new float[width, height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { array[i, j] = CalculateHeight(i, j); } } return array; } private float CalculateHeight(int x, int y) { float num = (float)x / (float)width * scale; float num2 = (float)y / (float)height * scale; return Mathf.PerlinNoise(num, num2); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Expected O, but got Unknown //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Expected O, but got Unknown //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_0781: Unknown result type (might be due to invalid IL or missing references) //IL_0770: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)("Loading scene: " + ((Scene)(ref scene)).name)); if (((Scene)(ref scene)).name == "MainMenu") { sessionWaiting = true; hostDataWaiting = true; ishost = false; alreadypatched = false; dungeonGeneratorReady = false; delayedLevelChange = -1; isInGame = false; AssetGather.Instance.AddAudioMixer(GameObject.Find("Canvas/MenuManager").GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer); SettingsMenu.Instance.InitSettingsMenu(); if (lastKickReason != null && lastKickReason.Length > 0) { PopupManager.Instance.InstantiatePopup(scene, "Kicked from Lobby", "You have been kicked\r\nReason: " + lastKickReason, "Ok", "Ignore"); } if (!ConfigManager.Instance.FindEntryValue<bool>("CoomfyDungeonCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "CoomfyDungeon")) { PopupManager instance = PopupManager.Instance; Scene sceneFocus = scene; object obj = <>c.<>9__31_0; if (obj == null) { UnityAction val = delegate { ConfigManager.Instance.SetItemValue("CoomfyDungeonCompatibility", value: true); ConfigManager.Instance.SetEntryValue("CoomfyDungeonCompatibility", value: true); }; <>c.<>9__31_0 = val; obj = (object)val; } instance.InstantiatePopup(sceneFocus, "CoomfyDungeon mod found", "Warning: CoomfyDungeon is incompatible with LethalExpansion, Would you like to enable the compatibility mode? Otherwise dungeon generation Desync may occurs!", "Yes", "No", (UnityAction)obj, null, 20, 18); } if (loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "BiggerLobby")) { PopupManager.Instance.InstantiatePopup(scene, "BiggerLobby mod found", "Warning: BiggerLobby is incompatible with LethalExpansion, host/client synchronization will break and dungeon generation Desync may occurs!", "Ok", "Ignore", null, null, 20, 18); } } if (((Scene)(ref scene)).name == "CompanyBuilding") { if ((Object)(object)SpaceLight != (Object)null) { SpaceLight.SetActive(false); } if ((Object)(object)terrainfixer != (Object)null) { terrainfixer.SetActive(false); } dungeonGeneratorReady = true; } if (((Scene)(ref scene)).name == "SampleSceneRelay") { SpaceLight = Object.Instantiate<GameObject>(AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/SpaceLight.prefab")); SceneManager.MoveGameObjectToScene(SpaceLight, scene); Mesh mesh = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Meshes/MonitorWall.fbx").GetComponent<MeshFilter>().mesh; GameObject val2 = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube"); val2.GetComponent<MeshFilter>().mesh = mesh; MeshRenderer component = val2.GetComponent<MeshRenderer>(); GameObject val3 = Object.Instantiate<GameObject>(GameObject.Find("Systems/GameSystems/TimeAndWeather/Flooding")); Object.Destroy((Object)(object)val3.GetComponent<FloodWeather>()); ((Object)val3).name = "WaterSurface"; val3.transform.position = Vector3.zero; ((Component)val3.transform.Find("Water")).GetComponent<MeshFilter>().sharedMesh = null; SpawnPrefab.Instance.waterSurface = val3; ((Renderer)component).materials = (Material[])(object)new Material[9] { ((Renderer)component).materials[0], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[1], ((Renderer)component).materials[2] }; ((Component)StartOfRound.Instance.screenLevelDescription).gameObject.AddComponent<AutoScrollText>(); AssetGather.Instance.AddAudioMixer(GameObject.Find("Systems/Audios/DiageticBackground").GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer); terrainfixer = new GameObject(); ((Object)terrainfixer).name = "terrainfixer"; terrainfixer.transform.position = new Vector3(0f, -500f, 0f); Terrain val4 = terrainfixer.AddComponent<Terrain>(); TerrainData val5 = new TerrainData(); val5.heightmapResolution = width + 1; val5.size = new Vector3((float)width, (float)depth, (float)height); val5.SetHeights(0, 0, GenerateHeights()); val4.terrainData = val5; Terminal_Patch.ResetFireExitAmounts(); Object[] array = Resources.FindObjectsOfTypeAll(typeof(Volume)); for (int i = 0; i < array.Length; i++) { Object obj2 = array[i]; if ((Object)(object)((Volume)((obj2 is Volume) ? obj2 : null)).sharedProfile == (Object)null) { Object obj3 = array[i]; ((Volume)((obj3 is Volume) ? obj3 : null)).sharedProfile = AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<VolumeProfile>("Assets/Mods/LethalExpansion/Sky and Fog Global Volume Profile.asset"); } } waitForSession().GetAwaiter(); isInGame = true; } if (((Scene)(ref scene)).name.StartsWith("Level")) { if ((Object)(object)SpaceLight != (Object)null) { SpaceLight.SetActive(false); } if ((Object)(object)terrainfixer != (Object)null) { terrainfixer.SetActive(false); } dungeonGeneratorReady = true; if (ConfigManager.Instance.FindItemValue<bool>("SettingsDebug")) { foreach (ConfigItem item in ConfigManager.Instance.GetAll()) { Log.LogInfo((object)"=========="); Log.LogInfo((object)item.Key); Log.LogInfo(item.Value); Log.LogInfo(item.DefaultValue); Log.LogInfo((object)item.Sync); } } } if (!(((Scene)(ref scene)).name == "InitSceneLaunchOptions") || !isInGame) { return; } if ((Object)(object)SpaceLight != (Object)null) { SpaceLight.SetActive(false); } if ((Object)(object)terrainfixer != (Object)null) { terrainfixer.SetActive(false); } GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val6 in rootGameObjects) { val6.SetActive(false); } if (ConfigManager.Instance.FindItemValue<bool>("SettingsDebug")) { foreach (ConfigItem item2 in ConfigManager.Instance.GetAll()) { Log.LogInfo((object)"=========="); Log.LogInfo((object)item2.Key); Log.LogInfo(item2.Value); Log.LogInfo(item2.DefaultValue); Log.LogInfo((object)item2.Sync); } } if (ConfigManager.Instance.FindItemValue<bool>("LegacyMoonLoading")) { LoadCustomMoon(scene).RunSynchronously(); } else { LoadCustomMoon(scene).GetAwaiter(); } } private async Task LoadCustomMoon(Scene scene) { //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) await Task.Delay(400); try { if ((Object)(object)Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab != (Object)null && (Object)(object)Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab.transform != (Object)null) { CheckRiskyComponents(Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab.transform, Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MoonName); GameObject mainPrefab = Object.Instantiate<GameObject>(Terminal_Patch.newMoons[StartOfRound.Instance.currentLevelID].MainPrefab); currentWaterSurface = mainPrefab.transform.Find("Environment/Water"); if ((Object)(object)mainPrefab != (Object)null) { SceneManager.MoveGameObjectToScene(mainPrefab, scene); Transform DiageticBackground = mainPrefab.transform.Find("Systems/Audio/DiageticBackground"); if ((Object)(object)DiageticBackground != (Object)null) { ((Component)DiageticBackground).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } Terrain[] Terrains = mainPrefab.GetComponentsInChildren<Terrain>(); if (Terrains != null && Terrains.Length != 0) { Terrain[] array = Terrains; foreach (Terrain terrain in array) { terrain.drawInstanced = true; } } } } string[] _tmp = new string[5] { "MapPropsContainer", "OutsideAINode", "SpawnDenialPoint", "ItemShipLandingNode", "OutsideLevelNavMesh" }; string[] array2 = _tmp; foreach (string s in array2) { if ((Object)(object)GameObject.FindGameObjectWithTag(s) == (Object)null || GameObject.FindGameObjectsWithTag(s).Any(delegate(GameObject o) { //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) Scene scene2 = o.scene; return ((Scene)(ref scene2)).name != "InitSceneLaunchOptions"; })) { GameObject obj = new GameObject(); ((Object)obj).name = s; obj.tag = s; obj.transform.position = new Vector3(0f, -200f, 0f); SceneManager.MoveGameObjectToScene(obj, scene); } } await Task.Delay(200); GameObject DropShip = GameObject.Find("ItemShipAnimContainer"); if ((Object)(object)DropShip != (Object)null) { Transform ItemShip = DropShip.transform.Find("ItemShip"); if ((Object)(object)ItemShip != (Object)null) { ((Component)ItemShip).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } Transform ItemShipMusicClose = DropShip.transform.Find("ItemShip/Music"); if ((Object)(object)ItemShipMusicClose != (Object)null) { ((Component)ItemShipMusicClose).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } Transform ItemShipMusicFar = DropShip.transform.Find("ItemShip/Music/Music (1)"); if ((Object)(object)ItemShipMusicFar != (Object)null) { ((Component)ItemShipMusicFar).GetComponent<AudioSource>().outputAudioMixerGroup = (AssetGather.Instance.audioMixers.ContainsKey("Diagetic") ? AssetGather.Instance.audioMixers["Diagetic"].Item2.First((AudioMixerGroup a) => ((Object)a).name == "Master") : null); } } await Task.Delay(200); RuntimeDungeon runtimeDungeon2 = Object.FindObjectOfType<RuntimeDungeon>(false); if ((Object)(object)runtimeDungeon2 == (Object)null) { GameObject dungeonGenerator = new GameObject(); ((Object)dungeonGenerator).name = "DungeonGenerator"; dungeonGenerator.tag = "DungeonGenerator"; dungeonGenerator.transform.position = new Vector3(0f, -200f, 0f); runtimeDungeon2 = dungeonGenerator.AddComponent<RuntimeDungeon>(); runtimeDungeon2.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; runtimeDungeon2.Generator.LengthMultiplier = 0.8f; runtimeDungeon2.Generator.PauseBetweenRooms = 0.2f; runtimeDungeon2.GenerateOnStart = false; runtimeDungeon2.Root = dungeonGenerator; runtimeDungeon2.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; UnityNavMeshAdapter dungeonNavMesh = dungeonGenerator.AddComponent<UnityNavMeshAdapter>(); dungeonNavMesh.BakeMode = (RuntimeNavMeshBakeMode)3; dungeonNavMesh.LayerMask = LayerMask.op_Implicit(35072); SceneManager.MoveGameObjectToScene(dungeonGenerator, scene); } else if ((Object)(object)runtimeDungeon2.Generator.DungeonFlow == (Object)null) { runtimeDungeon2.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; } dungeonGeneratorReady = true; GameObject OutOfBounds = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)OutOfBounds).name = "OutOfBounds"; OutOfBounds.layer = 13; OutOfBounds.transform.position = new Vector3(0f, -300f, 0f); OutOfBounds.transform.localScale = new Vector3(1000f, 5f, 1000f); BoxCollider boxCollider = OutOfBounds.GetComponent<BoxCollider>(); ((Collider)boxCollider).isTrigger = true; OutOfBounds.AddComponent<OutOfBoundsTrigger>(); Rigidbody rigidbody = OutOfBounds.AddComponent<Rigidbody>(); rigidbody.useGravity = false; rigidbody.isKinematic = true; rigidbody.collisionDetectionMode = (CollisionDetectionMode)1; SceneManager.MoveGameObjectToScene(OutOfBounds, scene); await Task.Delay(200); } catch (Exception ex2) { Exception ex = ex2; Log.LogError((object)ex); } } private void CheckRiskyComponents(Transform root, string objname) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown try { Component[] components = ((Component)root).GetComponents<Component>(); Component[] array = components; foreach (Component component in array) { if (!ComponentWhitelists.mainWhitelist.Any((Type whitelistType) => ((object)component).GetType() == whitelistType)) { Log.LogWarning((object)(((object)component).GetType().Name + " component is not native of Unity or LethalSDK. It can contains malwares. From " + objname + ".")); } } foreach (Transform item in root) { Transform root2 = item; CheckRiskyComponents(root2, objname); } } catch (Exception ex) { Log.LogError((object)ex.Message); } } private void OnSceneUnloaded(Scene scene) { if (((Scene)(ref scene)).name.Length > 0) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Unloading scene: " + ((Scene)(ref scene)).name)); } if (((Scene)(ref scene)).name.StartsWith("Level") || ((Scene)(ref scene)).name == "CompanyBuilding" || (((Scene)(ref scene)).name == "InitSceneLaunchOptions" && isInGame)) { if ((Object)(object)SpaceLight != (Object)null) { SpaceLight.SetActive(true); } if ((Object)(object)currentWaterSurface != (Object)null) { currentWaterSurface = null; } dungeonGeneratorReady = false; Terminal_Patch.ResetFireExitAmounts(); } } private async Task waitForSession() { while (sessionWaiting) { await Task.Delay(1000); } for (int i = 0; i < ConfigManager.Instance.GetAll().Count; i++) { if (ConfigManager.Instance.MustBeSync(i)) { ConfigManager.Instance.SetItemValue(i, ConfigManager.Instance.FindEntryValue(i)); } } bool patchGlobalTimeSpeedMultiplier = true; bool patchNumberOfHours = true; bool patchDeadlineDaysAmount = true; bool patchStartingQuota = true; bool patchStartingCredits = true; bool patchBaseIncrease = true; bool patchIncreaseSteepness = true; bool patchScrapValueMultiplier = true; bool patchScrapAmountMultiplier = true; bool patchMapSizeMultiplier = true; bool patchMaxShipItemCapacity = true; if (ConfigManager.Instance.FindItemValue<bool>("BrutalCompanyPlusCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "BrutalCompanyPlus")) { patchDeadlineDaysAmount = false; patchStartingQuota = false; patchStartingCredits = false; patchBaseIncrease = false; patchIncreaseSteepness = false; } if (ConfigManager.Instance.FindItemValue<bool>("LethalAdjustmentsCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "LethalAdjustments")) { patchScrapValueMultiplier = false; patchScrapAmountMultiplier = false; patchMapSizeMultiplier = false; } if (ConfigManager.Instance.FindItemValue<bool>("CoomfyDungeonCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "CoomfyDungeon")) { patchScrapAmountMultiplier = false; patchMapSizeMultiplier = false; } if (ConfigManager.Instance.FindItemValue<bool>("MoreMoneyStartCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "299792458.MoreMoneyStart")) { patchStartingCredits = false; } if (ConfigManager.Instance.FindItemValue<bool>("ExtraDaysToDeadline") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "ExtraDaysToDeadline")) { patchDeadlineDaysAmount = false; } if (ConfigManager.Instance.FindItemValue<bool>("AdvancedCompanyCompatibility") && loadedPlugins.Any((PluginInfo p) => p.Metadata.GUID == "AdvancedCompany")) { patchGlobalTimeSpeedMultiplier = false; patchStartingCredits = false; patchScrapValueMultiplier = false; patchScrapAmountMultiplier = false; patchMapSizeMultiplier = false; } if (patchGlobalTimeSpeedMultiplier) { TimeOfDay.Instance.globalTimeSpeedMultiplier = ConfigManager.Instance.FindItemValue<float>("GlobalTimeSpeedMultiplier"); } if (patchNumberOfHours) { TimeOfDay.Instance.numberOfHours = ConfigManager.Instance.FindItemValue<int>("NumberOfHours"); } if (patchDeadlineDaysAmount) { TimeOfDay.Instance.quotaVariables.deadlineDaysAmount = ConfigManager.Instance.FindItemValue<int>("DeadlineDaysAmount"); } if (patchStartingQuota) { TimeOfDay.Instance.quotaVariables.startingQuota = ConfigManager.Instance.FindItemValue<int>("StartingQuota"); } if (patchStartingCredits) { TimeOfDay.Instance.quotaVariables.startingCredits = ConfigManager.Instance.FindItemValue<int>("StartingCredits"); } if (patchBaseIncrease) { TimeOfDay.Instance.quotaVariables.baseIncrease = ConfigManager.Instance.FindItemValue<int>("QuotaBaseIncrease"); } if (patchIncreaseSteepness) { TimeOfDay.Instance.quotaVariables.increaseSteepness = ConfigManager.Instance.FindItemValue<int>("QuotaIncreaseSteepness"); } if (patchScrapValueMultiplier) { RoundManager.Instance.scrapValueMultiplier = ConfigManager.Instance.FindItemValue<float>("ScrapValueMultiplier"); } if (patchScrapAmountMultiplier) { RoundManager.Instance.scrapAmountMultiplier = ConfigManager.Instance.FindItemValue<float>("ScrapAmountMultiplier"); } if (patchMapSizeMultiplier) { RoundManager.Instance.mapSizeMultiplier = ConfigManager.Instance.FindItemValue<float>("MapSizeMultiplier"); } if (patchMaxShipItemCapacity) { StartOfRound.Instance.maxShipItemCapacity = ConfigManager.Instance.FindItemValue<int>("MaxItemsInShip"); } if (!alreadypatched) { Terminal_Patch.MainPatch(GameObject.Find("TerminalScript").GetComponent<Terminal>()); alreadypatched = true; } if (!ishost) { while (!sessionWaiting && hostDataWaiting) { NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.request, "hostconfig", string.Empty, 0L); await Task.Delay(3000); } Terminal_Patch.MainPatchPostConfig(GameObject.Find("TerminalScript").GetComponent<Terminal>()); } } private void ConfigSettingChanged(object sender, EventArgs e) { SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null); if (val != null) { Log.LogInfo((object)$"{val.ChangedSetting.Definition.Key} Changed to {val.ChangedSetting.BoxedValue}"); } } } } namespace LethalExpansion.Utils { public class AssetBundlesManager { private static AssetBundlesManager _instance; public AssetBundle mainAssetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("LethalExpansion.dll", "lethalexpansion.lem")); public Dictionary<string, (AssetBundle, ModManifest)> assetBundles = new Dictionary<string, (AssetBundle, ModManifest)>(); public readonly string[] forcedNative = new string[1] { "lethalexpansion" }; public DirectoryInfo modPath = new DirectoryInfo(Assembly.GetExecutingAssembly().Location); public DirectoryInfo modDirectory; public DirectoryInfo pluginsDirectory; public static AssetBundlesManager Instance { get { if (_instance == null) { _instance = new AssetBundlesManager(); } return _instance; } } public (AssetBundle, ModManifest) Load(string name) { return assetBundles[name.ToLower()]; } public void LoadAllAssetBundles() { modDirectory = modPath.Parent; pluginsDirectory = modDirectory; while (pluginsDirectory != null && pluginsDirectory.Name != "plugins") { pluginsDirectory = pluginsDirectory.Parent; } if (pluginsDirectory != null) { LethalExpansion.Log.LogInfo((object)("Plugins folder found: " + pluginsDirectory.FullName)); LethalExpansion.Log.LogInfo((object)("Mod path is: " + modDirectory.FullName)); if (modDirectory.FullName == pluginsDirectory.FullName) { LethalExpansion.Log.LogWarning((object)("LethalExpansion is Rooting the Plugins folder, this is not recommended. " + modDirectory.FullName)); } string[] files = Directory.GetFiles(pluginsDirectory.FullName, "*.lem", SearchOption.AllDirectories); foreach (string file in files) { LoadBundle(file); } } else { LethalExpansion.Log.LogWarning((object)"Mod is not in a plugins folder."); } } public void LoadBundle(string file) { if (forcedNative.Contains<string>(Path.GetFileNameWithoutExtension(file)) && !file.Contains(modDirectory.FullName)) { LethalExpansion.Log.LogWarning((object)("Illegal usage of reserved Asset Bundle name: " + Path.GetFileNameWithoutExtension(file) + " at: " + file + ".")); } else { if (!(Path.GetFileName(file) != "lethalexpansion.lem")) { return; } if (!assetBundles.ContainsKey(Path.GetFileNameWithoutExtension(file))) { Stopwatch stopwatch = new Stopwatch(); AssetBundle val = null; try { stopwatch.Start(); val = AssetBundle.LoadFromFile(file); stopwatch.Stop(); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); } if ((Object)(object)val != (Object)null) { string text = "Assets/Mods/" + Path.GetFileNameWithoutExtension(file) + "/ModManifest.asset"; ModManifest modManifest = val.LoadAsset<ModManifest>(text); if ((Object)(object)modManifest != (Object)null) { if (forcedNative.Contains(modManifest.modName.ToLower()) && !file.Contains(modDirectory.FullName)) { LethalExpansion.Log.LogWarning((object)("Illegal usage of reserved Mod name: " + modManifest.modName)); val.Unload(true); LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file))); } else if (!assetBundles.Any((KeyValuePair<string, (AssetBundle, ModManifest)> b) => b.Value.Item2.modName == modManifest.modName)) { LethalExpansion.Log.LogInfo((object)string.Format("Module found: {0} v{1} Loaded in {2}ms", modManifest.modName, (modManifest.GetVersion() != null) ? ((object)modManifest.GetVersion()).ToString() : "0.0.0.0", stopwatch.ElapsedMilliseconds)); if (modManifest.GetVersion() == null || ((object)modManifest.GetVersion()).ToString() == "0.0.0.0") { LethalExpansion.Log.LogWarning((object)("Module " + modManifest.modName + " have no version number, this is unsafe!")); } assetBundles.Add(Path.GetFileNameWithoutExtension(file).ToLower(), (val, modManifest)); } else { LethalExpansion.Log.LogWarning((object)("Another mod with same name is already loaded: " + modManifest.modName)); val.Unload(true); LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file))); } } else { LethalExpansion.Log.LogWarning((object)("AssetBundle have no ModManifest: " + Path.GetFileName(file))); val.Unload(true); LethalExpansion.Log.LogInfo((object)("AssetBundle unloaded: " + Path.GetFileName(file))); } } else { LethalExpansion.Log.LogWarning((object)("File is not an AssetBundle: " + Path.GetFileName(file))); } } else { LethalExpansion.Log.LogWarning((object)("AssetBundle with same name already loaded: " + Path.GetFileName(file))); } } } public bool BundleLoaded(string bundleName) { return assetBundles.ContainsKey(bundleName.ToLower()); } public bool BundlesLoaded(string[] bundleNames) { foreach (string text in bundleNames) { if (!assetBundles.ContainsKey(text.ToLower())) { return false; } } return true; } public bool IncompatibleBundlesLoaded(string[] bundleNames) { foreach (string text in bundleNames) { if (assetBundles.ContainsKey(text.ToLower())) { return true; } } return false; } } public class AssetGather { private static AssetGather _instance; public Dictionary<string, AudioClip> audioClips = new Dictionary<string, AudioClip>(); public Dictionary<string, (AudioMixer, AudioMixerGroup[])> audioMixers = new Dictionary<string, (AudioMixer, AudioMixerGroup[])>(); public Dictionary<string, GameObject> planetPrefabs = new Dictionary<string, GameObject>(); public Dictionary<string, GameObject> mapObjects = new Dictionary<string, GameObject>(); public Dictionary<string, SpawnableOutsideObject> outsideObjects = new Dictionary<string, SpawnableOutsideObject>(); public Dictionary<string, Item> scraps = new Dictionary<string, Item>(); public Dictionary<string, LevelAmbienceLibrary> levelAmbiances = new Dictionary<string, LevelAmbienceLibrary>(); public Dictionary<string, EnemyType> enemies = new Dictionary<string, EnemyType>(); public Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>(); public static AssetGather Instance { get { if (_instance == null) { _instance = new AssetGather(); } return _instance; } } public void GetList() { LethalExpansion.Log.LogInfo((object)"===Audio Clips==="); foreach (KeyValuePair<string, AudioClip> audioClip in audioClips) { LethalExpansion.Log.LogInfo((object)audioClip.Key); } LethalExpansion.Log.LogInfo((object)"===Audio Mixers==="); foreach (KeyValuePair<string, (AudioMixer, AudioMixerGroup[])> audioMixer in audioMixers) { LethalExpansion.Log.LogInfo((object)audioMixer.Key); } LethalExpansion.Log.LogInfo((object)"===Planet Prefabs==="); foreach (KeyValuePair<string, GameObject> planetPrefab in planetPrefabs) { LethalExpansion.Log.LogInfo((object)planetPrefab.Key); } LethalExpansion.Log.LogInfo((object)"===Map Objects==="); foreach (KeyValuePair<string, GameObject> mapObject in mapObjects) { LethalExpansion.Log.LogInfo((object)mapObject.Key); } LethalExpansion.Log.LogInfo((object)"===Outside Objects==="); foreach (KeyValuePair<string, SpawnableOutsideObject> outsideObject in outsideObjects) { LethalExpansion.Log.LogInfo((object)outsideObject.Key); } LethalExpansion.Log.LogInfo((object)"===Scraps==="); foreach (KeyValuePair<string, Item> scrap in scraps) { LethalExpansion.Log.LogInfo((object)scrap.Key); } LethalExpansion.Log.LogInfo((object)"===Level Ambiances==="); foreach (KeyValuePair<string, LevelAmbienceLibrary> levelAmbiance in levelAmbiances) { LethalExpansion.Log.LogInfo((object)levelAmbiance.Key); } LethalExpansion.Log.LogInfo((object)"===Enemies==="); foreach (KeyValuePair<string, EnemyType> enemy in enemies) { LethalExpansion.Log.LogInfo((object)enemy.Key); } LethalExpansion.Log.LogInfo((object)"===Sprites==="); foreach (KeyValuePair<string, Sprite> sprite in sprites) { LethalExpansion.Log.LogInfo((object)sprite.Key); } } public void AddAudioClip(AudioClip clip) { if ((Object)(object)clip != (Object)null && !audioClips.ContainsKey(((Object)clip).name) && !audioClips.ContainsValue(clip)) { audioClips.Add(((Object)clip).name, clip); } } public void AddAudioClip(string name, AudioClip clip) { if ((Object)(object)clip != (Object)null && !audioClips.ContainsKey(name) && !audioClips.ContainsValue(clip)) { audioClips.Add(name, clip); } } public void AddAudioClip(AudioClip[] clips) { foreach (AudioClip val in clips) { if ((Object)(object)val != (Object)null && !audioClips.ContainsKey(((Object)val).name) && !audioClips.ContainsValue(val)) { audioClips.Add(((Object)val).name, val); } } } public void AddAudioClip(string[] names, AudioClip[] clips) { for (int i = 0; i < clips.Length && i < names.Length; i++) { if ((Object)(object)clips[i] != (Object)null && !audioClips.ContainsKey(names[i]) && !audioClips.ContainsValue(clips[i])) { audioClips.Add(names[i], clips[i]); } } } public void AddAudioMixer(AudioMixer mixer) { if (!((Object)(object)mixer != (Object)null) || audioMixers.ContainsKey(((Object)mixer).name)) { return; } List<AudioMixerGroup> list = new List<AudioMixerGroup>(); AudioMixerGroup[] array = mixer.FindMatchingGroups(string.Empty); foreach (AudioMixerGroup val in array) { if ((Object)(object)val != (Object)null && !list.Contains(val)) { list.Add(val); } } audioMixers.Add(((Object)mixer).name, (mixer, list.ToArray())); } public void AddPlanetPrefabs(GameObject prefab) { if ((Object)(object)prefab != (Object)null && !planetPrefabs.ContainsKey(((Object)prefab).name) && !planetPrefabs.ContainsValue(prefab)) { planetPrefabs.Add(((Object)prefab).name, prefab); } } public void AddPlanetPrefabs(string name, GameObject prefab) { if ((Object)(object)prefab != (Object)null && !planetPrefabs.ContainsKey(name) && !planetPrefabs.ContainsValue(prefab)) { planetPrefabs.Add(name, prefab); } } public void AddMapObjects(GameObject mapObject) { if ((Object)(object)mapObject != (Object)null && !mapObjects.ContainsKey(((Object)mapObject).name) && !mapObjects.ContainsValue(mapObject)) { mapObjects.Add(((Object)mapObject).name, mapObject); } } public void AddOutsideObject(SpawnableOutsideObject outsideObject) { if ((Object)(object)outsideObject != (Object)null && !outsideObjects.ContainsKey(((Object)outsideObject).name) && !outsideObjects.ContainsValue(outsideObject)) { outsideObjects.Add(((Object)outsideObject).name, outsideObject); } } public void AddScrap(Item scrap) { if ((Object)(object)scrap != (Object)null && !scraps.ContainsKey(((Object)scrap).name) && !scraps.ContainsValue(scrap)) { scraps.Add(((Object)scrap).name, scrap); } } public void AddLevelAmbiances(LevelAmbienceLibrary levelAmbiance) { if ((Object)(object)levelAmbiance != (Object)null && !levelAmbiances.ContainsKey(((Object)levelAmbiance).name) && !levelAmbiances.ContainsValue(levelAmbiance)) { levelAmbiances.Add(((Object)levelAmbiance).name, levelAmbiance); } } public void AddEnemies(EnemyType enemie) { if ((Object)(object)enemie != (Object)null && !enemies.ContainsKey(((Object)enemie).name) && !enemies.ContainsValue(enemie)) { enemies.Add(((Object)enemie).name, enemie); } } public void AddSprites(Sprite sprite) { if ((Object)(object)sprite != (Object)null && !sprites.ContainsKey(((Object)sprite).name) && !sprites.ContainsValue(sprite)) { sprites.Add(((Object)sprite).name, sprite); } } public void AddSprites(string name, Sprite sprite) { if ((Object)(object)sprite != (Object)null && !sprites.ContainsKey(name) && !sprites.ContainsValue(sprite)) { sprites.Add(name, sprite); } } } public class ChatMessageProcessor { public static bool ProcessMessage(string message) { if (Regex.IsMatch(message, "^\\[sync\\].*\\[sync\\]$")) { try { string value = Regex.Match(message, "^\\[sync\\](.*)\\[sync\\]$").Groups[1].Value; string[] array = value.Split('|'); if (array.Length == 3) { NetworkPacketManager.packetType packetType = (NetworkPacketManager.packetType)int.Parse(array[0]); string[] array2 = array[1].Split('>'); ulong num = ulong.Parse(array2[0]); long num2 = long.Parse(array2[1]); string[] array3 = array[2].Split('='); string header = array3[0]; string packet = array3[1]; if (num2 == -1 || num2 == (long)((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId) { if (num != 0) { NetworkPacketManager.Instance.CancelTimeout((long)num); } LethalExpansion.Log.LogInfo((object)message); switch (packetType) { case NetworkPacketManager.packetType.request: ProcessRequest(num, header, packet); break; case NetworkPacketManager.packetType.data: ProcessData(num, header, packet); break; case NetworkPacketManager.packetType.other: LethalExpansion.Log.LogInfo((object)"Unsupported type."); break; default: LethalExpansion.Log.LogInfo((object)"Unrecognized type."); break; } } } return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); return false; } } return false; } private static void ProcessRequest(ulong sender, string header, string packet) { try { switch (header) { case "clientinfo": { if (LethalExpansion.ishost || sender != 0) { break; } string text2 = LethalExpansion.ModVersion.ToString() + "$"; foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles) { text2 = text2 + assetBundle.Key + "v" + ((object)assetBundle.Value.Item2.GetVersion()).ToString() + "&"; } if (text2.EndsWith('&')) { text2 = text2.Remove(text2.Length - 1); } NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "clientinfo", text2, 0L); break; } case "hostconfig": if (LethalExpansion.ishost && sender != 0) { NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.request, "clientinfo", string.Empty, (long)sender); } break; case "hostweathers": if (LethalExpansion.ishost && sender != 0L && LethalExpansion.weathersReadyToShare) { string text3 = string.Empty; int[] currentWeathers = StartOfRound_Patch.currentWeathers; foreach (int num2 in currentWeathers) { text3 = text3 + num2 + "&"; } if (text3.EndsWith('&')) { text3 = text3.Remove(text3.Length - 1); } NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "hostweathers", text3, (long)sender, waitForAnswer: false); } break; case "networkobjectdata": { if (!LethalExpansion.ishost || sender == 0) { break; } string text = string.Empty; if (packet.Length > 0 && packet.Contains(',')) { try { ulong[] array = Array.ConvertAll(packet.Split(','), ulong.Parse); ulong[] array2 = array; foreach (ulong num in array2) { text += $"{num}${NetworkDataManager.NetworkData[num].serializedData}&"; } if (text.EndsWith('&')) { text = text.Remove(text.Length - 1); } } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); text = "error"; } NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "networkobjectdata", text, (long)sender, waitForAnswer: false); } else { LethalExpansion.Log.LogError((object)"networkobjectdata packet error"); text = "packet error"; } break; } default: LethalExpansion.Log.LogInfo((object)"Unrecognized command."); break; } } catch (Exception ex2) { LethalExpansion.Log.LogError((object)ex2); } } private static void ProcessData(ulong sender, string header, string packet) { //IL_050b: Unknown result type (might be due to invalid IL or missing references) try { switch (header) { case "clientinfo": { if (!LethalExpansion.ishost || sender == 0) { break; } string[] array2 = ((!packet.Contains('$')) ? new string[1] { packet } : packet.Split('$')); string text = string.Empty; foreach (KeyValuePair<string, (AssetBundle, ModManifest)> assetBundle in AssetBundlesManager.Instance.assetBundles) { text = text + assetBundle.Key + "v" + ((object)assetBundle.Value.Item2.GetVersion()).ToString() + "&"; } if (text.Length > 0 && text.EndsWith('&')) { text = text.Remove(text.Length - 1); } if (array2[0] != LethalExpansion.ModVersion.ToString()) { if (StartOfRound.Instance.ClientPlayerList.ContainsKey(sender)) { LethalExpansion.Log.LogError((object)$"Kicking {sender} for wrong version."); NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "kickreason", "Wrong version.", (long)sender); StartOfRound.Instance.KickPlayer(StartOfRound.Instance.ClientPlayerList[sender]); } break; } if (array2.Length > 1 && array2[1] != text) { if (StartOfRound.Instance.ClientPlayerList.ContainsKey(sender)) { LethalExpansion.Log.LogError((object)$"Kicking {sender} for wrong bundles."); NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "kickreason", "Wrong bundles.", (long)sender); StartOfRound.Instance.KickPlayer(StartOfRound.Instance.ClientPlayerList[sender]); } break; } string text2 = string.Empty; foreach (ConfigItem item in ConfigManager.Instance.GetAll()) { switch (item.type.Name) { case "Int32": text2 = text2 + "i" + ((int)item.Value).ToString(CultureInfo.InvariantCulture); break; case "Single": text2 = text2 + "f" + ((float)item.Value).ToString(CultureInfo.InvariantCulture); break; case "Boolean": text2 = text2 + "b" + (bool)item.Value; break; case "String": text2 = text2 + "s" + item; break; } text2 += "&"; } if (text2.EndsWith('&')) { text2 = text2.Remove(text2.Length - 1); } NetworkPacketManager.Instance.sendPacket(NetworkPacketManager.packetType.data, "hostconfig", text2, (long)sender); break; } case "hostconfig": { if (LethalExpansion.ishost || sender != 0) { break; } string[] array6 = packet.Split('&'); LethalExpansion.Log.LogInfo((object)("Received host config: " + packet)); for (int k = 0; k < array6.Length; k++) { if (k < ConfigManager.Instance.GetCount() && ConfigManager.Instance.MustBeSync(k)) { ConfigManager.Instance.SetItemValue(k, array6[k].Substring(1), array6[k][0]); } } LethalExpansion.hostDataWaiting = false; LethalExpansion.Log.LogInfo((object)"Updated config"); break; } case "hostweathers": { if (LethalExpansion.ishost || sender != 0) { break; } string[] array = packet.Split('&'); LethalExpansion.Log.LogInfo((object)("Received host weathers: " + packet)); StartOfRound_Patch.currentWeathers = new int[array.Length]; for (int i = 0; i < array.Length; i++) { int result = 0; if (int.TryParse(array[i], out result)) { StartOfRound_Patch.currentWeathers[i] = result; StartOfRound.Instance.levels[i].currentWeather = (LevelWeatherType)result; } } break; } case "networkobjectdata": { if (LethalExpansion.ishost || sender != 0) { break; } string[] array3 = ((!packet.Contains('&')) ? new string[1] { packet } : packet.Split('&')); try { string[] array4 = array3; foreach (string text3 in array4) { if (text3.Contains('$')) { string[] array5 = text3.Split('$'); ulong result2 = 0uL; if (array5.Length >= 2 && ulong.TryParse(array5[0], out result2) && array5[1].Contains(',')) { NetworkDataManager.NetworkData[result2].serializedData = array5[1]; LethalExpansion.Log.LogDebug((object)("networkobjectdata: " + array5[0] + " data received " + array5[1])); } else { LethalExpansion.Log.LogError((object)("networkobjectdata error " + packet)); } } else { LethalExpansion.Log.LogError((object)("networkobjectdata error " + packet)); } } break; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex); break; } } case "kickreason": if (!LethalExpansion.ishost && sender == 0) { LethalExpansion.lastKickReason = packet; } break; default: LethalExpansion.Log.LogInfo((object)"Unrecognized property."); break; } } catch (Exception ex2) { LethalExpansion.Log.LogError((object)ex2); } } } public class ComponentWhitelists { public static List<Type> mainWhitelist = new List<Type> { typeof(Transform), typeof(MeshFilter), typeof(MeshRenderer), typeof(SkinnedMeshRenderer), typeof(MeshCollider), typeof(BoxCollider), typeof(SphereCollider), typeof(CapsuleCollider), typeof(TerrainCollider), typeof(WheelCollider), typeof(ArticulationBody), typeof(ConstantForce), typeof(ConfigurableJoint), typeof(FixedJoint), typeof(HingeJoint), typeof(Cloth), typeof(Rigidbody), typeof(NetworkObject), typeof(NetworkRigidbody), typeof(NetworkTransform), typeof(NetworkAnimator), typeof(Animator), typeof(Animation), typeof(Terrain), typeof(Tree), typeof(WindZone), typeof(DecalProjector), typeof(LODGroup), typeof(Light), typeof(HDAdditionalLightData), typeof(LightProbeGroup), typeof(LightProbeProxyVolume), typeof(LocalVolumetricFog), typeof(OcclusionArea), typeof(OcclusionPortal), typeof(ReflectionProbe), typeof(PlanarReflectionProbe), typeof(HDAdditionalReflectionData), typeof(Skybox), typeof(SortingGroup), typeof(SpriteRenderer), typeof(Volume), typeof(AudioSource), typeof(AudioReverbZone), typeof(AudioReverbFilter), typeof(AudioChorusFilter), typeof(AudioDistortionFilter), typeof(AudioEchoFilter), typeof(AudioHighPassFilter), typeof(AudioLowPassFilter), typeof(AudioListener), typeof(LensFlare), typeof(TrailRenderer), typeof(LineRenderer), typeof(ParticleSystem), typeof(ParticleSystemRenderer), typeof(ParticleSystemForceField), typeof(Projector), typeof(VideoPlayer), typeof(NavMeshSurface), typeof(NavMeshModifier), typeof(NavMeshModifierVolume), typeof(NavMeshLink), typeof(NavMeshObstacle), typeof(OffMeshLink), typeof(SI_AudioReverbPresets), typeof(SI_AudioReverbTrigger), typeof(SI_DungeonGenerator), typeof(SI_MatchLocalPlayerPosition), typeof(SI_AnimatedSun), typeof(SI_EntranceTeleport), typeof(SI_ScanNode), typeof(SI_DoorLock), typeof(SI_WaterSurface), typeof(SI_Ladder), typeof(SI_ItemDropship), typeof(SI_NetworkPrefabInstancier), typeof(SI_InteractTrigger), typeof(SI_DamagePlayer), typeof(SI_SoundYDistance), typeof(SI_AudioOutputInterface), typeof(SI_NetworkDataInterfacing), typeof(SI_NetworkData), typeof(TerrainChecker), typeof(PlayerShip) }; } public class ConfigManager { private static ConfigManager _instance; private List<ConfigItem> items = new List<ConfigItem>(); private List<ConfigEntryBase> entries = new List<ConfigEntryBase>(); public static ConfigManager Instance { get { if (_instance == null) { _instance = new ConfigManager(); } return _instance; } } public void AddItem(ConfigItem item) { try { items.Add(item); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); } } public void ReadConfig() { //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Expected O, but got Unknown //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Expected O, but got Unknown items = (from item in items orderby item.Tab, item.Key select item).ToList(); try { for (int i = 0; i < items.Count; i++) { if (!items[i].Hidden) { string description = items[i].Description; description = description + "\nNetwork synchronization: " + (items[i].Sync ? "Yes" : "No"); description = description + "\nMod required by clients: " + (items[i].Optional ? "No" : "Yes"); switch (items[i].type.Name) { case "Int32": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<int>(items[i].Tab, items[i].Key, (int)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>((int)items[i].MinValue, (int)items[i].MaxValue), Array.Empty<object>()))); break; case "Single": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<float>(items[i].Tab, items[i].Key, (float)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>((float)items[i].MinValue, (float)items[i].MaxValue), Array.Empty<object>()))); break; case "Boolean": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<bool>(items[i].Tab, items[i].Key, (bool)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()))); break; case "String": entries.Add((ConfigEntryBase)(object)LethalExpansion.config.Bind<string>(items[i].Tab, items[i].Key, (string)items[i].DefaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()))); break; } if (!items[i].Sync) { items[i].Value = entries.Last().BoxedValue; } } else { entries.Add(null); } } } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); } } public object FindItemValue(string key) { try { return items.First((ConfigItem item) => item.Key == key).Value; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindItemValue(int index) { try { return items[index].Value; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindEntryValue(string key) { try { return entries.First((ConfigEntryBase item) => item.Definition.Key == key).BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindEntryValue(int index) { try { return entries[index].BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public bool RequireRestart(string key) { try { return items.First((ConfigItem item) => item.Key == key).RequireRestart; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool RequireRestart(int index) { try { return items[index].RequireRestart; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public string FindDescription(string key) { try { return items.First((ConfigItem item) => item.Key == key).Description; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public string FindDescription(int index) { try { return items[index].Description; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public (bool, bool) FindNetInfo(string key) { try { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); return (configItem.Sync, configItem.Optional); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (false, false); } } public (bool, bool) FindNetInfo(int index) { try { return (items[index].Sync, items[index].Optional); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (false, false); } } public object FindDefaultValue(string key) { try { return items.First((ConfigItem item) => item.Key == key).DefaultValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public object FindDefaultValue(int index) { try { return items[index].DefaultValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public bool MustBeSync(string key) { try { return items.First((ConfigItem item) => item.Key == key).Sync; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return true; } } public bool MustBeSync(int index) { try { return items[index].Sync; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return true; } } public bool SetItemValue(string key, object value) { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (!items.First((ConfigItem item) => item.Key == key).RequireRestart) { try { configItem.Value = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue(string key, object value) { try { entries.First((ConfigEntryBase item) => item.Definition.Key == key).BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool SetItemValue(int index, string value, char type) { if (!items[index].RequireRestart) { try { switch (type) { case 'i': items[index].Value = int.Parse(value, CultureInfo.InvariantCulture); break; case 'f': items[index].Value = float.Parse(value, CultureInfo.InvariantCulture); break; case 'b': items[index].Value = bool.Parse(value); break; case 's': items[index].Value = value; break; } return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue(int index, string value, char type) { try { switch (type) { case 'i': entries[index].BoxedValue = int.Parse(value); break; case 'f': entries[index].BoxedValue = float.Parse(value); break; case 'b': entries[index].BoxedValue = bool.Parse(value); break; case 's': entries[index].BoxedValue = value; break; } return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public (object, int) FindValueAndIndex(string key) { try { return (items.First((ConfigItem item) => item.Key == key).Value, items.FindIndex((ConfigItem item) => item.Key == key)); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (null, -1); } } public int FindIndex(string key) { try { return items.FindIndex((ConfigItem item) => item.Key == key); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return -1; } } public T FindItemValue<T>(string key) { try { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (configItem != null && configItem.Value is T) { return (T)configItem.Value; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public T FindItemValue<T>(int index) { try { ConfigItem configItem = items[index]; if (configItem != null && configItem.Value is T) { return (T)configItem.Value; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public T FindEntryValue<T>(string key) { try { ConfigEntryBase val = entries.First((ConfigEntryBase item) => item.Definition.Key == key); if (val != null && val.BoxedValue is T) { return (T)val.BoxedValue; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public T FindEntryValue<T>(int index) { try { ConfigEntryBase val = entries[index]; if (val != null && val.BoxedValue is T) { return (T)val.BoxedValue; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public bool SetItemValue<T>(string key, T value) { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (!configItem.RequireRestart) { try { if (configItem == null || !(configItem.Value is T)) { LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } configItem.Value = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue<T>(string key, T value) { try { ConfigEntryBase val = entries.First((ConfigEntryBase item) => item.Definition.Key == key); if (val != null && val.BoxedValue is T) { val.BoxedValue = value; return true; } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool SetItemValue<T>(int index, T value) { if (!items[index].RequireRestart) { try { items[index].Value = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } return false; } public bool SetEntryValue<T>(int index, T value) { try { entries[index].BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public (T, int) FindValueAndIndex<T>(string key) { try { ConfigItem configItem = items.First((ConfigItem item) => item.Key == key); if (configItem != null && configItem.Value is T) { return ((T)configItem.Value, items.FindIndex((ConfigItem item) => item.Key == key)); } LethalExpansion.Log.LogError((object)"Key not found or value is of incorrect type"); throw new InvalidOperationException("Key not found or value is of incorrect type"); } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return (default(T), -1); } } public List<ConfigItem> GetAll() { try { return items; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public int GetCount() { try { return items.Count; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return -1; } } public int GetEntriesCount() { try { return entries.Count; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return -1; } } public object ReadConfigValue(string key) { try { return entries[FindIndex(key)].BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return null; } } public T ReadConfigValue<T>(string key) { try { return (T)entries[FindIndex(key)].BoxedValue; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return default(T); } } public bool WriteConfigValue(string key, object value) { try { int index = FindIndex(key); SetItemValue(index, value); entries[index].BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } public bool WriteConfigValue<T>(string key, T value) { try { int index = FindIndex(key); SetItemValue(index, value); entries[index].BoxedValue = value; return true; } catch (Exception ex) { LethalExpansion.Log.LogError((object)ex.Message); return false; } } } public static class ModUtils { public static T[] RemoveElementFromArray<T>(T[] originalArray, int indexToRemove) { if (indexToRemove < 0 || indexToRemove >= originalArray.Length) { throw new ArgumentOutOfRangeException("indexToRemove"); } T[] array = new T[originalArray.Length - 1]; int i = 0; int num = 0; for (; i < originalArray.Length; i++) { if (i != indexToRemove) { array[num] = originalArray[i]; num++; } } return array; } } public class NetworkPacketManager { public enum packetType { request = 0, data = 1, other = -1 } private static NetworkPacketManager _instance; private ConcurrentDictionary<long, CancellationTokenSource> timeoutDictionary = new ConcurrentDictionary<long, CancellationTokenSource>(); public static NetworkPacketManager Instance { get { if (_instance == null) { _instance = new NetworkPacketManager(); } return _instance; } } private NetworkPacketManager() { } public void sendPacket(packetType type, string header, string packet, long destination = -1L, bool waitForAnswer = true) { HUDManager.Instance.AddTextToChatOnServer($"[sync]{(int)type}|{((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId}>{destination}|{header}={packet}[sync]", -1); if ((waitForAnswer && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ConfigManager.Instance.FindItemValue<bool>("LoadModules")) || ConfigManager.Instance.FindItemValue<bool>("KickPlayerWithoutMod")) { StartTimeout(destination); } } public void sendPacket(packetType type, string header, string packet, long[] destinations, bool waitForAnswer = true) { for (int i = 0; i < destinations.Length; i++) { int num = (int)destinations[i]; if (num != -1) { HUDManager.Instance.AddTextToChatOnServer($"[sync]{(int)type}|{((NetworkBehaviour)RoundManager.Instance).NetworkManager.LocalClientId}>{num}|{header}={packet}[sync]", -1); if ((waitForAnswer && ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && ConfigManager.Instance.FindItemValue<bool>("LoadModules")) || ConfigManager.Instance.FindItemValue<bool>("KickPlayerWithoutMod")) { StartTimeout(num); } } } } public void StartTimeout(long id) { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); if (!timeoutDictionary.TryAdd(id, cancellationTokenSource)) { return; } Task.Run(async delegate { try { await PacketTimeout(id, cancellationTokenSource.Token); } catch (OperationCanceledException) { } finally { timeoutDictionary.TryRemove(id, out var _); } }); } public void CancelTimeout(long id) { if (timeoutDictionary.TryRemove(id, out var value)) { value.Cancel(); } } private async Task PacketTimeout(long id, CancellationToken token) { await Task.Delay(5000, token); if (token.IsCancellationRequested) { } } } public class PopupManager { private static PopupManager _instance; private List<PopupObject> popups = new List<PopupObject>(); public static PopupManager Instance { get { if (_instance == null) { _instance = new PopupManager(); } return _instance; } } private PopupManager() { } public void InstantiatePopup(Scene sceneFocus, string title = "Popup", string content = "", string button1 = "Ok", string button2 = "Cancel", UnityAction button1Action = null, UnityAction button2Action = null, int titlesize = 24, int contentsize = 24, int button1size = 24, int button2size = 24) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown if (!((Scene)(ref sceneFocus)).isLoaded) { return; } GameObject[] rootGameObjects = ((Scene)(ref sceneFocus)).GetRootGameObjects(); Canvas val = null; GameObject[] array = rootGameObjects; foreach (GameObject val2 in array) { val = val2.GetComponentInChildren<Canvas>(); if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null || ((Component)val).gameObject.scene != sceneFocus) { GameObject val3 = new GameObject(); ((Object)val3).name = "Canvas"; val = val3.AddComponent<Canvas>(); SceneManager.MoveGameObjectToScene(((Component)val).gameObject, sceneFocus); } GameObject _tmp = Object.Instantiate<GameObject>(AssetBundlesManager.Instance.mainAssetBundle.LoadAsset<GameObject>("Assets/Mods/LethalExpansion/Prefabs/HUD/Popup.prefab"), ((Component)val).transform); if ((Object)(object)_tmp != (Object)null) { ((Component)_tmp.transform.Find("DragAndDropSurface")).gameObject.AddComponent<SettingMenu_DragAndDrop>().rectTransform = _tmp.GetComponent<RectTransform>(); ((UnityEvent)((Component)_tmp.transform.Find("CloseButton")).gameObject.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { Object.Destroy((Object)(object)_tmp); }); if (button1Action != null) { ((UnityEvent)((Component)_tmp.transform.Find("Button1")).gameObject.GetComponent<Button>().onClick).AddListener(button1Action); } if (button2Action != null) { ((UnityEvent)((Component)_tmp.transform.Find("Button2")).gameObject.GetCompone
plugins/LethalLevelLoader.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using GameNetcodeStuff; using HarmonyLib; using LethalLevelLoader.NetcodePatcher; using LethalLevelLoader.Tools; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using On; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("LethalLevelLoader")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A Custom API to support the manual and dynamic integration of custom levels and dungeons in Lethal Company.")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+e4357129de2bfee0b9a624c989c1b553463f153f")] [assembly: AssemblyProduct("LethalLevelLoader")] [assembly: AssemblyTitle("LethalLevelLoader")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public enum ContentType { Vanilla, Custom, Any } internal static class HookHelper { public class DisposableHookCollection { private List<ILHook> ilHooks = new List<ILHook>(); private List<Hook> hooks = new List<Hook>(); public void Clear() { foreach (Hook hook in hooks) { hook.Dispose(); } hooks.Clear(); foreach (ILHook ilHook in ilHooks) { ilHook.Dispose(); } ilHooks.Clear(); } public void ILHook<T>(string methodName, Manipulator to, Type[] parameters = null) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown ilHooks.Add(new ILHook((MethodBase)EzGetMethod<T>(methodName, parameters), to)); } public void Hook<T>(string methodName, Delegate to, Type[] parameters = null) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown hooks.Add(new Hook((MethodBase)EzGetMethod<T>(methodName, parameters), to)); } } public static MethodInfo methodof(Delegate method) { return method.Method; } public static MethodInfo EzGetMethod(Type type, string name, Type[] parameters = null) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; if (parameters == null) { return type.GetMethod(name, bindingAttr); } return type.GetMethod(name, bindingAttr, null, parameters, null); } public static MethodInfo EzGetMethod<T>(string name, Type[] parameters = null) { return EzGetMethod(typeof(T), name, parameters); } } public static class NetworkScenePatcher { [CompilerGenerated] private static class <>O { public static Action<Action<NetworkSceneManager>, NetworkSceneManager> <0>__GenerateScenesInBuild_Hook; public static Func<Func<NetworkSceneManager, uint, string>, NetworkSceneManager, uint, string> <1>__SceneNameFromHash_Hook; public static Func<Func<NetworkSceneManager, int, string, LoadSceneMode, bool>, NetworkSceneManager, int, string, LoadSceneMode, bool> <2>__ValidateSceneBeforeLoading_Hook; public static Manipulator <3>__ReplaceBuildIndexByScenePath; public static Manipulator <4>__ReplaceScenePathByBuildIndex; public static Func<int, string> <5>__GetScenePathByBuildIndex; public static Func<string, int> <6>__GetBuildIndexByScenePath; } private static List<string> scenePaths = new List<string>(); private static Dictionary<string, int> scenePathToBuildIndex = new Dictionary<string, int>(); private static Dictionary<int, string> buildIndexToScenePath = new Dictionary<int, string>(); private static Dictionary<uint, string> sceneHashToScenePath = new Dictionary<uint, string>(); private static HookHelper.DisposableHookCollection hooks = new HookHelper.DisposableHookCollection(); internal static bool patched { get; private set; } public static void AddScenePath(string scenePath) { if (scenePaths.Contains(scenePath)) { Debug.LogError((object)("Can not add scene path " + scenePath + " to the network scene patcher! (already exists in scene paths list)")); } else { scenePaths.Add(scenePath); } } internal static void Patch() { //IL_00e0: 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_00eb: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown if (!patched) { patched = true; hooks.Hook<NetworkSceneManager>("GenerateScenesInBuild", new Action<Action<NetworkSceneManager>, NetworkSceneManager>(GenerateScenesInBuild_Hook)); hooks.Hook<NetworkSceneManager>("SceneNameFromHash", new Func<Func<NetworkSceneManager, uint, string>, NetworkSceneManager, uint, string>(SceneNameFromHash_Hook)); hooks.Hook<NetworkSceneManager>("ValidateSceneBeforeLoading", new Func<Func<NetworkSceneManager, int, string, LoadSceneMode, bool>, NetworkSceneManager, int, string, LoadSceneMode, bool>(ValidateSceneBeforeLoading_Hook), new Type[3] { typeof(int), typeof(string), typeof(LoadSceneMode) }); HookHelper.DisposableHookCollection disposableHookCollection = hooks; object obj = <>O.<3>__ReplaceBuildIndexByScenePath; if (obj == null) { Manipulator val = ReplaceBuildIndexByScenePath; <>O.<3>__ReplaceBuildIndexByScenePath = val; obj = (object)val; } disposableHookCollection.ILHook<NetworkSceneManager>("SceneHashFromNameOrPath", (Manipulator)obj); HookHelper.DisposableHookCollection disposableHookCollection2 = hooks; object obj2 = <>O.<3>__ReplaceBuildIndexByScenePath; if (obj2 == null) { Manipulator val2 = ReplaceBuildIndexByScenePath; <>O.<3>__ReplaceBuildIndexByScenePath = val2; obj2 = (object)val2; } disposableHookCollection2.ILHook<NetworkSceneManager>("ValidateSceneEvent", (Manipulator)obj2); HookHelper.DisposableHookCollection disposableHookCollection3 = hooks; object obj3 = <>O.<4>__ReplaceScenePathByBuildIndex; if (obj3 == null) { Manipulator val3 = ReplaceScenePathByBuildIndex; <>O.<4>__ReplaceScenePathByBuildIndex = val3; obj3 = (object)val3; } disposableHookCollection3.ILHook<NetworkSceneManager>("ScenePathFromHash", (Manipulator)obj3); } } internal static void Unpatch() { if (patched) { patched = false; hooks.Clear(); } } private static void ReplaceScenePathByBuildIndex(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MethodInfo methodInfo = HookHelper.methodof(new Func<int, string>(GetScenePathByBuildIndex)); while (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, typeof(SceneUtility), "GetScenePathByBuildIndex") })) { val.Remove(); val.Emit(OpCodes.Call, (MethodBase)methodInfo); } } private static void ReplaceBuildIndexByScenePath(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MethodInfo methodInfo = HookHelper.methodof(new Func<string, int>(GetBuildIndexByScenePath)); while (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall(instr, typeof(SceneUtility), "GetBuildIndexByScenePath") })) { val.Remove(); val.Emit(OpCodes.Call, (MethodBase)methodInfo); } } private static string GetScenePathByBuildIndex(int buildIndex) { if (buildIndexToScenePath.ContainsKey(buildIndex)) { return buildIndexToScenePath[buildIndex]; } return SceneUtility.GetScenePathByBuildIndex(buildIndex); } private static int GetBuildIndexByScenePath(string scenePath) { int num = SceneUtility.GetBuildIndexByScenePath(scenePath); if (num == -1 && scenePathToBuildIndex.ContainsKey(scenePath)) { num = scenePathToBuildIndex[scenePath]; } return num; } private static void GenerateScenesInBuild_Hook(Action<NetworkSceneManager> orig, NetworkSceneManager self) { scenePathToBuildIndex.Clear(); buildIndexToScenePath.Clear(); sceneHashToScenePath.Clear(); orig(self); int sceneCountInBuildSettings = SceneManager.sceneCountInBuildSettings; for (int i = 0; i < scenePaths.Count; i++) { int num = sceneCountInBuildSettings + i; string text = scenePaths[i]; uint num2 = XXHash.Hash32(text); self.HashToBuildIndex.Add(num2, num); self.BuildIndexToHash.Add(num, num2); scenePathToBuildIndex.Add(text, num); buildIndexToScenePath.Add(num, text); sceneHashToScenePath.Add(num2, text); Debug.Log((object)("Added modded scene path: " + text)); } } private static string SceneNameFromHash_Hook(Func<NetworkSceneManager, uint, string> orig, NetworkSceneManager self, uint sceneHash) { if (sceneHash == 0) { return "No Scene"; } if (sceneHashToScenePath.ContainsKey(sceneHash)) { return sceneHashToScenePath[sceneHash]; } return orig(self, sceneHash); } private static bool ValidateSceneBeforeLoading_Hook(Func<NetworkSceneManager, int, string, LoadSceneMode, bool> orig, NetworkSceneManager self, int sceneIndex, string sceneName, LoadSceneMode loadSceneMode) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Debug.LogWarning((object)(orig(self, sceneIndex, sceneName, loadSceneMode) ? ("Validation check success for scene: " + sceneName) : ("Bypassed validation check for scene " + sceneName))); return true; } } namespace LethalLevelLoader { [CreateAssetMenu(menuName = "LethalLevelLoader/ExtendedDungeonFlow")] public class ExtendedDungeonFlow : ScriptableObject { [Header("Extended DungeonFlow Settings")] public string contentSourceName = string.Empty; [Space(5f)] public string dungeonDisplayName = string.Empty; [Space(5f)] public DungeonFlow dungeonFlow; [Space(5f)] public AudioClip dungeonFirstTimeAudio; [Space(10f)] [Header("Dynamic DungeonFlow Injections Settings")] public List<StringWithRarity> dynamicLevelTagsList = new List<StringWithRarity>(); [Space(5f)] public List<Vector2WithRarity> dynamicRoutePricesList = new List<Vector2WithRarity>(); [Space(5f)] public List<StringWithRarity> dynamicCurrentWeatherList = new List<StringWithRarity>(); [Space(5f)] public List<StringWithRarity> manualPlanetNameReferenceList = new List<StringWithRarity>(); [Space(5f)] public List<StringWithRarity> manualContentSourceNameReferenceList = new List<StringWithRarity>(); [Space(10f)] [Header("Dynamic Dungeon Size Multiplier Lerp Settings")] public bool enableDynamicDungeonSizeRestriction = false; public float dungeonSizeMin = 1f; public float dungeonSizeMax = 1f; [Range(0f, 1f)] public float dungeonSizeLerpPercentage = 1f; [Space(10f)] [Header("Dynamic DungeonFlow Modification Settings")] public List<GlobalPropCountOverride> globalPropCountOverridesList = new List<GlobalPropCountOverride>(); [Space(10f)] [Header("Misc. Settings")] public bool generateAutomaticConfigurationOptions = true; [Space(10f)] [Header("Experimental Settings (Currently Unused As Of LethalLevelLoader 1.1.0")] public GameObject mainEntrancePropPrefab; [Space(5f)] public GameObject fireExitPropPrefab; [Space(5f)] public Animator mainEntrancePropAnimator; [Space(5f)] public Animator fireExitPropAnimator; [HideInInspector] public ContentType dungeonType; [HideInInspector] public int dungeonID; [HideInInspector] public int dungeonDefaultRarity; [HideInInspector] public DungeonEvents dungeonEvents = new DungeonEvents(); internal static ExtendedDungeonFlow Create(DungeonFlow newDungeonFlow, AudioClip newFirstTimeDungeonAudio, string contentSourceName) { ExtendedDungeonFlow extendedDungeonFlow = ScriptableObject.CreateInstance<ExtendedDungeonFlow>(); extendedDungeonFlow.dungeonFlow = newDungeonFlow; extendedDungeonFlow.dungeonFirstTimeAudio = newFirstTimeDungeonAudio; extendedDungeonFlow.contentSourceName = contentSourceName; return extendedDungeonFlow; } internal void Initialize(ContentType newDungeonType) { dungeonType = newDungeonType; GetDungeonFlowID(); if (dungeonDisplayName == null || dungeonDisplayName == string.Empty) { dungeonDisplayName = ((Object)dungeonFlow).name; } ((Object)this).name = ((Object)dungeonFlow).name.Replace("Flow", "") + "ExtendedDungeonFlow"; if ((Object)(object)dungeonFirstTimeAudio == (Object)null) { DebugHelper.Log("Warning, Custom Dungeon: " + dungeonDisplayName + " Is Missing A DungeonFirstTimeAudio Reference! Assigning Facility Audio To Prevent Errors."); dungeonFirstTimeAudio = RoundManager.Instance.firstTimeDungeonAudios[0]; } } private void GetDungeonFlowID() { if (dungeonType == ContentType.Custom) { dungeonID = PatchedContent.ExtendedDungeonFlows.Count; } if (dungeonType == ContentType.Vanilla) { dungeonID = RoundManager.Instance.dungeonFlowTypes.ToList().IndexOf(dungeonFlow); } } } [Serializable] public class StringWithRarity { [SerializeField] private string _name; [SerializeField] [Range(0f, 300f)] private int _rarity; [HideInInspector] public string Name { get { return _name; } set { _name = value; } } [HideInInspector] public int Rarity { get { return _rarity; } set { _rarity = value; } } [HideInInspector] public StringWithRarity(string newName, int newRarity) { _name = newName; _rarity = newRarity; } } [Serializable] public class Vector2WithRarity { [SerializeField] private Vector2 _minMax; [SerializeField] private int _rarity; [HideInInspector] public float Min { get { return _minMax.x; } set { _minMax.x = value; } } [HideInInspector] public float Max { get { return _minMax.y; } set { _minMax.y = value; } } [HideInInspector] public int Rarity { get { return _rarity; } set { _rarity = value; } } public Vector2WithRarity(Vector2 vector2, int newRarity) { //IL_000e: 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) _minMax.x = vector2.x; _minMax.y = vector2.y; _rarity = newRarity; } public Vector2WithRarity(float newMin, float newMax, int newRarity) { _minMax.x = newMin; _minMax.y = newMax; _rarity = newRarity; } } [Serializable] public class GlobalPropCountOverride { public int globalPropID; [Range(0f, 1f)] public float globalPropCountScaleRate = 0f; } [Serializable] public class DungeonEvents { public ExtendedEvent<RoundManager> onBeforeDungeonGenerate = new ExtendedEvent<RoundManager>(); public ExtendedEvent<List<GameObject>> onSpawnedSyncedObjects = new ExtendedEvent<List<GameObject>>(); public ExtendedEvent<List<GameObject>> onSpawnedMapObjects = new ExtendedEvent<List<GameObject>>(); public ExtendedEvent<List<GrabbableObject>> onSpawnedScrapObjects = new ExtendedEvent<List<GrabbableObject>>(); public ExtendedEvent<(EnemyVent, EnemyAI)> onEnemySpawnedFromVent = new ExtendedEvent<(EnemyVent, EnemyAI)>(); public ExtendedEvent<(EntranceTeleport, PlayerControllerB)> onPlayerEnterDungeon = new ExtendedEvent<(EntranceTeleport, PlayerControllerB)>(); public ExtendedEvent<(EntranceTeleport, PlayerControllerB)> onPlayerExitDungeon = new ExtendedEvent<(EntranceTeleport, PlayerControllerB)>(); public ExtendedEvent<bool> onPowerSwitchToggle = new ExtendedEvent<bool>(); public ExtendedEvent<LungProp> onApparatusTaken = new ExtendedEvent<LungProp>(); } [CreateAssetMenu(menuName = "LethalLevelLoader/ExtendedLevel")] public class ExtendedLevel : ScriptableObject { [Header("Extended Level Settings")] [Space(5f)] public string contentSourceName = string.Empty; [Space(5f)] public SelectableLevel selectableLevel; [Space(5f)] [SerializeField] private int routePrice = 0; [Space(5f)] public bool isHidden = false; [Space(5f)] public bool isLocked = false; [Space(5f)] public string lockedNodeText = string.Empty; [Space(10f)] public List<StoryLogData> storyLogs = new List<StoryLogData>(); [Space(10f)] [Header("Dynamic DungeonFlow Injections Settings")] [Space(5f)] public ContentType allowedDungeonContentTypes = ContentType.Any; [Space(5f)] public List<string> levelTags = new List<string>(); [HideInInspector] public ContentType levelType; [SerializeField] [TextArea] public string infoNodeDescripton = string.Empty; [HideInInspector] public TerminalNode routeNode; [HideInInspector] public TerminalNode routeConfirmNode; [HideInInspector] public TerminalNode infoNode; [Space(10f)] [Header("Misc. Settings")] [Space(5f)] public bool generateAutomaticConfigurationOptions = true; [HideInInspector] public LevelEvents levelEvents = new LevelEvents(); internal bool isLethalExpansion = false; public int RoutePrice { get { if ((Object)(object)routeNode != (Object)null) { routePrice = routeNode.itemCost; routeConfirmNode.itemCost = routePrice; return routeNode.itemCost; } DebugHelper.Log("routeNode Is Missing! Using internal value!"); return routePrice; } set { routeNode.itemCost = value; routeConfirmNode.itemCost = value; routePrice = value; } } [HideInInspector] public string NumberlessPlanetName => GetNumberlessPlanetName(selectableLevel); public bool IsLoaded { get { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Scene sceneByName = SceneManager.GetSceneByName(selectableLevel.sceneName); return ((Scene)(ref sceneByName)).isLoaded; } } internal static ExtendedLevel Create(SelectableLevel newSelectableLevel, ContentType newContentType) { ExtendedLevel extendedLevel = ScriptableObject.CreateInstance<ExtendedLevel>(); extendedLevel.levelType = newContentType; extendedLevel.selectableLevel = newSelectableLevel; return extendedLevel; } internal void Initialize(string newContentSourceName, bool generateTerminalAssets) { if (levelType == ContentType.Vanilla && selectableLevel.levelID > 8) { DebugHelper.LogWarning("LethalExpansion SelectableLevel " + NumberlessPlanetName + " Found, Setting To LevelType: Custom."); levelType = ContentType.Custom; generateTerminalAssets = true; contentSourceName = "Lethal Expansion"; levelTags.Clear(); isLethalExpansion = true; } if (contentSourceName == string.Empty) { contentSourceName = newContentSourceName; } if (levelType == ContentType.Custom) { levelTags.Add("Custom"); } SetLevelID(); if (generateTerminalAssets) { DebugHelper.Log("Generating Terminal Assets For: " + NumberlessPlanetName); TerminalManager.CreateLevelTerminalData(this, routePrice); } ((Object)this).name = NumberlessPlanetName + "Level"; } internal static string GetNumberlessPlanetName(SelectableLevel selectableLevel) { if ((Object)(object)selectableLevel != (Object)null) { return new string(selectableLevel.PlanetName.SkipWhile((char c) => !char.IsLetter(c)).ToArray()); } return string.Empty; } internal void SetLevelID() { if (levelType == ContentType.Custom) { selectableLevel.levelID = PatchedContent.ExtendedLevels.IndexOf(this); if ((Object)(object)routeNode != (Object)null) { routeNode.displayPlanetInfo = selectableLevel.levelID; } if ((Object)(object)routeConfirmNode != (Object)null) { routeConfirmNode.buyRerouteToMoon = selectableLevel.levelID; } } } } [Serializable] public class LevelEvents { public ExtendedEvent onLevelLoaded = new ExtendedEvent(); public ExtendedEvent onNighttime = new ExtendedEvent(); public ExtendedEvent<EnemyAI> onDaytimeEnemySpawn = new ExtendedEvent<EnemyAI>(); public ExtendedEvent<EnemyAI> onNighttimeEnemySpawn = new ExtendedEvent<EnemyAI>(); public ExtendedEvent<StoryLog> onStoryLogCollected = new ExtendedEvent<StoryLog>(); public ExtendedEvent<LungProp> onApparatusTaken = new ExtendedEvent<LungProp>(); public ExtendedEvent<(EntranceTeleport, PlayerControllerB)> onPlayerEnterDungeon = new ExtendedEvent<(EntranceTeleport, PlayerControllerB)>(); public ExtendedEvent<(EntranceTeleport, PlayerControllerB)> onPlayerExitDungeon = new ExtendedEvent<(EntranceTeleport, PlayerControllerB)>(); public ExtendedEvent<bool> onPowerSwitchToggle = new ExtendedEvent<bool>(); } [Serializable] public class StoryLogData { public int storyLogID; public string terminalWord = string.Empty; public string storyLogTitle = string.Empty; [TextArea] public string storyLogDescription = string.Empty; [HideInInspector] internal int newStoryLogID; } public class MoonsCataloguePage { private List<ExtendedLevelGroup> extendedLevelGroups; public List<ExtendedLevelGroup> ExtendedLevelGroups => extendedLevelGroups; public List<ExtendedLevel> ExtendedLevels { get { List<ExtendedLevel> list = new List<ExtendedLevel>(); foreach (ExtendedLevelGroup extendedLevelGroup in extendedLevelGroups) { foreach (ExtendedLevel extendedLevels in extendedLevelGroup.extendedLevelsList) { list.Add(extendedLevels); } } return list; } } public MoonsCataloguePage(List<ExtendedLevelGroup> newExtendedLevelGroupList) { extendedLevelGroups = new List<ExtendedLevelGroup>(); extendedLevelGroups.Clear(); foreach (ExtendedLevelGroup newExtendedLevelGroup in newExtendedLevelGroupList) { extendedLevelGroups.Add(new ExtendedLevelGroup(newExtendedLevelGroup.extendedLevelsList)); } } public void RebuildLevelGroups(List<ExtendedLevelGroup> newExtendedLevelGroups, int splitCount) { List<ExtendedLevel> list = new List<ExtendedLevel>(); foreach (ExtendedLevelGroup extendedLevelGroup in extendedLevelGroups) { foreach (ExtendedLevel extendedLevels in extendedLevelGroup.extendedLevelsList) { list.Add(extendedLevels); } } RebuildLevelGroups(list.ToArray(), splitCount); } public void RebuildLevelGroups(List<ExtendedLevel> newExtendedLevels, int splitCount) { RebuildLevelGroups(newExtendedLevels.ToArray(), splitCount); } public void RebuildLevelGroups(IOrderedEnumerable<ExtendedLevel> orderedExtendedLevels, int splitCount) { RebuildLevelGroups(orderedExtendedLevels.ToArray(), splitCount); } public void RebuildLevelGroups(ExtendedLevel[] newExtendedLevels, int splitCount) { List<ExtendedLevelGroup> list = new List<ExtendedLevelGroup>(); int num = 0; int num2 = 0; List<ExtendedLevel> list2 = new List<ExtendedLevel>(); foreach (ExtendedLevel item in new List<ExtendedLevel>(newExtendedLevels)) { list2.Add(item); num2++; num++; if (num == splitCount || num2 == newExtendedLevels.Length) { list.Add(new ExtendedLevelGroup(list2)); list2.Clear(); num = 0; } } extendedLevelGroups = list; } public void RefreshLevelGroups(List<ExtendedLevelGroup> newLevelGroups) { extendedLevelGroups.Clear(); foreach (ExtendedLevelGroup newLevelGroup in newLevelGroups) { if (newLevelGroup.extendedLevelsList.Count != 0) { extendedLevelGroups.Add(new ExtendedLevelGroup(newLevelGroup.extendedLevelsList)); } } } } [Serializable] public class ExtendedLevelGroup { public List<ExtendedLevel> extendedLevelsList; public ExtendedLevelGroup(List<ExtendedLevel> newExtendedLevelsList) { extendedLevelsList = new List<ExtendedLevel>(newExtendedLevelsList); } public ExtendedLevelGroup(List<SelectableLevel> newSelectableLevelsList) { extendedLevelsList = new List<ExtendedLevel>(); foreach (SelectableLevel newSelectableLevels in newSelectableLevelsList) { extendedLevelsList.Add(LevelManager.GetExtendedLevel(newSelectableLevels)); } } } public static class PatchedContent { public static List<ExtendedLevel> ExtendedLevels { get; internal set; } = new List<ExtendedLevel>(); public static List<ExtendedLevel> VanillaExtendedLevels { get { List<ExtendedLevel> list = new List<ExtendedLevel>(); foreach (ExtendedLevel extendedLevel in ExtendedLevels) { if (extendedLevel.levelType == ContentType.Vanilla) { list.Add(extendedLevel); } } return list; } } public static List<ExtendedLevel> CustomExtendedLevels { get { List<ExtendedLevel> list = new List<ExtendedLevel>(); foreach (ExtendedLevel extendedLevel in ExtendedLevels) { if (extendedLevel.levelType == ContentType.Custom) { list.Add(extendedLevel); } } return list; } } public static List<SelectableLevel> SeletectableLevels { get { List<SelectableLevel> list = new List<SelectableLevel>(); foreach (ExtendedLevel extendedLevel in ExtendedLevels) { list.Add(extendedLevel.selectableLevel); } return list; } } public static List<SelectableLevel> MoonsCatalogue { get { List<SelectableLevel> list = new List<SelectableLevel>(); foreach (SelectableLevel item in OriginalContent.MoonsCatalogue) { list.Add(item); } foreach (ExtendedLevel extendedLevel in ExtendedLevels) { if (extendedLevel.levelType == ContentType.Custom) { list.Add(extendedLevel.selectableLevel); } } return list; } } public static List<ExtendedDungeonFlow> ExtendedDungeonFlows { get; internal set; } = new List<ExtendedDungeonFlow>(); public static List<ExtendedDungeonFlow> VanillaExtendedDungeonFlows { get { List<ExtendedDungeonFlow> list = new List<ExtendedDungeonFlow>(); foreach (ExtendedDungeonFlow extendedDungeonFlow in ExtendedDungeonFlows) { if (extendedDungeonFlow.dungeonType == ContentType.Vanilla) { list.Add(extendedDungeonFlow); } } return list; } } public static List<ExtendedDungeonFlow> CustomExtendedDungeonFlows { get { List<ExtendedDungeonFlow> list = new List<ExtendedDungeonFlow>(); foreach (ExtendedDungeonFlow extendedDungeonFlow in ExtendedDungeonFlows) { if (extendedDungeonFlow.dungeonType == ContentType.Custom) { list.Add(extendedDungeonFlow); } } return list; } } public static List<string> AllExtendedLevelTags { get { List<string> list = new List<string>(); foreach (ExtendedLevel extendedLevel in ExtendedLevels) { foreach (string levelTag in extendedLevel.levelTags) { if (!list.Contains(levelTag)) { list.Add(levelTag); } } } return list; } } public static List<AudioMixer> AudioMixers { get; internal set; } = new List<AudioMixer>(); public static List<AudioMixerGroup> AudioMixerGroups { get; internal set; } = new List<AudioMixerGroup>(); public static List<AudioMixerSnapshot> AudioMixerSnapshots { get; internal set; } = new List<AudioMixerSnapshot>(); public static void RegisterExtendedDungeonFlow(ExtendedDungeonFlow extendedDungeonFlow) { AssetBundleLoader.obtainedExtendedDungeonFlowsList.Add(extendedDungeonFlow); } public static void RegisterExtendedLevel(ExtendedLevel extendedLevel) { AssetBundleLoader.obtainedExtendedLevelsList.Add(extendedLevel); } } public static class OriginalContent { public static List<SelectableLevel> SelectableLevels { get; internal set; } = new List<SelectableLevel>(); public static List<SelectableLevel> MoonsCatalogue { get; internal set; } = new List<SelectableLevel>(); public static List<DungeonFlow> DungeonFlows { get; internal set; } = new List<DungeonFlow>(); public static List<Item> Items { get; internal set; } = new List<Item>(); public static List<ItemGroup> ItemGroups { get; internal set; } = new List<ItemGroup>(); public static List<EnemyType> Enemies { get; internal set; } = new List<EnemyType>(); public static List<SpawnableOutsideObject> SpawnableOutsideObjects { get; internal set; } = new List<SpawnableOutsideObject>(); public static List<GameObject> SpawnableMapObjects { get; internal set; } = new List<GameObject>(); public static List<AudioMixer> AudioMixers { get; internal set; } = new List<AudioMixer>(); public static List<AudioMixerGroup> AudioMixerGroups { get; internal set; } = new List<AudioMixerGroup>(); public static List<AudioMixerSnapshot> AudioMixerSnapshots { get; internal set; } = new List<AudioMixerSnapshot>(); public static List<LevelAmbienceLibrary> LevelAmbienceLibraries { get; internal set; } = new List<LevelAmbienceLibrary>(); public static List<ReverbPreset> ReverbPresets { get; internal set; } = new List<ReverbPreset>(); public static List<TerminalKeyword> TerminalKeywords { get; internal set; } = new List<TerminalKeyword>(); public static List<TerminalNode> TerminalNodes { get; internal set; } = new List<TerminalNode>(); } internal class EventPatches { private static EnemyVent cachedSelectedVent; internal static void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null && LevelManager.CurrentExtendedLevel.IsLoaded) { LevelManager.CurrentExtendedLevel.levelEvents.onLevelLoaded.Invoke(); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(StoryLog), "CollectLog")] [HarmonyPrefix] internal static void StoryLogCollectLog_Prefix(StoryLog __instance) { if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null && ((NetworkBehaviour)__instance).IsServer) { LevelManager.CurrentExtendedLevel.levelEvents.onStoryLogCollected.Invoke(__instance); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnRandomDaytimeEnemy")] [HarmonyPostfix] internal static void RoundManagerSpawnRandomDaytimeEnemy_Postfix(RoundManager __instance, GameObject __result) { EnemyAI param = default(EnemyAI); if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null && ((NetworkBehaviour)__instance).IsServer && (Object)(object)__result != (Object)null && __result.TryGetComponent<EnemyAI>(ref param)) { LevelManager.CurrentExtendedLevel.levelEvents.onDaytimeEnemySpawn.Invoke(param); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnRandomOutsideEnemy")] [HarmonyPostfix] internal static void RoundManagerSpawnRandomOutsideEnemy_Postfix(RoundManager __instance, GameObject __result) { EnemyAI param = default(EnemyAI); if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null && ((NetworkBehaviour)__instance).IsServer && (Object)(object)__result != (Object)null && __result.TryGetComponent<EnemyAI>(ref param)) { LevelManager.CurrentExtendedLevel.levelEvents.onNighttimeEnemySpawn.Invoke(param); } } [HarmonyPriority(201)] [HarmonyPatch(typeof(DungeonGenerator), "Generate")] [HarmonyPrefix] internal static void DungeonGeneratorGenerate_Prefix() { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onBeforeDungeonGenerate.Invoke(RoundManager.Instance); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SwitchPower")] [HarmonyPrefix] internal static void RoundManagerSwitchPower_Prefix(bool on) { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onPowerSwitchToggle.Invoke(on); } if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { LevelManager.CurrentExtendedLevel.levelEvents.onPowerSwitchToggle.Invoke(on); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPostfix] internal static void RoundManagerSpawnScrapInLevel_Postfix() { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null && DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onSpawnedScrapObjects.HasListeners) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onSpawnedScrapObjects.Invoke(Object.FindObjectsOfType<GrabbableObject>().ToList()); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnSyncedProps")] [HarmonyPostfix] internal static void RoundManagerSpawnSyncedProps_Postfix() { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null && DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onSpawnedSyncedObjects.HasListeners) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onSpawnedSyncedObjects.Invoke(RoundManager.Instance.spawnedSyncedObjects); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnEnemyFromVent")] [HarmonyPrefix] internal static void RoundManagerSpawnEventFromVent_Prefix(EnemyVent vent) { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { cachedSelectedVent = vent; } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnEnemyGameObject")] [HarmonyPostfix] internal static void RoundManagerSpawnEventFromVent_Postfix() { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null && (Object)(object)cachedSelectedVent != (Object)null) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onEnemySpawnedFromVent.Invoke((cachedSelectedVent, RoundManager.Instance.SpawnedEnemies.Last())); cachedSelectedVent = null; } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "SpawnMapObjects")] [HarmonyPostfix] internal static void RoundManagerSpawnMapObjects_Postfix() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null)) { return; } List<GameObject> list = new List<GameObject>(); Scene sceneByName = SceneManager.GetSceneByName(LevelManager.CurrentExtendedLevel.selectableLevel.sceneName); GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { SpawnableMapObject[] spawnableMapObjects = LevelManager.CurrentExtendedLevel.selectableLevel.spawnableMapObjects; foreach (SpawnableMapObject val2 in spawnableMapObjects) { if (((Object)val).name.Sanitized().Contains(((Object)val2.prefabToSpawn).name.Sanitized())) { list.Add(val); } } } DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onSpawnedMapObjects.Invoke(list); } [HarmonyPriority(200)] [HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayerServerRpc")] [HarmonyPrefix] internal static void EntranceTeleportTeleportPlayerServerRpc_Prefix(EntranceTeleport __instance) { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (__instance.isEntranceToBuilding) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onPlayerEnterDungeon.Invoke((__instance, localPlayerController)); } else { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onPlayerExitDungeon.Invoke((__instance, localPlayerController)); } } if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { PlayerControllerB localPlayerController2 = GameNetworkManager.Instance.localPlayerController; if (__instance.isEntranceToBuilding) { LevelManager.CurrentExtendedLevel.levelEvents.onPlayerEnterDungeon.Invoke((__instance, localPlayerController2)); } else { LevelManager.CurrentExtendedLevel.levelEvents.onPlayerExitDungeon.Invoke((__instance, localPlayerController2)); } } } [HarmonyPriority(200)] [HarmonyPatch(typeof(LungProp), "EquipItem")] [HarmonyPrefix] internal static void LungPropEquipItem_Postfix(LungProp __instance) { if (((NetworkBehaviour)__instance).IsServer) { if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null) { DungeonManager.CurrentExtendedDungeonFlow.dungeonEvents.onApparatusTaken.Invoke(__instance); } if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { LevelManager.CurrentExtendedLevel.levelEvents.onApparatusTaken.Invoke(__instance); } } } } public class ExtendedEvent<T> { public delegate void ParameterEvent(T param); public bool HasListeners => Listeners != 0; public int Listeners { get; internal set; } private event ParameterEvent onParameterEvent; public void Invoke(T param) { this.onParameterEvent?.Invoke(param); } public void AddListener(ParameterEvent listener) { onParameterEvent += listener; Listeners++; } public void RemoveListener(ParameterEvent listener) { onParameterEvent -= listener; Listeners--; } } public class ExtendedEvent { public delegate void Event(); public bool HasListeners => Listeners != 0; public int Listeners { get; internal set; } private event Event onEvent; public void Invoke() { this.onEvent?.Invoke(); } public void AddListener(Event listener) { onEvent += listener; Listeners++; } public void RemoveListener(Event listener) { onEvent -= listener; Listeners--; } } public static class Extensions { public static List<Tile> GetTiles(this DungeonFlow dungeonFlow) { List<Tile> list = new List<Tile>(); foreach (GraphNode node in dungeonFlow.Nodes) { foreach (TileSet tileSet in node.TileSets) { list.AddRange(GetTilesInTileSet(tileSet)); } } foreach (GraphLine line in dungeonFlow.Lines) { foreach (DungeonArchetype dungeonArchetype in line.DungeonArchetypes) { foreach (TileSet branchCapTileSet in dungeonArchetype.BranchCapTileSets) { list.AddRange(GetTilesInTileSet(branchCapTileSet)); } foreach (TileSet tileSet2 in dungeonArchetype.TileSets) { list.AddRange(GetTilesInTileSet(tileSet2)); } } } foreach (Tile item in new List<Tile>(list)) { if ((Object)(object)item == (Object)null) { list.Remove(item); } } return list; } public static List<Tile> GetTilesInTileSet(TileSet tileSet) { List<Tile> list = new List<Tile>(); if (tileSet.TileWeights != null && tileSet.TileWeights.Weights != null) { foreach (GameObjectChance weight in tileSet.TileWeights.Weights) { Tile[] componentsInChildren = weight.Value.GetComponentsInChildren<Tile>(); foreach (Tile item in componentsInChildren) { list.Add(item); } } } return list; } public static List<RandomMapObject> GetRandomMapObjects(this DungeonFlow dungeonFlow) { List<RandomMapObject> list = new List<RandomMapObject>(); foreach (Tile tile in dungeonFlow.GetTiles()) { RandomMapObject[] componentsInChildren = ((Component)tile).gameObject.GetComponentsInChildren<RandomMapObject>(); foreach (RandomMapObject item in componentsInChildren) { list.Add(item); } } return list; } public static List<SpawnSyncedObject> GetSpawnSyncedObjects(this DungeonFlow dungeonFlow) { List<SpawnSyncedObject> list = new List<SpawnSyncedObject>(); foreach (Tile tile in dungeonFlow.GetTiles()) { Doorway[] componentsInChildren = ((Component)tile).gameObject.GetComponentsInChildren<Doorway>(); foreach (Doorway val in componentsInChildren) { foreach (GameObjectWeight connectorPrefabWeight in val.ConnectorPrefabWeights) { SpawnSyncedObject[] componentsInChildren2 = connectorPrefabWeight.GameObject.GetComponentsInChildren<SpawnSyncedObject>(); foreach (SpawnSyncedObject item in componentsInChildren2) { list.Add(item); } } foreach (GameObjectWeight blockerPrefabWeight in val.BlockerPrefabWeights) { SpawnSyncedObject[] componentsInChildren3 = blockerPrefabWeight.GameObject.GetComponentsInChildren<SpawnSyncedObject>(); foreach (SpawnSyncedObject item2 in componentsInChildren3) { list.Add(item2); } } } SpawnSyncedObject[] componentsInChildren4 = ((Component)tile).gameObject.GetComponentsInChildren<SpawnSyncedObject>(); foreach (SpawnSyncedObject item3 in componentsInChildren4) { list.Add(item3); } } return list; } public static void AddReferences(this CompatibleNoun compatibleNoun, TerminalKeyword firstNoun, TerminalNode firstResult) { compatibleNoun.noun = firstNoun; compatibleNoun.result = firstResult; } public static void AddCompatibleNoun(this TerminalKeyword terminalKeyword, TerminalKeyword newNoun, TerminalNode newResult) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (terminalKeyword.compatibleNouns == null) { terminalKeyword.compatibleNouns = (CompatibleNoun[])(object)new CompatibleNoun[0]; } CompatibleNoun val = new CompatibleNoun(); val.noun = newNoun; val.result = newResult; terminalKeyword.compatibleNouns = CollectionExtensions.AddItem<CompatibleNoun>((IEnumerable<CompatibleNoun>)terminalKeyword.compatibleNouns, val).ToArray(); } public static void AddCompatibleNoun(this TerminalNode terminalNode, TerminalKeyword newNoun, TerminalNode newResult) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (terminalNode.terminalOptions == null) { terminalNode.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[0]; } CompatibleNoun val = new CompatibleNoun(); val.noun = newNoun; val.result = newResult; terminalNode.terminalOptions = CollectionExtensions.AddItem<CompatibleNoun>((IEnumerable<CompatibleNoun>)terminalNode.terminalOptions, val).ToArray(); } public static void Add(this IntWithRarity intWithRarity, int id, int rarity) { intWithRarity.id = id; intWithRarity.rarity = rarity; } public static string Sanitized(this string currentString) { return new string(currentString.SkipToLetters().RemoveWhitespace().ToLowerInvariant()); } public static string RemoveWhitespace(this string input) { return new string((from c in input.ToCharArray() where !char.IsWhiteSpace(c) select c).ToArray()); } public static string SkipToLetters(this string input) { return new string(input.SkipWhile((char c) => !char.IsLetter(c)).ToArray()); } } internal static class Patches { internal const int harmonyPriority = 200; [HarmonyPriority(200)] [HarmonyPatch(typeof(PreInitSceneScript), "Awake")] [HarmonyPrefix] internal static void PreInitSceneScriptAwake_Prefix(PreInitSceneScript __instance) { if (!Plugin.hasVanillaBeenPatched) { AssetBundleLoader.CreateLoadingBundlesHeaderText(__instance); AudioSource val = default(AudioSource); if (((Component)__instance).TryGetComponent<AudioSource>(ref val)) { OriginalContent.AudioMixers.Add(val.outputAudioMixerGroup.audioMixer); } AssetBundleLoader.LoadBundles(__instance); AssetBundleLoader.onBundlesFinishedLoading += AssetBundleLoader.LoadContentInBundles; } } [HarmonyPriority(200)] [HarmonyPatch(typeof(PreInitSceneScript), "ChooseLaunchOption")] [HarmonyPrefix] internal static bool PreInitSceneScriptChooseLaunchOption_Prefix() { return AssetBundleLoader.loadedFilesTotal - AssetBundleLoader.loadingAssetBundles.Count == AssetBundleLoader.loadedFilesTotal; } [HarmonyPriority(200)] [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPrefix] internal static void GameNetworkManagerStart_Prefix(GameNetworkManager __instance) { if (Plugin.hasVanillaBeenPatched) { return; } foreach (NetworkPrefab prefab in ((Component)__instance).GetComponent<NetworkManager>().NetworkConfig.Prefabs.m_Prefabs) { if (((Object)prefab.Prefab).name.Contains("EntranceTeleport") && (Object)(object)prefab.Prefab.GetComponent<AudioSource>() != (Object)null) { OriginalContent.AudioMixers.Add(prefab.Prefab.GetComponent<AudioSource>().outputAudioMixerGroup.audioMixer); } } GameObject val = NetworkPrefabs.CreateNetworkPrefab("LethalLevelLoaderNetworkManagerTest"); val.AddComponent<LethalLevelLoaderNetworkManager>(); val.GetComponent<NetworkObject>().DontDestroyWithOwner = true; val.GetComponent<NetworkObject>().SceneMigrationSynchronization = true; val.GetComponent<NetworkObject>().DestroyWithScene = false; Object.DontDestroyOnLoad((Object)(object)val); LethalLevelLoaderNetworkManager.networkingManagerPrefab = val; AssetBundleLoader.RegisterCustomContent(((Component)__instance).GetComponent<NetworkManager>()); LethalLevelLoaderNetworkManager.RegisterPrefabs(((Component)__instance).GetComponent<NetworkManager>()); } [HarmonyPriority(200)] [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPrefix] internal static void StartOfRoundAwake_Prefix(StartOfRound __instance) { if (!Plugin.hasVanillaBeenPatched) { ContentExtractor.TryScrapeVanillaItems(__instance); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "Awake")] [HarmonyPostfix] internal static void RoundManagerAwake_Postfix(RoundManager __instance) { if (((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().IsServer) { LethalLevelLoaderNetworkManager component = Object.Instantiate<GameObject>(LethalLevelLoaderNetworkManager.networkingManagerPrefab).GetComponent<LethalLevelLoaderNetworkManager>(); ((Component)component).GetComponent<NetworkObject>().Spawn(false); } RoundManager.Instance.firstTimeDungeonAudios = CollectionExtensions.AddItem<AudioClip>((IEnumerable<AudioClip>)RoundManager.Instance.firstTimeDungeonAudios.ToList(), RoundManager.Instance.firstTimeDungeonAudios[0]).ToArray(); if (Plugin.hasVanillaBeenPatched) { return; } ContentExtractor.TryScrapeVanillaContent(__instance); TerminalManager.CacheTerminalReferences(); AssetBundleLoader.CreateVanillaExtendedDungeonFlows(); AssetBundleLoader.CreateVanillaExtendedLevels(StartOfRound.Instance); AssetBundleLoader.InitializeBundles(); string text = "LethalLevelLoader Loaded The Following ExtendedLevels:\n"; foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { text = text + (PatchedContent.ExtendedLevels.IndexOf(extendedLevel) + 1) + ". " + extendedLevel.selectableLevel.PlanetName + " (" + extendedLevel.levelType.ToString() + ")\n"; } DebugHelper.Log(text); text = "LethalLevelLoader Loaded The Following ExtendedDungeonFlows:\n"; foreach (ExtendedDungeonFlow extendedDungeonFlow in PatchedContent.ExtendedDungeonFlows) { text = text + (PatchedContent.ExtendedDungeonFlows.IndexOf(extendedDungeonFlow) + 1) + ". " + extendedDungeonFlow.dungeonDisplayName + " (" + ((Object)extendedDungeonFlow.dungeonFlow).name + ") (" + extendedDungeonFlow.dungeonType.ToString() + ")\n"; } DebugHelper.Log(text); } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPrefix] internal static void RoundManagerStart_Prefix() { if (!Plugin.hasVanillaBeenPatched) { foreach (ExtendedLevel customExtendedLevel in PatchedContent.CustomExtendedLevels) { ContentRestorer.RestoreVanillaLevelAssetReferences(customExtendedLevel); } foreach (ExtendedDungeonFlow customExtendedDungeonFlow in PatchedContent.CustomExtendedDungeonFlows) { ContentRestorer.RestoreVanillaDungeonAssetReferences(customExtendedDungeonFlow); } TerminalManager.CreateMoonsFilterTerminalAssets(); ConfigLoader.BindConfigs(); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneLoaded += EventPatches.OnSceneLoaded; Plugin.hasVanillaBeenPatched = true; } AudioSource[] array = Resources.FindObjectsOfTypeAll<AudioSource>(); foreach (AudioSource val in array) { val.spatialize = false; } LevelManager.ValidateLevelLists(); LevelManager.PatchVanillaLevelLists(); DungeonManager.PatchVanillaDungeonLists(); LevelManager.RefreshCustomExtendedLevelIDs(); TerminalManager.CreateExtendedLevelGroups(); } [HarmonyPriority(200)] [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] internal static void TerminalStart_Postfix() { LevelManager.RefreshLethalExpansionMoons(); } [HarmonyPriority(200)] [HarmonyPatch(typeof(Terminal), "ParseWord")] [HarmonyPostfix] internal static void TerminalParseWord_Postfix(Terminal __instance, ref TerminalKeyword __result, string playerWord) { if ((Object)(object)__result != (Object)null) { TerminalKeyword val = TerminalManager.TryFindAlternativeNoun(__instance, __result, playerWord); if ((Object)(object)val != (Object)null) { __result = val; } } } [HarmonyPriority(200)] [HarmonyPatch(typeof(Terminal), "RunTerminalEvents")] [HarmonyPrefix] internal static bool TerminalRunTerminalEvents_Prefix(TerminalNode node) { return TerminalManager.RunLethalLevelLoaderTerminalEvents(node); } [HarmonyPriority(200)] [HarmonyPatch(typeof(Terminal), "LoadNewNode")] [HarmonyPrefix] internal static void TerminalLoadNewNode_Prefix(Terminal __instance, ref TerminalNode node) { if ((Object)(object)node == (Object)(object)TerminalManager.moonsKeyword.specialKeywordResult) { TerminalManager.RefreshExtendedLevelGroups(); node.displayText = TerminalManager.GetMoonsTerminalText(); } else { if (!((Object)(object)__instance.currentNode == (Object)(object)TerminalManager.moonsKeyword.specialKeywordResult)) { return; } foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { if ((Object)(object)extendedLevel.routeNode == (Object)(object)node && extendedLevel.isLocked) { TerminalManager.SwapRouteNodeToLockedNode(extendedLevel, ref node); } } } } internal static void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode) { //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) if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null && LevelManager.CurrentExtendedLevel.IsLoaded && LevelManager.CurrentExtendedLevel.levelType == ContentType.Custom && !LevelManager.CurrentExtendedLevel.isLethalExpansion) { Scene sceneByName = SceneManager.GetSceneByName(LevelManager.CurrentExtendedLevel.selectableLevel.sceneName); GameObject[] rootGameObjects = ((Scene)(ref sceneByName)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { LevelLoader.UpdateStoryLogs(LevelManager.CurrentExtendedLevel, val); ContentRestorer.RestoreAudioAssetReferencesInParent(val); } } } [HarmonyPriority(200)] [HarmonyPatch(typeof(DungeonGenerator), "Generate")] [HarmonyPrefix] internal static void DungeonGeneratorGenerate_Prefix(DungeonGenerator __instance) { if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { DungeonLoader.PrepareDungeon(); } LevelManager.LogDayHistory(); } [HarmonyPriority(200)] [HarmonyPatch(typeof(RoundManager), "Generator_OnGenerationStatusChanged")] [HarmonyPrefix] internal static bool OnGenerationStatusChanged_Prefix(RoundManager __instance, GenerationStatus status) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown DebugHelper.Log(((object)(GenerationStatus)(ref status)).ToString()); if ((int)status == 6 && !__instance.dungeonCompletedGenerating) { __instance.FinishGeneratingLevel(); __instance.dungeonGenerator.Generator.OnGenerationStatusChanged -= new GenerationStatusDelegate(__instance.Generator_OnGenerationStatusChanged); Debug.Log((object)"Dungeon has finished generating on this client after multiple frames"); } return false; } [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> GenerateNewLevelClientRpcTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).SearchForward((Func<CodeInstruction, bool>)((CodeInstruction instructions) => CodeInstructionExtensions.Calls(instructions, AccessTools.Method(typeof(RoundManager), "GenerateNewFloor", (Type[])null, (Type[])null)))).SetInstruction(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Patches), "InjectHostDungeonFlowSelection", (Type[])null, (Type[])null))).Advance(-1) .SetInstruction(new CodeInstruction(OpCodes.Nop, (object)null)); return val.InstructionEnumeration(); } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> GenerateNewFloorTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).SearchForward((Func<CodeInstruction, bool>)((CodeInstruction instructions) => CodeInstructionExtensions.Calls(instructions, AccessTools.Method(typeof(RuntimeDungeon), "Generate", (Type[])null, (Type[])null)))).SetInstruction(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Patches), "InjectHostDungeonSizeSelection", (Type[])null, (Type[])null))).Advance(-1) .SetInstruction(new CodeInstruction(OpCodes.Nop, (object)null)); return val.InstructionEnumeration(); } public static void InjectHostDungeonSizeSelection(RoundManager roundManager) { if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { LethalLevelLoaderNetworkManager.Instance.GetDungeonFlowSizeServerRpc(); } else { roundManager.dungeonGenerator.Generate(); } } internal static void InjectHostDungeonFlowSelection() { if ((Object)(object)LevelManager.CurrentExtendedLevel != (Object)null) { DungeonManager.TryAddCurrentVanillaLevelDungeonFlow(RoundManager.Instance.dungeonGenerator.Generator, LevelManager.CurrentExtendedLevel); DungeonLoader.SelectDungeon(); } else { RoundManager.Instance.GenerateNewFloor(); } } [HarmonyPriority(200)] [HarmonyPatch(typeof(Dungeon), "RoundManager_Start")] [HarmonyPrefix] internal static bool Dungeon_Start_Prefix(orig_Start orig, RoundManager self) { DebugHelper.LogWarning("Disabling LethalLib Dungeon.RoundManager_Start() Function To Prevent Conflicts"); orig.Invoke(self); return false; } [HarmonyPriority(200)] [HarmonyPatch(typeof(Dungeon), "RoundManager_GenerateNewFloor")] [HarmonyPrefix] internal static bool Dungeon_GenerateNewFloor_Prefix(orig_GenerateNewFloor orig, RoundManager self) { DebugHelper.LogWarning("Disabling LethalLib Dungeon.RoundManager_GenerateNewFloor() Function To Prevent Conflicts"); orig.Invoke(self); return false; } } public enum PreviewInfoType { Price, Difficulty, Weather, History, All, None, Vanilla, Override } public enum SortInfoType { Price, Difficulty, Tag, LastTraveled, None } public enum FilterInfoType { Price, Weather, Tag, TraveledThisQuota, TraveledThisRun, None } public enum SimulateInfoType { Percentage, Rarity } public static class Settings { public static PreviewInfoType levelPreviewInfoType = PreviewInfoType.Weather; public static SortInfoType levelPreviewSortType = SortInfoType.None; public static FilterInfoType levelPreviewFilterType = FilterInfoType.None; public static SimulateInfoType levelSimulateInfoType = SimulateInfoType.Percentage; public static bool allDungeonFlowsRequireMatching = false; public static string GetOverridePreviewInfo(ExtendedLevel extendedLevel) { return string.Empty; } } [Serializable] public class ExtendedDungeonFlowWithRarity { public ExtendedDungeonFlow extendedDungeonFlow; public int rarity; public ExtendedDungeonFlowWithRarity(ExtendedDungeonFlow newExtendedDungeonFlow, int newRarity) { extendedDungeonFlow = newExtendedDungeonFlow; rarity = newRarity; } public bool UpdateRarity(int newRarity) { if (newRarity > rarity) { rarity = newRarity; return true; } return false; } } public static class DungeonLoader { internal static void SelectDungeon() { RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow = null; if (((NetworkBehaviour)LethalLevelLoaderNetworkManager.Instance).IsServer) { LethalLevelLoaderNetworkManager.Instance.GetRandomExtendedDungeonFlowServerRpc(); } } internal static void PrepareDungeon() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) DungeonGenerator generator = RoundManager.Instance.dungeonGenerator.Generator; ExtendedLevel currentExtendedLevel = LevelManager.CurrentExtendedLevel; ExtendedDungeonFlow currentExtendedDungeonFlow = DungeonManager.CurrentExtendedDungeonFlow; PatchFireEscapes(generator, currentExtendedLevel, SceneManager.GetSceneByName(currentExtendedLevel.selectableLevel.sceneName)); PatchDynamicGlobalProps(generator, currentExtendedDungeonFlow); } public static float GetClampedDungeonSize() { float num = LevelManager.CurrentExtendedLevel.selectableLevel.factorySizeMultiplier * RoundManager.Instance.mapSizeMultiplier; if ((Object)(object)DungeonManager.CurrentExtendedDungeonFlow != (Object)null && DungeonManager.CurrentExtendedDungeonFlow.enableDynamicDungeonSizeRestriction) { ExtendedDungeonFlow currentExtendedDungeonFlow = DungeonManager.CurrentExtendedDungeonFlow; ExtendedLevel currentExtendedLevel = LevelManager.CurrentExtendedLevel; if (currentExtendedLevel.selectableLevel.factorySizeMultiplier > currentExtendedDungeonFlow.dungeonSizeMax) { num = Mathf.Lerp(currentExtendedLevel.selectableLevel.factorySizeMultiplier, currentExtendedDungeonFlow.dungeonSizeMax, currentExtendedDungeonFlow.dungeonSizeLerpPercentage) * RoundManager.Instance.mapSizeMultiplier; } else if (currentExtendedLevel.selectableLevel.factorySizeMultiplier < currentExtendedDungeonFlow.dungeonSizeMin) { num = Mathf.Lerp(currentExtendedLevel.selectableLevel.factorySizeMultiplier, currentExtendedDungeonFlow.dungeonSizeMin, currentExtendedDungeonFlow.dungeonSizeLerpPercentage) * RoundManager.Instance.mapSizeMultiplier; } DebugHelper.Log("CurrentLevel: " + LevelManager.CurrentExtendedLevel.NumberlessPlanetName + " DungeonSize Is: " + LevelManager.CurrentExtendedLevel.selectableLevel.factorySizeMultiplier + " | Overrriding DungeonSize To: " + num / RoundManager.Instance.mapSizeMultiplier + " (" + num + ")"); } else { DebugHelper.Log("CurrentLevel: " + LevelManager.CurrentExtendedLevel.NumberlessPlanetName + " DungeonSize Is: " + LevelManager.CurrentExtendedLevel.selectableLevel.factorySizeMultiplier + " | Leaving DungeonSize As: " + num / RoundManager.Instance.mapSizeMultiplier + " (" + num + ")"); } return num; } internal static void PatchDungeonSize(DungeonGenerator dungeonGenerator, ExtendedLevel extendedLevel, ExtendedDungeonFlow extendedDungeonFlow) { } internal static List<EntranceTeleport> GetEntranceTeleports(Scene scene) { List<EntranceTeleport> list = new List<EntranceTeleport>(); GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { EntranceTeleport[] componentsInChildren = val.GetComponentsInChildren<EntranceTeleport>(); foreach (EntranceTeleport item in componentsInChildren) { list.Add(item); } } return list; } internal static void PatchFireEscapes(DungeonGenerator dungeonGenerator, ExtendedLevel extendedLevel, Scene scene) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Expected O, but got Unknown string text = "Fire Exit Patch Report, Details Below;\n\n"; if (!DungeonManager.TryGetExtendedDungeonFlow(dungeonGenerator.DungeonFlow, out var returnExtendedDungeonFlow)) { return; } List<EntranceTeleport> list = (from o in GetEntranceTeleports(scene) orderby o.entranceId select o).ToList(); foreach (EntranceTeleport item in list) { item.entranceId = list.IndexOf(item); item.dungeonFlowId = returnExtendedDungeonFlow.dungeonID; } text = text + "EntranceTeleport's Found, " + extendedLevel.NumberlessPlanetName + " Contains " + list.Count + " Entrances! ( " + (list.Count - 1) + " Fire Escapes) \n"; text = text + "Main Entrance: " + ((Object)((Component)list[0]).gameObject).name + " (Entrance ID: " + list[0].entranceId + ") (Dungeon ID: " + list[0].dungeonFlowId + ")\n"; foreach (EntranceTeleport item2 in list) { if (item2.entranceId != 0) { text = text + "Alternate Entrance: " + ((Object)((Component)item2).gameObject).name + " (Entrance ID: " + item2.entranceId + ") (Dungeon ID: " + item2.dungeonFlowId + ")\n"; } } foreach (GlobalPropSettings globalProp in dungeonGenerator.DungeonFlow.GlobalProps) { if (globalProp.ID == 1231) { text = text + "Found Fire Escape GlobalProp: (ID: 1231), Modifying Spawnrate Count From (" + globalProp.Count.Min + "," + globalProp.Count.Max + ") To (" + (list.Count - 1) + "," + (list.Count - 1) + ")\n"; globalProp.Count = new IntRange(list.Count - 1, list.Count - 1); break; } } DebugHelper.Log(text + "\n"); } public static void PatchDynamicGlobalProps(DungeonGenerator dungeonGenerator, ExtendedDungeonFlow extendedDungeonFlow) { foreach (GlobalPropCountOverride globalPropCountOverrides in extendedDungeonFlow.globalPropCountOverridesList) { foreach (GlobalPropSettings globalProp in dungeonGenerator.DungeonFlow.GlobalProps) { if (globalPropCountOverrides.globalPropID == globalProp.ID) { globalProp.Count.Min = globalProp.Count.Min * Mathf.RoundToInt(Mathf.Lerp(1f, dungeonGenerator.LengthMultiplier / RoundManager.Instance.mapSizeMultiplier, globalPropCountOverrides.globalPropCountScaleRate)); globalProp.Count.Max = globalProp.Count.Max * Mathf.RoundToInt(Mathf.Lerp(1f, dungeonGenerator.LengthMultiplier / RoundManager.Instance.mapSizeMultiplier, globalPropCountOverrides.globalPropCountScaleRate)); } } } } } public class LevelLoader { internal static List<MeshCollider> customLevelMeshCollidersList = new List<MeshCollider>(); internal static async void EnableMeshColliders() { List<MeshCollider> instansiatedCustomLevelMeshColliders = new List<MeshCollider>(); int counter = 0; MeshCollider[] array = Object.FindObjectsOfType<MeshCollider>(); foreach (MeshCollider meshCollider in array) { if (((Object)((Component)meshCollider).gameObject).name.Contains(" (LLL Tracked)")) { instansiatedCustomLevelMeshColliders.Add(meshCollider); } } Task[] meshColliderEnableTasks = new Task[instansiatedCustomLevelMeshColliders.Count]; foreach (MeshCollider meshCollider2 in instansiatedCustomLevelMeshColliders) { meshColliderEnableTasks[counter] = EnableMeshCollider(meshCollider2); counter++; } await Task.WhenAll(meshColliderEnableTasks); } internal static async Task EnableMeshCollider(MeshCollider meshCollider) { ((Collider)meshCollider).enabled = true; ((Object)((Component)meshCollider).gameObject).name.Replace(" (LLL Tracked)", ""); await Task.Yield(); } internal static void UpdateStoryLogs(ExtendedLevel extendedLevel, GameObject sceneRootObject) { StoryLog[] componentsInChildren = sceneRootObject.GetComponentsInChildren<StoryLog>(); foreach (StoryLog val in componentsInChildren) { foreach (StoryLogData storyLog in extendedLevel.storyLogs) { if (val.storyLogID == storyLog.storyLogID) { val.storyLogID = storyLog.newStoryLogID; } } } } } public class DungeonManager { public static ExtendedDungeonFlow CurrentExtendedDungeonFlow { get { ExtendedDungeonFlow result = null; if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.dungeonGenerator != (Object)null && TryGetExtendedDungeonFlow(RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow, out var returnExtendedDungeonFlow)) { result = returnExtendedDungeonFlow; } return result; } } internal static void PatchVanillaDungeonLists() { foreach (ExtendedDungeonFlow customExtendedDungeonFlow in PatchedContent.CustomExtendedDungeonFlows) { customExtendedDungeonFlow.dungeonID = RoundManager.Instance.dungeonFlowTypes.Length; RoundManager.Instance.dungeonFlowTypes = CollectionExtensions.AddItem<DungeonFlow>((IEnumerable<DungeonFlow>)RoundManager.Instance.dungeonFlowTypes, customExtendedDungeonFlow.dungeonFlow).ToArray(); if ((Object)(object)customExtendedDungeonFlow.dungeonFirstTimeAudio != (Object)null) { RoundManager.Instance.firstTimeDungeonAudios = CollectionExtensions.AddItem<AudioClip>((IEnumerable<AudioClip>)RoundManager.Instance.firstTimeDungeonAudios, customExtendedDungeonFlow.dungeonFirstTimeAudio).ToArray(); } } } internal static void AddExtendedDungeonFlow(ExtendedDungeonFlow extendedDungeonFlow) { PatchedContent.ExtendedDungeonFlows.Add(extendedDungeonFlow); } internal static void TryAddCurrentVanillaLevelDungeonFlow(DungeonGenerator dungeonGenerator, ExtendedLevel currentExtendedLevel) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown if ((Object)(object)dungeonGenerator.DungeonFlow != (Object)null && !RoundManager.Instance.dungeonFlowTypes.ToList().Contains(dungeonGenerator.DungeonFlow)) { DebugHelper.Log("Level: " + currentExtendedLevel.selectableLevel.PlanetName + " Contains DungeonFlow: " + ((Object)dungeonGenerator.DungeonFlow).name + " In DungeonGenerator That Was Not Found In RoundManager, Adding!"); AssetBundleLoader.CreateVanillaExtendedDungeonFlow(dungeonGenerator.DungeonFlow); if (TryGetExtendedDungeonFlow(dungeonGenerator.DungeonFlow, out var returnExtendedDungeonFlow)) { IntWithRarity val = new IntWithRarity(); val.id = returnExtendedDungeonFlow.dungeonID; val.rarity = 300; currentExtendedLevel.selectableLevel.dungeonFlowTypes = CollectionExtensions.AddItem<IntWithRarity>((IEnumerable<IntWithRarity>)currentExtendedLevel.selectableLevel.dungeonFlowTypes, val).ToArray(); } } } internal static List<ExtendedDungeonFlowWithRarity> GetValidExtendedDungeonFlows(ExtendedLevel extendedLevel, bool debugResults) { string text = "Trying To Find All Matching DungeonFlows For Level: " + extendedLevel.NumberlessPlanetName + "\n"; List<ExtendedDungeonFlowWithRarity> list = new List<ExtendedDungeonFlowWithRarity>(); List<ExtendedDungeonFlowWithRarity> list2 = new List<ExtendedDungeonFlowWithRarity>(); if (extendedLevel.allowedDungeonContentTypes == ContentType.Vanilla || extendedLevel.allowedDungeonContentTypes == ContentType.Any) { IntWithRarity[] dungeonFlowTypes = extendedLevel.selectableLevel.dungeonFlowTypes; foreach (IntWithRarity val in dungeonFlowTypes) { if (TryGetExtendedDungeonFlow(RoundManager.Instance.dungeonFlowTypes[val.id], out var returnExtendedDungeonFlow)) { if (!Settings.allDungeonFlowsRequireMatching) { list.Add(new ExtendedDungeonFlowWithRarity(returnExtendedDungeonFlow, val.rarity)); } else { list2.Add(new ExtendedDungeonFlowWithRarity(returnExtendedDungeonFlow, val.rarity)); } } } } if (extendedLevel.allowedDungeonContentTypes == ContentType.Custom || extendedLevel.allowedDungeonContentTypes == ContentType.Any) { foreach (ExtendedDungeonFlow customExtendedDungeonFlow in PatchedContent.CustomExtendedDungeonFlows) { list2.Add(new ExtendedDungeonFlowWithRarity(customExtendedDungeonFlow, 0)); } } text += "Potential DungeonFlows Collected, List Below: \n"; foreach (ExtendedDungeonFlowWithRarity item in list.Concat(list2)) { text = text + item.extendedDungeonFlow.dungeonDisplayName + " - " + item.rarity + ", "; } text = text + "\n\nSelectableLevel - " + extendedLevel.selectableLevel.PlanetName + " Level Tags: "; foreach (string levelTag in extendedLevel.levelTags) { text = text + levelTag + ", "; } text += "\n"; foreach (ExtendedDungeonFlowWithRarity item2 in list) { text = text + "\nDungeonFlow " + (list.IndexOf(item2) + 1) + ". : " + ((Object)item2.extendedDungeonFlow.dungeonFlow).name + " - Matched " + extendedLevel.NumberlessPlanetName + " With A Rarity Of: " + item2.rarity + " Based On The Levels DungeonFlowTypes!\n"; } foreach (ExtendedDungeonFlowWithRarity item3 in new List<ExtendedDungeonFlowWithRarity>(list2)) { string text2 = string.Empty; ExtendedDungeonFlow extendedDungeonFlow = item3.extendedDungeonFlow; if (item3.UpdateRarity(GetHighestRarityViaMatchingNormalizedString(extendedLevel.contentSourceName, extendedDungeonFlow.manualContentSourceNameReferenceList))) { text2 = " Based On Content Source Name!"; } if (item3.UpdateRarity(GetHighestRarityViaMatchingNormalizedString(extendedLevel.NumberlessPlanetName, extendedDungeonFlow.manualPlanetNameReferenceList))) { text2 = " Based On Planet Name!"; } if (item3.UpdateRarity(GetHighestRarityViaMatchingWithinRanges(extendedLevel.RoutePrice, extendedDungeonFlow.dynamicRoutePricesList))) { text2 = " Based On Route Price!"; } if (item3.UpdateRarity(GetHighestRarityViaMatchingNormalizedStrings(extendedLevel.levelTags, extendedDungeonFlow.dynamicLevelTagsList))) { text2 = " Based On Level Tags!"; } if (item3.UpdateRarity(GetHighestRarityViaMatchingNormalizedString(((object)(LevelWeatherType)(ref extendedLevel.selectableLevel.currentWeather)).ToString(), extendedDungeonFlow.dynamicCurrentWeatherList))) { text2 = " Based On Current Weather!"; } if (text2 != string.Empty) { text = text + "\nDungeonFlow " + (list2.IndexOf(item3) + 1) + ". : " + ((Object)extendedDungeonFlow.dungeonFlow).name + " - Matched " + extendedLevel.NumberlessPlanetName + " With A Rarity Of: " + item3.rarity + text2 + "\n"; } if (item3.rarity != 0) { list.Add(item3); } } if (debugResults) { DebugHelper.Log(text + "\nMatching DungeonFlows Collected, Count Is: " + list.Count + "\n\n"); } return list; } internal static void RefreshDungeonFlowIDs() { DebugHelper.Log("Re-Adjusting DungeonFlowTypes Array For Late Arriving Vanilla DungeonFlow"); List<DungeonFlow> list = new List<DungeonFlow>(); foreach (ExtendedDungeonFlow vanillaExtendedDungeonFlow in PatchedContent.VanillaExtendedDungeonFlows) { vanillaExtendedDungeonFlow.dungeonID = list.Count; list.Add(vanillaExtendedDungeonFlow.dungeonFlow); } foreach (ExtendedDungeonFlow customExtendedDungeonFlow in PatchedContent.CustomExtendedDungeonFlows) { customExtendedDungeonFlow.dungeonID = list.Count; list.Add(customExtendedDungeonFlow.dungeonFlow); } RoundManager.Instance.dungeonFlowTypes = list.ToArray(); } internal static int GetHighestRarityViaMatchingWithinRanges(int comparingValue, List<Vector2WithRarity> matchingVectors) { int num = 0; foreach (Vector2WithRarity matchingVector in matchingVectors) { if (matchingVector.Rarity >= num && (float)comparingValue >= matchingVector.Min && (float)comparingValue <= matchingVector.Max) { num = matchingVector.Rarity; } } return num; } internal static int GetHighestRarityViaMatchingNormalizedString(string comparingString, List<StringWithRarity> matchingStrings) { return GetHighestRarityViaMatchingNormalizedStrings(new List<string> { comparingString }, matchingStrings); } internal static int GetHighestRarityViaMatchingNormalizedStrings(List<string> comparingStrings, List<StringWithRarity> matchingStrings) { int num = 0; foreach (StringWithRarity matchingString in matchingStrings) { foreach (string item in new List<string>(comparingStrings)) { if (matchingString.Rarity >= num && (matchingString.Name.Sanitized().Contains(item.Sanitized()) || item.Sanitized().Contains(matchingString.Name.Sanitized()))) { num = matchingString.Rarity; } } } return num; } internal static bool TryGetExtendedDungeonFlow(DungeonFlow dungeonFlow, out ExtendedDungeonFlow returnExtendedDungeonFlow, ContentType contentType = ContentType.Any) { returnExtendedDungeonFlow = null; List<ExtendedDungeonFlow> list = null; if ((Object)(object)dungeonFlow == (Object)null) { return false; } switch (contentType) { case ContentType.Any: list = PatchedContent.ExtendedDungeonFlows; break; case ContentType.Custom: list = PatchedContent.CustomExtendedDungeonFlows; break; case ContentType.Vanilla: list = PatchedContent.VanillaExtendedDungeonFlows; break; } foreach (ExtendedDungeonFlow item in list) { if ((Object)(object)item.dungeonFlow == (Object)(object)dungeonFlow) { returnExtendedDungeonFlow = item; } } return (Object)(object)returnExtendedDungeonFlow != (Object)null; } } public class LethalLevelLoaderNetworkManager : NetworkBehaviour { public static GameObject networkingManagerPrefab; private static LethalLevelLoaderNetworkManager _instance; private static List<GameObject> queuedNetworkPrefabs = new List<GameObject>(); public static bool networkHasStarted; public static LethalLevelLoaderNetworkManager Instance { get { if ((Object)(object)_instance == (Object)null) { _instance = Object.FindObjectOfType<LethalLevelLoaderNetworkManager>(); } if ((Object)(object)_instance == (Object)null) { DebugHelper.LogWarning("LethalLevelLoaderNetworkManager Could Not Be Found! Returning Null!"); } return _instance; } set { _instance = value; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); ((Object)((Component)this).gameObject).name = "LethalLevelLoaderNetworkManager"; Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } [ServerRpc] public void GetRandomExtendedDungeonFlowServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(12573863u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 12573863u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } DebugHelper.Log("Getting Random DungeonFlow!"); List<ExtendedDungeonFlowWithRarity> validExtendedDungeonFlows = DungeonManager.GetValidExtendedDungeonFlows(LevelManager.CurrentExtendedLevel, debugResults: true); List<int> list = new List<int>(); List<int> list2 = new List<int>(); if (validExtendedDungeonFlows.Count == 0) { DebugHelper.LogError("No ExtendedDungeonFlow's could be found! This should only happen if the Host's requireMatchesOnAllDungeonFlows is set to true!"); DebugHelper.LogError("Loading Facility DungeonFlow to prevent infinite loading!"); list.Add(0); list2.Add(300); } else { foreach (ExtendedDungeonFlowWithRarity item in validExtendedDungeonFlows) { list.Add(RoundManager.Instance.dungeonFlowTypes.ToList().IndexOf(item.extendedDungeonFlow.dungeonFlow)); list2.Add(item.rarity); } } SetRandomExtendedDungeonFlowClientRpc(list.ToArray(), list2.ToArray()); } [ClientRpc] public void SetRandomExtendedDungeonFlowClientRpc(int[] dungeonFlowIDs, int[] rarities) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1934987400u, val, (RpcDelivery)0); bool flag = dungeonFlowIDs != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(dungeonFlowIDs, default(ForPrimitives)); } bool flag2 = rarities != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(rarities, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1934987400u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { DebugHelper.Log("Setting Random DungeonFlow!"); List<IntWithRarity> list = new List<IntWithRarity>(); List<IntWithRarity> list2 = new List<IntWithRarity>(); for (int i = 0; i < dungeonFlowIDs.Length; i++) { IntWithRarity val3 = new IntWithRarity(); val3.Add(dungeonFlowIDs[i], rarities[i]); list.Add(val3); } list2 = new List<IntWithRarity>(LevelManager.CurrentExtendedLevel.selectableLevel.dungeonFlowTypes.ToList()); LevelManager.CurrentExtendedLevel.selectableLevel.dungeonFlowTypes = list.ToArray(); RoundManager.Instance.GenerateNewFloor(); LevelManager.CurrentExtendedLevel.selectableLevel.dungeonFlowTypes = list2.ToArray(); } } [ServerRpc] public void GetDungeonFlowSizeServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1367970965u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1367970965u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetDungeonFlowSizeClientRpc(DungeonLoader.GetClampedDungeonSize()); } } [ClientRpc] public void SetDungeonFlowSizeClientRpc(float hostSize) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1778200789u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref hostSize, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1778200789u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { RoundManager.Instance.dungeonGenerator.Generator.LengthMultiplier = hostSize; RoundManager.Instance.dungeonGenerator.Generate(); } } } public static void RegisterNetworkPrefab(GameObject prefab) { if (!networkHasStarted) { queuedNetworkPrefabs.Add(prefab); } else { DebugHelper.Log("Attempted To Register NetworkPrefab: " + ((object)prefab)?.ToString() + " After GameNetworkManager Has Started!"); } } internal static void RegisterPrefabs(NetworkManager networkManager) { List<GameObject> list = new List<GameObject>(); foreach (NetworkPrefab prefab in networkManager.NetworkConfig.Prefabs.m_Prefabs) { list.Add(prefab.Prefab); } int num = 0; foreach (GameObject queuedNetworkPrefab in queuedNetworkPrefabs) { if (!list.Contains(queuedNetworkPrefab)) { networkManager.AddNetworkPrefab(queuedNetworkPrefab); list.Add(queuedNetworkPrefab); } else { num++; } } DebugHelper.Log("Skipped Registering " + num + " NetworkObjects As They Were Already Registered."); networkHasStarted = true; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_LethalLevelLoaderNetworkManager() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(12573863u, new RpcReceiveHandler(__rpc_handler_12573863)); NetworkManager.__rpc_func_table.Add(1934987400u, new RpcReceiveHandler(__rpc_handler_1934987400)); NetworkManager.__rpc_func_table.Add(1367970965u, new RpcReceiveHandler(__rpc_handler_1367970965)); NetworkManager.__rpc_func_table.Add(1778200789u, new RpcReceiveHandler(__rpc_handler_1778200789)); } private static void __rpc_handler_12573863(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((LethalLevelLoaderNetworkManager)(object)target).GetRandomExtendedDungeonFlowServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1934987400(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0074: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); int[] dungeonFlowIDs = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref dungeonFlowIDs, default(ForPrimitives)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); int[] rarities = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref rarities, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)2; ((LethalLevelLoaderNetworkManager)(object)target).SetRandomExtendedDungeonFlowClientRpc(dungeonFlowIDs, rarities); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1367970965(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((LethalLevelLoaderNetworkManager)(object)target).GetDungeonFlowSizeServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1778200789(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float dungeonFlowSizeClientRpc = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref dungeonFlowSizeClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((LethalLevelLoaderNetworkManager)(object)target).SetDungeonFlowSizeClientRpc(dungeonFlowSizeClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "LethalLevelLoaderNetworkManager"; } } public class LevelManager { public static List<DayHistory> dayHistoryList = new List<DayHistory>(); public static int daysTotal; public static int quotasTotal; public static ExtendedLevel CurrentExtendedLevel { get { ExtendedLevel result = null; if ((Object)(object)StartOfRound.Instance != (Object)null && TryGetExtendedLevel(StartOfRound.Instance.currentLevel, out var returnExtendedLevel)) { result = returnExtendedLevel; } return result; } } internal static void ValidateLevelLists() { List<SelectableLevel> list = new List<SelectableLevel>(OriginalContent.SelectableLevels); List<SelectableLevel> list2 = new List<SelectableLevel>(OriginalContent.MoonsCatalogue); List<SelectableLevel> list3 = new List<SelectableLevel>(StartOfRound.Instance.levels); foreach (SelectableLevel item in new List<SelectableLevel>(list)) { if (item.levelID > 8) { list.Remove(item); } } foreach (SelectableLevel item2 in new List<SelectableLevel>(list2)) { if (item2.levelID > 8) { list2.Remove(item2); } } foreach (SelectableLevel item3 in new List<SelectableLevel>(list3)) { if (item3.levelID > 8) { list3.Remove(item3); } } OriginalContent.SelectableLevels = list; OriginalContent.MoonsCatalogue = list2; PatchVanillaLevelLists(); } internal static void PatchVanillaLevelLists() { StartOfRound.Instance.levels = PatchedContent.SeletectableLevels.ToArray(); TerminalManager.Terminal.moonsCatalogueList = PatchedContent.MoonsCatalogue.ToArray(); } internal static void RefreshCustomExtendedLevelIDs() { foreach (ExtendedLevel item in new List<ExtendedLevel>(PatchedContent.CustomExtendedLevels)) { item.SetLevelID(); } } internal static void RefreshLethalExpansionMoons() { foreach (ExtendedLevel customExtendedLevel in PatchedContent.CustomExtendedLevels) { if (!customExtendedLevel.isLethalExpansion) { continue; } CompatibleNoun[] compatibleNouns = TerminalManager.routeKeyword.compatibleNouns; foreach (CompatibleNoun val in compatibleNouns) { if (((Object)val.noun).name.ToLower().Contains(customExtendedLevel.NumberlessPlanetName.ToLower())) { customExtendedLevel.routeNode = val.result; customExtendedLevel.routeConfirmNode = val.result.terminalOptions[1].result; customExtendedLevel.RoutePrice = customExtendedLevel.routeNode.itemCost; break; } } } RefreshCustomExtendedLevelIDs(); } public static bool TryGetExtendedLevel(SelectableLevel selectableLevel, out ExtendedLevel returnExtendedLevel, ContentType levelType = ContentType.Any) { returnExtendedLevel = null; List<ExtendedLevel> list = null; if ((Object)(object)selectableLevel == (Object)null) { return false; } switch (levelType) { case ContentType.Any: list = PatchedContent.ExtendedLevels; break; case ContentType.Custom: list = PatchedContent.CustomExtendedLevels; break; case ContentType.Vanilla: list = PatchedContent.VanillaExtendedLevels; break; } foreach (ExtendedLevel item in list) { if ((Object)(object)item.selectableLevel == (Object)(object)selectableLevel) { returnExtendedLevel = item; } } return (Object)(object)returnExtendedLevel != (Object)null; } public static ExtendedLevel GetExtendedLevel(SelectableLevel selectableLevel) { ExtendedLevel result = null; foreach (ExtendedLevel extendedLevel in PatchedContent.ExtendedLevels) { if ((Object)(object)extendedLevel.selectableLevel == (Object)(object)selectableLevel) { result = extendedLevel; } } return result; } public static void LogDayHistory() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) DayHistory dayHistory = new DayHistory(); daysTotal++; dayHistory.extendedLevel = GetExtendedLevel(StartOfRound.Instance.currentLevel); DungeonManager.TryGetExtendedDungeonFlow(RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow, out var returnExtendedDungeonFlow); dayHistory.extendedDungeonFlow = returnExtendedDungeonFlow; dayHistory.day = daysTotal; dayHistory.quota = TimeOfDay.Instance.timesFulfilledQuota; dayHistory.weatherEffect = StartOfRound.Instance.currentLevel.currentWeather; DebugHelper.Log("Created New Day History Log! PlanetName: " + dayHistory.extendedLevel.NumberlessPlanetName + " , DungeonName: " + dayHistory.extendedDungeonFlow.dungeonDisplayName + " , Quota: " + dayHistory.quota + " , Day: " + dayHistory.day + " , Weather: " + ((object)(LevelWeatherType)(ref dayHistory.weatherEffect)).ToString()); if (dayHistoryList == null) { dayHistoryList = new List<DayHistory>(); } dayHistoryList.Add(dayHistory); } } public class DayHistory { public int quota; public int day; public ExtendedLevel extendedLevel; public ExtendedDungeonFlow extendedDungeonFlow; public LevelWeatherType weatherEffect; } public class TerminalManager { public delegate string PreviewInfoText(ExtendedLevel extendedLevel, PreviewInfoType infoType); private static Terminal _terminal; internal static TerminalNode lockedNode; internal static MoonsCataloguePage defaultMoonsCataloguePage; internal static MoonsCataloguePage currentMoonsCataloguePage; internal static TerminalKeyword routeKeyword; internal static TerminalKeyword infoKeyword; internal static TerminalKeyword confirmKeyword; internal static TerminalKeyword denyKeyword; internal static TerminalKeyword moonsKeyword; internal static TerminalKeyword viewKeyword; internal static TerminalNode cancelRouteNode; internal static string currentTagFilter; internal static TerminalKeyword lastParsedVerbKeyword; internal static Terminal Terminal { get { if ((Object)(object)_terminal == (Object)null) { _terminal = Object.FindObjectOfType<Terminal>(); } return _terminal; } } public static event PreviewInfoText onBeforePreviewInfoTextAdded; internal static void CacheTerminalReferences() { routeKeyword = Terminal.terminalNodes.allKeywords[26]; infoKeyword = Terminal.terminalNodes.allKeywords[6]; confirmKeyword = Terminal.terminalNodes.allKeywords[3]; denyKeyword = Terminal.terminalNodes.allKeywords[4]; moonsKeyword = Terminal.terminalNodes.allKeywords[21]; viewKeyword = Terminal.terminalNodes.allKeywords[19]; cancelRouteNode = routeKeyword.compatibleNouns[0].result.terminalOptions[0].result; lockedNode = CreateNewTerminalNode(); ((Object)lockedNode).name = "lockedLevelNode"; lockedNode.clearPreviousText = true; } internal static void SwapRouteNodeToLockedNode(Extended
plugins/LethalLib.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DunGen; using DunGen.Graph; using LethalLib.Extras; using LethalLib.Modules; using LethalLib.NetcodePatcher; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using On; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("Evaisa")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Content-addition API for Lethal Company")] [assembly: AssemblyFileVersion("0.14.2.0")] [assembly: AssemblyInformationalVersion("0.14.2+553a3b4022b798db3343e7463a3d6d5d90b37d0e")] [assembly: AssemblyProduct("LethalLib")] [assembly: AssemblyTitle("LethalLib")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/EvaisaDev/LethalLib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalLib { [BepInPlugin("evaisa.lethallib", "LethalLib", "0.14.2")] public class Plugin : BaseUnityPlugin { public const string ModGUID = "evaisa.lethallib"; public const string ModName = "LethalLib"; public const string ModVersion = "0.14.2"; public static AssetBundle MainAssets; public static ManualLogSource logger; public static ConfigFile config; public static Plugin Instance; public static ConfigEntry<bool> extendedLogging; private void Awake() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) Instance = this; config = ((BaseUnityPlugin)this).Config; logger = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"LethalLib loaded!!"); extendedLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExtendedLogging", false, "Enable extended logging"); MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "lethallib")); new ILHook((MethodBase)typeof(StackTrace).GetMethod("AddFrames", BindingFlags.Instance | BindingFlags.NonPublic), new Manipulator(IlHook)); Enemies.Init(); Items.Init(); Unlockables.Init(); MapObjects.Init(); Dungeon.Init(); Weathers.Init(); Player.Init(); Utilities.Init(); NetworkPrefabs.Init(); } private void IlHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)typeof(StackFrame).GetMethod("GetFileLineNumber", BindingFlags.Instance | BindingFlags.Public)) }); val.RemoveRange(2); val.EmitDelegate<Func<StackFrame, string>>((Func<StackFrame, string>)GetLineOrIL); } private static string GetLineOrIL(StackFrame instance) { int fileLineNumber = instance.GetFileLineNumber(); if (fileLineNumber == -1 || fileLineNumber == 0) { return "IL_" + instance.GetILOffset().ToString("X4"); } return fileLineNumber.ToString(); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LethalLib"; public const string PLUGIN_NAME = "LethalLib"; public const string PLUGIN_VERSION = "0.14.2"; } } namespace LethalLib.Modules { public class ContentLoader { public class CustomContent { private string id = ""; public string ID => id; public CustomContent(string id) { this.id = id; } } public class CustomItem : CustomContent { public Action<Item> registryCallback = delegate { }; public string contentPath = ""; internal Item item; public Item Item => item; public CustomItem(string id, string contentPath, Action<Item> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } } } public class ShopItem : CustomItem { public int initPrice; public string buyNode1Path; public string buyNode2Path; public string itemInfoPath; public void RemoveFromShop() { Items.RemoveShopItem(base.Item); } public void SetPrice(int price) { Items.UpdateShopItemPrice(base.Item, price); } public ShopItem(string id, string contentPath, int price = 0, string buyNode1Path = null, string buyNode2Path = null, string itemInfoPath = null, Action<Item> registryCallback = null) : base(id, contentPath, registryCallback) { initPrice = price; this.buyNode1Path = buyNode1Path; this.buyNode2Path = buyNode2Path; this.itemInfoPath = itemInfoPath; } } public class ScrapItem : CustomItem { public Dictionary<Levels.LevelTypes, int> levelRarities = new Dictionary<Levels.LevelTypes, int>(); public Dictionary<string, int> customLevelRarities = new Dictionary<string, int>(); public int Rarity => 0; public void RemoveFromLevels(Levels.LevelTypes levelFlags) { Items.RemoveScrapFromLevels(base.Item, levelFlags); } public ScrapItem(string id, string contentPath, int rarity, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null, Action<Item> registryCallback = null) : base(id, contentPath, registryCallback) { if (levelFlags != Levels.LevelTypes.None) { levelRarities.Add(levelFlags, rarity); } else if (levelOverrides != null) { foreach (string key in levelOverrides) { customLevelRarities.Add(key, rarity); } } } public ScrapItem(string id, string contentPath, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, Action<Item> registryCallback = null) : base(id, contentPath, registryCallback) { if (levelRarities != null) { this.levelRarities = levelRarities; } if (customLevelRarities != null) { this.customLevelRarities = customLevelRarities; } } } public class Unlockable : CustomContent { public Action<UnlockableItem> registryCallback = delegate { }; internal UnlockableItem unlockable; public string contentPath = ""; public int initPrice; public string buyNode1Path; public string buyNode2Path; public string itemInfoPath; public StoreType storeType; public UnlockableItem UnlockableItem => unlockable; public void RemoveFromShop() { Unlockables.DisableUnlockable(UnlockableItem); } public void SetPrice(int price) { Unlockables.UpdateUnlockablePrice(UnlockableItem, price); } public Unlockable(string id, string contentPath, int price = 0, string buyNode1Path = null, string buyNode2Path = null, string itemInfoPath = null, StoreType storeType = StoreType.None, Action<UnlockableItem> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } initPrice = price; this.buyNode1Path = buyNode1Path; this.buyNode2Path = buyNode2Path; this.itemInfoPath = itemInfoPath; this.storeType = storeType; } } public class CustomEnemy : CustomContent { public Action<EnemyType> registryCallback = delegate { }; public string contentPath = ""; internal EnemyType enemy; public string infoNodePath; public string infoKeywordPath; public int rarity; public Levels.LevelTypes LevelTypes = Levels.LevelTypes.None; public string[] levelOverrides; public Enemies.SpawnType spawnType = (Enemies.SpawnType)(-1); public EnemyType Enemy => enemy; public void RemoveFromLevels(Levels.LevelTypes levelFlags) { Enemies.RemoveEnemyFromLevels(Enemy, levelFlags); } public CustomEnemy(string id, string contentPath, int rarity = 0, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, Enemies.SpawnType spawnType = (Enemies.SpawnType)(-1), string[] levelOverrides = null, string infoNodePath = null, string infoKeywordPath = null, Action<EnemyType> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } this.infoNodePath = infoNodePath; this.infoKeywordPath = infoKeywordPath; this.rarity = rarity; LevelTypes = levelFlags; this.levelOverrides = levelOverrides; this.spawnType = spawnType; } } public class MapHazard : CustomContent { public Action<SpawnableMapObjectDef> registryCallback = delegate { }; public string contentPath = ""; internal SpawnableMapObjectDef hazard; public Func<SelectableLevel, AnimationCurve> spawnRateFunction; public Levels.LevelTypes LevelTypes = Levels.LevelTypes.None; public string[] levelOverrides; public SpawnableMapObjectDef Hazard => hazard; public void RemoveFromLevels(Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { MapObjects.RemoveMapObject(Hazard, levelFlags, levelOverrides); } public MapHazard(string id, string contentPath, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null, Action<SpawnableMapObjectDef> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } LevelTypes = levelFlags; this.levelOverrides = levelOverrides; this.spawnRateFunction = spawnRateFunction; } } public class OutsideObject : CustomContent { public Action<SpawnableOutsideObjectDef> registryCallback = delegate { }; public string contentPath = ""; internal SpawnableOutsideObjectDef mapObject; public Func<SelectableLevel, AnimationCurve> spawnRateFunction; public Levels.LevelTypes LevelTypes = Levels.LevelTypes.None; public string[] levelOverrides; public SpawnableOutsideObjectDef MapObject => mapObject; public void RemoveFromLevels(Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { MapObjects.RemoveOutsideObject(MapObject, levelFlags, levelOverrides); } public OutsideObject(string id, string contentPath, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null, Action<SpawnableOutsideObjectDef> registryCallback = null) : base(id) { this.contentPath = contentPath; if (registryCallback != null) { this.registryCallback = registryCallback; } LevelTypes = levelFlags; this.levelOverrides = levelOverrides; this.spawnRateFunction = spawnRateFunction; } } public PluginInfo modInfo; private AssetBundle modBundle; public Action<CustomContent, GameObject> prefabCallback = delegate { }; public Dictionary<string, CustomContent> LoadedContent { get; } = new Dictionary<string, CustomContent>(); public string modName => modInfo.Metadata.Name; public string modVersion => modInfo.Metadata.Version.ToString(); public string modGUID => modInfo.Metadata.GUID; public ContentLoader(PluginInfo modInfo, AssetBundle modBundle, Action<CustomContent, GameObject> prefabCallback = null) { this.modInfo = modInfo; this.modBundle = modBundle; if (prefabCallback != null) { this.prefabCallback = prefabCallback; } } public ContentLoader Create(PluginInfo modInfo, AssetBundle modBundle, Action<CustomContent, GameObject> prefabCallback = null) { return new ContentLoader(modInfo, modBundle, prefabCallback); } public void Register(CustomContent content) { if (LoadedContent.ContainsKey(content.ID)) { Debug.LogError((object)("[LethalLib] " + modName + " tried to register content with ID " + content.ID + " but it already exists!")); return; } if (content is CustomItem customItem) { Item val = (customItem.item = modBundle.LoadAsset<Item>(customItem.contentPath)); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); prefabCallback(customItem, val.spawnPrefab); customItem.registryCallback(val); if (content is ShopItem shopItem) { TerminalNode buyNode = null; TerminalNode buyNode2 = null; TerminalNode itemInfo = null; if (shopItem.buyNode1Path != null) { buyNode = modBundle.LoadAsset<TerminalNode>(shopItem.buyNode1Path); } if (shopItem.buyNode2Path != null) { buyNode2 = modBundle.LoadAsset<TerminalNode>(shopItem.buyNode2Path); } if (shopItem.itemInfoPath != null) { itemInfo = modBundle.LoadAsset<TerminalNode>(shopItem.itemInfoPath); } Items.RegisterShopItem(val, buyNode, buyNode2, itemInfo, shopItem.initPrice); } else if (content is ScrapItem scrapItem) { Items.RegisterScrap(val, scrapItem.levelRarities, scrapItem.customLevelRarities); } else { Items.RegisterItem(val); } } else if (content is Unlockable unlockable) { UnlockableItemDef unlockableItemDef = modBundle.LoadAsset<UnlockableItemDef>(unlockable.contentPath); if ((Object)(object)unlockableItemDef.unlockable.prefabObject != (Object)null) { NetworkPrefabs.RegisterNetworkPrefab(unlockableItemDef.unlockable.prefabObject); prefabCallback(content, unlockableItemDef.unlockable.prefabObject); Utilities.FixMixerGroups(unlockableItemDef.unlockable.prefabObject); } unlockable.unlockable = unlockableItemDef.unlockable; unlockable.registryCallback(unlockableItemDef.unlockable); TerminalNode buyNode3 = null; TerminalNode buyNode4 = null; TerminalNode itemInfo2 = null; if (unlockable.buyNode1Path != null) { buyNode3 = modBundle.LoadAsset<TerminalNode>(unlockable.buyNode1Path); } if (unlockable.buyNode2Path != null) { buyNode4 = modBundle.LoadAsset<TerminalNode>(unlockable.buyNode2Path); } if (unlockable.itemInfoPath != null) { itemInfo2 = modBundle.LoadAsset<TerminalNode>(unlockable.itemInfoPath); } Unlockables.RegisterUnlockable(unlockableItemDef, unlockable.storeType, buyNode3, buyNode4, itemInfo2, unlockable.initPrice); } else if (content is CustomEnemy customEnemy) { EnemyType val2 = modBundle.LoadAsset<EnemyType>(customEnemy.contentPath); NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab); Utilities.FixMixerGroups(val2.enemyPrefab); customEnemy.enemy = val2; prefabCallback(content, val2.enemyPrefab); customEnemy.registryCallback(val2); TerminalNode infoNode = null; TerminalKeyword infoKeyword = null; if (customEnemy.infoNodePath != null) { infoNode = modBundle.LoadAsset<TerminalNode>(customEnemy.infoNodePath); } if (customEnemy.infoKeywordPath != null) { infoKeyword = modBundle.LoadAsset<TerminalKeyword>(customEnemy.infoKeywordPath); } if (customEnemy.spawnType == (Enemies.SpawnType)(-1)) { Enemies.RegisterEnemy(val2, customEnemy.rarity, customEnemy.LevelTypes, customEnemy.levelOverrides, infoNode, infoKeyword); } else { Enemies.RegisterEnemy(val2, customEnemy.rarity, customEnemy.LevelTypes, customEnemy.spawnType, customEnemy.levelOverrides, infoNode, infoKeyword); } } else if (content is MapHazard mapHazard) { SpawnableMapObjectDef spawnableMapObjectDef = (mapHazard.hazard = modBundle.LoadAsset<SpawnableMapObjectDef>(mapHazard.contentPath)); NetworkPrefabs.RegisterNetworkPrefab(spawnableMapObjectDef.spawnableMapObject.prefabToSpawn); Utilities.FixMixerGroups(spawnableMapObjectDef.spawnableMapObject.prefabToSpawn); prefabCallback(content, spawnableMapObjectDef.spawnableMapObject.prefabToSpawn); mapHazard.registryCallback(spawnableMapObjectDef); MapObjects.RegisterMapObject(spawnableMapObjectDef, mapHazard.LevelTypes, mapHazard.levelOverrides, mapHazard.spawnRateFunction); } else if (content is OutsideObject outsideObject) { SpawnableOutsideObjectDef spawnableOutsideObjectDef = (outsideObject.mapObject = modBundle.LoadAsset<SpawnableOutsideObjectDef>(outsideObject.contentPath)); NetworkPrefabs.RegisterNetworkPrefab(spawnableOutsideObjectDef.spawnableMapObject.spawnableObject.prefabToSpawn); Utilities.FixMixerGroups(spawnableOutsideObjectDef.spawnableMapObject.spawnableObject.prefabToSpawn); prefabCallback(content, spawnableOutsideObjectDef.spawnableMapObject.spawnableObject.prefabToSpawn); outsideObject.registryCallback(spawnableOutsideObjectDef); MapObjects.RegisterOutsideObject(spawnableOutsideObjectDef, outsideObject.LevelTypes, outsideObject.levelOverrides, outsideObject.spawnRateFunction); } LoadedContent.Add(content.ID, content); } public void RegisterAll(CustomContent[] content) { Plugin.logger.LogInfo((object)$"[LethalLib] {modName} is registering {content.Length} content items!"); foreach (CustomContent content2 in content) { Register(content2); } } public void RegisterAll(List<CustomContent> content) { Plugin.logger.LogInfo((object)$"[LethalLib] {modName} is registering {content.Count} content items!"); foreach (CustomContent item in content) { Register(item); } } } public class Dungeon { public class CustomDungeonArchetype { public DungeonArchetype archeType; public Levels.LevelTypes LevelTypes; public int lineIndex = -1; } public class CustomGraphLine { public GraphLine graphLine; public Levels.LevelTypes LevelTypes; } public class CustomDungeon { public int rarity; public DungeonFlow dungeonFlow; public Levels.LevelTypes LevelTypes; public string[] levelOverrides; public int dungeonIndex = -1; public AudioClip firstTimeDungeonAudio; } [CompilerGenerated] private static class <>O { public static hook_GenerateNewFloor <0>__RoundManager_GenerateNewFloor; public static hook_Start <1>__RoundManager_Start; } public static List<CustomDungeonArchetype> customDungeonArchetypes = new List<CustomDungeonArchetype>(); public static List<CustomGraphLine> customGraphLines = new List<CustomGraphLine>(); public static Dictionary<string, TileSet> extraTileSets = new Dictionary<string, TileSet>(); public static Dictionary<string, GameObjectChance> extraRooms = new Dictionary<string, GameObjectChance>(); public static List<CustomDungeon> customDungeons = new List<CustomDungeon>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__RoundManager_GenerateNewFloor; if (obj == null) { hook_GenerateNewFloor val = RoundManager_GenerateNewFloor; <>O.<0>__RoundManager_GenerateNewFloor = val; obj = (object)val; } RoundManager.GenerateNewFloor += (hook_GenerateNewFloor)obj; object obj2 = <>O.<1>__RoundManager_Start; if (obj2 == null) { hook_Start val2 = RoundManager_Start; <>O.<1>__RoundManager_Start = val2; obj2 = (object)val2; } RoundManager.Start += (hook_Start)obj2; } private static void RoundManager_Start(orig_Start orig, RoundManager self) { //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Expected O, but got Unknown foreach (CustomDungeon customDungeon in customDungeons) { if (self.dungeonFlowTypes.Contains(customDungeon.dungeonFlow)) { continue; } List<DungeonFlow> list = self.dungeonFlowTypes.ToList(); list.Add(customDungeon.dungeonFlow); self.dungeonFlowTypes = list.ToArray(); int dungeonIndex = self.dungeonFlowTypes.Length - 1; customDungeon.dungeonIndex = dungeonIndex; List<AudioClip> list2 = self.firstTimeDungeonAudios.ToList(); if (list2.Count != self.dungeonFlowTypes.Length - 1) { while (list2.Count < self.dungeonFlowTypes.Length - 1) { list2.Add(null); } } list2.Add(customDungeon.firstTimeDungeonAudio); self.firstTimeDungeonAudios = list2.ToArray(); } StartOfRound instance = StartOfRound.Instance; foreach (CustomDungeon dungeon in customDungeons) { SelectableLevel[] levels = instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = dungeon.LevelTypes.HasFlag(Levels.LevelTypes.All) || (dungeon.levelOverrides != null && dungeon.levelOverrides.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant())); if (dungeon.LevelTypes.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag) { Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if ((flag || dungeon.LevelTypes.HasFlag(levelTypes)) && !val.dungeonFlowTypes.Any((IntWithRarity rarityInt) => rarityInt.id == dungeon.dungeonIndex)) { List<IntWithRarity> list3 = val.dungeonFlowTypes.ToList(); list3.Add(new IntWithRarity { id = dungeon.dungeonIndex, rarity = dungeon.rarity }); val.dungeonFlowTypes = list3.ToArray(); } } } } orig.Invoke(self); } private static void RoundManager_GenerateNewFloor(orig_GenerateNewFloor orig, RoundManager self) { string name = ((Object)self.currentLevel).name; if (Enum.IsDefined(typeof(Levels.LevelTypes), name)) { Levels.LevelTypes levelEnum = (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name); int index = 0; self.dungeonGenerator.Generator.DungeonFlow.Lines.ForEach(delegate(GraphLine line) { foreach (CustomDungeonArchetype customDungeonArchetype in customDungeonArchetypes) { if (customDungeonArchetype.LevelTypes.HasFlag(levelEnum) && !line.DungeonArchetypes.Contains(customDungeonArchetype.archeType) && (customDungeonArchetype.lineIndex == -1 || customDungeonArchetype.lineIndex == index)) { line.DungeonArchetypes.Add(customDungeonArchetype.archeType); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)customDungeonArchetype.archeType).name + " to " + name)); } } } foreach (DungeonArchetype dungeonArchetype in line.DungeonArchetypes) { string name2 = ((Object)dungeonArchetype).name; if (extraTileSets.ContainsKey(name2)) { TileSet val4 = extraTileSets[name2]; if (!dungeonArchetype.TileSets.Contains(val4)) { dungeonArchetype.TileSets.Add(val4); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)val4).name + " to " + name)); } } } foreach (TileSet tileSet in dungeonArchetype.TileSets) { string name3 = ((Object)tileSet).name; if (extraRooms.ContainsKey(name3)) { GameObjectChance item = extraRooms[name3]; if (!tileSet.TileWeights.Weights.Contains(item)) { tileSet.TileWeights.Weights.Add(item); } } } } index++; }); foreach (CustomGraphLine customGraphLine in customGraphLines) { if (customGraphLine.LevelTypes.HasFlag(levelEnum) && !self.dungeonGenerator.Generator.DungeonFlow.Lines.Contains(customGraphLine.graphLine)) { self.dungeonGenerator.Generator.DungeonFlow.Lines.Add(customGraphLine.graphLine); } } } orig.Invoke(self); NetworkManager val = Object.FindObjectOfType<NetworkManager>(); RandomMapObject[] array = Object.FindObjectsOfType<RandomMapObject>(); foreach (RandomMapObject val2 in array) { for (int j = 0; j < val2.spawnablePrefabs.Count; j++) { string prefabName = ((Object)val2.spawnablePrefabs[j]).name; NetworkPrefab val3 = ((IEnumerable<NetworkPrefab>)val.NetworkConfig.Prefabs.m_Prefabs).FirstOrDefault((Func<NetworkPrefab, bool>)((NetworkPrefab x) => ((Object)x.Prefab).name == prefabName)); if (val3 != null && (Object)(object)val3.Prefab != (Object)(object)val2.spawnablePrefabs[j]) { val2.spawnablePrefabs[j] = val3.Prefab; } else if (val3 == null) { Plugin.logger.LogError((object)("DungeonGeneration - Could not find network prefab (" + prefabName + ")! Make sure your assigned prefab is registered with the network manager, or named identically to the vanilla prefab you are referencing.")); } } } } public static void AddArchetype(DungeonArchetype archetype, Levels.LevelTypes levelFlags, int lineIndex = -1) { CustomDungeonArchetype customDungeonArchetype = new CustomDungeonArchetype(); customDungeonArchetype.archeType = archetype; customDungeonArchetype.LevelTypes = levelFlags; customDungeonArchetype.lineIndex = lineIndex; customDungeonArchetypes.Add(customDungeonArchetype); } public static void AddLine(GraphLine line, Levels.LevelTypes levelFlags) { CustomGraphLine customGraphLine = new CustomGraphLine(); customGraphLine.graphLine = line; customGraphLine.LevelTypes = levelFlags; customGraphLines.Add(customGraphLine); } public static void AddLine(DungeonGraphLineDef line, Levels.LevelTypes levelFlags) { AddLine(line.graphLine, levelFlags); } public static void AddTileSet(TileSet set, string archetypeName) { extraTileSets.Add(archetypeName, set); } public static void AddRoom(GameObjectChance room, string tileSetName) { extraRooms.Add(tileSetName, room); } public static void AddRoom(GameObjectChanceDef room, string tileSetName) { AddRoom(room.gameObjectChance, tileSetName); } public static void AddDungeon(DungeonDef dungeon, Levels.LevelTypes levelFlags) { AddDungeon(dungeon.dungeonFlow, dungeon.rarity, levelFlags, dungeon.firstTimeDungeonAudio); } public static void AddDungeon(DungeonDef dungeon, Levels.LevelTypes levelFlags, string[] levelOverrides) { AddDungeon(dungeon.dungeonFlow, dungeon.rarity, levelFlags, levelOverrides, dungeon.firstTimeDungeonAudio); } public static void AddDungeon(DungeonFlow dungeon, int rarity, Levels.LevelTypes levelFlags, AudioClip firstTimeDungeonAudio = null) { customDungeons.Add(new CustomDungeon { dungeonFlow = dungeon, rarity = rarity, LevelTypes = levelFlags, firstTimeDungeonAudio = firstTimeDungeonAudio }); } public static void AddDungeon(DungeonFlow dungeon, int rarity, Levels.LevelTypes levelFlags, string[] levelOverrides = null, AudioClip firstTimeDungeonAudio = null) { customDungeons.Add(new CustomDungeon { dungeonFlow = dungeon, rarity = rarity, LevelTypes = levelFlags, firstTimeDungeonAudio = firstTimeDungeonAudio, levelOverrides = levelOverrides }); } } public class Enemies { public struct EnemyAssetInfo { public EnemyType EnemyAsset; public TerminalKeyword keyword; } public enum SpawnType { Default, Daytime, Outside } public class SpawnableEnemy { public EnemyType enemy; public SpawnType spawnType; public TerminalNode terminalNode; public TerminalKeyword infoKeyword; public string modName; public int rarity; public Levels.LevelTypes spawnLevels; public string[] spawnLevelOverrides; public Dictionary<string, int> customLevelRarities = new Dictionary<string, int>(); public Dictionary<Levels.LevelTypes, int> levelRarities = new Dictionary<Levels.LevelTypes, int>(); public SpawnableEnemy(EnemyType enemy, int rarity, Levels.LevelTypes spawnLevels, SpawnType spawnType, string[] spawnLevelOverrides = null) { this.enemy = enemy; this.spawnLevels = spawnLevels; this.spawnType = spawnType; if (spawnLevelOverrides != null) { foreach (string key in spawnLevelOverrides) { customLevelRarities.Add(key, rarity); } } if (spawnLevels == Levels.LevelTypes.None) { return; } foreach (Levels.LevelTypes value in Enum.GetValues(typeof(Levels.LevelTypes))) { if (spawnLevels.HasFlag(value)) { levelRarities.Add(value, rarity); } } } public SpawnableEnemy(EnemyType enemy, SpawnType spawnType, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null) { this.enemy = enemy; this.spawnType = spawnType; if (levelRarities != null) { this.levelRarities = levelRarities; } if (customLevelRarities != null) { this.customLevelRarities = customLevelRarities; } } } [CompilerGenerated] private static class <>O { public static hook_Awake <0>__RegisterLevelEnemies; public static hook_Start <1>__Terminal_Start; public static hook_Start <2>__QuickMenuManager_Start; } private static bool addedToDebug = false; public static Terminal terminal; public static List<EnemyAssetInfo> enemyAssetInfos = new List<EnemyAssetInfo>(); public static List<SpawnableEnemy> spawnableEnemies = new List<SpawnableEnemy>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_005b: Expected O, but got Unknown object obj = <>O.<0>__RegisterLevelEnemies; if (obj == null) { hook_Awake val = RegisterLevelEnemies; <>O.<0>__RegisterLevelEnemies = val; obj = (object)val; } StartOfRound.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__Terminal_Start; if (obj2 == null) { hook_Start val2 = Terminal_Start; <>O.<1>__Terminal_Start = val2; obj2 = (object)val2; } Terminal.Start += (hook_Start)obj2; object obj3 = <>O.<2>__QuickMenuManager_Start; if (obj3 == null) { hook_Start val3 = QuickMenuManager_Start; <>O.<2>__QuickMenuManager_Start = val3; obj3 = (object)val3; } QuickMenuManager.Start += (hook_Start)obj3; } private static void QuickMenuManager_Start(orig_Start orig, QuickMenuManager self) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown if (addedToDebug) { orig.Invoke(self); return; } SelectableLevel testAllEnemiesLevel = self.testAllEnemiesLevel; List<SpawnableEnemyWithRarity> enemies = testAllEnemiesLevel.Enemies; List<SpawnableEnemyWithRarity> daytimeEnemies = testAllEnemiesLevel.DaytimeEnemies; List<SpawnableEnemyWithRarity> outsideEnemies = testAllEnemiesLevel.OutsideEnemies; foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { if (enemies.All((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { continue; } SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = spawnableEnemy.enemy, rarity = spawnableEnemy.rarity }; switch (spawnableEnemy.spawnType) { case SpawnType.Default: if (!enemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { enemies.Add(item); } break; case SpawnType.Daytime: if (!daytimeEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { daytimeEnemies.Add(item); } break; case SpawnType.Outside: if (!outsideEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { outsideEnemies.Add(item); } break; } if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"Added {spawnableEnemy.enemy.enemyName} to DebugList [{spawnableEnemy.spawnType}]"); } } addedToDebug = true; orig.Invoke(self); } private static void Terminal_Start(orig_Start orig, Terminal self) { //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: 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_027a: Expected O, but got Unknown terminal = self; TerminalKeyword val = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); List<string> list = new List<string>(); foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { if (list.Contains(spawnableEnemy.enemy.enemyName)) { Plugin.logger.LogInfo((object)("Skipping " + spawnableEnemy.enemy.enemyName + " because it was already added")); continue; } if ((Object)(object)spawnableEnemy.terminalNode == (Object)null) { spawnableEnemy.terminalNode = ScriptableObject.CreateInstance<TerminalNode>(); spawnableEnemy.terminalNode.displayText = spawnableEnemy.enemy.enemyName + "\n\nDanger level: Unknown\n\n[No information about this creature was found.]\n\n"; spawnableEnemy.terminalNode.clearPreviousText = true; spawnableEnemy.terminalNode.maxCharactersToType = 35; spawnableEnemy.terminalNode.creatureName = spawnableEnemy.enemy.enemyName; } if (self.enemyFiles.Any((TerminalNode x) => x.creatureName == spawnableEnemy.terminalNode.creatureName)) { Plugin.logger.LogInfo((object)("Skipping " + spawnableEnemy.enemy.enemyName + " because it was already added")); continue; } TerminalKeyword keyword2 = (((Object)(object)spawnableEnemy.infoKeyword != (Object)null) ? spawnableEnemy.infoKeyword : TerminalUtils.CreateTerminalKeyword(spawnableEnemy.terminalNode.creatureName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val)); keyword2.defaultVerb = val; List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList(); if (!list2.Any((TerminalKeyword x) => x.word == keyword2.word)) { list2.Add(keyword2); self.terminalNodes.allKeywords = list2.ToArray(); } List<CompatibleNoun> list3 = val.compatibleNouns.ToList(); if (!list3.Any((CompatibleNoun x) => x.noun.word == keyword2.word)) { list3.Add(new CompatibleNoun { noun = keyword2, result = spawnableEnemy.terminalNode }); } val.compatibleNouns = list3.ToArray(); spawnableEnemy.terminalNode.creatureFileID = self.enemyFiles.Count; self.enemyFiles.Add(spawnableEnemy.terminalNode); spawnableEnemy.enemy.enemyPrefab.GetComponentInChildren<ScanNodeProperties>().creatureScanID = spawnableEnemy.terminalNode.creatureFileID; EnemyAssetInfo enemyAssetInfo = default(EnemyAssetInfo); enemyAssetInfo.EnemyAsset = spawnableEnemy.enemy; enemyAssetInfo.keyword = keyword2; EnemyAssetInfo item = enemyAssetInfo; enemyAssetInfos.Add(item); } orig.Invoke(self); } private static void RegisterLevelEnemies(orig_Awake orig, StartOfRound self) { //IL_01a7: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown orig.Invoke(self); foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { SelectableLevel[] levels = self.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = spawnableEnemy.levelRarities.ContainsKey(Levels.LevelTypes.All) || (spawnableEnemy.customLevelRarities != null && spawnableEnemy.customLevelRarities.ContainsKey(name)); if (spawnableEnemy.levelRarities.ContainsKey(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelEnum = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (!flag && !spawnableEnemy.spawnLevels.HasFlag(levelEnum)) { continue; } int rarity = 0; if (spawnableEnemy.levelRarities.Keys.Any((Levels.LevelTypes key) => key.HasFlag(levelEnum))) { rarity = spawnableEnemy.levelRarities.First((KeyValuePair<Levels.LevelTypes, int> x) => x.Key.HasFlag(levelEnum)).Value; } else if (spawnableEnemy.customLevelRarities != null && spawnableEnemy.customLevelRarities.ContainsKey(name)) { rarity = spawnableEnemy.customLevelRarities[name]; } SpawnableEnemyWithRarity item = new SpawnableEnemyWithRarity { enemyType = spawnableEnemy.enemy, rarity = rarity }; switch (spawnableEnemy.spawnType) { case SpawnType.Default: if (!val.Enemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { val.Enemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Default]")); } } break; case SpawnType.Daytime: if (!val.DaytimeEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { val.DaytimeEnemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Daytime]")); } } break; case SpawnType.Outside: if (!val.OutsideEnemies.Any((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)spawnableEnemy.enemy)) { val.OutsideEnemies.Add(item); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)spawnableEnemy.enemy).name + " to " + name + " with SpawnType [Outside]")); } } break; } } } } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { RegisterEnemy(enemy, rarity, levelFlags, spawnType, null, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, SpawnType spawnType, string[] spawnLevelOverrides = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyType enemy2 = enemy; SpawnableEnemy spawnableEnemy = spawnableEnemies.FirstOrDefault((SpawnableEnemy x) => (Object)(object)x.enemy == (Object)(object)enemy2 && x.spawnType == spawnType); if (spawnableEnemy != null) { if (levelFlags != Levels.LevelTypes.None) { spawnableEnemy.levelRarities.Add(levelFlags, rarity); } if (spawnLevelOverrides != null) { foreach (string key in spawnLevelOverrides) { spawnableEnemy.customLevelRarities.Add(key, rarity); } } } else { spawnableEnemy = new SpawnableEnemy(enemy2, rarity, levelFlags, spawnType, spawnLevelOverrides); spawnableEnemy.terminalNode = infoNode; spawnableEnemy.infoKeyword = infoKeyword; string name = Assembly.GetCallingAssembly().GetName().Name; spawnableEnemy.modName = name; spawnableEnemies.Add(spawnableEnemy); } } public static void RegisterEnemy(EnemyType enemy, SpawnType spawnType, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { EnemyType enemy2 = enemy; SpawnableEnemy spawnableEnemy = spawnableEnemies.FirstOrDefault((SpawnableEnemy x) => (Object)(object)x.enemy == (Object)(object)enemy2 && x.spawnType == spawnType); if (spawnableEnemy != null) { if (levelRarities != null) { foreach (KeyValuePair<Levels.LevelTypes, int> levelRarity in levelRarities) { spawnableEnemy.levelRarities.Add(levelRarity.Key, levelRarity.Value); } } if (customLevelRarities == null) { return; } { foreach (KeyValuePair<string, int> customLevelRarity in customLevelRarities) { spawnableEnemy.customLevelRarities.Add(customLevelRarity.Key, customLevelRarity.Value); } return; } } spawnableEnemy = new SpawnableEnemy(enemy2, spawnType, levelRarities, customLevelRarities); spawnableEnemy.terminalNode = infoNode; spawnableEnemy.infoKeyword = infoKeyword; string name = Assembly.GetCallingAssembly().GetName().Name; spawnableEnemy.modName = name; } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, rarity, levelFlags, spawnType, null, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, int rarity, Levels.LevelTypes levelFlags, string[] spawnLevelOverrides = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, rarity, levelFlags, spawnType, spawnLevelOverrides, infoNode, infoKeyword); } public static void RegisterEnemy(EnemyType enemy, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null, TerminalNode infoNode = null, TerminalKeyword infoKeyword = null) { SpawnType spawnType = (enemy.isDaytimeEnemy ? SpawnType.Daytime : (enemy.isOutsideEnemy ? SpawnType.Outside : SpawnType.Default)); RegisterEnemy(enemy, spawnType, levelRarities, customLevelRarities, infoNode, infoKeyword); } public static void RemoveEnemyFromLevels(EnemyType enemyType, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { EnemyType enemyType2 = enemyType; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { List<SpawnableEnemyWithRarity> enemies = val.Enemies; List<SpawnableEnemyWithRarity> daytimeEnemies = val.DaytimeEnemies; List<SpawnableEnemyWithRarity> outsideEnemies = val.OutsideEnemies; enemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); daytimeEnemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); outsideEnemies.RemoveAll((SpawnableEnemyWithRarity x) => (Object)(object)x.enemyType == (Object)(object)enemyType2); } } } } public class Items { public struct ItemSaveOrderData { public int itemId; public string itemName; public string assetName; } public struct BuyableItemAssetInfo { public Item itemAsset; public TerminalKeyword keyword; } public class ScrapItem { public Item item; public Item origItem; public int rarity; public Levels.LevelTypes spawnLevels; public string[] spawnLevelOverrides; public string modName = "Unknown"; public Dictionary<string, int> customLevelRarities = new Dictionary<string, int>(); public Dictionary<Levels.LevelTypes, int> levelRarities = new Dictionary<Levels.LevelTypes, int>(); public ScrapItem(Item item, int rarity, Levels.LevelTypes spawnLevels = Levels.LevelTypes.None, string[] spawnLevelOverrides = null) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) origItem = item; if (!item.isScrap) { item = item.Clone<Item>(); item.isScrap = true; if (item.maxValue == 0 && item.minValue == 0) { item.minValue = 40; item.maxValue = 100; } else if (item.maxValue == 0) { item.maxValue = item.minValue * 2; } else if (item.minValue == 0) { item.minValue = item.maxValue / 2; } GameObject val = NetworkPrefabs.CloneNetworkPrefab(item.spawnPrefab); if ((Object)(object)val.GetComponent<GrabbableObject>() != (Object)null) { val.GetComponent<GrabbableObject>().itemProperties = item; } if ((Object)(object)val.GetComponentInChildren<ScanNodeProperties>() == (Object)null) { GameObject obj = Object.Instantiate<GameObject>(scanNodePrefab, val.transform); ((Object)obj).name = "ScanNode"; obj.transform.localPosition = new Vector3(0f, 0f, 0f); obj.GetComponent<ScanNodeProperties>().headerText = item.itemName; } item.spawnPrefab = val; } this.item = item; if (spawnLevelOverrides != null) { foreach (string key in spawnLevelOverrides) { customLevelRarities.Add(key, rarity); } } if (spawnLevels == Levels.LevelTypes.None) { return; } foreach (Levels.LevelTypes value in Enum.GetValues(typeof(Levels.LevelTypes))) { if (spawnLevels.HasFlag(value)) { levelRarities.Add(value, rarity); } } } public ScrapItem(Item item, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) origItem = item; if (!item.isScrap) { item = item.Clone<Item>(); item.isScrap = true; if (item.maxValue == 0 && item.minValue == 0) { item.minValue = 40; item.maxValue = 100; } else if (item.maxValue == 0) { item.maxValue = item.minValue * 2; } else if (item.minValue == 0) { item.minValue = item.maxValue / 2; } GameObject val = NetworkPrefabs.CloneNetworkPrefab(item.spawnPrefab); if ((Object)(object)val.GetComponent<GrabbableObject>() != (Object)null) { val.GetComponent<GrabbableObject>().itemProperties = item; } if ((Object)(object)val.GetComponentInChildren<ScanNodeProperties>() == (Object)null) { GameObject obj = Object.Instantiate<GameObject>(scanNodePrefab, val.transform); ((Object)obj).name = "ScanNode"; obj.transform.localPosition = new Vector3(0f, 0f, 0f); obj.GetComponent<ScanNodeProperties>().headerText = item.itemName; } item.spawnPrefab = val; } this.item = item; if (customLevelRarities != null) { this.customLevelRarities = customLevelRarities; } if (levelRarities != null) { this.levelRarities = levelRarities; } } } public class PlainItem { public Item item; public string modName; public PlainItem(Item item) { this.item = item; } } public class ShopItem { public Item item; public Item origItem; public TerminalNode buyNode1; public TerminalNode buyNode2; public TerminalNode itemInfo; public bool wasRemoved; public int price; public string modName; public ShopItem(Item item, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = 0) { origItem = item; this.item = item; this.price = price; if ((Object)(object)buyNode1 != (Object)null) { this.buyNode1 = buyNode1; } if ((Object)(object)buyNode2 != (Object)null) { this.buyNode2 = buyNode2; } if ((Object)(object)itemInfo != (Object)null) { this.itemInfo = itemInfo; } } } [CompilerGenerated] private static class <>O { public static hook_Start <0>__StartOfRound_Start; public static hook_Awake <1>__Terminal_Awake; public static hook_TextPostProcess <2>__Terminal_TextPostProcess; } public static ConfigEntry<bool> useSavedataFix; public static GameObject scanNodePrefab; public static List<Item> LethalLibItemList = new List<Item>(); public static List<BuyableItemAssetInfo> buyableItemAssetInfos = new List<BuyableItemAssetInfo>(); public static Terminal terminal; public static List<ScrapItem> scrapItems = new List<ScrapItem>(); public static List<ShopItem> shopItems = new List<ShopItem>(); public static List<PlainItem> plainItems = new List<PlainItem>(); public static void Init() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0063: 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_006e: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown useSavedataFix = Plugin.config.Bind<bool>("Items", "EnableItemSaveFix", false, "Allow for LethalLib to store/reorder the item list, which should fix issues where items get reshuffled when loading an old save. This is experimental and may cause save corruptions occasionally."); scanNodePrefab = Plugin.MainAssets.LoadAsset<GameObject>("Assets/Custom/ItemScanNode.prefab"); object obj = <>O.<0>__StartOfRound_Start; if (obj == null) { hook_Start val = StartOfRound_Start; <>O.<0>__StartOfRound_Start = val; obj = (object)val; } StartOfRound.Start += (hook_Start)obj; object obj2 = <>O.<1>__Terminal_Awake; if (obj2 == null) { hook_Awake val2 = Terminal_Awake; <>O.<1>__Terminal_Awake = val2; obj2 = (object)val2; } Terminal.Awake += (hook_Awake)obj2; object obj3 = <>O.<2>__Terminal_TextPostProcess; if (obj3 == null) { hook_TextPostProcess val3 = Terminal_TextPostProcess; <>O.<2>__Terminal_TextPostProcess = val3; obj3 = (object)val3; } Terminal.TextPostProcess += (hook_TextPostProcess)obj3; } private static string Terminal_TextPostProcess(orig_TextPostProcess orig, Terminal self, string modifiedDisplayText, TerminalNode node) { List<Item> list = self.buyableItemsList.ToList(); List<Item> list2 = self.buyableItemsList.ToList(); list2.RemoveAll((Item x) => shopItems.FirstOrDefault((ShopItem item) => (Object)(object)item.origItem == (Object)(object)x || (Object)(object)item.item == (Object)(object)x)?.wasRemoved ?? false); self.buyableItemsList = list2.ToArray(); string result = orig.Invoke(self, modifiedDisplayText, node); self.buyableItemsList = list.ToArray(); return result; } private static void StartOfRound_Start(orig_Start orig, StartOfRound self) { if (useSavedataFix.Value && ((NetworkBehaviour)self).IsHost) { Plugin.logger.LogInfo((object)"Fixing Item savedata!!"); List<ItemSaveOrderData> itemList = new List<ItemSaveOrderData>(); StartOfRound.Instance.allItemsList.itemsList.ForEach(delegate(Item item) { itemList.Add(new ItemSaveOrderData { itemId = item.itemId, itemName = item.itemName, assetName = ((Object)item).name }); }); if (ES3.KeyExists("LethalLibAllItemsList", GameNetworkManager.Instance.currentSaveFileName)) { itemList = ES3.Load<List<ItemSaveOrderData>>("LethalLibAllItemsList", GameNetworkManager.Instance.currentSaveFileName); } List<Item> itemsList = StartOfRound.Instance.allItemsList.itemsList; List<Item> list = new List<Item>(); foreach (ItemSaveOrderData item2 in itemList) { Item val = ((IEnumerable<Item>)itemsList).FirstOrDefault((Func<Item, bool>)((Item x) => x.itemId == item2.itemId && x.itemName == item2.itemName && item2.assetName == ((Object)x).name)); if ((Object)(object)val != (Object)null) { list.Add(val); } else { list.Add(ScriptableObject.CreateInstance<Item>()); } } foreach (Item item3 in itemsList) { if (!list.Contains(item3)) { list.Add(item3); } } StartOfRound.Instance.allItemsList.itemsList = list; ES3.Save<List<ItemSaveOrderData>>("LethalLibAllItemsList", itemList, GameNetworkManager.Instance.currentSaveFileName); } orig.Invoke(self); } private static void Terminal_Awake(orig_Awake orig, Terminal self) { //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_0855: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_088f: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Expected O, but got Unknown //IL_089a: Unknown result type (might be due to invalid IL or missing references) //IL_089f: Unknown result type (might be due to invalid IL or missing references) //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_08dc: Expected O, but got Unknown //IL_093f: Unknown result type (might be due to invalid IL or missing references) //IL_0944: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_0959: Expected O, but got Unknown //IL_09e6: Unknown result type (might be due to invalid IL or missing references) //IL_09eb: Unknown result type (might be due to invalid IL or missing references) //IL_09f3: Unknown result type (might be due to invalid IL or missing references) //IL_0a00: Expected O, but got Unknown StartOfRound instance = StartOfRound.Instance; foreach (ScrapItem scrapItem in scrapItems) { SelectableLevel[] levels = instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = scrapItem.levelRarities.ContainsKey(Levels.LevelTypes.All) || (scrapItem.customLevelRarities != null && scrapItem.customLevelRarities.ContainsKey(name)); if (scrapItem.levelRarities.ContainsKey(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelEnum = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (!flag && !scrapItem.levelRarities.Keys.Any((Levels.LevelTypes key) => key.HasFlag(levelEnum))) { continue; } int rarity = 0; if (scrapItem.levelRarities.Keys.Any((Levels.LevelTypes key) => key.HasFlag(levelEnum))) { rarity = scrapItem.levelRarities.First((KeyValuePair<Levels.LevelTypes, int> x) => x.Key.HasFlag(levelEnum)).Value; } else if (scrapItem.customLevelRarities != null && scrapItem.customLevelRarities.ContainsKey(name)) { rarity = scrapItem.customLevelRarities[name]; } SpawnableItemWithRarity item2 = new SpawnableItemWithRarity { spawnableItem = scrapItem.item, rarity = rarity }; if (!val.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)scrapItem.item)) { val.spawnableScrap.Add(item2); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)scrapItem.item).name + " to " + name)); } } } } foreach (ScrapItem scrapItem2 in scrapItems) { if (instance.allItemsList.itemsList.Contains(scrapItem2.item)) { continue; } if (Plugin.extendedLogging.Value) { if (scrapItem2.modName != "LethalLib") { Plugin.logger.LogInfo((object)(scrapItem2.modName + " registered scrap item: " + scrapItem2.item.itemName)); } else { Plugin.logger.LogInfo((object)("Registered scrap item: " + scrapItem2.item.itemName)); } } LethalLibItemList.Add(scrapItem2.item); instance.allItemsList.itemsList.Add(scrapItem2.item); } foreach (ShopItem shopItem in shopItems) { if (instance.allItemsList.itemsList.Contains(shopItem.item)) { continue; } if (Plugin.extendedLogging.Value) { if (shopItem.modName != "LethalLib") { Plugin.logger.LogInfo((object)(shopItem.modName + " registered shop item: " + shopItem.item.itemName)); } else { Plugin.logger.LogInfo((object)("Registered shop item: " + shopItem.item.itemName)); } } LethalLibItemList.Add(shopItem.item); instance.allItemsList.itemsList.Add(shopItem.item); } foreach (PlainItem plainItem in plainItems) { if (instance.allItemsList.itemsList.Contains(plainItem.item)) { continue; } if (Plugin.extendedLogging.Value) { if (plainItem.modName != "LethalLib") { Plugin.logger.LogInfo((object)(plainItem.modName + " registered item: " + plainItem.item.itemName)); } else { Plugin.logger.LogInfo((object)("Registered item: " + plainItem.item.itemName)); } } LethalLibItemList.Add(plainItem.item); instance.allItemsList.itemsList.Add(plainItem.item); } terminal = self; List<Item> list = self.buyableItemsList.ToList(); TerminalKeyword val2 = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy"); TerminalNode result = val2.compatibleNouns[0].result.terminalOptions[1].result; TerminalKeyword val3 = self.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); Plugin.logger.LogInfo((object)$"Adding {shopItems.Count} items to terminal"); foreach (ShopItem item in shopItems) { if (list.Any((Item x) => x.itemName == item.item.itemName) && !item.wasRemoved) { Plugin.logger.LogInfo((object)("Item " + item.item.itemName + " already exists in terminal, skipping")); continue; } item.wasRemoved = false; if (item.price == -1) { item.price = item.item.creditsWorth; } else { item.item.creditsWorth = item.price; } int num = -1; if (!list.Any((Item x) => (Object)(object)x == (Object)(object)item.item)) { list.Add(item.item); } else { num = list.IndexOf(item.item); } int buyItemIndex = ((num == -1) ? (list.Count - 1) : num); string itemName = item.item.itemName; _ = itemName[itemName.Length - 1]; string text = itemName; TerminalNode val4 = item.buyNode2; if ((Object)(object)val4 == (Object)null) { val4 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val4).name = itemName.Replace(" ", "-") + "BuyNode2"; val4.displayText = "Ordered [variableAmount] " + text + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n"; val4.clearPreviousText = true; val4.maxCharactersToType = 15; } val4.buyItemIndex = buyItemIndex; val4.isConfirmationNode = false; val4.itemCost = item.price; val4.playSyncedClip = 0; TerminalNode val5 = item.buyNode1; if ((Object)(object)val5 == (Object)null) { val5 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val5).name = itemName.Replace(" ", "-") + "BuyNode1"; val5.displayText = "You have requested to order " + text + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n"; val5.clearPreviousText = true; val5.maxCharactersToType = 35; } val5.buyItemIndex = buyItemIndex; val5.isConfirmationNode = true; val5.overrideOptions = true; val5.itemCost = item.price; val5.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { new CompatibleNoun { noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "confirm"), result = val4 }, new CompatibleNoun { noun = self.terminalNodes.allKeywords.First((TerminalKeyword keyword2) => keyword2.word == "deny"), result = result } }; TerminalKeyword val6 = TerminalUtils.CreateTerminalKeyword(itemName.ToLowerInvariant().Replace(" ", "-"), isVerb: false, null, null, val2); List<TerminalKeyword> list2 = self.terminalNodes.allKeywords.ToList(); list2.Add(val6); self.terminalNodes.allKeywords = list2.ToArray(); List<CompatibleNoun> list3 = val2.compatibleNouns.ToList(); list3.Add(new CompatibleNoun { noun = val6, result = val5 }); val2.compatibleNouns = list3.ToArray(); TerminalNode val7 = item.itemInfo; if ((Object)(object)val7 == (Object)null) { val7 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val7).name = itemName.Replace(" ", "-") + "InfoNode"; val7.displayText = "[No information about this object was found.]\n\n"; val7.clearPreviousText = true; val7.maxCharactersToType = 25; } self.terminalNodes.allKeywords = list2.ToArray(); List<CompatibleNoun> list4 = val3.compatibleNouns.ToList(); list4.Add(new CompatibleNoun { noun = val6, result = val7 }); val3.compatibleNouns = list4.ToArray(); BuyableItemAssetInfo buyableItemAssetInfo = default(BuyableItemAssetInfo); buyableItemAssetInfo.itemAsset = item.item; buyableItemAssetInfo.keyword = val6; BuyableItemAssetInfo item3 = buyableItemAssetInfo; buyableItemAssetInfos.Add(item3); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)$"Added {itemName} to terminal (Item price: {val5.itemCost}, Item Index: {val5.buyItemIndex}, Terminal keyword: {val6.word})"); } } self.buyableItemsList = list.ToArray(); orig.Invoke(self); } public static void RegisterScrap(Item spawnableItem, int rarity, Levels.LevelTypes levelFlags) { Item spawnableItem2 = spawnableItem; ScrapItem scrapItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)spawnableItem2 || (Object)(object)x.item == (Object)(object)spawnableItem2); if (scrapItem != null) { if (levelFlags != Levels.LevelTypes.None) { scrapItem.levelRarities.Add(levelFlags, rarity); } } else { scrapItem = new ScrapItem(spawnableItem2, rarity, levelFlags); string name = Assembly.GetCallingAssembly().GetName().Name; scrapItem.modName = name; scrapItems.Add(scrapItem); } } public static void RegisterScrap(Item spawnableItem, int rarity, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { Item spawnableItem2 = spawnableItem; ScrapItem scrapItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)spawnableItem2 || (Object)(object)x.item == (Object)(object)spawnableItem2); if (scrapItem != null) { if (levelFlags != Levels.LevelTypes.None) { scrapItem.levelRarities.Add(levelFlags, rarity); } if (levelOverrides != null) { foreach (string key in levelOverrides) { scrapItem.customLevelRarities.Add(key, rarity); } } } else { scrapItem = new ScrapItem(spawnableItem2, rarity, levelFlags, levelOverrides); string name = Assembly.GetCallingAssembly().GetName().Name; scrapItem.modName = name; scrapItems.Add(scrapItem); } } public static void RegisterScrap(Item spawnableItem, Dictionary<Levels.LevelTypes, int>? levelRarities = null, Dictionary<string, int>? customLevelRarities = null) { Item spawnableItem2 = spawnableItem; ScrapItem scrapItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)spawnableItem2 || (Object)(object)x.item == (Object)(object)spawnableItem2); if (scrapItem != null) { if (levelRarities != null) { foreach (KeyValuePair<Levels.LevelTypes, int> levelRarity in levelRarities) { scrapItem.levelRarities.Add(levelRarity.Key, levelRarity.Value); } } if (customLevelRarities == null) { return; } { foreach (KeyValuePair<string, int> customLevelRarity in customLevelRarities) { scrapItem.customLevelRarities.Add(customLevelRarity.Key, customLevelRarity.Value); } return; } } scrapItem = new ScrapItem(spawnableItem2, levelRarities, customLevelRarities); string name = Assembly.GetCallingAssembly().GetName().Name; scrapItem.modName = name; scrapItems.Add(scrapItem); } public static void RegisterShopItem(Item shopItem, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1) { ShopItem shopItem2 = new ShopItem(shopItem, buyNode1, buyNode2, itemInfo, price); string name = Assembly.GetCallingAssembly().GetName().Name; shopItem2.modName = name; shopItems.Add(shopItem2); } public static void RegisterShopItem(Item shopItem, int price = -1) { ShopItem shopItem2 = new ShopItem(shopItem, null, null, null, price); string name = Assembly.GetCallingAssembly().GetName().Name; shopItem2.modName = name; shopItems.Add(shopItem2); } public static void RegisterItem(Item plainItem) { PlainItem plainItem2 = new PlainItem(plainItem); string name = Assembly.GetCallingAssembly().GetName().Name; plainItem2.modName = name; plainItems.Add(plainItem2); } public static void RemoveScrapFromLevels(Item scrapItem, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { Item scrapItem2 = scrapItem; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { ScrapItem actualItem = scrapItems.FirstOrDefault((ScrapItem x) => (Object)(object)x.origItem == (Object)(object)scrapItem2 || (Object)(object)x.item == (Object)(object)scrapItem2); SpawnableItemWithRarity val2 = ((IEnumerable<SpawnableItemWithRarity>)val.spawnableScrap).FirstOrDefault((Func<SpawnableItemWithRarity, bool>)((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)actualItem.item)); if (val2 != null) { val.spawnableScrap.Remove(val2); } } } } public static void RemoveShopItem(Item shopItem) { Item shopItem2 = shopItem; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } ShopItem actualItem = shopItems.FirstOrDefault((ShopItem x) => (Object)(object)x.origItem == (Object)(object)shopItem2 || (Object)(object)x.item == (Object)(object)shopItem2); actualItem.wasRemoved = true; List<TerminalKeyword> list = terminal.terminalNodes.allKeywords.ToList(); TerminalKeyword obj = terminal.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); TerminalKeyword val = terminal.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy"); List<CompatibleNoun> list2 = val.compatibleNouns.ToList(); List<CompatibleNoun> list3 = obj.compatibleNouns.ToList(); if (buyableItemAssetInfos.Any((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item)) { BuyableItemAssetInfo asset = buyableItemAssetInfos.First((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item); list.Remove(asset.keyword); list2.RemoveAll((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword); list3.RemoveAll((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword); } terminal.terminalNodes.allKeywords = list.ToArray(); val.compatibleNouns = list2.ToArray(); obj.compatibleNouns = list3.ToArray(); } public static void UpdateShopItemPrice(Item shopItem, int price) { Item shopItem2 = shopItem; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } ShopItem actualItem = shopItems.FirstOrDefault((ShopItem x) => (Object)(object)x.origItem == (Object)(object)shopItem2 || (Object)(object)x.item == (Object)(object)shopItem2); actualItem.item.creditsWorth = price; TerminalKeyword obj = terminal.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "buy"); _ = obj.compatibleNouns[0].result.terminalOptions[1].result; List<CompatibleNoun> source = obj.compatibleNouns.ToList(); if (!buyableItemAssetInfos.Any((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item)) { return; } BuyableItemAssetInfo asset = buyableItemAssetInfos.First((BuyableItemAssetInfo x) => (Object)(object)x.itemAsset == (Object)(object)actualItem.item); if (!source.Any((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword)) { return; } TerminalNode result = source.First((CompatibleNoun noun) => (Object)(object)noun.noun == (Object)(object)asset.keyword).result; result.itemCost = price; if (result.terminalOptions.Length == 0) { return; } CompatibleNoun[] terminalOptions = result.terminalOptions; foreach (CompatibleNoun val in terminalOptions) { if ((Object)(object)val.result != (Object)null && val.result.buyItemIndex != -1) { val.result.itemCost = price; } } } } public class Levels { [Flags] public enum LevelTypes { None = 1, ExperimentationLevel = 4, AssuranceLevel = 8, VowLevel = 0x10, OffenseLevel = 0x20, MarchLevel = 0x40, RendLevel = 0x80, DineLevel = 0x100, TitanLevel = 0x200, Vanilla = 0x3FC, Modded = 0x400, All = -1 } } public class MapObjects { public class RegisteredMapObject { public SpawnableMapObject mapObject; public SpawnableOutsideObjectWithRarity outsideObject; public Levels.LevelTypes levels; public string[] spawnLevelOverrides; public Func<SelectableLevel, AnimationCurve> spawnRateFunction; } [CompilerGenerated] private static class <>O { public static hook_Awake <0>__StartOfRound_Awake; public static hook_SpawnMapObjects <1>__RoundManager_SpawnMapObjects; } public static List<RegisteredMapObject> mapObjects = new List<RegisteredMapObject>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown object obj = <>O.<0>__StartOfRound_Awake; if (obj == null) { hook_Awake val = StartOfRound_Awake; <>O.<0>__StartOfRound_Awake = val; obj = (object)val; } StartOfRound.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__RoundManager_SpawnMapObjects; if (obj2 == null) { hook_SpawnMapObjects val2 = RoundManager_SpawnMapObjects; <>O.<1>__RoundManager_SpawnMapObjects = val2; obj2 = (object)val2; } RoundManager.SpawnMapObjects += (hook_SpawnMapObjects)obj2; } private static void RoundManager_SpawnMapObjects(orig_SpawnMapObjects orig, RoundManager self) { RandomMapObject[] array = Object.FindObjectsOfType<RandomMapObject>(); foreach (RandomMapObject val in array) { foreach (RegisteredMapObject mapObject in mapObjects) { if (mapObject.mapObject != null && !val.spawnablePrefabs.Any((GameObject prefab) => (Object)(object)prefab == (Object)(object)mapObject.mapObject.prefabToSpawn)) { val.spawnablePrefabs.Add(mapObject.mapObject.prefabToSpawn); } } } orig.Invoke(self); } private static void StartOfRound_Awake(orig_Awake orig, StartOfRound self) { orig.Invoke(self); foreach (RegisteredMapObject mapObject in mapObjects) { SelectableLevel[] levels = self.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = mapObject.levels.HasFlag(Levels.LevelTypes.All) || (mapObject.spawnLevelOverrides != null && mapObject.spawnLevelOverrides.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant())); if (mapObject.levels.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (!flag && !mapObject.levels.HasFlag(levelTypes)) { continue; } if (mapObject.mapObject != null) { if (val.spawnableMapObjects.Any((SpawnableMapObject x) => (Object)(object)x.prefabToSpawn == (Object)(object)mapObject.mapObject.prefabToSpawn)) { List<SpawnableMapObject> list = val.spawnableMapObjects.ToList(); list.RemoveAll((SpawnableMapObject x) => (Object)(object)x.prefabToSpawn == (Object)(object)mapObject.mapObject.prefabToSpawn); val.spawnableMapObjects = list.ToArray(); } SpawnableMapObject mapObject2 = mapObject.mapObject; if (mapObject.spawnRateFunction != null) { mapObject2.numberToSpawn = mapObject.spawnRateFunction(val); } List<SpawnableMapObject> list2 = val.spawnableMapObjects.ToList(); list2.Add(mapObject2); val.spawnableMapObjects = list2.ToArray(); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)mapObject2.prefabToSpawn).name + " to " + name)); } } else { if (mapObject.outsideObject == null) { continue; } if (val.spawnableOutsideObjects.Any((SpawnableOutsideObjectWithRarity x) => (Object)(object)x.spawnableObject.prefabToSpawn == (Object)(object)mapObject.outsideObject.spawnableObject.prefabToSpawn)) { List<SpawnableOutsideObjectWithRarity> list3 = val.spawnableOutsideObjects.ToList(); list3.RemoveAll((SpawnableOutsideObjectWithRarity x) => (Object)(object)x.spawnableObject.prefabToSpawn == (Object)(object)mapObject.outsideObject.spawnableObject.prefabToSpawn); val.spawnableOutsideObjects = list3.ToArray(); } SpawnableOutsideObjectWithRarity outsideObject = mapObject.outsideObject; if (mapObject.spawnRateFunction != null) { outsideObject.randomAmount = mapObject.spawnRateFunction(val); } List<SpawnableOutsideObjectWithRarity> list4 = val.spawnableOutsideObjects.ToList(); list4.Add(outsideObject); val.spawnableOutsideObjects = list4.ToArray(); if (Plugin.extendedLogging.Value) { Plugin.logger.LogInfo((object)("Added " + ((Object)outsideObject.spawnableObject.prefabToSpawn).name + " to " + name)); } } } } } public static void RegisterMapObject(SpawnableMapObjectDef mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterMapObject(mapObject.spawnableMapObject, levels, spawnRateFunction); } public static void RegisterMapObject(SpawnableMapObjectDef mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterMapObject(mapObject.spawnableMapObject, levels, levelOverrides, spawnRateFunction); } public static void RegisterMapObject(SpawnableMapObject mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { mapObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction }); } public static void RegisterMapObject(SpawnableMapObject mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { mapObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction, spawnLevelOverrides = levelOverrides }); } public static void RegisterOutsideObject(SpawnableOutsideObjectDef mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterOutsideObject(mapObject.spawnableMapObject, levels, spawnRateFunction); } public static void RegisterOutsideObject(SpawnableOutsideObjectDef mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { RegisterOutsideObject(mapObject.spawnableMapObject, levels, levelOverrides, spawnRateFunction); } public static void RegisterOutsideObject(SpawnableOutsideObjectWithRarity mapObject, Levels.LevelTypes levels, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { outsideObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction }); } public static void RegisterOutsideObject(SpawnableOutsideObjectWithRarity mapObject, Levels.LevelTypes levels = Levels.LevelTypes.None, string[] levelOverrides = null, Func<SelectableLevel, AnimationCurve> spawnRateFunction = null) { mapObjects.Add(new RegisteredMapObject { outsideObject = mapObject, levels = levels, spawnRateFunction = spawnRateFunction, spawnLevelOverrides = levelOverrides }); } public static void RemoveMapObject(SpawnableMapObjectDef mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { RemoveMapObject(mapObject.spawnableMapObject, levelFlags, levelOverrides); } public static void RemoveMapObject(SpawnableMapObject mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { SpawnableMapObject mapObject2 = mapObject; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { val.spawnableMapObjects = val.spawnableMapObjects.Where((SpawnableMapObject x) => (Object)(object)x.prefabToSpawn != (Object)(object)mapObject2.prefabToSpawn).ToArray(); } } } public static void RemoveOutsideObject(SpawnableOutsideObjectDef mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { RemoveOutsideObject(mapObject.spawnableMapObject, levelFlags, levelOverrides); } public static void RemoveOutsideObject(SpawnableOutsideObjectWithRarity mapObject, Levels.LevelTypes levelFlags, string[] levelOverrides = null) { SpawnableOutsideObjectWithRarity mapObject2 = mapObject; if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string name = ((Object)val).name; bool flag = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides?.Any((string item) => item.ToLowerInvariant() == name.ToLowerInvariant()) ?? false); if (levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name)) { flag = true; } if (!(Enum.IsDefined(typeof(Levels.LevelTypes), name) || flag)) { continue; } Levels.LevelTypes levelTypes = (flag ? Levels.LevelTypes.All : ((Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name))); if (flag || levelFlags.HasFlag(levelTypes)) { val.spawnableOutsideObjects = val.spawnableOutsideObjects.Where((SpawnableOutsideObjectWithRarity x) => (Object)(object)x.spawnableObject.prefabToSpawn != (Object)(object)mapObject2.spawnableObject.prefabToSpawn).ToArray(); } } } } public class NetworkPrefabs { [CompilerGenerated] private static class <>O { public static hook_Start <0>__GameNetworkManager_Start; } private static List<GameObject> _networkPrefabs = new List<GameObject>(); internal static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__GameNetworkManager_Start; if (obj == null) { hook_Start val = GameNetworkManager_Start; <>O.<0>__GameNetworkManager_Start = val; obj = (object)val; } GameNetworkManager.Start += (hook_Start)obj; } public static void RegisterNetworkPrefab(GameObject prefab) { if (!_networkPrefabs.Contains(prefab)) { _networkPrefabs.Add(prefab); } } public static GameObject CreateNetworkPrefab(string name) { GameObject obj = PrefabUtils.CreatePrefab(name); obj.AddComponent<NetworkObject>(); byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetCallingAssembly().GetName().Name + name)); obj.GetComponent<NetworkObject>().GlobalObjectIdHash = BitConverter.ToUInt32(value, 0); RegisterNetworkPrefab(obj); return obj; } public static GameObject CloneNetworkPrefab(GameObject prefabToClone, string newName = null) { GameObject val = PrefabUtils.ClonePrefab(prefabToClone, newName); byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetCallingAssembly().GetName().Name + ((Object)val).name)); val.GetComponent<NetworkObject>().GlobalObjectIdHash = BitConverter.ToUInt32(value, 0); RegisterNetworkPrefab(val); return val; } private static void GameNetworkManager_Start(orig_Start orig, GameNetworkManager self) { orig.Invoke(self); foreach (GameObject networkPrefab in _networkPrefabs) { if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(networkPrefab)) { NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } } } public class Player { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__StartOfRound_Awake; } public static Dictionary<string, GameObject> ragdollRefs = new Dictionary<string, GameObject>(); public static Dictionary<string, int> ragdollIndexes = new Dictionary<string, int>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__StartOfRound_Awake; if (obj == null) { hook_Awake val = StartOfRound_Awake; <>O.<0>__StartOfRound_Awake = val; obj = (object)val; } StartOfRound.Awake += (hook_Awake)obj; } private static void StartOfRound_Awake(orig_Awake orig, StartOfRound self) { orig.Invoke(self); foreach (KeyValuePair<string, GameObject> ragdollRef in ragdollRefs) { if (!self.playerRagdolls.Contains(ragdollRef.Value)) { self.playerRagdolls.Add(ragdollRef.Value); int value = self.playerRagdolls.Count - 1; if (ragdollIndexes.ContainsKey(ragdollRef.Key)) { ragdollIndexes[ragdollRef.Key] = value; } else { ragdollIndexes.Add(ragdollRef.Key, value); } } } } public static int GetRagdollIndex(string id) { return ragdollIndexes[id]; } public static GameObject GetRagdoll(string id) { return ragdollRefs[id]; } public static void RegisterPlayerRagdoll(string id, GameObject ragdoll) { Plugin.logger.LogInfo((object)("Registering player ragdoll " + id)); ragdollRefs.Add(id, ragdoll); } } public class PrefabUtils { internal static Lazy<GameObject> _prefabParent; internal static GameObject prefabParent => _prefabParent.Value; static PrefabUtils() { _prefabParent = new Lazy<GameObject>((Func<GameObject>)delegate { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown GameObject val = new GameObject("LethalLibGeneratedPrefabs") { hideFlags = (HideFlags)61 }; val.SetActive(false); return val; }); } public static GameObject ClonePrefab(GameObject prefabToClone, string newName = null) { GameObject val = Object.Instantiate<GameObject>(prefabToClone, prefabParent.transform); ((Object)val).hideFlags = (HideFlags)61; if (newName != null) { ((Object)val).name = newName; } else { ((Object)val).name = ((Object)prefabToClone).name; } return val; } public static GameObject CreatePrefab(string name) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown GameObject val = new GameObject(name) { hideFlags = (HideFlags)61 }; val.transform.SetParent(prefabParent.transform); return val; } } public class Shaders { public static void FixShaders(GameObject gameObject) { Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] materials = componentsInChildren[i].materials; foreach (Material val in materials) { if (((Object)val.shader).name.Contains("Standard")) { val.shader = Shader.Find("HDRP/Lit"); } } } } } public class TerminalUtils { public static TerminalKeyword CreateTerminalKeyword(string word, bool isVerb = false, CompatibleNoun[] compatibleNouns = null, TerminalNode specialKeywordResult = null, TerminalKeyword defaultVerb = null, bool accessTerminalObjects = false) { TerminalKeyword obj = ScriptableObject.CreateInstance<TerminalKeyword>(); ((Object)obj).name = word; obj.word = word; obj.isVerb = isVerb; obj.compatibleNouns = compatibleNouns; obj.specialKeywordResult = specialKeywordResult; obj.defaultVerb = defaultVerb; obj.accessTerminalObjects = accessTerminalObjects; return obj; } } public enum StoreType { None, ShipUpgrade, Decor } public class Unlockables { public class RegisteredUnlockable { public UnlockableItem unlockable; public StoreType StoreType; public TerminalNode buyNode1; public TerminalNode buyNode2; public TerminalNode itemInfo; public int price; public string modName; public bool disabled; public bool wasAlwaysInStock; public RegisteredUnlockable(UnlockableItem unlockable, TerminalNode buyNode1 = null, TerminalNode buyNode2 = null, TerminalNode itemInfo = null, int price = -1) { this.unlockable = unlockable; this.buyNode1 = buyNode1; this.buyNode2 = buyNode2; this.itemInfo = itemInfo; this.price = price; } } public struct BuyableUnlockableAssetInfo { public UnlockableItem itemAsset; public TerminalKeyword keyword; } [CompilerGenerated] private static class <>O { public static hook_Awake <0>__Terminal_Awake; public static hook_TextPostProcess <1>__Terminal_TextPostProcess; public static hook_RotateShipDecorSelection <2>__Terminal_RotateShipDecorSelection; } public static List<RegisteredUnlockable> registeredUnlockables = new List<RegisteredUnlockable>(); public static List<BuyableUnlockableAssetInfo> buyableUnlockableAssetInfos = new List<BuyableUnlockableAssetInfo>(); public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_005b: Expected O, but got Unknown object obj = <>O.<0>__Terminal_Awake; if (obj == null) { hook_Awake val = Terminal_Awake; <>O.<0>__Terminal_Awake = val; obj = (object)val; } Terminal.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__Terminal_TextPostProcess; if (obj2 == null) { hook_TextPostProcess val2 = Terminal_TextPostProcess; <>O.<1>__Terminal_TextPostProcess = val2; obj2 = (object)val2; } Terminal.TextPostProcess += (hook_TextPostProcess)obj2; object obj3 = <>O.<2>__Terminal_RotateShipDecorSelection; if (obj3 == null) { hook_RotateShipDecorSelection val3 = Terminal_RotateShipDecorSelection; <>O.<2>__Terminal_RotateShipDecorSelection = val3; obj3 = (object)val3; } Terminal.RotateShipDecorSelection += (hook_RotateShipDecorSelection)obj3; } private static void Terminal_RotateShipDecorSelection(orig_RotateShipDecorSelection orig, Terminal self) { foreach (RegisteredUnlockable registeredUnlockable in registeredUnlockables) { if (registeredUnlockable.StoreType == StoreType.Decor && registeredUnlockable.disabled) { registeredUnlockable.wasAlwaysInStock = registeredUnlockable.unlockable.alwaysInStock; registeredUnlockable.unlockable.alwaysInStock = true; } } orig.Invoke(self); foreach (RegisteredUnlockable registeredUnlockable2 in registeredUnlockables) { if (registeredUnlockable2.StoreType == StoreType.Decor && registeredUnlockable2.disabled) { registeredUnlockable2.unlockable.alwaysInStock = registeredUnlockable2.wasAlwaysInStock; } } } private static string Terminal_TextPostProcess(orig_TextPostProcess orig, Terminal self, string modifiedDisplayText, TerminalNode node) { if (modifiedDisplayText.Contains("[buyableItemsList]") && modifiedDisplayText.Contains("[unlockablesSelectionList]")) { int num = modifiedDisplayText.IndexOf(":"); foreach (RegisteredUnlockable registeredUnlockable in registeredUnlockables) { if (registeredUnlockable.StoreType == StoreType.ShipUpgrade && !registeredUnlockable.disabled) { string unlockableName = registeredUnlockable.unlockable.unlockableName; int price = registeredUnlockable.price; string value = $"\n* {unlockableName} // Price: ${price}"; modifiedDisplayText = modifiedDisplayText.Insert(num + 1, value); } } } return orig.Invoke(self, modifiedDisplayText, node); } private static void Terminal_Awake(orig_Awake orig, Terminal self) { //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Expected O, but got Unknown //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Expected O, but got Unknown //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Expected O, but got Unknown //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Expected O, but got Unknown StartOfR
plugins/LethalSDK.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using DunGen; using DunGen.Adapters; using GameNetcodeStuff; using LethalSDK.Component; using LethalSDK.ScriptableObjects; using LethalSDK.Utils; using Unity.Netcode; using UnityEditor; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LethalSDK")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalSDK")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4d234a4d-c807-438a-b717-4c6d77706054")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] public class AssetModificationProcessor : AssetPostprocessor { private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string assetPath in importedAssets) { ProcessAsset(assetPath); } foreach (string assetPath2 in movedAssets) { ProcessAsset(assetPath2); } } private static void ProcessAsset(string assetPath) { if (assetPath.Contains("NavMesh-Environment")) { AssetDatabase.RenameAsset(assetPath, (SelectionLogger.name != string.Empty) ? (SelectionLogger.name + "NavMesh") : "New NavMesh"); } if (assetPath.Contains("New Terrain")) { AssetDatabase.RenameAsset(assetPath, (SelectionLogger.name != string.Empty) ? SelectionLogger.name : "New Terrain"); } if (assetPath.ToLower().StartsWith("assets/mods/") && assetPath.Split(new char[1] { '/' }).Length > 3 && !assetPath.ToLower().EndsWith(".unity") && !assetPath.ToLower().Contains("/scenes")) { AssetImporter atPath = AssetImporter.GetAtPath(assetPath); if ((Object)(object)atPath != (Object)null) { string text2 = (atPath.assetBundleName = ExtractBundleNameFromPath(assetPath)); atPath.assetBundleVariant = "lem"; Debug.Log((object)(assetPath + " asset moved to " + text2 + " asset bundle.")); } if (assetPath != "Assets/Mods/" + assetPath.Replace("Assets/Mods/", string.Empty).RemoveNonAlphanumeric(4)) { AssetDatabase.MoveAsset(assetPath, "Assets/Mods/" + assetPath.Replace("Assets/Mods/", string.Empty).RemoveNonAlphanumeric(4)); } } else { AssetImporter atPath2 = AssetImporter.GetAtPath(assetPath); if ((Object)(object)atPath2 != (Object)null) { atPath2.assetBundleName = null; Debug.Log((object)(assetPath + " asset removed from asset bundle.")); } } } public static string ExtractBundleNameFromPath(string path) { string[] array = path.Split(new char[1] { '/' }); if (array.Length > 3) { return array[2].ToLower(); } return ""; } } [InitializeOnLoad] public class SelectionLogger { public static string name; static SelectionLogger() { Selection.selectionChanged = (Action)Delegate.Combine(Selection.selectionChanged, new Action(OnSelectionChanged)); } private static void OnSelectionChanged() { if ((Object)(object)Selection.activeGameObject != (Object)null) { name = ((Object)GetRootParent(Selection.activeGameObject)).name; } else { name = string.Empty; } } public static GameObject GetRootParent(GameObject obj) { if ((Object)(object)obj != (Object)null && (Object)(object)obj.transform.parent != (Object)null) { return GetRootParent(((Component)obj.transform.parent).gameObject); } return obj; } } [InitializeOnLoad] public class AssetBundleVariantAssigner { static AssetBundleVariantAssigner() { AssignVariantToAssetBundles(); } [InitializeOnLoadMethod] private static void AssignVariantToAssetBundles() { string[] allAssetBundleNames = AssetDatabase.GetAllAssetBundleNames(); string[] array = allAssetBundleNames; foreach (string text in array) { if (!text.Contains(".")) { string[] assetPathsFromAssetBundle = AssetDatabase.GetAssetPathsFromAssetBundle(text); string[] array2 = assetPathsFromAssetBundle; foreach (string text2 in array2) { AssetImporter.GetAtPath(text2).SetAssetBundleNameAndVariant(text, "lem"); } Debug.Log((object)("File extention added to AssetBundle: " + text)); } } AssetDatabase.SaveAssets(); string text3 = "Assets/AssetBundles"; if (!Directory.Exists(text3)) { Debug.LogError((object)("The folder doesn't exist : " + text3)); return; } string[] files = Directory.GetFiles(text3); string[] array3 = files; foreach (string text4 in array3) { if (Path.GetExtension(text4) == "" && Path.GetFileName(text4) != "AssetBundles") { string path = text4 + ".meta"; string text5 = text4 + ".manifest"; string path2 = text5 + ".meta"; File.Delete(text4); if (File.Exists(path)) { File.Delete(path); } if (File.Exists(text5)) { File.Delete(text5); } if (File.Exists(path2)) { File.Delete(path2); } Debug.Log((object)("File deleted : " + text4)); } } AssetDatabase.Refresh(); } } public class CubemapTextureBuilder : EditorWindow { private Texture2D[] textures = (Texture2D[])(object)new Texture2D[6]; private string[] labels = new string[6] { "Right", "Left", "Top", "Bottom", "Front", "Back" }; private TextureFormat[] HDRFormats; private Vector2Int[] placementRects; [MenuItem("LethalSDK/Cubemap Builder", false, 100)] public static void OpenWindow() { EditorWindow.GetWindow<CubemapTextureBuilder>(); } private Texture2D UpscaleTexture(Texture2D original, int targetWidth, int targetHeight) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) RenderTexture val = (RenderTexture.active = RenderTexture.GetTemporary(targetWidth, targetHeight)); Graphics.Blit((Texture)(object)original, val); Texture2D val2 = new Texture2D(targetWidth, targetHeight); val2.ReadPixels(new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), 0, 0); val2.Apply(); RenderTexture.ReleaseTemporary(val); return val2; } private void OnGUI() { //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected O, but got Unknown for (int i = 0; i < 6; i++) { ref Texture2D reference = ref textures[i]; Object obj = EditorGUILayout.ObjectField(labels[i], (Object)(object)textures[i], typeof(Texture2D), false, Array.Empty<GUILayoutOption>()); reference = (Texture2D)(object)((obj is Texture2D) ? obj : null); } if (!GUILayout.Button("Build Cubemap", Array.Empty<GUILayoutOption>())) { return; } if (textures.Any((Texture2D t) => (Object)(object)t == (Object)null)) { EditorUtility.DisplayDialog("Cubemap Builder Error", "One or more texture is missing.", "Ok"); return; } int size = ((Texture)textures[0]).width; if (textures.Any((Texture2D t) => ((Texture)t).width != size || ((Texture)t).height != size)) { EditorUtility.DisplayDialog("Cubemap Builder Error", "All the textures need to be the same size and square.", "Ok"); return; } bool flag = HDRFormats.Any((TextureFormat f) => f == textures[0].format); string[] array = textures.Select((Texture2D t) => AssetDatabase.GetAssetPath((Object)(object)t)).ToArray(); string text = EditorUtility.SaveFilePanel("Save Cubemap", Path.GetDirectoryName(array[0]), "Cubemap", flag ? "exr" : "png"); if (!string.IsNullOrEmpty(text)) { bool[] array2 = textures.Select((Texture2D t) => ((Texture)t).isReadable).ToArray(); TextureImporter[] array3 = array.Select(delegate(string p) { AssetImporter atPath2 = AssetImporter.GetAtPath(p); return (TextureImporter)(object)((atPath2 is TextureImporter) ? atPath2 : null); }).ToArray(); TextureImporter[] array4 = array3; foreach (TextureImporter val in array4) { val.isReadable = true; } AssetDatabase.Refresh(); string[] array5 = array; foreach (string text2 in array5) { AssetDatabase.ImportAsset(text2); } Texture2D val2 = new Texture2D(size * 4, size * 3, (TextureFormat)(flag ? 20 : 4), false); for (int l = 0; l < 6; l++) { val2.SetPixels(((Vector2Int)(ref placementRects[l])).x * size, ((Vector2Int)(ref placementRects[l])).y * size, size, size, textures[l].GetPixels(0)); } val2.Apply(false); byte[] bytes = (flag ? ImageConversion.EncodeToEXR(val2) : ImageConversion.EncodeToPNG(val2)); File.WriteAllBytes(text, bytes); Object.Destroy((Object)(object)val2); for (int m = 0; m < 6; m++) { array3[m].isReadable = array2[m]; } text = text.Remove(0, Application.dataPath.Length - 6); AssetDatabase.ImportAsset(text); AssetImporter atPath = AssetImporter.GetAtPath(text); TextureImporter val3 = (TextureImporter)(object)((atPath is TextureImporter) ? atPath : null); val3.textureShape = (TextureImporterShape)2; val3.sRGBTexture = false; val3.generateCubemap = (TextureImporterGenerateCubemap)5; string[] array6 = array; foreach (string text3 in array6) { AssetDatabase.ImportAsset(text3); } AssetDatabase.ImportAsset(text); AssetDatabase.Refresh(); } } public CubemapTextureBuilder() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) TextureFormat[] array = new TextureFormat[9]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); HDRFormats = (TextureFormat[])(object)array; placementRects = (Vector2Int[])(object)new Vector2Int[6] { new Vector2Int(2, 1), new Vector2Int(0, 1), new Vector2Int(1, 2), new Vector2Int(1, 0), new Vector2Int(1, 1), new Vector2Int(3, 1) }; ((EditorWindow)this)..ctor(); } } public class PlayerShip : MonoBehaviour { public readonly Vector3 shipPosition = new Vector3(-17.5f, 5.75f, -16.55f); private void Start() { Object.Destroy((Object)(object)this); } } [CustomEditor(typeof(PlayerShip))] public class PlayerShipEditor : Editor { public override void OnInspectorGUI() { //IL_001a: 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_0036: Unknown result type (might be due to invalid IL or missing references) ((Editor)this).OnInspectorGUI(); PlayerShip playerShip = (PlayerShip)(object)((Editor)this).target; if (((Component)playerShip).transform.position != playerShip.shipPosition) { ((Component)playerShip).transform.position = playerShip.shipPosition; } } } namespace LethalSDK.ScriptableObjects { [CreateAssetMenu(fileName = "AssetBank", menuName = "LethalSDK/Asset Bank")] public class AssetBank : ScriptableObject { [Header("Audio Clips")] [SerializeField] private AudioClipInfoPair[] _audioClips = new AudioClipInfoPair[0]; [SerializeField] private PlanetPrefabInfoPair[] _planetPrefabs = new PlanetPrefabInfoPair[0]; [SerializeField] private PrefabInfoPair[] _networkPrefabs = new PrefabInfoPair[0]; [HideInInspector] public string serializedAudioClips; [HideInInspector] public string serializedPlanetPrefabs; [HideInInspector] public string serializedNetworkPrefabs; private void OnValidate() { for (int i = 0; i < _audioClips.Length; i++) { _audioClips[i].AudioClipName = _audioClips[i].AudioClipName.RemoveNonAlphanumeric(1); _audioClips[i].AudioClipPath = _audioClips[i].AudioClipPath.RemoveNonAlphanumeric(4); } for (int j = 0; j < _planetPrefabs.Length; j++) { _planetPrefabs[j].PlanetPrefabName = _planetPrefabs[j].PlanetPrefabName.RemoveNonAlphanumeric(1); _planetPrefabs[j].PlanetPrefabPath = _planetPrefabs[j].PlanetPrefabPath.RemoveNonAlphanumeric(4); } for (int k = 0; k < _networkPrefabs.Length; k++) { _networkPrefabs[k].PrefabName = _networkPrefabs[k].PrefabName.RemoveNonAlphanumeric(1); _networkPrefabs[k].PrefabPath = _networkPrefabs[k].PrefabPath.RemoveNonAlphanumeric(4); } serializedAudioClips = string.Join(";", _audioClips.Select((AudioClipInfoPair p) => ((p.AudioClipName.Length != 0) ? p.AudioClipName : (((Object)(object)p.AudioClip != (Object)null) ? ((Object)p.AudioClip).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.AudioClip))); serializedPlanetPrefabs = string.Join(";", _planetPrefabs.Select((PlanetPrefabInfoPair p) => ((p.PlanetPrefabName.Length != 0) ? p.PlanetPrefabName : (((Object)(object)p.PlanetPrefab != (Object)null) ? ((Object)p.PlanetPrefab).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.PlanetPrefab))); serializedNetworkPrefabs = string.Join(";", _networkPrefabs.Select((PrefabInfoPair p) => ((p.PrefabName.Length != 0) ? p.PrefabName : (((Object)(object)p.Prefab != (Object)null) ? ((Object)p.Prefab).name : "")) + "," + AssetDatabase.GetAssetPath((Object)(object)p.Prefab))); } public AudioClipInfoPair[] AudioClips() { if (serializedAudioClips != null) { return (from s in serializedAudioClips.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new AudioClipInfoPair(split[0], split[1])).ToArray(); } return new AudioClipInfoPair[0]; } public bool HaveAudioClip(string audioClipName) { if (serializedAudioClips != null) { return AudioClips().Any((AudioClipInfoPair a) => a.AudioClipName == audioClipName); } return false; } public string AudioClipPath(string audioClipName) { if (serializedAudioClips != null) { return AudioClips().First((AudioClipInfoPair c) => c.AudioClipName == audioClipName).AudioClipPath; } return string.Empty; } public Dictionary<string, string> AudioClipsDictionary() { if (serializedAudioClips != null) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); AudioClipInfoPair[] audioClips = _audioClips; for (int i = 0; i < audioClips.Length; i++) { AudioClipInfoPair audioClipInfoPair = audioClips[i]; dictionary.Add(audioClipInfoPair.AudioClipName, audioClipInfoPair.AudioClipPath); } return dictionary; } return new Dictionary<string, string>(); } public PlanetPrefabInfoPair[] PlanetPrefabs() { if (serializedPlanetPrefabs != null) { return (from s in serializedPlanetPrefabs.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new PlanetPrefabInfoPair(split[0], split[1])).ToArray(); } return new PlanetPrefabInfoPair[0]; } public bool HavePlanetPrefabs(string planetPrefabName) { if (serializedPlanetPrefabs != null) { return PlanetPrefabs().Any((PlanetPrefabInfoPair a) => a.PlanetPrefabName == planetPrefabName); } return false; } public string PlanetPrefabsPath(string planetPrefabName) { if (serializedPlanetPrefabs != null) { return PlanetPrefabs().First((PlanetPrefabInfoPair c) => c.PlanetPrefabName == planetPrefabName).PlanetPrefabPath; } return string.Empty; } public Dictionary<string, string> PlanetPrefabsDictionary() { if (serializedPlanetPrefabs != null) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); PlanetPrefabInfoPair[] planetPrefabs = _planetPrefabs; for (int i = 0; i < planetPrefabs.Length; i++) { PlanetPrefabInfoPair planetPrefabInfoPair = planetPrefabs[i]; dictionary.Add(planetPrefabInfoPair.PlanetPrefabName, planetPrefabInfoPair.PlanetPrefabPath); } return dictionary; } return new Dictionary<string, string>(); } public PrefabInfoPair[] NetworkPrefabs() { if (serializedNetworkPrefabs != null) { return (from s in serializedNetworkPrefabs.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new PrefabInfoPair(split[0], split[1])).ToArray(); } return new PrefabInfoPair[0]; } public bool HaveNetworkPrefabs(string networkPrefabName) { if (serializedNetworkPrefabs != null) { return NetworkPrefabs().Any((PrefabInfoPair a) => a.PrefabName == networkPrefabName); } return false; } public string NetworkPrefabsPath(string networkPrefabName) { if (serializedNetworkPrefabs != null) { return NetworkPrefabs().First((PrefabInfoPair c) => c.PrefabName == networkPrefabName).PrefabPath; } return string.Empty; } public Dictionary<string, string> NetworkPrefabsDictionary() { if (serializedNetworkPrefabs != null) { Dictionary<string, string> dictionary = new Dictionary<string, string>(); PrefabInfoPair[] networkPrefabs = _networkPrefabs; for (int i = 0; i < networkPrefabs.Length; i++) { PrefabInfoPair prefabInfoPair = networkPrefabs[i]; dictionary.Add(prefabInfoPair.PrefabName, prefabInfoPair.PrefabPath); } return dictionary; } return new Dictionary<string, string>(); } } [CreateAssetMenu(fileName = "ModManifest", menuName = "LethalSDK/Mod Manifest")] public class ModManifest : ScriptableObject { public string modName = "New Mod"; [Space] [SerializeField] private SerializableVersion version = new SerializableVersion(0, 0, 0, 0); [HideInInspector] public string serializedVersion; [Space] public string author = "Author"; [Space] [TextArea(5, 15)] public string description = "Mod Description"; [Space] [Header("Content")] public Scrap[] scraps = new Scrap[0]; public Moon[] moons = new Moon[0]; [Space] public AssetBank assetBank; private void OnValidate() { serializedVersion = version.ToString(); } public SerializableVersion GetVersion() { int[] array = ((serializedVersion != null) ? serializedVersion.Split(new char[1] { '.' }).Select(int.Parse).ToArray() : new int[4]); return new SerializableVersion(array[0], array[1], array[2], array[3]); } } [CreateAssetMenu(fileName = "New Moon", menuName = "LethalSDK/Moon")] public class Moon : ScriptableObject { public string MoonName = "NewMoon"; public string[] RequiredBundles; public string[] IncompatibleBundles; public bool IsEnabled = true; public bool IsHidden = false; public bool IsLocked = false; [Header("Info")] public string OrbitPrefabName = "Moon1"; public bool SpawnEnemiesAndScrap = true; public string PlanetName = "New Moon"; public GameObject MainPrefab; [TextArea(5, 15)] public string PlanetDescription; [TextArea(5, 15)] public string PlanetLore; public VideoClip PlanetVideo; public string RiskLevel = "X"; [Range(0f, 16f)] public float TimeToArrive = 1f; [Header("Time")] [Range(0.1f, 5f)] public float DaySpeedMultiplier = 1f; public bool PlanetHasTime = true; [SerializeField] private RandomWeatherPair[] _RandomWeatherTypes = new RandomWeatherPair[6] { new RandomWeatherPair(LevelWeatherType.None, 0, 0), new RandomWeatherPair(LevelWeatherType.Rainy, 0, 0), new RandomWeatherPair(LevelWeatherType.Stormy, 1, 0), new RandomWeatherPair(LevelWeatherType.Foggy, 1, 0), new RandomWeatherPair(LevelWeatherType.Flooded, -4, 5), new RandomWeatherPair(LevelWeatherType.Eclipsed, 1, 0) }; public bool OverwriteWeather = false; public LevelWeatherType OverwriteWeatherType = LevelWeatherType.None; [Header("Route")] public string RouteWord = "newmoon"; public int RoutePrice; public string BoughtComment = "Please enjoy your flight."; [Header("Dungeon")] [Range(1f, 5f)] public float FactorySizeMultiplier = 1f; public int FireExitsAmountOverwrite = 1; [SerializeField] private DungeonFlowPair[] _DungeonFlowTypes = new DungeonFlowPair[2] { new DungeonFlowPair(0, 300), new DungeonFlowPair(1, 1) }; [SerializeField] private SpawnableScrapPair[] _SpawnableScrap = new SpawnableScrapPair[19] { new SpawnableScrapPair("Cog1", 80), new SpawnableScrapPair("EnginePart1", 90), new SpawnableScrapPair("FishTestProp", 12), new SpawnableScrapPair("MetalSheet", 88), new SpawnableScrapPair("FlashLaserPointer", 4), new SpawnableScrapPair("BigBolt", 80), new SpawnableScrapPair("BottleBin", 19), new SpawnableScrapPair("Ring", 3), new SpawnableScrapPair("SteeringWheel", 32), new SpawnableScrapPair("MoldPan", 5), new SpawnableScrapPair("EggBeater", 10), new SpawnableScrapPair("PickleJar", 10), new SpawnableScrapPair("DustPan", 32), new SpawnableScrapPair("Airhorn", 3), new SpawnableScrapPair("ClownHorn", 3), new SpawnableScrapPair("CashRegister", 3), new SpawnableScrapPair("Candy", 2), new SpawnableScrapPair("GoldBar", 1), new SpawnableScrapPair("YieldSign", 6) }; public string[] spawnableScrapBlacklist = new string[0]; [Range(0f, 100f)] public int MinScrap = 8; [Range(0f, 100f)] public int MaxScrap = 12; public string LevelAmbienceClips = "Level1TypeAmbience"; [Range(0f, 30f)] public int MaxEnemyPowerCount = 4; [SerializeField] private SpawnableEnemiesPair[] _Enemies = new SpawnableEnemiesPair[8] { new SpawnableEnemiesPair("Centipede", 51), new SpawnableEnemiesPair("SandSpider", 58), new SpawnableEnemiesPair("HoarderBug", 28), new SpawnableEnemiesPair("Flowerman", 13), new SpawnableEnemiesPair("Crawler", 16), new SpawnableEnemiesPair("Blob", 31), new SpawnableEnemiesPair("DressGirl", 1), new SpawnableEnemiesPair("Puffer", 28) }; public AnimationCurve EnemySpawnChanceThroughoutDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0015411376953125,\"value\":-3.0,\"inSlope\":19.556997299194337,\"outSlope\":19.556997299194337,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.12297855317592621},{\"serializedVersion\":\"3\",\"time\":0.4575331211090088,\"value\":4.796203136444092,\"inSlope\":24.479534149169923,\"outSlope\":24.479534149169923,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.396077424287796,\"outWeight\":0.35472238063812258},{\"serializedVersion\":\"3\",\"time\":0.7593884468078613,\"value\":4.973001480102539,\"inSlope\":2.6163148880004885,\"outSlope\":2.6163148880004885,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.2901076376438141,\"outWeight\":0.5360636115074158},{\"serializedVersion\":\"3\",\"time\":1.0,\"value\":15.0,\"inSlope\":35.604026794433597,\"outSlope\":35.604026794433597,\"tangentMode\":0,\"weightedMode\":1,\"inWeight\":0.04912583902478218,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"); [Range(0f, 30f)] public float SpawnProbabilityRange = 4f; [Header("Outside")] [SerializeField] private SpawnableMapObjectPair[] _SpawnableMapObjects = new SpawnableMapObjectPair[2] { new SpawnableMapObjectPair("Landmine", spawnFacingAwayFromWall: false, CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":-0.003082275390625,\"value\":0.0,\"inSlope\":0.23179344832897187,\"outSlope\":0.23179344832897187,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27936428785324099},{\"serializedVersion\":\"3\",\"time\":0.8171924352645874,\"value\":1.7483322620391846,\"inSlope\":7.064207077026367,\"outSlope\":7.064207077026367,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.2631833553314209,\"outWeight\":0.6898177862167358},{\"serializedVersion\":\"3\",\"time\":1.0002186298370362,\"value\":11.760997772216797,\"inSlope\":968.80810546875,\"outSlope\":968.80810546875,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.029036391526460649,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableMapObjectPair("TurretContainer", spawnFacingAwayFromWall: true, CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.354617178440094,\"outSlope\":0.354617178440094,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9190289974212647,\"value\":1.0005745887756348,\"inSlope\":Infinity,\"outSlope\":1.7338485717773438,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.6534967422485352},{\"serializedVersion\":\"3\",\"time\":1.0038425922393799,\"value\":7.198680877685547,\"inSlope\":529.4945068359375,\"outSlope\":529.4945068359375,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.14589552581310273,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")) }; [SerializeField] private SpawnableOutsideObjectPair[] _SpawnableOutsideObjects = new SpawnableOutsideObjectPair[7] { new SpawnableOutsideObjectPair("LargeRock1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.7571572661399841,\"value\":0.6448163986206055,\"inSlope\":2.974250078201294,\"outSlope\":2.974250078201294,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.3333333432674408},{\"serializedVersion\":\"3\",\"time\":0.9995536804199219,\"value\":5.883961200714111,\"inSlope\":65.30631256103516,\"outSlope\":65.30631256103516,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.12097536772489548,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("LargeRock2", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.7562879920005798,\"value\":1.2308543920516968,\"inSlope\":5.111926555633545,\"outSlope\":5.111926555633545,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.21955738961696626},{\"serializedVersion\":\"3\",\"time\":1.0010795593261719,\"value\":7.59307336807251,\"inSlope\":92.0470199584961,\"outSlope\":92.0470199584961,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.05033162236213684,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("LargeRock3", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9964686632156372,\"value\":2.0009398460388185,\"inSlope\":6.82940673828125,\"outSlope\":6.82940673828125,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.06891261041164398,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("LargeRock4", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0},{\"serializedVersion\":\"3\",\"time\":0.9635604619979858,\"value\":2.153383493423462,\"inSlope\":6.251225471496582,\"outSlope\":6.251225471496582,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.07428120821714401,\"outWeight\":0.3333333432674408},{\"serializedVersion\":\"3\",\"time\":0.9995394349098206,\"value\":5.0,\"inSlope\":15.746581077575684,\"outSlope\":15.746581077575684,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.06317413598299027,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("TreeLeafless1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.776531994342804,\"value\":6.162014007568359,\"inSlope\":30.075166702270509,\"outSlope\":30.075166702270509,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.15920747816562653,\"outWeight\":0.5323987007141113},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":38.093849182128909,\"inSlope\":1448.839111328125,\"outSlope\":1448.839111328125,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0620061457157135,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("SmallGreyRocks1", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.802714467048645,\"value\":1.5478605031967164,\"inSlope\":9.096116065979004,\"outSlope\":9.096116065979004,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.15920747816562653,\"outWeight\":0.58766108751297},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":14.584033966064454,\"inSlope\":1244.9173583984375,\"outSlope\":1244.9173583984375,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.054620321840047839,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")), new SpawnableOutsideObjectPair("GiantPumpkin", CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":0.0,\"inSlope\":1.6912956237792969,\"outSlope\":1.6912956237792969,\"tangentMode\":0,\"weightedMode\":2,\"inWeight\":0.0,\"outWeight\":0.27726083993911745},{\"serializedVersion\":\"3\",\"time\":0.8832725882530212,\"value\":0.5284063816070557,\"inSlope\":3.2962090969085695,\"outSlope\":29.38977813720703,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.19772815704345704,\"outWeight\":0.8989489078521729},{\"serializedVersion\":\"3\",\"time\":0.972209095954895,\"value\":6.7684478759765629,\"inSlope\":140.27394104003907,\"outSlope\":140.27394104003907,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.39466607570648196,\"outWeight\":0.47049039602279665},{\"serializedVersion\":\"3\",\"time\":1.0002281665802003,\"value\":23.0,\"inSlope\":579.3037109375,\"outSlope\":14.8782377243042,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.648808479309082,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}")) }; [Range(0f, 30f)] public int MaxOutsideEnemyPowerCount = 8; [Range(0f, 30f)] public int MaxDaytimeEnemyPowerCount = 5; [SerializeField] private SpawnableEnemiesPair[] _OutsideEnemies = new SpawnableEnemiesPair[3] { new SpawnableEnemiesPair("MouthDog", 75), new SpawnableEnemiesPair("ForestGiant", 0), new SpawnableEnemiesPair("SandWorm", 56) }; [SerializeField] private SpawnableEnemiesPair[] _DaytimeEnemies = new SpawnableEnemiesPair[3] { new SpawnableEnemiesPair("RedLocustBees", 22), new SpawnableEnemiesPair("Doublewing", 74), new SpawnableEnemiesPair("DocileLocustBees", 52) }; public AnimationCurve OutsideEnemySpawnChanceThroughDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":-7.736962288618088e-7,\"value\":-2.996999979019165,\"inSlope\":Infinity,\"outSlope\":0.5040292143821716,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.0,\"outWeight\":0.08937685936689377},{\"serializedVersion\":\"3\",\"time\":0.7105481624603272,\"value\":-0.6555822491645813,\"inSlope\":9.172262191772461,\"outSlope\":9.172262191772461,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.3333333432674408,\"outWeight\":0.7196550369262695},{\"serializedVersion\":\"3\",\"time\":1.0052626132965088,\"value\":5.359400749206543,\"inSlope\":216.42247009277345,\"outSlope\":11.374387741088868,\"tangentMode\":0,\"weightedMode\":3,\"inWeight\":0.044637180864810947,\"outWeight\":0.48315444588661196}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"); public AnimationCurve DaytimeEnemySpawnChanceThroughDay = CurveContainer.DeserializeCurve("{\"curve\":{\"serializedVersion\":\"2\",\"m_Curve\":[{\"serializedVersion\":\"3\",\"time\":0.0,\"value\":2.2706568241119386,\"inSlope\":-7.500085353851318,\"outSlope\":-7.500085353851318,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.3333333432674408,\"outWeight\":0.20650266110897065},{\"serializedVersion\":\"3\",\"time\":0.38507816195487978,\"value\":-0.0064108967781066898,\"inSlope\":-2.7670974731445314,\"outSlope\":-2.7670974731445314,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.28388944268226626,\"outWeight\":0.30659767985343935},{\"serializedVersion\":\"3\",\"time\":0.6767024993896484,\"value\":-7.021658420562744,\"inSlope\":-27.286888122558595,\"outSlope\":-27.286888122558595,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.10391546785831452,\"outWeight\":0.12503522634506226},{\"serializedVersion\":\"3\",\"time\":0.9998173117637634,\"value\":-14.818100929260254,\"inSlope\":0.0,\"outSlope\":0.0,\"tangentMode\":0,\"weightedMode\":0,\"inWeight\":0.0,\"outWeight\":0.0}],\"m_PreInfinity\":2,\"m_PostInfinity\":2,\"m_RotationOrder\":4}}"); [Range(0f, 30f)] public float DaytimeEnemiesProbabilityRange = 5f; public bool LevelIncludesSnowFootprints = false; [HideInInspector] public string serializedRandomWeatherTypes; [HideInInspector] public string serializedDungeonFlowTypes; [HideInInspector] public string serializedSpawnableScrap; [HideInInspector] public string serializedEnemies; [HideInInspector] public string serializedOutsideEnemies; [HideInInspector] public string serializedDaytimeEnemies; [HideInInspector] public string serializedSpawnableMapObjects; [HideInInspector] public string serializedSpawnableOutsideObjects; private void OnValidate() { RequiredBundles = RequiredBundles.RemoveNonAlphanumeric(1); IncompatibleBundles = IncompatibleBundles.RemoveNonAlphanumeric(1); MoonName = MoonName.RemoveNonAlphanumeric(1); OrbitPrefabName = OrbitPrefabName.RemoveNonAlphanumeric(1); RiskLevel = RiskLevel.RemoveNonAlphanumeric(); RouteWord = RouteWord.RemoveNonAlphanumeric(2); BoughtComment = BoughtComment.RemoveNonAlphanumeric(); LevelAmbienceClips = LevelAmbienceClips.RemoveNonAlphanumeric(1); TimeToArrive = Mathf.Clamp(TimeToArrive, 0f, 16f); DaySpeedMultiplier = Mathf.Clamp(DaySpeedMultiplier, 0.1f, 5f); RoutePrice = Mathf.Clamp(RoutePrice, 0, int.MaxValue); FactorySizeMultiplier = Mathf.Clamp(FactorySizeMultiplier, 1f, 5f); FireExitsAmountOverwrite = Mathf.Clamp(FireExitsAmountOverwrite, 0, 20); MinScrap = Mathf.Clamp(MinScrap, 0, MaxScrap); MaxScrap = Mathf.Clamp(MaxScrap, MinScrap, 100); MaxEnemyPowerCount = Mathf.Clamp(MaxEnemyPowerCount, 0, 30); MaxOutsideEnemyPowerCount = Mathf.Clamp(MaxOutsideEnemyPowerCount, 0, 30); MaxDaytimeEnemyPowerCount = Mathf.Clamp(MaxDaytimeEnemyPowerCount, 0, 30); SpawnProbabilityRange = Mathf.Clamp(SpawnProbabilityRange, 0f, 30f); DaytimeEnemiesProbabilityRange = Mathf.Clamp(DaytimeEnemiesProbabilityRange, 0f, 30f); for (int i = 0; i < _SpawnableScrap.Length; i++) { _SpawnableScrap[i].ObjectName = _SpawnableScrap[i].ObjectName.RemoveNonAlphanumeric(1); } for (int j = 0; j < _Enemies.Length; j++) { _Enemies[j].EnemyName = _Enemies[j].EnemyName.RemoveNonAlphanumeric(1); } for (int k = 0; k < _SpawnableMapObjects.Length; k++) { _SpawnableMapObjects[k].ObjectName = _SpawnableMapObjects[k].ObjectName.RemoveNonAlphanumeric(1); } for (int l = 0; l < _SpawnableOutsideObjects.Length; l++) { _SpawnableOutsideObjects[l].ObjectName = _SpawnableOutsideObjects[l].ObjectName.RemoveNonAlphanumeric(1); } for (int m = 0; m < _OutsideEnemies.Length; m++) { _OutsideEnemies[m].EnemyName = _OutsideEnemies[m].EnemyName.RemoveNonAlphanumeric(1); } for (int n = 0; n < _DaytimeEnemies.Length; n++) { _DaytimeEnemies[n].EnemyName = _DaytimeEnemies[n].EnemyName.RemoveNonAlphanumeric(1); } serializedRandomWeatherTypes = string.Join(";", _RandomWeatherTypes.Select((RandomWeatherPair p) => $"{(int)p.Weather},{p.WeatherVariable1},{p.WeatherVariable2}")); serializedDungeonFlowTypes = string.Join(";", _DungeonFlowTypes.Select((DungeonFlowPair p) => $"{p.ID},{p.Rarity}")); serializedSpawnableScrap = string.Join(";", _SpawnableScrap.Select((SpawnableScrapPair p) => $"{p.ObjectName},{p.SpawnWeight}")); serializedEnemies = string.Join(";", _Enemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}")); serializedOutsideEnemies = string.Join(";", _OutsideEnemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}")); serializedDaytimeEnemies = string.Join(";", _DaytimeEnemies.Select((SpawnableEnemiesPair p) => $"{p.EnemyName},{p.SpawnWeight}")); serializedSpawnableMapObjects = string.Join(";", _SpawnableMapObjects.Select((SpawnableMapObjectPair p) => $"{p.ObjectName}|{p.SpawnFacingAwayFromWall}|{CurveContainer.SerializeCurve(p.SpawnRate)}")); serializedSpawnableOutsideObjects = string.Join(";", _SpawnableOutsideObjects.Select((SpawnableOutsideObjectPair p) => p.ObjectName + "|" + CurveContainer.SerializeCurve(p.SpawnRate))); } public RandomWeatherPair[] RandomWeatherTypes() { return (from s in serializedRandomWeatherTypes.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 3 select new RandomWeatherPair((LevelWeatherType)int.Parse(split[0]), int.Parse(split[1]), int.Parse(split[2]))).ToArray(); } public DungeonFlowPair[] DungeonFlowTypes() { return (from s in serializedDungeonFlowTypes.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new DungeonFlowPair(int.Parse(split[0]), int.Parse(split[1]))).ToArray(); } public SpawnableScrapPair[] SpawnableScrap() { return (from s in serializedSpawnableScrap.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableScrapPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableEnemiesPair[] Enemies() { return (from s in serializedEnemies.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableEnemiesPair[] OutsideEnemies() { return (from s in serializedOutsideEnemies.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableEnemiesPair[] DaytimeEnemies() { return (from s in serializedDaytimeEnemies.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new SpawnableEnemiesPair(split[0], int.Parse(split[1]))).ToArray(); } public SpawnableMapObjectPair[] SpawnableMapObjects() { return (from s in serializedSpawnableMapObjects.Split(new char[1] { ';' }) select s.Split(new char[1] { '|' }) into split where split.Length == 3 select new SpawnableMapObjectPair(split[0], bool.Parse(split[1]), CurveContainer.DeserializeCurve(split[2]))).ToArray(); } public SpawnableOutsideObjectPair[] SpawnableOutsideObjects() { return (from s in serializedSpawnableOutsideObjects.Split(new char[1] { ';' }) select s.Split(new char[1] { '|' }) into split where split.Length == 2 select new SpawnableOutsideObjectPair(split[0], CurveContainer.DeserializeCurve(split[1]))).ToArray(); } } [CreateAssetMenu(fileName = "New Scrap", menuName = "LethalSDK/Scrap")] public class Scrap : ScriptableObject { public string[] RequiredBundles; public string[] IncompatibleBundles; [Header("Base")] public ScrapType scrapType = ScrapType.Normal; public string itemName = string.Empty; public int minValue = 0; public int maxValue = 0; public bool twoHanded = false; public GrabAnim HandedAnimation = GrabAnim.OneHanded; public bool requiresBattery = false; public bool isConductiveMetal = false; public int weight = 0; public GameObject prefab; [Header("Sounds")] public string grabSFX = string.Empty; public string dropSFX = string.Empty; [Header("Offsets")] public float verticalOffset = 0f; public Vector3 restingRotation = Vector3.zero; public Vector3 positionOffset = Vector3.zero; public Vector3 rotationOffset = Vector3.zero; [Header("Variants")] public Mesh[] meshVariants = (Mesh[])(object)new Mesh[0]; public Material[] materialVariants = (Material[])(object)new Material[0]; [Header("Spawn rate")] public bool useGlobalSpawnWeight = true; [Range(0f, 100f)] public int globalSpawnWeight = 10; [SerializeField] private ScrapSpawnChancePerScene[] _perPlanetSpawnWeight = new ScrapSpawnChancePerScene[9] { new ScrapSpawnChancePerScene("41 Experimentation", 10), new ScrapSpawnChancePerScene("220 Assurance", 10), new ScrapSpawnChancePerScene("56 Vow", 10), new ScrapSpawnChancePerScene("21 Offense", 10), new ScrapSpawnChancePerScene("61 March", 10), new ScrapSpawnChancePerScene("85 Rend", 10), new ScrapSpawnChancePerScene("7 Dine", 10), new ScrapSpawnChancePerScene("8 Titan", 10), new ScrapSpawnChancePerScene("Others", 10) }; public string[] playetSpawnBlacklist = new string[0]; [Header("Shovel")] public int shovelHitForce = 1; public AudioSource shovelAudio; public string reelUp = "ShovelReelUp"; public string swing = "ShovelSwing"; public string[] hitSFX = new string[2] { "ShovelHitDefault", "ShovelHitDefault2" }; [Header("Flashlight")] public bool usingPlayerHelmetLight = false; public int flashlightInterferenceLevel = 0; public Light flashlightBulb; public Light flashlightBulbGlow; public AudioSource flashlightAudio; public string[] flashlightClips = new string[1] { "FlashlightClick" }; public string outOfBatteriesClip = "FlashlightOutOfBatteries"; public string flashlightFlicker = "FlashlightFlicker"; public Material bulbLight; public Material bulbDark; public MeshRenderer flashlightMesh; public int flashlightTypeID = 0; public bool changeMaterial = true; [Header("Noisemaker")] public AudioSource noiseAudio; public AudioSource noiseAudioFar; public string[] noiseSFX = new string[1] { "ClownHorn1" }; public string[] noiseSFXFar = new string[1] { "ClownHornFar" }; public float noiseRange = 60f; public float maxLoudness = 1f; public float minLoudness = 0.6f; public float minPitch = 0.93f; public float maxPitch = 1f; public Animator triggerAnimator; [Header("WhoopieCushion")] public AudioSource whoopieCushionAudio; public string[] fartAudios = new string[4] { "Fart1", "Fart2", "Fart3", "Fart5" }; [HideInInspector] public string serializedData; private void OnValidate() { RequiredBundles = RequiredBundles.RemoveNonAlphanumeric(1); IncompatibleBundles = IncompatibleBundles.RemoveNonAlphanumeric(1); itemName = itemName.RemoveNonAlphanumeric(1); grabSFX = grabSFX.RemoveNonAlphanumeric(1); dropSFX = dropSFX.RemoveNonAlphanumeric(1); for (int i = 0; i < _perPlanetSpawnWeight.Length; i++) { _perPlanetSpawnWeight[i].SceneName = _perPlanetSpawnWeight[i].SceneName.RemoveNonAlphanumeric(1); } serializedData = string.Join(";", _perPlanetSpawnWeight.Select((ScrapSpawnChancePerScene p) => $"{p.SceneName},{p.SpawnWeight}")); } public ScrapSpawnChancePerScene[] perPlanetSpawnWeight() { return (from s in serializedData.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new ScrapSpawnChancePerScene(split[0], int.Parse(split[1]))).ToArray(); } } public enum ScrapType { Normal, Shovel, Flashlight, Noisemaker, WhoopieCushion } public enum GrabAnim { OneHanded, TwoHanded, Shotgun, Jetpack, Clipboard } } namespace LethalSDK.Utils { public static class AssetGatherDialog { public static Dictionary<string, AudioClip> audioClips = new Dictionary<string, AudioClip>(); public static Dictionary<string, (AudioMixer, AudioMixerGroup[])> audioMixers = new Dictionary<string, (AudioMixer, AudioMixerGroup[])>(); public static Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>(); } [Serializable] public class SerializableVersion { public int Major = 1; public int Minor = 0; public int Build = 0; public int Revision = 0; public SerializableVersion(int major, int minor, int build, int revision) { Major = major; Minor = minor; Build = build; Revision = revision; } public Version ToVersion() { return new Version(Major, Minor, Build, Revision); } public override string ToString() { return $"{Major}.{Minor}.{Build}.{Revision}"; } } [Serializable] public class CurveContainer { public AnimationCurve curve; public static string SerializeCurve(AnimationCurve curve) { CurveContainer curveContainer = new CurveContainer { curve = curve }; return JsonUtility.ToJson((object)curveContainer); } public static AnimationCurve DeserializeCurve(string json) { CurveContainer curveContainer = JsonUtility.FromJson<CurveContainer>(json); return curveContainer.curve; } } public static class NetworkDataManager { public static Dictionary<ulong, SI_NetworkData> NetworkData = new Dictionary<ulong, SI_NetworkData>(); } public class SI_NetworkData : NetworkBehaviour { public StringStringPair[] data = new StringStringPair[0]; [HideInInspector] public string serializedData = string.Empty; public string datacache = string.Empty; public UnityEvent dataChangeEvent = new UnityEvent(); public void Start() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (dataChangeEvent != null) { dataChangeEvent.AddListener(new UnityAction(OnDataChanged)); } } public void Update() { if (datacache != serializedData && dataChangeEvent != null) { dataChangeEvent.Invoke(); } } public override void OnNetworkSpawn() { NetworkDataManager.NetworkData.Add(((NetworkBehaviour)this).NetworkObjectId, this); } public override void OnNetworkDespawn() { NetworkDataManager.NetworkData.Remove(((NetworkBehaviour)this).NetworkObjectId); } public virtual void OnDataChanged() { datacache = serializedData; } public override void OnDestroy() { if (dataChangeEvent != null) { ((UnityEventBase)dataChangeEvent).RemoveAllListeners(); } } public virtual StringStringPair[] getData() { return (from s in serializedData.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new StringStringPair(split[0], split[1])).ToArray(); } public virtual void setData(string datastring) { if (!Enumerable.Contains(datastring, ',')) { Debug.LogWarning((object)"Invalid datastring format."); } else { serializedData = datastring; } } public virtual void setData(StringStringPair[] dataarray) { string source = string.Join(";", dataarray.Select((StringStringPair p) => p._string1 + "," + p._string2)); if (!Enumerable.Contains(source, ',')) { Debug.LogWarning((object)"Invalid datastring format."); } else { serializedData = source; } } public virtual void addData(string datastring) { if (!Enumerable.Contains(datastring, ',')) { Debug.LogWarning((object)"Invalid datastring format."); return; } serializedData += datastring; serializedData = serializedData.Replace(";;", string.Empty); if (serializedData.StartsWith(";")) { serializedData = serializedData.Substring(1); } if (serializedData.EndsWith(";")) { serializedData = serializedData.Substring(0, serializedData.Length - 1); } } public virtual void addData(StringStringPair[] dataarray) { string text = string.Join(";", dataarray.Select((StringStringPair p) => p._string1 + "," + p._string2)).Insert(0, ";"); if (!Enumerable.Contains(text, ',')) { Debug.LogWarning((object)"Invalid datastring format."); return; } serializedData += text; serializedData = serializedData.Replace(";;", string.Empty); if (serializedData.StartsWith(";")) { serializedData = serializedData.Substring(1); } if (serializedData.EndsWith(";")) { serializedData = serializedData.Substring(0, serializedData.Length - 1); } } public virtual void delData(string datastring) { if (!Enumerable.Contains(datastring, ',')) { Debug.LogWarning((object)"Invalid datastring format."); return; } if (!serializedData.Contains(datastring)) { Debug.Log((object)"Datastring doesn't exist in serializedData."); return; } serializedData = serializedData.Replace(datastring, string.Empty); serializedData = serializedData.Replace(";;", string.Empty); if (serializedData.StartsWith(";")) { serializedData = serializedData.Substring(1); } if (serializedData.EndsWith(";")) { serializedData = serializedData.Substring(0, serializedData.Length - 1); } } public virtual void delData(StringStringPair[] dataarray) { string text = string.Join(";", dataarray.Select((StringStringPair p) => p._string1 + "," + p._string2)).Insert(0, ";"); if (!Enumerable.Contains(text, ',')) { Debug.LogWarning((object)"Invalid datastring format."); return; } if (!serializedData.Contains(text)) { Debug.Log((object)"Datastring doesn't exist in serializedData."); return; } serializedData = serializedData.Replace(text, string.Empty); serializedData = serializedData.Replace(";;", string.Empty); if (serializedData.StartsWith(";")) { serializedData = serializedData.Substring(1); } if (serializedData.EndsWith(";")) { serializedData = serializedData.Substring(0, serializedData.Length - 1); } } } [Serializable] public struct StringIntPair { public string _string; public int _int; public StringIntPair(string _string, int _int) { this._string = _string.RemoveNonAlphanumeric(1); this._int = Mathf.Clamp(_int, 0, 100); } } [Serializable] public struct StringStringPair { public string _string1; public string _string2; public StringStringPair(string _string1, string _string2) { this._string1 = _string1.RemoveNonAlphanumeric(1); this._string2 = _string2.RemoveNonAlphanumeric(1); } } [Serializable] public struct IntIntPair { public int _int1; public int _int2; public IntIntPair(int _int1, int _int2) { this._int1 = _int1; this._int2 = _int2; } } [Serializable] public struct DungeonFlowPair { public int ID; [Range(0f, 300f)] public int Rarity; public DungeonFlowPair(int id, int rarity) { ID = id; Rarity = Mathf.Clamp(rarity, 0, 300); } } [Serializable] public struct SpawnableScrapPair { public string ObjectName; [Range(0f, 100f)] public int SpawnWeight; public SpawnableScrapPair(string objectName, int spawnWeight) { ObjectName = objectName.RemoveNonAlphanumeric(1); SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100); } } [Serializable] public struct SpawnableMapObjectPair { public string ObjectName; public bool SpawnFacingAwayFromWall; public AnimationCurve SpawnRate; public SpawnableMapObjectPair(string objectName, bool spawnFacingAwayFromWall, AnimationCurve spawnRate) { ObjectName = objectName.RemoveNonAlphanumeric(1); SpawnFacingAwayFromWall = spawnFacingAwayFromWall; SpawnRate = spawnRate; } } [Serializable] public struct SpawnableOutsideObjectPair { public string ObjectName; public AnimationCurve SpawnRate; public SpawnableOutsideObjectPair(string objectName, AnimationCurve spawnRate) { ObjectName = objectName.RemoveNonAlphanumeric(1); SpawnRate = spawnRate; } } [Serializable] public struct SpawnableEnemiesPair { public string EnemyName; [Range(0f, 100f)] public int SpawnWeight; public SpawnableEnemiesPair(string enemyName, int spawnWeight) { EnemyName = enemyName.RemoveNonAlphanumeric(1); SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100); } } [Serializable] public struct ScrapSpawnChancePerScene { public string SceneName; [Range(0f, 100f)] public int SpawnWeight; public ScrapSpawnChancePerScene(string sceneName, int spawnWeight) { SceneName = sceneName.RemoveNonAlphanumeric(1); SpawnWeight = Mathf.Clamp(spawnWeight, 0, 100); } } [Serializable] public struct ScrapInfoPair { public string ScrapPath; public Scrap Scrap; public ScrapInfoPair(string scrapPath, Scrap scrap) { ScrapPath = scrapPath.RemoveNonAlphanumeric(4); Scrap = scrap; } } [Serializable] public struct AudioClipInfoPair { public string AudioClipName; [HideInInspector] public string AudioClipPath; [SerializeField] public AudioClip AudioClip; public AudioClipInfoPair(string audioClipName, string audioClipPath) { AudioClipName = audioClipName.RemoveNonAlphanumeric(1); AudioClipPath = audioClipPath.RemoveNonAlphanumeric(4); AudioClip = null; } } [Serializable] public struct PlanetPrefabInfoPair { public string PlanetPrefabName; [HideInInspector] public string PlanetPrefabPath; [SerializeField] public GameObject PlanetPrefab; public PlanetPrefabInfoPair(string planetPrefabName, string planetPrefabPath) { PlanetPrefabName = planetPrefabName.RemoveNonAlphanumeric(1); PlanetPrefabPath = planetPrefabPath.RemoveNonAlphanumeric(4); PlanetPrefab = null; } } [Serializable] public struct PrefabInfoPair { public string PrefabName; [HideInInspector] public string PrefabPath; [SerializeField] public GameObject Prefab; public PrefabInfoPair(string prefabName, string prefabPath) { PrefabName = prefabName.RemoveNonAlphanumeric(1); PrefabPath = prefabPath.RemoveNonAlphanumeric(4); Prefab = null; } } [Serializable] public struct RandomWeatherPair { public LevelWeatherType Weather; [Tooltip("Thunder Frequency, Flooding speed or minimum initial enemies in eclipses")] public int WeatherVariable1; [Tooltip("Flooding offset when Weather is Flooded")] public int WeatherVariable2; public RandomWeatherPair(LevelWeatherType weather, int weatherVariable1, int weatherVariable2) { Weather = weather; WeatherVariable1 = weatherVariable1; WeatherVariable2 = weatherVariable2; } } public enum LevelWeatherType { None = -1, DustClouds, Rainy, Stormy, Foggy, Flooded, Eclipsed } public class SpawnPrefab { private static SpawnPrefab _instance; public GameObject waterSurface; public static SpawnPrefab Instance { get { if (_instance == null) { _instance = new SpawnPrefab(); } return _instance; } } } public static class TypeExtensions { public enum removeType { Normal, Serializable, Keyword, Path, SerializablePath } public static readonly Dictionary<removeType, string> regexes = new Dictionary<removeType, string> { { removeType.Normal, "[^a-zA-Z0-9 ,.!?_-]" }, { removeType.Serializable, "[^a-zA-Z0-9 .!_-]" }, { removeType.Keyword, "[^a-zA-Z0-9._-]" }, { removeType.Path, "[^a-zA-Z0-9 ,.!_/-]" }, { removeType.SerializablePath, "[^a-zA-Z0-9 .!_/-]" } }; public static string RemoveNonAlphanumeric(this string input) { if (input != null) { return Regex.Replace(input, regexes[removeType.Normal], string.Empty); } return string.Empty; } public static string[] RemoveNonAlphanumeric(this string[] input) { if (input != null) { for (int i = 0; i < input.Length; i++) { input[i] = Regex.Replace(input[i], regexes[removeType.Normal], string.Empty); } return input; } return new string[0]; } public static string RemoveNonAlphanumeric(this string input, removeType removeType = removeType.Normal) { if (input != null) { return Regex.Replace(input, regexes[removeType], string.Empty); } return string.Empty; } public static string[] RemoveNonAlphanumeric(this string[] input, removeType removeType = removeType.Normal) { if (input != null) { for (int i = 0; i < input.Length; i++) { input[i] = Regex.Replace(input[i], regexes[removeType], string.Empty); } return input; } return new string[0]; } public static string RemoveNonAlphanumeric(this string input, int removeType = 0) { if (input != null) { return Regex.Replace(input, regexes[(removeType)removeType], string.Empty); } return string.Empty; } public static string[] RemoveNonAlphanumeric(this string[] input, int removeType = 0) { if (input != null) { for (int i = 0; i < input.Length; i++) { input[i] = Regex.Replace(input[i], regexes[(removeType)removeType], string.Empty); } return input; } return new string[0]; } } } namespace LethalSDK.Editor { internal class CopyrightsWindow : EditorWindow { private Vector2 scrollPosition; private readonly Dictionary<string, string> assetAuthorList = new Dictionary<string, string> { { "Drop Ship assets, Sun cycle animations, ScrapItem sprite, ScavengerSuit Textures/Arms Mesh and MonitorWall mesh", "Zeekerss" }, { "SDK Scripts, Sun Texture, CrossButton Sprite (Inspired of vanilla), OldSeaPort planet prefab texture", "HolographicWings" }, { "Old Sea Port asset package", "VIVID Arts" }, { "Survival Game Tools asset package", "cookiepopworks.com" } }; [MenuItem("LethalSDK/Copyrights", false, 999)] public static void ShowWindow() { EditorWindow.GetWindow<CopyrightsWindow>("Copyrights"); } private void OnGUI() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("List of Copyrights", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>()); scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>()); EditorGUILayout.Space(5f); foreach (KeyValuePair<string, string> assetAuthor in assetAuthorList) { GUILayout.Label("Asset: " + assetAuthor.Key + " - By: " + assetAuthor.Value, EditorStyles.wordWrappedLabel, Array.Empty<GUILayoutOption>()); EditorGUILayout.Space(2f); } EditorGUILayout.Space(5f); GUILayout.Label("This SDK do not embed any Vanilla script.", Array.Empty<GUILayoutOption>()); GUILayout.EndScrollView(); } } public class EditorChecker : Editor { public override void OnInspectorGUI() { ((Editor)this).DrawDefaultInspector(); } } [CustomEditor(typeof(ModManifest))] public class ModManifestEditor : EditorChecker { public override void OnInspectorGUI() { ModManifest modManifest = (ModManifest)(object)((Editor)this).target; if (modManifest.serializedVersion == "0.0.0.0") { EditorGUILayout.HelpBox("Please define a version to your mod and don't forget to increment it at each update.", (MessageType)2); } if (modManifest.modName == null || modManifest.modName.Length == 0) { EditorGUILayout.HelpBox("Your mod need a name.", (MessageType)3); } IEnumerable<string> enumerable = from e in modManifest.scraps.Where((Scrap e) => (Object)(object)e != (Object)null).ToList() group e by e.itemName into g where g.Count() > 1 select g.Key; if (enumerable.Any()) { string text = string.Empty; foreach (string item in enumerable) { text = text + item + ","; } text = text.Remove(text.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Scraps. Duplicated Scraps are: " + text, (MessageType)2); } IEnumerable<string> enumerable2 = from e in modManifest.moons.Where((Moon e) => (Object)(object)e != (Object)null).ToList() group e by e.MoonName into g where g.Count() > 1 select g.Key; if (enumerable2.Any()) { string text2 = string.Empty; foreach (string item2 in enumerable2) { text2 = text2 + item2 + ","; } text2 = text2.Remove(text2.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Moons. Duplicated Moons are: " + text2, (MessageType)2); } string text3 = string.Empty; Scrap[] scraps = modManifest.scraps; foreach (Scrap scrap in scraps) { if ((Object)(object)scrap != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest))) { text3 = text3 + ((Object)scrap).name + ","; } } Moon[] moons = modManifest.moons; foreach (Moon moon in moons) { if ((Object)(object)moon != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest))) { text3 = text3 + ((Object)moon).name + ","; } } if (text3 != null && text3.Length > 0) { text3 = text3.Remove(text3.Length - 1); EditorGUILayout.HelpBox("You try to register a Scrap or a Moon from another mod folder. " + text3, (MessageType)2); } if ((Object)(object)modManifest.assetBank != (Object)null && AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest.assetBank)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)modManifest))) { EditorGUILayout.HelpBox("You try to register an AssetBank from another mod folder.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(AssetBank))] public class AssetBankEditor : EditorChecker { public override void OnInspectorGUI() { AssetBank assetBank = (AssetBank)(object)((Editor)this).target; IEnumerable<string> enumerable = from e in (from e in assetBank.AudioClips() where e.AudioClipName != null && e.AudioClipName.Length > 0 select e).ToList() group e by e.AudioClipName into g where g.Count() > 1 select g.Key; if (enumerable.Any()) { string text = string.Empty; foreach (string item in enumerable) { text = text + item + ","; } text = text.Remove(text.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Audio Clip. Duplicated Clips are: " + text, (MessageType)2); } IEnumerable<string> enumerable2 = from e in (from e in assetBank.PlanetPrefabs() where e.PlanetPrefabName != null && e.PlanetPrefabName.Length > 0 select e).ToList() group e by e.PlanetPrefabName into g where g.Count() > 1 select g.Key; if (enumerable2.Any()) { string text2 = string.Empty; foreach (string item2 in enumerable2) { text2 = text2 + item2 + ","; } text2 = text2.Remove(text2.Length - 1); EditorGUILayout.HelpBox("You are trying to register two times or more the same Planet Prefabs. Duplicated Planet Prefabs are: " + text2, (MessageType)2); } string text3 = string.Empty; AudioClipInfoPair[] array = assetBank.AudioClips(); for (int i = 0; i < array.Length; i++) { AudioClipInfoPair audioClipInfoPair = array[i]; if (audioClipInfoPair.AudioClipName != null && audioClipInfoPair.AudioClipName.Length > 0 && AssetModificationProcessor.ExtractBundleNameFromPath(audioClipInfoPair.AudioClipPath) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)assetBank))) { text3 = text3 + audioClipInfoPair.AudioClipName + ","; } } PlanetPrefabInfoPair[] array2 = assetBank.PlanetPrefabs(); for (int j = 0; j < array2.Length; j++) { PlanetPrefabInfoPair planetPrefabInfoPair = array2[j]; if (planetPrefabInfoPair.PlanetPrefabName != null && planetPrefabInfoPair.PlanetPrefabName.Length > 0 && AssetModificationProcessor.ExtractBundleNameFromPath(planetPrefabInfoPair.PlanetPrefabPath) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)assetBank))) { text3 = text3 + planetPrefabInfoPair.PlanetPrefabName + ","; } } if (text3 != null && text3.Length > 0) { text3 = text3.Remove(text3.Length - 1); EditorGUILayout.HelpBox("You try to register an Audio Clip or a Planet Prefab from another mod folder. " + text3, (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_DungeonGenerator))] public class SI_DungeonGeneratorEditor : EditorChecker { public override void OnInspectorGUI() { SI_DungeonGenerator sI_DungeonGenerator = (SI_DungeonGenerator)(object)((Editor)this).target; string assetPath = AssetDatabase.GetAssetPath((Object)(object)sI_DungeonGenerator.DungeonRoot); if (assetPath != null && assetPath.Length > 0) { EditorGUILayout.HelpBox("Dungeon Root must be in the scene.", (MessageType)3); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_ScanNode))] public class SI_ScanNodeEditor : EditorChecker { public override void OnInspectorGUI() { SI_ScanNode sI_ScanNode = (SI_ScanNode)(object)((Editor)this).target; if (sI_ScanNode.MinRange > sI_ScanNode.MaxRange) { EditorGUILayout.HelpBox("Min Range must be smaller than Max Ranger.", (MessageType)3); } if (sI_ScanNode.CreatureScanID < -1) { EditorGUILayout.HelpBox("Creature Scan ID can't be less than -1.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_AnimatedSun))] public class SI_AnimatedSunEditor : EditorChecker { public override void OnInspectorGUI() { SI_AnimatedSun sI_AnimatedSun = (SI_AnimatedSun)(object)((Editor)this).target; if ((Object)(object)sI_AnimatedSun.directLight == (Object)null || (Object)(object)sI_AnimatedSun.indirectLight == (Object)null) { EditorGUILayout.HelpBox("A direct and an indirect light must be defined.", (MessageType)2); } if ((Object)(object)((Component)sI_AnimatedSun.directLight).transform.parent != (Object)(object)((Component)sI_AnimatedSun).transform || (Object)(object)((Component)sI_AnimatedSun.indirectLight).transform.parent != (Object)(object)((Component)sI_AnimatedSun).transform) { EditorGUILayout.HelpBox("Direct and an indirect light must be a child of the AnimatedSun in the hierarchy.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_EntranceTeleport))] public class SI_EntranceTeleportEditor : EditorChecker { public override void OnInspectorGUI() { SI_EntranceTeleport sI_EntranceTeleport = (SI_EntranceTeleport)(object)((Editor)this).target; IEnumerable<int> enumerable = from e in Object.FindObjectsOfType<SI_EntranceTeleport>().ToList() group e by e.EntranceID into g where g.Count() > 1 select g.Key; if (enumerable.Any()) { string text = string.Empty; foreach (int item in enumerable) { text += $"{item},"; } text = text.Remove(text.Length - 1); EditorGUILayout.HelpBox("Two entrances or more have same Entrance ID. Duplicated entrances are: " + text, (MessageType)2); } if ((Object)(object)sI_EntranceTeleport.EntrancePoint == (Object)null) { EditorGUILayout.HelpBox("An entrance point must be defined.", (MessageType)3); } if (sI_EntranceTeleport.AudioReverbPreset < 0) { EditorGUILayout.HelpBox("Audio Reverb Preset can't be negative.", (MessageType)3); } base.OnInspectorGUI(); } } [CustomEditor(typeof(Scrap))] public class ScrapEditor : EditorChecker { public override void OnInspectorGUI() { Scrap scrap = (Scrap)(object)((Editor)this).target; if ((Object)(object)scrap.prefab == (Object)null) { EditorGUILayout.HelpBox("You must add a Prefab to your Scrap.", (MessageType)1); } else { if ((Object)(object)scrap.prefab.GetComponent<NetworkObject>() == (Object)null) { EditorGUILayout.HelpBox("The Prefab must have a NetworkObject.", (MessageType)3); } else { NetworkObject component = scrap.prefab.GetComponent<NetworkObject>(); string text = string.Empty; if (component.AlwaysReplicateAsRoot) { text += "\n- AlwaysReplicateAsRoot should be false."; } if (!component.SynchronizeTransform) { text += "\n- SynchronizeTransform should be true."; } if (component.ActiveSceneSynchronization) { text += "\n- ActiveSceneSynchronization should be false."; } if (!component.SceneMigrationSynchronization) { text += "\n- SceneMigrationSynchronization should be true."; } if (!component.SpawnWithObservers) { text += "\n- SpawnWithObservers should be true."; } if (!component.DontDestroyWithOwner) { text += "\n- DontDestroyWithOwner should be true."; } if (component.AutoObjectParentSync) { text += "\n- AutoObjectParentSync should be false."; } if (text.Length > 0) { EditorGUILayout.HelpBox("The NetworkObject of the Prefab have incorrect settings: " + text, (MessageType)2); } } if ((Object)(object)scrap.prefab.transform.Find("ScanNode") == (Object)null) { EditorGUILayout.HelpBox("The Prefab don't have a ScanNode.", (MessageType)2); } if (AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap.prefab)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)scrap))) { EditorGUILayout.HelpBox("The Prefab must come from the same mod folder as your Scrap.", (MessageType)2); } } if (scrap.itemName == null || scrap.itemName.Length == 0) { EditorGUILayout.HelpBox("Your scrap must have a Name.", (MessageType)3); } if (!scrap.useGlobalSpawnWeight && !scrap.perPlanetSpawnWeight().Any((ScrapSpawnChancePerScene w) => w.SceneName != null && w.SceneName.Length > 0)) { EditorGUILayout.HelpBox("Your scrap use Per Planet Spawn Weight but no planet are defined.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(Moon))] public class MoonEditor : EditorChecker { public override void OnInspectorGUI() { Moon moon = (Moon)(object)((Editor)this).target; if (moon.MoonName == null || moon.MoonName.Length == 0) { EditorGUILayout.HelpBox("Your moon must have a Name.", (MessageType)3); } if (moon.PlanetName == null || moon.PlanetName.Length == 0) { EditorGUILayout.HelpBox("Your moon must have a Planet Name.", (MessageType)3); } if (moon.RouteWord == null || moon.RouteWord.Length < 3) { EditorGUILayout.HelpBox("Your moon route word must be at least 3 characters long.", (MessageType)3); } if ((Object)(object)moon.MainPrefab == (Object)null) { EditorGUILayout.HelpBox("You must add a Main Prefab to your Scrap.", (MessageType)1); } else if (AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon.MainPrefab)) != AssetModificationProcessor.ExtractBundleNameFromPath(AssetDatabase.GetAssetPath((Object)(object)moon))) { EditorGUILayout.HelpBox("The Main Prefab must come from the same mod folder as your Moon.", (MessageType)2); } base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_DoorLock))] public class SI_DoorLockEditor : EditorChecker { public override void OnInspectorGUI() { SI_DoorLock sI_DoorLock = (SI_DoorLock)(object)((Editor)this).target; EditorGUILayout.HelpBox("DoorLock is not implemented yet.", (MessageType)1); base.OnInspectorGUI(); } } [CustomEditor(typeof(SI_Ladder))] public class SI_LadderEditor : EditorChecker { public override void OnInspectorGUI() { SI_Ladder sI_Ladder = (SI_Ladder)(object)((Editor)this).target; EditorGUILayout.HelpBox("Ladder is experimental.", (MessageType)1); base.OnInspectorGUI(); } } [InitializeOnLoad] [CustomEditor(typeof(TerrainChecker))] public class TerrainCheckerEditor : EditorChecker { static TerrainCheckerEditor() { Selection.selectionChanged = (Action)Delegate.Combine(Selection.selectionChanged, new Action(OnSelectionChanged)); } private static void OnSelectionChanged() { if (Object.op_Implicit((Object)(object)Selection.activeGameObject) && Object.op_Implicit((Object)(object)Selection.activeGameObject.GetComponent<Terrain>())) { Terrain component = Selection.activeGameObject.GetComponent<Terrain>(); if (!Object.op_Implicit((Object)(object)((Component)component).gameObject.GetComponent<TerrainChecker>())) { ((Component)component).gameObject.AddComponent<TerrainChecker>(); } } } public override void OnInspectorGUI() { TerrainChecker terrainChecker = (TerrainChecker)(object)((Editor)this).target; if ((Object)(object)terrainChecker.terrain != (Object)null) { int num = 1024; if ((terrainChecker.terrain.renderingLayerMask & num) == 0) { EditorGUILayout.HelpBox("Quicksand will not show on this terrain, to fix you must enable the '10: Decal Layer 2' in Terrain Settings > Rendering Layer Mask.", (MessageType)2); } if ((Object)(object)terrainChecker.terrain.materialTemplate != (Object)null && ((Object)terrainChecker.terrain.materialTemplate.shader).name != "HDRP/UpdatedTerrainLit") { EditorGUILayout.HelpBox("To use Terrain Holes, you must change the material of the terrain with another one that use the HDRP/UpdatedTerrainLit shader in Terrain Settings > Basic Terrain > Material.", (MessageType)1); } if (!terrainChecker.terrain.drawInstanced) { EditorGUILayout.HelpBox("For performances with a lot of trees, grass and other details, it's recommended to enable Terrain Settings > Basic Terrain > Draw Instanced.", (MessageType)1); } } } } internal class OldAssetsRemover { private static readonly List<string> assetPaths = new List<string> { "Assets/LethalCompanyAssets", "Assets/Mods/LethalExpansion/Audio", "Assets/Mods/LethalExpansion/AudioMixerController", "Assets/Mods/LethalExpansion/Materials/Default.mat", "Assets/Mods/LethalExpansion/Prefabs/Settings", "Assets/Mods/LethalExpansion/Prefabs/EntranceTeleportA.prefab", "Assets/Mods/LethalExpansion/Prefabs/Prefabs.zip", "Assets/Mods/LethalExpansion/Scenes/ItemPlaceTest", "Assets/Mods/LethalExpansion/Sprites/HandIcon.png", "Assets/Mods/LethalExpansion/Sprites/HandIconPoint.png", "Assets/Mods/LethalExpansion/Sprites/HandLadderIcon.png", "Assets/Mods/TemplateMod/Moons/NavMesh-Environment.asset", "Assets/Mods/TemplateMod/Moons/OldSeaPort.asset", "Assets/Mods/TemplateMod/Moons/Sky and Fog Global Volume Profile.asset", "Assets/Mods/TemplateMod/Moons/Sky and Fog Global Volume Profile 1.asset", "Assets/Mods/TemplateMod/AssetBank.asset", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunCompanyLevel.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeB.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeBEclipse.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeBStormy.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeC.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeCEclipse.anim", "Assets/Mods/LethalExpansion/Animations/Sun/TimeOfDaySunTypeCStormy.anim", "Assets/Mods/LethalExpansion/Skybox", "Assets/Mods/LethalExpansion/Sprites/XButton.png", "Assets/Mods/LethalExpansion/Textures/sunTexture1.png", "Assets/Mods/OldSeaPort/Materials/Maple_bark_1.mat", "Assets/Mods/OldSeaPort/Materials/maple_leaves.mat", "Assets/Mods/TemplateMod/AssetBank.asset", "Assets/Mods/OldSeaPort/EffectExamples/Shared/Scripts", "Assets/Mods/OldSeaPort/scenes", "Assets/Mods/OldSeaPort/prefabs/Plane (12).prefab", "Assets/Mods/LethalExpansion/Meshes/labyrinth.fbx", "Assets/Mods/ChristmasVillage/christmas-assets-free/fbx/Materials" }; [InitializeOnLoadMethod] public static void CheckOldAssets() { foreach (string assetPath in assetPaths) { if (AssetDatabase.IsValidFolder(assetPath)) { DeleteFolder(assetPath); } else if ((Object)(object)AssetDatabase.LoadAssetAtPath<GameObject>(assetPath) != (Object)null) { DeleteAsset(assetPath); } } } private static void DeleteFolder(string path) { if (AssetDatabase.DeleteAsset(path)) { Debug.Log((object)("Deleted folder at: " + path)); } else { Debug.LogError((object)("Failed to delete folder at: " + path)); } } private static void DeleteAsset(string path) { if (AssetDatabase.DeleteAsset(path)) { Debug.Log((object)("Deleted asset at: " + path)); } else { Debug.LogError((object)("Failed to delete asset at: " + path)); } } } public class VersionChecker : Editor { [InitializeOnLoadMethod] public static void CheckVersion() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown UnityWebRequest www = UnityWebRequest.Get("https://raw.githubusercontent.com/HolographicWings/LethalSDK-Unity-Project/main/last.txt"); UnityWebRequestAsyncOperation operation = www.SendWebRequest(); CallbackFunction callback = null; callback = (CallbackFunction)delegate { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (((AsyncOperation)operation).isDone) { EditorApplication.update = (CallbackFunction)Delegate.Remove((Delegate?)(object)EditorApplication.update, (Delegate?)(object)callback); OnRequestComplete(www); } }; EditorApplication.update = (CallbackFunction)Delegate.Combine((Delegate?)(object)EditorApplication.update, (Delegate?)(object)callback); } private static void OnRequestComplete(UnityWebRequest www) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 if ((int)www.result == 2 || (int)www.result == 3) { Debug.LogError((object)("Error when getting last version number: " + www.error)); } else { CompareVersions(www.downloadHandler.text); } } private static void CompareVersions(string onlineVersion) { if (Version.Parse(PlayerSettings.bundleVersion) < Version.Parse(onlineVersion) && EditorUtility.DisplayDialogComplex("Warning", "The SDK is not up to date: " + onlineVersion, "Update", "Ignore", "") == 0) { Application.OpenURL("https://thunderstore.io/c/lethal-company/p/HolographicWings/LethalSDK/"); } } } internal class LethalSDKCategory : EditorWindow { [MenuItem("LethalSDK/Lethal SDK v1.3.0", false, 0)] public static void ShowWindow() { } } public class Lethal_AssetBundleBuilderWindow : EditorWindow { private enum compressionOption { NormalCompression, FastCompression, Uncompressed } private static string assetBundleDirectoryKey = "LethalSDK_AssetBundleBuilderWindow_assetBundleDirectory"; private static string compressionModeKey = "LethalSDK_AssetBundleBuilderWindow_compressionMode"; private static string _64BitsModeKey = "LethalSDK_AssetBundleBuilderWindow_64BitsMode"; private string assetBundleDirectory = string.Empty; private compressionOption compressionMode = compressionOption.NormalCompression; private bool _64BitsMode; [MenuItem("LethalSDK/AssetBundle Builder", false, 100)] public static void ShowWindow() { //IL_0017: 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) Lethal_AssetBundleBuilderWindow window = EditorWindow.GetWindow<Lethal_AssetBundleBuilderWindow>("AssetBundle Builder"); ((EditorWindow)window).minSize = new Vector2(295f, 133f); ((EditorWindow)window).maxSize = new Vector2(295f, 133f); window.LoadPreferences(); } private void OnGUI() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown GUILayout.Label("Base Settings", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); EditorGUILayout.LabelField(new GUIContent("Output Path", "The directory where the asset bundles will be saved."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(84f) }); assetBundleDirectory = EditorGUILayout.TextField(assetBundleDirectory, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); GUILayout.EndHorizontal(); EditorGUILayout.Space(5f); GUILayout.Label("Options", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); EditorGUILayout.LabelField(new GUIContent("Compression Mode", "Select the compression option for the asset bundle. Faster the compression is, faster the assets will load and less CPU it will use, but the Bundle will be bigger."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(145f) }); compressionMode = (compressionOption)(object)EditorGUILayout.EnumPopup((Enum)compressionMode, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); EditorGUILayout.LabelField(new GUIContent("64 Bits Asset Bundle (Not recommended)", "Better performances but incompatible with 32 bits computers."), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(270f) }); _64BitsMode = EditorGUILayout.Toggle(_64BitsMode, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); EditorGUILayout.Space(5f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Build AssetBundles", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) })) { BuildAssetBundles(); } if (GUILayout.Button("Reset", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) })) { ClearPreferences(); } GUILayout.EndHorizontal(); } private void ClearPreferences() { EditorPrefs.DeleteKey(assetBundleDirectoryKey); EditorPrefs.DeleteKey(compressionModeKey); EditorPrefs.DeleteKey(_64BitsModeKey); LoadPreferences(); } private void BuildAssetBundles() { //IL_0022: 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_004b: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (!Directory.Exists(assetBundleDirectory)) { Directory.CreateDirectory(assetBundleDirectory); } BuildAssetBundleOptions val = (BuildAssetBundleOptions)0; val = (BuildAssetBundleOptions)(compressionMode switch { compressionOption.NormalCompression => 0, compressionOption.FastCompression => 256, compressionOption.Uncompressed => 1, _ => 0, }); BuildTarget val2 = (BuildTarget)(_64BitsMode ? 19 : 5); if (assetBundleDirectory != null || assetBundleDirectory.Length != 0 || assetBundleDirectory != string.Empty) { AssetBundleManifest val3 = null; try { val3 = BuildPipeline.BuildAssetBundles(assetBundleDirectory, val, val2); } catch (Exception ex) { Debug.LogError((object)ex.Message); } if ((Object)(object)val3 != (Object)null) { Debug.Log((object)"AssetBundles built successfully."); } else { Debug.LogError((object)"Cannot build AssetBundles."); } } else { Debug.LogError((object)"AssetBundles path cannot be blank."); } } private void OnLostFocus() { SavePreferences(); } private void OnDisable() { SavePreferences(); } private void LoadPreferences() { assetBundleDirectory = EditorPrefs.GetString(assetBundleDirectoryKey, "Assets/AssetBundles"); compressionMode = (compressionOption)EditorPrefs.GetInt(compressionModeKey, 0); _64BitsMode = EditorPrefs.GetBool(_64BitsModeKey, false); } private void SavePreferences() { EditorPrefs.SetString(assetBundleDirectoryKey, assetBundleDirectory); EditorPrefs.SetInt(compressionModeKey, (int)compressionMode); EditorPrefs.SetBool(_64BitsModeKey, _64BitsMode); } } [RequireComponent(typeof(Terrain))] public class TerrainChecker : MonoBehaviour { [HideInInspector] public Terrain terrain; private void OnDrawGizmosSelected() { terrain = ((Component)this).GetComponent<Terrain>(); } private void Awake() { Object.Destroy((Object)(object)this); } } } namespace LethalSDK.Component { [AddComponentMenu("LethalSDK/DamagePlayer")] public class SI_DamagePlayer : MonoBehaviour { public bool kill = false; public bool dontSpawnBody = false; public SI_CauseOfDeath causeOfDeath = SI_CauseOfDeath.Gravity; public int damages = 25; public int numberIterations = 1; public int iterationCooldown = 1000; public int warmupCooldown = 0; public UnityEvent postEvent = new UnityEvent(); public void Trigger(object player) { if (kill) { ((MonoBehaviour)this).StartCoroutine(Kill(player)); } else { ((MonoBehaviour)this).StartCoroutine(Damage(player)); } } public IEnumerator Kill(object player) { yield return (object)new WaitForSeconds((float)warmupCooldown / 1000f); ((PlayerControllerB)((player is PlayerControllerB) ? player : null)).KillPlayer(Vector3.zero, !dontSpawnBody, (CauseOfDeath)causeOfDeath, 0); postEvent.Invoke(); } public IEnumerator Damage(object player) { yield return (object)new WaitForSeconds((float)warmupCooldown / 1000f); int iteration = 0; while (iteration < numberIterations || numberIterations == -1) { ((PlayerControllerB)((player is PlayerControllerB) ? player : null)).DamagePlayer(damages, true, true, (CauseOfDeath)causeOfDeath, 0, false, Vector3.zero); postEvent.Invoke(); iteration++; yield return (object)new WaitForSeconds((float)iterationCooldown / 1000f); } } public void StopCounter(object player) { ((MonoBehaviour)this).StopAllCoroutines(); } } [AddComponentMenu("LethalSDK/SoundYDistance")] public class SI_SoundYDistance : MonoBehaviour { public AudioSource audioSource; public int maxDistance = 50; public void Awake() { if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.GetComponent<AudioSource>(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); } } } public void Update() { //IL_0032: 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) if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)StartOfRound.Instance != (Object)null) { audioSource.volume = 1f - Mathf.Abs(((Component)this).transform.position.y - ((Component)RoundManager.Instance.playersManager.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[((NetworkBehaviour)StartOfRound.Instance).NetworkManager.LocalClientId]].gameplayCamera).transform.position.y) / (float)maxDistance; } } } [AddComponentMenu("LethalSDK/AudioOutputInterface")] public class SI_AudioOutputInterface : MonoBehaviour { public AudioSource audioSource; public string mixerName = "Diagetic"; public string mixerGroupName = "Master"; public void Awake() { if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.GetComponent<AudioSource>(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); } } if (mixerName != null && mixerName.Length > 0 && mixerGroupName != null && mixerGroupName.Length > 0) { audioSource.outputAudioMixerGroup = AssetGatherDialog.audioMixers[mixerName].Item2.First((AudioMixerGroup g) => ((Object)g).name == mixerGroupName); } Object.Destroy((Object)(object)this); } } [AddComponentMenu("LethalSDK/NetworkPrefabInstancier")] public class SI_NetworkPrefabInstancier : MonoBehaviour { public GameObject prefab; [HideInInspector] public GameObject instance; public void Awake() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab != (Object)null) { NetworkObject component = prefab.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && (Object)(object)component.NetworkManager != (Object)null) { SI_NetworkDataInterfacing component2 = ((Component)this).GetComponent<SI_NetworkDataInterfacing>(); SI_NetworkData sI_NetworkData = null; if ((Object)(object)component2 != (Object)null) { sI_NetworkData = prefab.GetComponent<SI_NetworkData>(); if ((Object)(object)sI_NetworkData == (Object)null) { prefab.AddComponent<SI_NetworkData>(); } } if (component.NetworkManager.IsHost) { instance = Object.Instantiate<GameObject>(prefab, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.parent); SI_NetworkData component3 = instance.GetComponent<SI_NetworkData>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component3 != (Object)null) { component3.setData(component2.getData()); } instance.GetComponent<NetworkObject>().Spawn(false); } } } ((Component)this).gameObject.SetActive(false); } public void OnDestroy() { if ((Object)(object)instance != (Object)null) { NetworkObject component = prefab.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && (Object)(object)component.NetworkManager != (Object)null && component.NetworkManager.IsHost) { instance.GetComponent<NetworkObject>().Despawn(true); Object.Destroy((Object)(object)instance); } } } } [AddComponentMenu("LethalSDK/NetworkDataInterfacing")] public class SI_NetworkDataInterfacing : MonoBehaviour { public StringStringPair[] data = new StringStringPair[0]; [HideInInspector] public string serializedData = string.Empty; private void OnValidate() { serializedData = string.Join(";", data.Select((StringStringPair p) => p._string1.RemoveNonAlphanumeric(1) + "," + p._string2.RemoveNonAlphanumeric(1))); } public virtual StringStringPair[] getData() { return (from s in serializedData.Split(new char[1] { ';' }) select s.Split(new char[1] { ',' }) into split where split.Length == 2 select new StringStringPair(split[0], split[1])).ToArray(); } } public class ScriptImporter : MonoBehaviour { public virtual void Awake() { Object.Destroy((Object)(object)this); } } [AddComponentMenu("LethalSDK/MatchLocalPlayerPosition")] public class SI_MatchLocalPlayerPosition : ScriptImporter { public override void Awake() { ((Component)this).gameObject.AddComponent<MatchLocalPlayerPosition>(); base.Awake(); } } [AddComponentMenu("LethalSDK/AnimatedSun")] public class SI_AnimatedSun : ScriptImporter { public Light indirectLight; public Light directLight; public override void Awake() { animatedSun val = ((Component)this).gameObject.AddComponent<animatedSun>(); val.indirectLight = indirectLight; val.directLight = directLight; base.Awake(); } } [AddComponentMenu("LethalSDK/ScanNode")] public class SI_ScanNode : ScriptImporter { public int MaxRange; public int MinRange; public bool RequiresLineOfSight; public string HeaderText; public string SubText; public int ScrapValue; public int CreatureScanID; public NodeType NodeType; public override void Awake() { ScanNodeProperties val = ((Component)this).gameObject.AddComponent<ScanNodeProperties>(); val.minRange = MinRange; val.maxRange = MaxRange; val.requiresLineOfSight = RequiresLineOfSight; val.headerText = HeaderText; val.subText = SubText; val.scrapValue = ScrapValue; val.creatureScanID = CreatureScanID; val.nodeType = (int)NodeType; base.Awake(); } } public enum NodeType { Information = 0, Danger = 0, Ressource = 0 } [AddComponentMenu("LethalSDK/AudioReverbPresets")] public class SI_AudioReverbPresets : ScriptImporter { public GameObject[] presets; public override void Awake() { } public void Update() { int num = 0; GameObject[] array = presets; foreach (GameObject val in array) { if ((Object)(object)val.GetComponent<SI_AudioReverbTrigger>() != (Object)null) { num++; } } if (num != 0) { return; } List<AudioReverbTrigger> list = new List<AudioReverbTrigger>(); GameObject[] array2 = presets; foreach (GameObject val2 in array2) { if ((Object)(object)val2.GetComponent<AudioReverbTrigger>() != (Object)null) { list.Add(val2.GetComponent<AudioReverbTrigger>()); } } AudioReverbPresets val3 = ((Component)this).gameObject.AddComponent<AudioReverbPresets>(); val3.audioPresets = list.ToArray(); Object.Destroy((Object)(object)this); } } [AddComponentMenu("LethalSDK/AudioReverbTrigger")] public class SI_AudioReverbTrigger : ScriptImporter { [Header("Reverb Preset")] public bool ChangeDryLevel = false; [Range(-10000f, 0f)] public float DryLevel = 0f; public bool ChangeHighFreq = false; [Range(-10000f, 0f)] public float HighFreq = -270f; public bool ChangeLowFreq = false; [Range(-10000f, 0f)] public float LowFreq = -244f; public bool ChangeDecayTime = false; [Range(0f, 35f)] public float DecayTime = 1.4f; public bool ChangeRoom = false; [Range(-10000f, 0f)] public float Room = -600f; [Header("MISC")] public bool ElevatorTriggerForProps = false; public bool SetInElevatorTrigger = false; public bool IsShipRoom = false; public bool ToggleLocalFog = false; public float FogEnabledAmount = 10f; [Header("Weather and effects")] public bool SetInsideAtmosphere = false; public bool InsideLighting = false; public int WeatherEffect = -1; public bool EffectEnabled = true; public bool DisableAllWeather = false; public bool EnableCurrentLevelWeather = true; public override void Awake() { AudioReverbTrigger val = ((Component)this).gameObject.AddComponent<AudioReverbTrigger>(); ReverbPreset val2 = ScriptableObject.CreateInstance<ReverbPreset>(); val2.changeDryLevel = ChangeDryLevel; val2.dryLevel = DryLevel; val2.changeHighFreq = ChangeHighFreq; val2.highFreq = HighFreq; val2.changeLowFreq = ChangeLowFreq; val2.lowFreq = LowFreq; val2.changeDecayTime = ChangeDecayTime; val2.decayTime = DecayTime; val2.changeRoom = ChangeRoom; val2.room = Room; val.reverbPreset = val2; val.usePreset = -1; val.audioChanges = (switchToAudio[])(object)new switchToAudio[0]; val.elevatorTriggerForProps = ElevatorTriggerForProps; val.setInElevatorTrigger = SetInElevatorTrigger; val.isShipRoom = IsShipRoom; val.toggleLocalFog = ToggleLocalFog; val.fogEnabledAmount = FogEnabledAmount; val.setInsideAtmosphere = SetInsideAtmosphere; val.insideLighting = InsideLighting; val.weatherEffect = WeatherEffect; val.effectEnabled = EffectEnabled; val.disableAllWeather = DisableAllWeather; val.enableCurrentLevelWeather = EnableCurrentLevelWeather; base.Awake(); } } [AddComponentMenu("LethalSDK/DungeonGenerator")] public class SI_DungeonGenerator : ScriptImporter { public GameObject DungeonRoot; public override void Awake() { //IL_0081: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_009b: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (((Component)this).tag != "DungeonGenerator") { ((Component)this).tag = "DungeonGenerator"; } RuntimeDungeon val = ((Component)this).gameObject.AddComponent<RuntimeDungeon>(); val.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; val.Generator.LengthMultiplier = 0.8f; val.Generator.PauseBetweenRooms = 0.2f; val.GenerateOnStart = false; if ((Object)(object)DungeonRoot != (Object)null) { _ = DungeonRoot.scene; if (false) { DungeonRoot = new GameObject(); ((Object)DungeonRoot).name = "DungeonRoot"; DungeonRoot.transform.position = new Vector3(0f, -200f, 0f); } } val.Root = DungeonRoot; val.Generator.DungeonFlow = RoundManager.Instance.dungeonFlowTypes[0]; UnityNavMeshAdapter val2 = ((Component)this).gameObject.AddComponent<UnityNavMeshAdapter>(); val2.BakeMode = (RuntimeNavMeshBakeMode)3; val2.LayerMask = LayerMask.op_Implicit(35072); base.Awake(); } } [AddComponentMenu("LethalSDK/EntranceTeleport")] public class SI_EntranceTeleport : ScriptImporter { public int EntranceID = 0; public Transform EntrancePoint; public int AudioReverbPreset = 2; public AudioClip[] DoorAudios = (AudioClip[])(object)new AudioClip[0]; public override void Awake() { //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown AudioSource val = ((Component)this).gameObject.AddComponent<AudioSource>(); val.outputAudioMixerGroup = AssetGatherDialog.audioMixers["Diagetic"].Item2.First((AudioMixerGroup g) => ((Object)g).name == "Master"); val.playOnAwake = false; val.spatialBlend = 1f; EntranceTeleport entra
plugins/LethalThings/LethalThings.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalLib.Extras; using LethalLib.Modules; using LethalThings.Extensions; using LethalThings.MonoBehaviours; using LethalThings.NetcodePatcher; using LethalThings.Patches; using Microsoft.CodeAnalysis; using On; using On.GameNetcodeStuff; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations.Rigging; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("LethalThings")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Mod for Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+dffd1fa1a88c1099e7d37ac2a79e708256ab06a6")] [assembly: AssemblyProduct("LethalThings")] [assembly: AssemblyTitle("LethalThings")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<Vector3>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<Vector3>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<HackingTool.HackState>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedValueEquals<HackingTool.HackState>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalLib.Modules { public class SaveData { [CompilerGenerated] private static class <>O { public static hook_ResetSavedGameValues <0>__GameNetworkManager_ResetSavedGameValues; public static hook_SaveItemsInShip <1>__GameNetworkManager_SaveItemsInShip; public static hook_LoadShipGrabbableItems <2>__StartOfRound_LoadShipGrabbableItems; } public static List<string> saveKeys = new List<string>(); public static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown object obj = <>O.<0>__GameNetworkManager_ResetSavedGameValues; if (obj == null) { hook_ResetSavedGameValues val = GameNetworkManager_ResetSavedGameValues; <>O.<0>__GameNetworkManager_ResetSavedGameValues = val; obj = (object)val; } GameNetworkManager.ResetSavedGameValues += (hook_ResetSavedGameValues)obj; object obj2 = <>O.<1>__GameNetworkManager_SaveItemsInShip; if (obj2 == null) { hook_SaveItemsInShip val2 = GameNetworkManager_SaveItemsInShip; <>O.<1>__GameNetworkManager_SaveItemsInShip = val2; obj2 = (object)val2; } GameNetworkManager.SaveItemsInShip += (hook_SaveItemsInShip)obj2; object obj3 = <>O.<2>__StartOfRound_LoadShipGrabbableItems; if (obj3 == null) { hook_LoadShipGrabbableItems val3 = StartOfRound_LoadShipGrabbableItems; <>O.<2>__StartOfRound_LoadShipGrabbableItems = val3; obj3 = (object)val3; } StartOfRound.LoadShipGrabbableItems += (hook_LoadShipGrabbableItems)obj3; } private static void StartOfRound_LoadShipGrabbableItems(orig_LoadShipGrabbableItems orig, StartOfRound self) { orig.Invoke(self); SaveableObject[] array = Object.FindObjectsOfType<SaveableObject>(); SaveableNetworkBehaviour[] array2 = Object.FindObjectsOfType<SaveableNetworkBehaviour>(); SaveableObject[] array3 = array; foreach (SaveableObject saveableObject in array3) { saveableObject.LoadObjectData(); } SaveableNetworkBehaviour[] array4 = array2; foreach (SaveableNetworkBehaviour saveableNetworkBehaviour in array4) { saveableNetworkBehaviour.LoadObjectData(); } if (ES3.KeyExists("LethalLibItemSaveKeys", GameNetworkManager.Instance.currentSaveFileName)) { saveKeys = ES3.Load<List<string>>("LethalLibItemSaveKeys", GameNetworkManager.Instance.currentSaveFileName); } } private static void GameNetworkManager_SaveItemsInShip(orig_SaveItemsInShip orig, GameNetworkManager self) { orig.Invoke(self); SaveableObject[] array = Object.FindObjectsOfType<SaveableObject>(); SaveableNetworkBehaviour[] array2 = Object.FindObjectsOfType<SaveableNetworkBehaviour>(); SaveableObject[] array3 = array; foreach (SaveableObject saveableObject in array3) { saveableObject.SaveObjectData(); } SaveableNetworkBehaviour[] array4 = array2; foreach (SaveableNetworkBehaviour saveableNetworkBehaviour in array4) { saveableNetworkBehaviour.SaveObjectData(); } ES3.Save<List<string>>("LethalLibItemSaveKeys", saveKeys, GameNetworkManager.Instance.currentSaveFileName); } private static void GameNetworkManager_ResetSavedGameValues(orig_ResetSavedGameValues orig, GameNetworkManager self) { orig.Invoke(self); foreach (string saveKey in saveKeys) { ES3.DeleteKey(saveKey, GameNetworkManager.Instance.currentSaveFileName); } saveKeys.Clear(); } public static void SaveObjectData<T>(string key, T data, int objectId) { List<T> list = new List<T>(); if (ES3.KeyExists("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName)) { list = ES3.Load<List<T>>("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName); } List<int> list2 = new List<int>(); if (ES3.KeyExists("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName)) { list2 = ES3.Load<List<int>>("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName); } list.Add(data); list2.Add(objectId); if (!saveKeys.Contains("LethalThingsSave_" + key)) { saveKeys.Add("LethalThingsSave_" + key); } if (!saveKeys.Contains("LethalThingsSave_objectIds_" + key)) { saveKeys.Add("LethalThingsSave_objectIds_" + key); } ES3.Save<List<T>>("LethalThingsSave_" + key, list, GameNetworkManager.Instance.currentSaveFileName); ES3.Save<List<int>>("LethalThingsSave_objectIds_" + key, list2, GameNetworkManager.Instance.currentSaveFileName); } public static T LoadObjectData<T>(string key, int objectId) { List<T> list = new List<T>(); if (ES3.KeyExists("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName)) { list = ES3.Load<List<T>>("LethalThingsSave_" + key, GameNetworkManager.Instance.currentSaveFileName); } List<int> list2 = new List<int>(); if (ES3.KeyExists("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName)) { list2 = ES3.Load<List<int>>("LethalThingsSave_objectIds_" + key, GameNetworkManager.Instance.currentSaveFileName); } if (!saveKeys.Contains("LethalThingsSave_" + key)) { saveKeys.Add("LethalThingsSave_" + key); } if (!saveKeys.Contains("LethalThingsSave_objectIds_" + key)) { saveKeys.Add("LethalThingsSave_objectIds_" + key); } if (list2.Contains(objectId)) { int index = list2.IndexOf(objectId); return list[index]; } return default(T); } } } namespace LethalThings { public class Content { public static AssetBundle MainAssets; public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>(); public static ContentLoader ContentLoader; public static GameObject devMenuPrefab; public static GameObject configManagerPrefab; public static void Init() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Expected O, but got Unknown //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Expected O, but got Unknown //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Expected O, but got Unknown //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Expected O, but got Unknown //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Expected O, but got Unknown //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Expected O, but got Unknown //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Expected O, but got Unknown //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Expected O, but got Unknown //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Expected O, but got Unknown //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Expected O, but got Unknown //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Expected O, but got Unknown //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Expected O, but got Unknown MainAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalthings")); configManagerPrefab = MainAssets.LoadAsset<GameObject>("Assets/Custom/LethalThings/LTNetworkConfig.prefab"); NetworkPrefabs.RegisterNetworkPrefab(configManagerPrefab); ContentLoader = new ContentLoader(Plugin.pluginInfo, MainAssets, (Action<CustomContent, GameObject>)delegate(CustomContent content, GameObject prefab) { Prefabs.Add(content.ID, prefab); }); CustomContent[] array = (CustomContent[])(object)new CustomContent[26] { (CustomContent)new ScrapItem("Arson", "Assets/Custom/LethalThings/Scrap/Arson/ArsonPlush.asset", NetworkConfig.arsonSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Cookie", "Assets/Custom/LethalThings/Scrap/Cookie/CookieFumo.asset", NetworkConfig.cookieSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Bilka", "Assets/Custom/LethalThings/Scrap/Toimari/ToimariPlush.asset", NetworkConfig.toimariSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Hamis", "Assets/Custom/LethalThings/Scrap/Hamis/HamisPlush.asset", NetworkConfig.hamisSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("ArsonDirty", "Assets/Custom/LethalThings/Scrap/Arson/ArsonPlushDirty.asset", NetworkConfig.dirtyArsonSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Maxwell", "Assets/Custom/LethalThings/Scrap/Maxwell/Dingus.asset", NetworkConfig.maxwellSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Glizzy", "Assets/Custom/LethalThings/Scrap/glizzy/glizzy.asset", NetworkConfig.glizzySpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Revolver", "Assets/Custom/LethalThings/Scrap/Flaggun/Toygun.asset", NetworkConfig.revolverSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("GremlinEnergy", "Assets/Custom/LethalThings/Scrap/GremlinEnergy/GremlinEnergy.asset", NetworkConfig.gremlinSodaSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("ToyHammerScrap", "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammer.asset", NetworkConfig.toyHammerScrapSpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ScrapItem("Gnarpy", "Assets/Custom/LethalThings/Scrap/Gnarpy/GnarpyPlush.asset", NetworkConfig.gnarpySpawnChance.Value, (LevelTypes)(-1), (string[])null, (Action<Item>)null), (CustomContent)new ShopItem("RocketLauncher", "Assets/Custom/LethalThings/Items/RocketLauncher/RocketLauncher.asset", NetworkConfig.rocketLauncherPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/RocketLauncher/RocketLauncherInfo.asset", (Action<Item>)delegate(Item item) { NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<RocketLauncher>().missilePrefab); }), (CustomContent)new ShopItem("Flaregun", "Assets/Custom/LethalThings/Items/Flaregun/Flaregun.asset", NetworkConfig.flareGunPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Flaregun/FlaregunInfo.asset", (Action<Item>)delegate(Item item) { NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<ProjectileWeapon>().projectilePrefab); }), (CustomContent)new ShopItem("FlaregunAmmo", "Assets/Custom/LethalThings/Items/Flaregun/FlaregunAmmo.asset", NetworkConfig.flareGunAmmoPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Flaregun/FlaregunAmmoInfo.asset", (Action<Item>)null), (CustomContent)new ShopItem("ToyHammerShop", "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammer.asset", NetworkConfig.toyHammerPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/ToyHammer/ToyHammerInfo.asset", (Action<Item>)null), (CustomContent)new ShopItem("RemoteRadar", "Assets/Custom/LethalThings/Items/Radar/HandheldRadar.asset", NetworkConfig.remoteRadarPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Radar/HandheldRadarInfo.asset", (Action<Item>)null), (CustomContent)new ShopItem("PouchyBelt", "Assets/Custom/LethalThings/Items/Pouch/Pouch.asset", NetworkConfig.pouchyBeltPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/Pouch/PouchInfo.asset", (Action<Item>)null), (CustomContent)new ShopItem("HackingTool", "Assets/Custom/LethalThings/Items/HackingTool/HackingTool.asset", NetworkConfig.hackingToolPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/HackingTool/HackingToolInfo.asset", (Action<Item>)null), (CustomContent)new ShopItem("Pinger", "Assets/Custom/LethalThings/Items/PingingTool/PingTool.asset", NetworkConfig.pingerPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Items/PingingTool/PingToolInfo.asset", (Action<Item>)delegate(Item item) { NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab.GetComponent<Pinger>().pingMarkerPrefab); }), (CustomContent)new CustomItem("Dart", "Assets/Custom/LethalThings/Unlockables/dartboard/Dart.asset", (Action<Item>)null), (CustomContent)new Unlockable("SmallRug", "Assets/Custom/LethalThings/Unlockables/Rug/SmallRug.asset", NetworkConfig.smallRugPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Rug/RugInfo.asset", (StoreType)2, (Action<UnlockableItem>)null), (CustomContent)new Unlockable("LargeRug", "Assets/Custom/LethalThings/Unlockables/Rug/LargeRug.asset", NetworkConfig.largeRugPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Rug/RugInfo.asset", (StoreType)2, (Action<UnlockableItem>)null), (CustomContent)new Unlockable("FatalitiesSign", "Assets/Custom/LethalThings/Unlockables/Sign/Sign.asset", NetworkConfig.fatalitiesSignPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/Sign/SignInfo.asset", (StoreType)2, (Action<UnlockableItem>)null), (CustomContent)new Unlockable("Dartboard", "Assets/Custom/LethalThings/Unlockables/dartboard/Dartboard.asset", NetworkConfig.dartBoardPrice.Value, (string)null, (string)null, "Assets/Custom/LethalThings/Unlockables/dartboard/DartboardInfo.asset", (StoreType)2, (Action<UnlockableItem>)null), (CustomContent)new CustomEnemy("Boomba", "Assets/Custom/LethalThings/Enemies/Roomba/Boomba.asset", NetworkConfig.boombaSpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, (string[])null, "Assets/Custom/LethalThings/Enemies/Roomba/BoombaFile.asset", (string)null, (Action<EnemyType>)null), (CustomContent)new MapHazard("TeleporterTrap", "Assets/Custom/LethalThings/hazards/TeleporterTrap/TeleporterTrap.asset", (LevelTypes)(-1), (string[])null, (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 0f), new Keyframe(1f, 4f) })), (Action<SpawnableMapObjectDef>)null) }; ContentLoader.RegisterAll(array); foreach (KeyValuePair<string, GameObject> prefab in Prefabs) { GameObject value = prefab.Value; string key = prefab.Key; AudioSource[] componentsInChildren = value.GetComponentsInChildren<AudioSource>(); if (componentsInChildren.Length != 0) { ConfigEntry<float> val = NetworkConfig.VolumeConfig.Bind<float>("Volume", key ?? "", 100f, "Audio volume for " + key + " (0 - 100)"); AudioSource[] array2 = componentsInChildren; foreach (AudioSource val2 in array2) { val2.volume *= val.Value / 100f; } } } GameObject val3 = MainAssets.LoadAsset<GameObject>("Assets/Custom/LethalThings/DevMenu.prefab"); NetworkPrefabs.RegisterNetworkPrefab(val3); devMenuPrefab = val3; try { IEnumerable<Type> loadableTypes = Assembly.GetExecutingAssembly().GetLoadableTypes(); foreach (Type item in loadableTypes) { MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array3 = methods; foreach (MethodInfo methodInfo in array3) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } catch (Exception) { } } } public static class InputCompat { public static InputActionAsset Asset; public static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.LethalCompanyInputUtils"); public static InputAction LTUtilityBeltQuick1 => Keybinds.Instance.LTUtilityBeltQuick1; public static InputAction LTUtilityBeltQuick2 => Keybinds.Instance.LTUtilityBeltQuick2; public static InputAction LTUtilityBeltQuick3 => Keybinds.Instance.LTUtilityBeltQuick3; public static InputAction LTUtilityBeltQuick4 => Keybinds.Instance.LTUtilityBeltQuick4; public static void Init() { Keybinds.Instance = new Keybinds(); Asset = Keybinds.Instance.GetAsset(); } } public class Keybinds : LcInputActions { public static Keybinds Instance; [InputAction("", Name = "[LT] Utility Belt Quick 1")] public InputAction LTUtilityBeltQuick1 { get; set; } [InputAction("", Name = "[LT] Utility Belt Quick 2")] public InputAction LTUtilityBeltQuick2 { get; set; } [InputAction("", Name = "[LT] Utility Belt Quick 3")] public InputAction LTUtilityBeltQuick3 { get; set; } [InputAction("", Name = "[LT] Utility Belt Quick 4")] public InputAction LTUtilityBeltQuick4 { get; set; } public InputActionAsset GetAsset() { return ((LcInputActions)this).Asset; } } public class Dingus : SaveableObject { public AudioSource noiseAudio; public AudioSource noiseAudioFar; public AudioSource musicAudio; public AudioSource musicAudioFar; [Space(3f)] public AudioClip[] noiseSFX; public AudioClip[] noiseSFXFar; public AudioClip evilNoise; [Space(3f)] public float noiseRange; public float maxLoudness; public float minLoudness; public float minPitch; public float maxPitch; private Random noisemakerRandom; public Animator triggerAnimator; private int timesPlayedWithoutTurningOff = 0; private RoundManager roundManager; private float noiseInterval = 1f; public Animator danceAnimator; public bool wasLoadedFromSave = false; public bool exploding = false; private NetworkVariable<bool> isEvil = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public GameObject evilObject; public NetworkVariable<bool> isPlayingMusic = new NetworkVariable<bool>(NetworkConfig.maxwellPlayMusicDefault.Value, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); public NetworkVariable<bool> isPipebomb = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public override void SaveObjectData() { SaveData.SaveObjectData("dingusBeEvil", isEvil.Value, uniqueId); } public override void LoadObjectData() { if (((NetworkBehaviour)this).IsHost) { bool flag = SaveData.LoadObjectData<bool>("dingusBeEvil", uniqueId); Plugin.logger.LogInfo((object)$"Loading object[{uniqueId}] save data, evil? {flag}"); if (flag) { isEvil.Value = flag; } } } public override void Start() { ((GrabbableObject)this).Start(); roundManager = Object.FindObjectOfType<RoundManager>(); noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85); Debug.Log((object)"Making the dingus dance"); } public override void OnNetworkSpawn() { base.OnNetworkSpawn(); if (((NetworkBehaviour)this).IsOwner) { isPlayingMusic.Value = NetworkConfig.Instance.maxwellPlayMusicDefaultNetVar.Value; } if (((NetworkBehaviour)this).IsHost) { isEvil.Value = Random.Range(0f, 100f) <= NetworkConfig.evilMaxwellChance.Value; } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { int num = noisemakerRandom.Next(0, noiseSFX.Length); float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f; float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f; noiseAudio.pitch = pitch; noiseAudio.PlayOneShot(noiseSFX[num], num2); if ((Object)(object)noiseAudioFar != (Object)null) { noiseAudioFar.pitch = pitch; noiseAudioFar.PlayOneShot(noiseSFXFar[num], num2); } if ((Object)(object)triggerAnimator != (Object)null) { triggerAnimator.SetTrigger("playAnim"); } WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num], num2); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num2, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } } public override void DiscardItem() { if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).isBeingUsed = false; ((GrabbableObject)this).DiscardItem(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true; danceAnimator.Play("dingusIdle"); Debug.Log((object)"Making the dingus idle"); } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (!right && ((NetworkBehaviour)this).IsOwner) { isPlayingMusic.Value = !isPlayingMusic.Value; } } public override void InteractItem() { ((GrabbableObject)this).InteractItem(); if (isEvil.Value && !exploding && !isPipebomb.Value) { EvilMaxwellServerRpc(); } } public void EvilMaxwellTruly() { danceAnimator.Play("dingusIdle"); if (musicAudio.isPlaying) { musicAudio.Pause(); musicAudioFar.Pause(); } ((MonoBehaviour)this).StartCoroutine(evilMaxwellMoment()); } [ServerRpc(RequireOwnership = false)] public void EvilMaxwellServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(88404199u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 88404199u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { isPipebomb.Value = true; EvilMaxwellClientRpc(); } } } [ClientRpc] public void EvilMaxwellClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1120322383u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1120322383u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { EvilMaxwellTruly(); exploding = true; if (((NetworkBehaviour)this).IsOwner) { isPlayingMusic.Value = false; } timesPlayedWithoutTurningOff = 0; danceAnimator.Play("dingusIdle"); if (musicAudio.isPlaying) { musicAudio.Pause(); musicAudioFar.Pause(); } Plugin.logger.LogInfo((object)"Evil maxwell moment"); } } public IEnumerator evilMaxwellMoment() { yield return (object)new WaitForSeconds(1f); noiseAudio.PlayOneShot(evilNoise, 1f); evilObject.SetActive(true); ((Renderer)((GrabbableObject)this).mainObjectRenderer).enabled = false; if ((Object)(object)noiseAudioFar != (Object)null) { noiseAudioFar.PlayOneShot(evilNoise, 1f); } if ((Object)(object)triggerAnimator != (Object)null) { triggerAnimator.SetTrigger("playAnim"); } WalkieTalkie.TransmitOneShotAudio(noiseAudio, evilNoise, 1f); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, 1f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); yield return (object)new WaitForSeconds(1.5f); Utilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, 100, 0f, 6.4f, 6, (CauseOfDeath)3); Rigidbody[] componentsInChildren = evilObject.GetComponentsInChildren<Rigidbody>(); foreach (Rigidbody rb in componentsInChildren) { rb.isKinematic = false; rb.AddExplosionForce(1000f, evilObject.transform.position, 100f); } yield return (object)new WaitForSeconds(2f); if (((NetworkBehaviour)this).IsServer) { ((Component)this).GetComponent<NetworkObject>().Despawn(true); } } public override void Update() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (isEvil.Value) { ((GrabbableObject)this).grabbable = false; ((GrabbableObject)this).grabbableToEnemies = false; } if (isPlayingMusic.Value && !exploding) { if (!musicAudio.isPlaying) { musicAudio.Play(); musicAudioFar.Play(); } if (!((GrabbableObject)this).isHeld) { danceAnimator.Play("dingusDance"); } else { danceAnimator.Play("dingusIdle"); } if (noiseInterval <= 0f) { noiseInterval = 1f; timesPlayedWithoutTurningOff++; roundManager.PlayAudibleNoise(((Component)this).transform.position, 16f, 0.9f, timesPlayedWithoutTurningOff, false, 5); } else { noiseInterval -= Time.deltaTime; } } else { timesPlayedWithoutTurningOff = 0; danceAnimator.Play("dingusIdle"); if (musicAudio.isPlaying) { musicAudio.Pause(); musicAudioFar.Pause(); } } } protected override void __initializeVariables() { if (isEvil == null) { throw new Exception("Dingus.isEvil cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)isEvil).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isEvil, "isEvil"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isEvil); if (isPlayingMusic == null) { throw new Exception("Dingus.isPlayingMusic cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)isPlayingMusic).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isPlayingMusic, "isPlayingMusic"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isPlayingMusic); if (isPipebomb == null) { throw new Exception("Dingus.isPipebomb cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)isPipebomb).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)isPipebomb, "isPipebomb"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)isPipebomb); base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Dingus() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(88404199u, new RpcReceiveHandler(__rpc_handler_88404199)); NetworkManager.__rpc_func_table.Add(1120322383u, new RpcReceiveHandler(__rpc_handler_1120322383)); } private static void __rpc_handler_88404199(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((Dingus)(object)target).EvilMaxwellServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1120322383(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((Dingus)(object)target).EvilMaxwellClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Dingus"; } } public class Missile : NetworkBehaviour { public int damage = 50; public float maxDistance = 10f; public float minDistance = 0f; public float gravity = 2.4f; public float flightDelay = 0.5f; public float flightForce = 150f; public float flightTime = 2f; public float autoDestroyTime = 3f; private float timeAlive = 0f; public float LobForce = 100f; public ParticleSystem particleSystem; private void OnCollisionEnter(Collision collision) { if (((NetworkBehaviour)this).IsHost) { Boom(); BoomClientRpc(); } else { BoomServerRpc(); } } private void Start() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) ((Component)this).GetComponent<Rigidbody>().useGravity = false; if (((NetworkBehaviour)this).IsHost) { ((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * LobForce, (ForceMode)1); } } [ClientRpc] public void BoomClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3331368301u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3331368301u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Boom(); } } } [ServerRpc] public void BoomServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(452316787u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 452316787u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Boom(); BoomClientRpc(); } } public void CreateExplosion() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB attacker = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => ((NetworkBehaviour)x).OwnerClientId == ((NetworkBehaviour)this).OwnerClientId)); Utilities.CreateExplosion(((Component)this).transform.position, spawnExplosionEffect: true, damage, minDistance, maxDistance, 10, (CauseOfDeath)3, attacker); } public void Boom() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)particleSystem == (Object)null) { Debug.LogError((object)"No particle system set on missile, destruction time!!"); CreateExplosion(); if (((NetworkBehaviour)this).IsHost) { Object.Destroy((Object)(object)((Component)this).gameObject); } return; } particleSystem.Stop(true, (ParticleSystemStopBehavior)1); ((Component)particleSystem).transform.SetParent((Transform)null); ((Component)particleSystem).transform.localScale = Vector3.one; GameObject gameObject = ((Component)particleSystem).gameObject; MainModule main = particleSystem.main; float duration = ((MainModule)(ref main)).duration; main = particleSystem.main; MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime; Object.Destroy((Object)(object)gameObject, duration + ((MinMaxCurve)(ref startLifetime)).constant); CreateExplosion(); if (((NetworkBehaviour)this).IsHost) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void FixedUpdate() { //IL_0022: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)this).IsHost) { return; } ((Component)this).GetComponent<Rigidbody>().useGravity = false; ((Component)this).GetComponent<Rigidbody>().AddForce(Vector3.down * gravity); if (timeAlive <= flightTime && timeAlive >= flightDelay) { ((Component)this).GetComponent<Rigidbody>().AddForce(((Component)this).transform.forward * flightForce); } timeAlive += Time.fixedDeltaTime; if (timeAlive > autoDestroyTime) { if (((NetworkBehaviour)this).IsHost) { Boom(); BoomClientRpc(); } else { BoomServerRpc(); } } else { Debug.Log((object)("Time alive: " + timeAlive + " / " + autoDestroyTime)); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Missile() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3331368301u, new RpcReceiveHandler(__rpc_handler_3331368301)); NetworkManager.__rpc_func_table.Add(452316787u, new RpcReceiveHandler(__rpc_handler_452316787)); } private static void __rpc_handler_3331368301(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((Missile)(object)target).BoomClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_452316787(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((Missile)(object)target).BoomServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Missile"; } } public class PouchyBelt : GrabbableObject { [CompilerGenerated] private static class <>O { public static hook_SetHoverTipAndCurrentInteractTrigger <0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger; public static hook_BeginGrabObject <1>__PlayerControllerB_BeginGrabObject; } public Transform beltCosmetic; public Vector3 beltCosmeticPositionOffset = new Vector3(0f, 0f, 0f); public Vector3 beltCosmeticRotationOffset = new Vector3(0f, 0f, 0f); public int beltCapacity = 3; private PlayerControllerB previousPlayerHeldBy; public List<int> slotIndexes = new List<int>(); public static void Initialize() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown object obj = <>O.<0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger; if (obj == null) { hook_SetHoverTipAndCurrentInteractTrigger val = PlayerControllerB_SetHoverTipAndCurrentInteractTrigger; <>O.<0>__PlayerControllerB_SetHoverTipAndCurrentInteractTrigger = val; obj = (object)val; } PlayerControllerB.SetHoverTipAndCurrentInteractTrigger += (hook_SetHoverTipAndCurrentInteractTrigger)obj; object obj2 = <>O.<1>__PlayerControllerB_BeginGrabObject; if (obj2 == null) { hook_BeginGrabObject val2 = PlayerControllerB_BeginGrabObject; <>O.<1>__PlayerControllerB_BeginGrabObject = val2; obj2 = (object)val2; } PlayerControllerB.BeginGrabObject += (hook_BeginGrabObject)obj2; } public void Awake() { if (InputCompat.Enabled) { InputCompat.LTUtilityBeltQuick1.started += InputReceived; InputCompat.LTUtilityBeltQuick2.started += InputReceived; InputCompat.LTUtilityBeltQuick3.started += InputReceived; InputCompat.LTUtilityBeltQuick4.started += InputReceived; } } private static void PlayerControllerB_BeginGrabObject(orig_BeginGrabObject orig, PlayerControllerB self) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) self.interactRay = new Ray(((Component)self.gameplayCamera).transform.position, ((Component)self.gameplayCamera).transform.forward); if (!Physics.Raycast(self.interactRay, ref self.hit, self.grabDistance, self.interactableObjectsMask) || ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.layer == 8 || !(((Component)((RaycastHit)(ref self.hit)).collider).tag == "PhysicsProp") || self.twoHanded || self.sinkingValue > 0.73f) { return; } self.currentlyGrabbingObject = ((Component)((Component)((RaycastHit)(ref self.hit)).collider).transform).gameObject.GetComponent<GrabbableObject>(); if ((!GameNetworkManager.Instance.gameHasStarted && !self.currentlyGrabbingObject.itemProperties.canBeGrabbedBeforeGameStart && ((Object)(object)StartOfRound.Instance.testRoom == (Object)null || !StartOfRound.Instance.testRoom.activeSelf)) || (Object)(object)self.currentlyGrabbingObject == (Object)null || self.inSpecialInteractAnimation || self.currentlyGrabbingObject.isHeld || self.currentlyGrabbingObject.isPocketed) { return; } NetworkObject networkObject = ((NetworkBehaviour)self.currentlyGrabbingObject).NetworkObject; if (!((Object)(object)networkObject == (Object)null) && networkObject.IsSpawned) { if (self.currentlyGrabbingObject is PouchyBelt && self.ItemSlots.Any((GrabbableObject x) => (Object)(object)x != (Object)null && x is PouchyBelt)) { self.currentlyGrabbingObject.grabbable = false; } orig.Invoke(self); if (self.currentlyGrabbingObject is PouchyBelt) { self.currentlyGrabbingObject.grabbable = true; } } } private static void PlayerControllerB_SetHoverTipAndCurrentInteractTrigger(orig_SetHoverTipAndCurrentInteractTrigger orig, PlayerControllerB self) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!Physics.Raycast(self.interactRay, ref self.hit, self.grabDistance, self.interactableObjectsMask) || ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.layer == 8) { return; } string tag = ((Component)((RaycastHit)(ref self.hit)).collider).tag; if (!(tag == "PhysicsProp")) { return; } if (self.FirstEmptyItemSlot() == -1) { ((TMP_Text)self.cursorTip).text = "Inventory full!"; return; } GrabbableObject component = ((Component)((RaycastHit)(ref self.hit)).collider).gameObject.GetComponent<GrabbableObject>(); if (component is PouchyBelt) { if (self.ItemSlots.Any((GrabbableObject x) => (Object)(object)x != (Object)null && x is PouchyBelt)) { ((TMP_Text)self.cursorTip).text = "(Cannot hold more than 1 belt)"; } else { ((TMP_Text)self.cursorTip).text = "Pick up belt"; } } } public void InputReceived(CallbackContext context) { if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.playerHeldBy != (Object)null && ((CallbackContext)(ref context)).started) { int num = -1; if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick1) { num = 0; } else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick2) { num = 1; } else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick3) { num = 2; } else if (((CallbackContext)(ref context)).action == InputCompat.LTUtilityBeltQuick4) { num = 3; } if (num != -1 && num < slotIndexes.Count) { base.playerHeldBy.SwitchItemSlots(slotIndexes[num]); } } } public override void LateUpdate() { //IL_0083: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).LateUpdate(); if ((Object)(object)previousPlayerHeldBy != (Object)null) { ((Component)beltCosmetic).gameObject.SetActive(true); beltCosmetic.SetParent((Transform)null); ((Renderer)((Component)beltCosmetic).GetComponent<MeshRenderer>()).enabled = true; if (((NetworkBehaviour)this).IsOwner) { ((Renderer)((Component)beltCosmetic).GetComponent<MeshRenderer>()).enabled = false; } Transform parent = previousPlayerHeldBy.lowerSpine.parent; beltCosmetic.position = parent.position + beltCosmeticPositionOffset; Quaternion rotation = parent.rotation; Quaternion rotation2 = Quaternion.Euler(((Quaternion)(ref rotation)).eulerAngles + beltCosmeticRotationOffset); beltCosmetic.rotation = rotation2; ((Renderer)base.mainObjectRenderer).enabled = false; ((Component)this).gameObject.SetActive(true); } else { ((Component)beltCosmetic).gameObject.SetActive(false); ((Renderer)base.mainObjectRenderer).enabled = true; beltCosmetic.SetParent(((Component)this).transform); } } public void UpdateHUD(bool add) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) slotIndexes.Clear(); HUDManager instance = HUDManager.Instance; if (add) { int num = 0; GrabbableObject[] itemSlots = GameNetworkManager.Instance.localPlayerController.ItemSlots; foreach (GrabbableObject val in itemSlots) { if (val is PouchyBelt) { num++; } } Image val2 = instance.itemSlotIconFrames[0]; Image val3 = instance.itemSlotIcons[0]; int num2 = instance.itemSlotIconFrames.Length; CanvasScaler componentInParent = ((Component)val2).GetComponentInParent<CanvasScaler>(); AspectRatioFitter componentInParent2 = ((Component)val2).GetComponentInParent<AspectRatioFitter>(); float x = ((Graphic)val2).rectTransform.sizeDelta.x; float y = ((Graphic)val2).rectTransform.sizeDelta.y; float num3 = ((Graphic)val2).rectTransform.anchoredPosition.y + 1.125f * y * (float)num; Vector3 localEulerAngles = ((Transform)((Graphic)val2).rectTransform).localEulerAngles; Vector3 localEulerAngles2 = ((Transform)((Graphic)val3).rectTransform).localEulerAngles; List<Image> list = instance.itemSlotIconFrames.ToList(); List<Image> list2 = instance.itemSlotIcons.ToList(); int count = list.Count; float num4 = (float)beltCapacity * x + (float)(beltCapacity - 1) * 15f; Debug.Log((object)$"Adding {beltCapacity} item slots! Surely this will go well.."); Debug.Log((object)$"Adding after index: {count}"); for (int j = 0; j < beltCapacity; j++) { float num5 = 0f - ((Component)((Transform)((Graphic)val2).rectTransform).parent).GetComponent<RectTransform>().sizeDelta.x / 2f - 3f; float num6 = num5 + (float)j * x + (float)j * 15f; Image val4 = list[0]; Image val5 = Object.Instantiate<Image>(val4, ((Component)val2).transform.parent); ((Object)val5).name = $"Slot{num2 + j}[LethalThingsBelt]"; ((Graphic)val5).rectTransform.anchoredPosition = new Vector2(num6, num3); ((Transform)((Graphic)val5).rectTransform).eulerAngles = localEulerAngles; Image component = ((Component)((Component)val5).transform.GetChild(0)).GetComponent<Image>(); ((Object)component).name = "icon"; ((Behaviour)component).enabled = false; ((Transform)((Graphic)component).rectTransform).eulerAngles = localEulerAngles2; ((Transform)((Graphic)component).rectTransform).Rotate(new Vector3(0f, 0f, -90f)); int num7 = count + j; list.Insert(num7, val5); list2.Insert(num7, component); slotIndexes.Add(num7); ((Component)val5).transform.SetSiblingIndex(num7); } instance.itemSlotIconFrames = list.ToArray(); instance.itemSlotIcons = list2.ToArray(); Debug.Log((object)$"Added {beltCapacity} item slots!"); return; } List<Image> list3 = instance.itemSlotIconFrames.ToList(); List<Image> list4 = instance.itemSlotIcons.ToList(); int count2 = list3.Count; int num8 = 0; for (int num9 = count2 - 1; num9 >= 0; num9--) { if (((Object)list3[num9]).name.Contains("[LethalThingsBelt]")) { num8++; Image val6 = list3[num9]; list3.RemoveAt(num9); list4.RemoveAt(num9); Object.Destroy((Object)(object)((Component)val6).gameObject); if (num8 >= beltCapacity) { break; } } } instance.itemSlotIconFrames = list3.ToArray(); instance.itemSlotIcons = list4.ToArray(); Debug.Log((object)$"Removed {beltCapacity} item slots!"); } public void AddItemSlots() { if ((Object)(object)base.playerHeldBy != (Object)null) { List<GrabbableObject> list = base.playerHeldBy.ItemSlots.ToList(); base.playerHeldBy.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[list.Count + beltCapacity]; for (int i = 0; i < list.Count; i++) { base.playerHeldBy.ItemSlots[i] = list[i]; } if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { UpdateHUD(add: true); } } } public void RemoveItemSlots() { if (!((Object)(object)base.playerHeldBy != (Object)null)) { return; } int num = base.playerHeldBy.ItemSlots.Length - beltCapacity; int currentItemSlot = base.playerHeldBy.currentItemSlot; for (int i = 0; i < beltCapacity; i++) { GrabbableObject val = base.playerHeldBy.ItemSlots[num + i]; if ((Object)(object)val != (Object)null) { base.playerHeldBy.DropItem(val, num + i); } } int currentItemSlot2 = base.playerHeldBy.currentItemSlot; currentItemSlot2 = ((currentItemSlot < base.playerHeldBy.ItemSlots.Length) ? currentItemSlot : 0); List<GrabbableObject> list = base.playerHeldBy.ItemSlots.ToList(); base.playerHeldBy.ItemSlots = (GrabbableObject[])(object)new GrabbableObject[list.Count - beltCapacity]; for (int j = 0; j < base.playerHeldBy.ItemSlots.Length; j++) { base.playerHeldBy.ItemSlots[j] = list[j]; } if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController) { UpdateHUD(add: false); } base.playerHeldBy.SwitchItemSlots(currentItemSlot2); } public override void DiscardItem() { RemoveItemSlots(); previousPlayerHeldBy = null; ((GrabbableObject)this).DiscardItem(); } public override void OnNetworkDespawn() { RemoveItemSlots(); previousPlayerHeldBy = null; ((NetworkBehaviour)this).OnNetworkDespawn(); } public void GrabItemOnClient() { ((GrabbableObject)this).GrabItemOnClient(); } public override void OnDestroy() { if (InputCompat.Enabled) { InputCompat.LTUtilityBeltQuick1.started -= InputReceived; InputCompat.LTUtilityBeltQuick2.started -= InputReceived; InputCompat.LTUtilityBeltQuick3.started -= InputReceived; InputCompat.LTUtilityBeltQuick4.started -= InputReceived; } ((NetworkBehaviour)this).OnDestroy(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if ((Object)(object)base.playerHeldBy != (Object)null) { if ((Object)(object)base.playerHeldBy != (Object)(object)previousPlayerHeldBy) { AddItemSlots(); } previousPlayerHeldBy = base.playerHeldBy; } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PouchyBelt"; } } public class PowerOutletStun : NetworkBehaviour { private Coroutine electrocutionCoroutine; public AudioSource strikeAudio; public ParticleSystem strikeParticle; private NetworkVariable<int> damage = new NetworkVariable<int>(20, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public void Electrocute(ItemCharger socket) { Debug.Log((object)"Attempting electrocution"); if (electrocutionCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(electrocutionCoroutine); } electrocutionCoroutine = ((MonoBehaviour)this).StartCoroutine(electrocutionDelayed(socket)); } public void Awake() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) StormyWeather val = Object.FindObjectOfType<StormyWeather>(true); GameObject gameObject = ((Component)val.targetedStrikeAudio).gameObject; strikeAudio = Object.Instantiate<GameObject>(gameObject, ((Component)this).transform).GetComponent<AudioSource>(); ((Component)strikeAudio).transform.localPosition = Vector3.zero; ((Component)strikeAudio).gameObject.SetActive(true); strikeParticle = Object.Instantiate<GameObject>(((Component)val.explosionEffectParticle).gameObject, ((Component)this).transform).GetComponent<ParticleSystem>(); ((Component)strikeParticle).transform.localPosition = Vector3.zero; ((Component)strikeParticle).gameObject.SetActive(true); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (((NetworkBehaviour)this).IsHost) { damage.Value = NetworkConfig.itemChargerElectrocutionDamage.Value; } } private IEnumerator electrocutionDelayed(ItemCharger socket) { Debug.Log((object)"Electrocution started"); socket.zapAudio.Play(); yield return (object)new WaitForSeconds(0.75f); socket.chargeStationAnimator.SetTrigger("zap"); Debug.Log((object)"Electrocution finished"); if (((NetworkBehaviour)this).NetworkObject.IsOwner && !((NetworkBehaviour)this).NetworkObject.IsOwnedByServer) { Debug.Log((object)"Sending stun to server!!"); ElectrocutedServerRpc(((Component)this).transform.position); } else if (((NetworkBehaviour)this).NetworkObject.IsOwner && ((NetworkBehaviour)this).NetworkObject.IsOwnedByServer) { Debug.Log((object)"Sending stun to clients!!"); ElectrocutedClientRpc(((Component)this).transform.position); Electrocuted(((Component)this).transform.position); } } [ClientRpc] private void ElectrocutedClientRpc(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_00d5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(328188188u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 328188188u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { Debug.Log((object)"Stun received!!"); Electrocuted(position); } } } private void Electrocuted(Vector3 position) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) StormyWeather val = Object.FindObjectOfType<StormyWeather>(true); Utilities.CreateExplosion(position, spawnExplosionEffect: false, damage.Value, 0f, 5f, 3, (CauseOfDeath)11); strikeParticle.Play(); val.PlayThunderEffects(position, strikeAudio); } [ServerRpc] private void ElectrocutedServerRpc(Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0110: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2844681185u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2844681185u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ElectrocutedClientRpc(position); } } protected override void __initializeVariables() { if (damage == null) { throw new Exception("PowerOutletStun.damage cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)damage).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)damage, "damage"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)damage); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_PowerOutletStun() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(328188188u, new RpcReceiveHandler(__rpc_handler_328188188)); NetworkManager.__rpc_func_table.Add(2844681185u, new RpcReceiveHandler(__rpc_handler_2844681185)); } private static void __rpc_handler_328188188(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)2; ((PowerOutletStun)(object)target).ElectrocutedClientRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2844681185(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((PowerOutletStun)(object)target).ElectrocutedServerRpc(position); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PowerOutletStun"; } } public class ProjectileWeapon : SaveableObject { public AudioSource mainAudio; public AudioClip[] activateClips; public AudioClip[] noAmmoSounds; public AudioClip[] reloadSounds; public Transform aimDirection; public int maxAmmo = 4; [HideInInspector] private NetworkVariable<int> currentAmmo = new NetworkVariable<int>(4, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public GameObject projectilePrefab; public float LobForce = 100f; private float timeSinceLastShot; private PlayerControllerB previousPlayerHeldBy; public Animator Animator; public ParticleSystem particleSystem; public Item ammoItem; public int ammoSlotToUse = -1; public override void SaveObjectData() { SaveData.SaveObjectData("projectileWeaponAmmoData", currentAmmo.Value, uniqueId); } public override void LoadObjectData() { if (((NetworkBehaviour)this).IsHost) { currentAmmo.Value = SaveData.LoadObjectData<int>("projectileWeaponAmmoData", uniqueId); } } public static void Init() { } private static bool GrabbableObject_UseItemBatteries(orig_UseItemBatteries orig, GrabbableObject self) { if (self is ProjectileWeapon) { return true; } return orig.Invoke(self); } public override void Start() { ((GrabbableObject)this).Start(); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); } public override void OnNetworkSpawn() { base.OnNetworkSpawn(); if (((NetworkBehaviour)this).IsServer) { currentAmmo.Value = maxAmmo; } } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (currentAmmo.Value > 0) { if (((NetworkBehaviour)this).IsHost) { NetworkVariable<int> obj = currentAmmo; int value = obj.Value; obj.Value = value - 1; } PlayRandomAudio(mainAudio, activateClips); Animator.Play("fire"); particleSystem.Play(); timeSinceLastShot = 0f; if (((NetworkBehaviour)this).IsOwner) { if (((NetworkBehaviour)this).IsHost) { ProjectileSpawner(aimDirection.position, aimDirection.rotation, aimDirection.forward); } else { SpawnProjectileServerRpc(aimDirection.position, aimDirection.rotation, aimDirection.forward); } } } else { PlayRandomAudio(mainAudio, noAmmoSounds); } } private bool ReloadedGun() { int num = FindAmmoInInventory(); if (num == -1) { return false; } ammoSlotToUse = num; return true; } private int FindAmmoInInventory() { for (int i = 0; i < ((GrabbableObject)this).playerHeldBy.ItemSlots.Length; i++) { if (!((Object)(object)((GrabbableObject)this).playerHeldBy.ItemSlots[i] == (Object)null) && ((GrabbableObject)this).playerHeldBy.ItemSlots[i].itemProperties.itemId == ammoItem.itemId) { return i; } } return -1; } [ServerRpc] private void FixWeightServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(43845628u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 43845628u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { FixWeightClientRpc(); } } [ClientRpc] private void FixWeightClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(948021082u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 948021082u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; playerHeldBy.carryWeight -= Mathf.Clamp(ammoItem.weight - 1f, 0f, 10f); } } } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (right || !((NetworkBehaviour)this).IsOwner) { return; } if (ReloadedGun()) { if (currentAmmo.Value > 0) { HUDManager.Instance.DisplayTip("Item already loaded.", "You can reload once you use up all the ammo.", false, false, "LC_Tip1"); return; } ReloadAmmoServerRpc(); DestroyItemInSlotAndSync(ammoSlotToUse); ammoSlotToUse = -1; } else { HUDManager.Instance.DisplayTip("No ammo found.", "Buy " + ammoItem.itemName + " from the Terminal to reload.", false, false, "LC_Tip1"); } } [ServerRpc] private void ReloadAmmoServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1064596822u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1064596822u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { currentAmmo.Value = maxAmmo; ReloadAmmoSoundClientRpc(); } } [ClientRpc] private void ReloadAmmoSoundClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3520251861u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3520251861u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayRandomAudio(mainAudio, reloadSounds); Animator.Play("reload"); } } } [ServerRpc] private void SpawnProjectileServerRpc(Vector3 aimPosition, Quaternion aimRotation, Vector3 forward) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Invalid comparison between Unknown and I4 //IL_012a: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1043162412u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimRotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1043162412u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ProjectileSpawner(aimPosition, aimRotation, forward); } } private void ProjectileSpawner(Vector3 aimPosition, Quaternion aimRotation, Vector3 forward) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(projectilePrefab, aimPosition, aimRotation); val.GetComponent<NetworkObject>().SpawnWithOwnership(((NetworkBehaviour)this).OwnerClientId, false); ApplyProjectileForceClientRpc(NetworkObjectReference.op_Implicit(val.GetComponent<NetworkObject>()), aimPosition, aimRotation, forward); } [ClientRpc] public void ApplyProjectileForceClientRpc(NetworkObjectReference projectile, Vector3 aimPosition, Quaternion aimRotation, Vector3 forward) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2170744407u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref projectile, default(ForNetworkSerializable)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimPosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref aimRotation); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref forward); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2170744407u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref projectile)).TryGet(ref val3, (NetworkManager)null)) { GameObject gameObject = ((Component)val3).gameObject; gameObject.transform.position = aimPosition; gameObject.transform.rotation = aimRotation; gameObject.GetComponent<Rigidbody>().AddForce(forward * LobForce, (ForceMode)1); } } } private void PlayRandomAudio(AudioSource audioSource, AudioClip[] audioClips) { if (audioClips.Length != 0) { audioSource.PlayOneShot(audioClips[Random.Range(0, audioClips.Length)]); } } public override void Update() { ((GrabbableObject)this).Update(); timeSinceLastShot += Time.deltaTime; } private void OnEnable() { } private void OnDisable() { } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true; } public void DestroyItemInSlotAndSync(int itemSlot) { if (((NetworkBehaviour)this).IsOwner) { if (itemSlot >= ((GrabbableObject)this).playerHeldBy.ItemSlots.Length || (Object)(object)((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot] == (Object)null) { Debug.LogError((object)$"Destroy item in slot called for a slot (slot {itemSlot}) which is empty or incorrect"); } DestroyItemInSlotServerRpc(itemSlot); } } [ServerRpc] public void DestroyItemInSlotServerRpc(int itemSlot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3656085789u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemSlot); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3656085789u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { DestroyItemInSlotClientRpc(itemSlot); } } [ClientRpc] public void DestroyItemInSlotClientRpc(int itemSlot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(314723133u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, itemSlot); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 314723133u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { DestroyItemInSlot(itemSlot); } } } public void DestroyItemInSlot(int itemSlot) { if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || (Object)(object)NetworkManager.Singleton == (Object)null || NetworkManager.Singleton.ShutdownInProgress) { return; } GrabbableObject val = ((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot]; if ((Object)(object)val == (Object)null || (Object)(object)val.itemProperties == (Object)null) { Plugin.logger.LogError((object)"Item properties are null, cannot destroy item in slot"); return; } PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy; playerHeldBy.carryWeight -= Mathf.Clamp(val.itemProperties.weight - 1f, 0f, 10f); if (((GrabbableObject)this).playerHeldBy.currentItemSlot == itemSlot) { ((GrabbableObject)this).playerHeldBy.isHoldingObject = false; ((GrabbableObject)this).playerHeldBy.twoHanded = false; if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner) { ((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("cancelHolding", true); ((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("Throw"); ((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false; HUDManager.Instance.ClearControlTips(); ((GrabbableObject)this).playerHeldBy.activatingItem = false; } } if (((NetworkBehaviour)this).IsOwner) { ((Behaviour)HUDManager.Instance.itemSlotIcons[itemSlot]).enabled = false; } if ((Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer != (Object)null && (Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer == (Object)(object)val) { if (((NetworkBehaviour)((GrabbableObject)this).playerHeldBy).IsOwner) { ((GrabbableObject)this).playerHeldBy.SetSpecialGrabAnimationBool(false, ((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer); ((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer.DiscardItemOnClient(); } ((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer = null; } ((GrabbableObject)this).playerHeldBy.ItemSlots[itemSlot] = null; if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)val).NetworkObject.Despawn(true); } } protected override void __initializeVariables() { if (currentAmmo == null) { throw new Exception("ProjectileWeapon.currentAmmo cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)currentAmmo).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)currentAmmo, "currentAmmo"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)currentAmmo); base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ProjectileWeapon() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(43845628u, new RpcReceiveHandler(__rpc_handler_43845628)); NetworkManager.__rpc_func_table.Add(948021082u, new RpcReceiveHandler(__rpc_handler_948021082)); NetworkManager.__rpc_func_table.Add(1064596822u, new RpcReceiveHandler(__rpc_handler_1064596822)); NetworkManager.__rpc_func_table.Add(3520251861u, new RpcReceiv
plugins/MaskedEnemyRework.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using MaskedEnemyRework.External_Classes; using MaskedEnemyRework.Patches; using Microsoft.CodeAnalysis; using MoreCompany; using MoreCompany.Cosmetics; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyCompany("MaskedEnemyRework")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("3.1.1.0")] [assembly: AssemblyInformationalVersion("3.1.1")] [assembly: AssemblyProduct("MaskedEnemyRework")] [assembly: AssemblyTitle("MaskedEnemyRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MaskedEnemyRework { [BepInPlugin("MaskedEnemyRework", "MaskedEnemyRework", "3.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("MaskedEnemyRework"); private static Plugin Instance; internal ManualLogSource logger; public static List<int> PlayerMimicList; public static int PlayerMimicIndex; private ConfigEntry<bool> RemoveMasksConfig; private ConfigEntry<bool> RevealMasksConfig; private ConfigEntry<bool> ShowMaskedNamesConfig; private ConfigEntry<bool> RemoveZombieArmsConfig; private ConfigEntry<bool> UseSpawnRarityConfig; private ConfigEntry<int> SpawnRarityConfig; private ConfigEntry<bool> CanSpawnOutsideConfig; private ConfigEntry<int> MaxSpawnCountConfig; private ConfigEntry<bool> ZombieApocalypeModeConfig; private ConfigEntry<bool> UseVanillaSpawnsConfig; private ConfigEntry<int> ZombieApocalypeRandomChanceConfig; private ConfigEntry<int> MaxZombiesZombieConfig; private ConfigEntry<float> InsideEnemySpawnCurveConfig; private ConfigEntry<float> MiddayInsideEnemySpawnCurveConfig; private ConfigEntry<float> StartOutsideEnemySpawnCurveConfig; private ConfigEntry<float> MidOutsideEnemySpawnCurveConfig; private ConfigEntry<float> EndOutsideEnemySpawnCurveConfig; public static bool RemoveMasks; public static bool RevealMasks; public static bool ShowMaskedNames; public static bool RemoveZombieArms; public static bool UseSpawnRarity; public static int SpawnRarity; public static bool CanSpawnOutside; public static int MaxSpawnCount; public static int MaxZombies; public static bool ZombieApocalypseMode; public static bool UseVanillaSpawns; public static int RandomChanceZombieApocalypse; public static float InsideEnemySpawnCurve; public static float MiddayInsideEnemySpawnCurve; public static float StartOutsideEnemySpawnCurve; public static float MidOutsideEnemySpawnCurve; public static float EndOutsideEnemySpawnCurve; public static int InitialPlayerCount; public static SpawnableEnemyWithRarity maskedPrefab; public static SpawnableEnemyWithRarity flowerPrefab; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } PlayerMimicList = new List<int>(); PlayerMimicIndex = 0; InitialPlayerCount = 0; ShowMaskedNamesConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Show Masked Usernames", false, "Will show username of player being mimicked."); RemoveMasksConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Mask From Masked Enemy", true, "Whether or not the Masked Enemy has a mask on."); RevealMasksConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Reveal Mask When Attacking", false, "The enemy would reveal their mask permanently after trying to attack someone. Mask would be off until the attempt to attack is made"); RemoveZombieArmsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Zombie Arms", true, "Remove the animation where the Masked raise arms like a zombie."); UseVanillaSpawnsConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Use Vanilla Spawns", false, "Ignores anything else in this mod. Only uses the above settings from this config. Will not spawn on all moons. will ignore EVERYTHING in the config below this point."); UseSpawnRarityConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawns", "Use Spawn Rarity", false, "Use custom spawn rate from config. If this is false, the masked spawns at the same rate as the Bracken. If true, will spawn at whatever rarity is given in Spawn Rarity config option"); SpawnRarityConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Spawns", "Spawn Rarity", 15, "The rarity for the Masked Enemy to spawn. The higher the number, the more likely to spawn. Can go to 1000000000, any higher will break. Use Spawn Rarity must be set to True"); CanSpawnOutsideConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawns", "Allow Masked To Spawn Outside", false, "Whether the Masked Enemy can spawn outside the building"); MaxSpawnCountConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Spawns", "Max Number of Masked", 2, "Max Number of possible masked to spawn in one level"); ZombieApocalypeModeConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Zombie Apocalypse Mode", "Zombie Apocalypse Mode", false, "Only spawns Masked! Make sure to crank up the Max Spawn Count in this config! Would also recommend bringing a gun (mod), a shovel works fine too though.... This mode does not play nice with other mods that affect spawn rates. Disable those before playing for best results"); MaxZombiesZombieConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Zombie Apocalypse Mode", "Max Number of Masked in Zombie Apocalypse", 2, "Max Number of possible masked to spawn in Zombie Apocalypse"); ZombieApocalypeRandomChanceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Zombie Apocalypse Mode", "Random Zombie Apocalypse Mode", -1, "[Must Be Whole Number] The percent chance from 1 to 100 that a day could contain a zombie apocalypse. Put at -1 to never have the chance arise and don't have Only Spawn Masked turned on"); InsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "StartOfDay Inside Masked Spawn Curve", 0.1f, "Spawn curve for masked inside, start of the day. Crank this way up for immediate action. More info in the readme"); MiddayInsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "Midday Inside Masked Spawn Curve", 500f, "Spawn curve for masked inside, midday."); StartOutsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "StartOfDay Masked Outside Spawn Curve", -30f, "Spawn curve for outside masked, start of the day."); MidOutsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "Midday Outside Masked Spawn Curve", -30f, "Spawn curve for outside masked, midday."); EndOutsideEnemySpawnCurveConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Zombie Apocalypse Mode", "EOD Outside Masked Spawn Curve", 10f, "Spawn curve for outside masked, end of day"); RemoveMasks = RemoveMasksConfig.Value; ShowMaskedNames = ShowMaskedNamesConfig.Value; RevealMasks = RevealMasksConfig.Value; UseVanillaSpawns = UseVanillaSpawnsConfig.Value; RemoveZombieArms = RemoveZombieArmsConfig.Value; UseSpawnRarity = UseSpawnRarityConfig.Value; CanSpawnOutside = CanSpawnOutsideConfig.Value; MaxSpawnCount = MaxSpawnCountConfig.Value; SpawnRarity = SpawnRarityConfig.Value; ZombieApocalypseMode = ZombieApocalypeModeConfig.Value; MaxZombies = MaxZombiesZombieConfig.Value; InsideEnemySpawnCurve = InsideEnemySpawnCurveConfig.Value; MiddayInsideEnemySpawnCurve = MiddayInsideEnemySpawnCurveConfig.Value; StartOutsideEnemySpawnCurve = StartOutsideEnemySpawnCurveConfig.Value; MidOutsideEnemySpawnCurve = MidOutsideEnemySpawnCurveConfig.Value; EndOutsideEnemySpawnCurve = EndOutsideEnemySpawnCurveConfig.Value; RandomChanceZombieApocalypse = ZombieApocalypeRandomChanceConfig.Value; logger = Logger.CreateLogSource("MaskedEnemyRework"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MaskedEnemyRework is loaded! Woohoo!"); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(GetMaskedPrefabForLaterUse)); harmony.PatchAll(typeof(MaskedVisualRework)); harmony.PatchAll(typeof(MaskedSpawnSettings)); } } public static class PluginInfo { public const string PLUGIN_GUID = "MaskedEnemyRework"; public const string PLUGIN_NAME = "MaskedEnemyRework"; public const string PLUGIN_VERSION = "3.1.1"; } } namespace MaskedEnemyRework.Patches { [HarmonyPatch] internal class GetMaskedPrefabForLaterUse { [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void SavesPrefabForLaterUse(ref SelectableLevel[] ___moonsCatalogueList) { ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); SelectableLevel[] array = ___moonsCatalogueList; foreach (SelectableLevel val2 in array) { foreach (SpawnableEnemyWithRarity enemy in val2.Enemies) { if (enemy.enemyType.enemyName == "Masked") { val.LogInfo((object)"Found Masked!"); Plugin.maskedPrefab = enemy; } else if (enemy.enemyType.enemyName == "Flowerman") { Plugin.flowerPrefab = enemy; val.LogInfo((object)"Found Flowerman!"); } } } } [HarmonyPatch(typeof(PlayerControllerB), "SetHoverTipAndCurrentInteractTrigger")] [HarmonyPrefix] private static void LookingAtMasked(ref PlayerControllerB __instance) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.ShowMaskedNames) { return; } Ray val = default(Ray); ((Ray)(ref val))..ctor(((Component)__instance.gameplayCamera).transform.position, ((Component)__instance.gameplayCamera).transform.forward); LayerMask val2 = LayerMask.op_Implicit(524288); RaycastHit val3 = default(RaycastHit); if (!__instance.isFreeCamera && Physics.Raycast(val, ref val3, 5f, LayerMask.op_Implicit(val2))) { EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val3)).collider).gameObject.GetComponent<EnemyAICollisionDetect>(); MaskedPlayerEnemy val4 = null; if (Object.op_Implicit((Object)(object)component)) { val4 = ((Component)component.mainScript).gameObject.GetComponent<MaskedPlayerEnemy>(); } if ((Object)(object)val4 != (Object)null) { MaskedNamePatch.ToggleName(val4, TurnOn: true); } } } } internal class MaskedNamePatch { public static void UpdateNameBillboard(MaskedPlayerEnemy masked) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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) MaskedNameBillboard maskedNameBillboard = default(MaskedNameBillboard); if (((Component)masked).gameObject.TryGetComponent<MaskedNameBillboard>(ref maskedNameBillboard)) { Canvas usernameCanvas = maskedNameBillboard.usernameCanvas; CanvasGroup canvasGroup = GetCanvasGroup(usernameCanvas); Transform transform = ((Component)usernameCanvas).transform; TextMeshProUGUI usernameText = maskedNameBillboard.usernameText; if (Object.op_Implicit((Object)(object)usernameCanvas) && Object.op_Implicit((Object)(object)transform) && Object.op_Implicit((Object)(object)canvasGroup)) { if (!((Component)usernameText).gameObject.activeInHierarchy || !Object.op_Implicit((Object)(object)((Graphic)usernameText).canvas)) { ((TMP_Text)usernameText).transform.SetParent(transform, false); } if (canvasGroup.alpha >= 0f && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { canvasGroup.alpha -= Time.deltaTime; Vector3 val = default(Vector3); ((Vector3)(ref val)).Set(((Component)masked).transform.position.x, ((Component)masked).transform.position.y + 2.64f, ((Component)masked).transform.position.z); transform.SetPositionAndRotation(val, transform.rotation); transform.LookAt(GameNetworkManager.Instance.localPlayerController.localVisorTargetPoint); } else if (((Component)usernameCanvas).gameObject.activeSelf) { ((Component)usernameCanvas).gameObject.SetActive(false); } } } else if ((Object)(object)masked.mimickingPlayer != (Object)null) { SetNameBillboard(masked); } } public static void ToggleName(MaskedPlayerEnemy masked, bool TurnOn) { MaskedNameBillboard maskedNameBillboard = default(MaskedNameBillboard); if (!((Object)(object)masked == (Object)null) && ((Component)masked).gameObject.TryGetComponent<MaskedNameBillboard>(ref maskedNameBillboard)) { ((Component)maskedNameBillboard.usernameCanvas).gameObject.SetActive(TurnOn); if (TurnOn) { GetCanvasGroup(maskedNameBillboard.usernameCanvas).alpha = 1f; } } } public static CanvasGroup GetCanvasGroup(Canvas canvas) { CanvasGroup val = null; if ((Object)(object)canvas != (Object)null) { val = ((Component)canvas).gameObject.GetComponent<CanvasGroup>(); if ((Object)(object)val == (Object)null) { val = ((Component)canvas).gameObject.AddComponent<CanvasGroup>(); } } return val; } public static void SetNameBillboard(MaskedPlayerEnemy masked) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: 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_02c4: 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_02e0: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)masked.mimickingPlayer == (Object)null)) { PlayerControllerB mimickingPlayer = masked.mimickingPlayer; MaskedNameBillboard maskedNameBillboard = default(MaskedNameBillboard); if (!((Component)masked).gameObject.TryGetComponent<MaskedNameBillboard>(ref maskedNameBillboard)) { maskedNameBillboard = ((Component)masked).gameObject.AddComponent<MaskedNameBillboard>(); } maskedNameBillboard.usernameCanvas = mimickingPlayer.usernameCanvas; GetCanvasGroup(maskedNameBillboard.usernameCanvas); GameObject val = new GameObject("usernameText"); val.transform.SetParent(((Component)maskedNameBillboard.usernameCanvas).transform, false); maskedNameBillboard.usernameText = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)maskedNameBillboard.usernameText).transform.SetParent(((Component)maskedNameBillboard.usernameCanvas).transform, false); ((TMP_Text)maskedNameBillboard.usernameText).text = ((TMP_Text)mimickingPlayer.usernameBillboardText).text; ((TMP_Text)maskedNameBillboard.usernameText).font = ((TMP_Text)mimickingPlayer.usernameBillboardText).font; ((Graphic)maskedNameBillboard.usernameText).color = ((Graphic)mimickingPlayer.usernameBillboardText).color; ((TMP_Text)maskedNameBillboard.usernameText).fontSize = ((TMP_Text)mimickingPlayer.usernameBillboardText).fontSize; ((TMP_Text)maskedNameBillboard.usernameText).enableAutoSizing = ((TMP_Text)mimickingPlayer.usernameBillboardText).enableAutoSizing; ((TMP_Text)maskedNameBillboard.usernameText).extraPadding = ((TMP_Text)mimickingPlayer.usernameBillboardText).extraPadding; ((TMP_Text)maskedNameBillboard.usernameText).alignment = ((TMP_Text)mimickingPlayer.usernameBillboardText).alignment; ((TMP_Text)maskedNameBillboard.usernameText).textStyle = ((TMP_Text)mimickingPlayer.usernameBillboardText).textStyle; ((TMP_Text)maskedNameBillboard.usernameText).textPreprocessor = ((TMP_Text)mimickingPlayer.usernameBillboardText).textPreprocessor; ((TMP_Text)maskedNameBillboard.usernameText).characterSpacing = ((TMP_Text)mimickingPlayer.usernameBillboardText).characterSpacing; ((TMP_Text)maskedNameBillboard.usernameText).wordSpacing = ((TMP_Text)mimickingPlayer.usernameBillboardText).wordSpacing; ((TMP_Text)maskedNameBillboard.usernameText).lineSpacing = ((TMP_Text)mimickingPlayer.usernameBillboardText).lineSpacing; ((TMP_Text)maskedNameBillboard.usernameText).margin = ((TMP_Text)mimickingPlayer.usernameBillboardText).margin; ((TMP_Text)maskedNameBillboard.usernameText).overflowMode = ((TMP_Text)mimickingPlayer.usernameBillboardText).overflowMode; ((TMP_Text)maskedNameBillboard.usernameText).fontSharedMaterial = ((TMP_Text)mimickingPlayer.usernameBillboardText).fontSharedMaterial; ((TMP_Text)maskedNameBillboard.usernameText).fontSizeMin = ((TMP_Text)mimickingPlayer.usernameBillboardText).fontSizeMin; ((TMP_Text)maskedNameBillboard.usernameText).fontSizeMax = ((TMP_Text)mimickingPlayer.usernameBillboardText).fontSizeMax; ((TMP_Text)maskedNameBillboard.usernameText).enableKerning = ((TMP_Text)mimickingPlayer.usernameBillboardText).enableKerning; RectTransform component = ((Component)mimickingPlayer.usernameBillboardText).GetComponent<RectTransform>(); RectTransform component2 = ((Component)maskedNameBillboard.usernameText).GetComponent<RectTransform>(); ((Transform)component2).localPosition = ((Transform)component).localPosition; component2.sizeDelta = component.sizeDelta; component2.anchorMin = component.anchorMin; component2.anchorMax = component.anchorMax; component2.pivot = component.pivot; component2.anchoredPosition = component.anchoredPosition; ((Transform)component2).localScale = ((Transform)component).localScale; component2.offsetMin = component.offsetMin; component2.offsetMax = component.offsetMax; ((Transform)component2).right = ((Transform)component).right; ((Component)maskedNameBillboard.usernameText).gameObject.SetActive(true); ((Behaviour)maskedNameBillboard.usernameText).enabled = true; ((Behaviour)maskedNameBillboard.usernameCanvas).enabled = true; } } } [HarmonyPatch(typeof(RoundManager))] internal class MaskedSpawnSettings { [HarmonyPatch("BeginEnemySpawning")] [HarmonyPrefix] private static void UpdateSpawnRates(ref SelectableLevel ___currentLevel) { //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_022b: 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_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0257: 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_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown if (Plugin.UseVanillaSpawns) { return; } try { SpawnableEnemyWithRarity maskedPrefab = Plugin.maskedPrefab; SpawnableEnemyWithRarity val = Plugin.flowerPrefab; List<SpawnableEnemyWithRarity> enemies = ___currentLevel.Enemies; for (int i = 0; i < ___currentLevel.Enemies.Count; i++) { SpawnableEnemyWithRarity val2 = ___currentLevel.Enemies[i]; if (val2.enemyType.enemyName == "Masked") { enemies.Remove(val2); } if (val2.enemyType.enemyName == "Flowerman") { val = val2; } } ___currentLevel.Enemies = enemies; maskedPrefab.enemyType.PowerLevel = 1; maskedPrefab.enemyType.probabilityCurve = val.enemyType.probabilityCurve; if (Plugin.UseSpawnRarity) { maskedPrefab.rarity = Plugin.SpawnRarity; } else { maskedPrefab.rarity = val.rarity; } maskedPrefab.enemyType.MaxCount = Plugin.MaxSpawnCount; int num = 0; num = ((StartOfRound.Instance.randomMapSeed.ToString().Length >= 3) ? int.Parse(StartOfRound.Instance.randomMapSeed.ToString().Substring(1, 2)) : 0); num = Mathf.Clamp(num, 0, 100); if (Plugin.ZombieApocalypseMode || (num <= Plugin.RandomChanceZombieApocalypse && Plugin.RandomChanceZombieApocalypse >= 0)) { maskedPrefab.enemyType.MaxCount = Plugin.MaxZombies; Plugin.RandomChanceZombieApocalypse = -1; ___currentLevel.enemySpawnChanceThroughoutDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, Plugin.InsideEnemySpawnCurve), new Keyframe(0.5f, Plugin.MiddayInsideEnemySpawnCurve) }); ___currentLevel.daytimeEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 7f), new Keyframe(0.5f, 7f) }); ___currentLevel.outsideEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, Plugin.StartOutsideEnemySpawnCurve), new Keyframe(20f, Plugin.MidOutsideEnemySpawnCurve), new Keyframe(21f, Plugin.EndOutsideEnemySpawnCurve) }); maskedPrefab.rarity = 1000000; } maskedPrefab.enemyType.isOutsideEnemy = Plugin.CanSpawnOutside; if (Plugin.CanSpawnOutside) { ___currentLevel.OutsideEnemies.Add(maskedPrefab); } SelectableLevel obj = ___currentLevel; obj.maxEnemyPowerCount += maskedPrefab.enemyType.MaxCount; SelectableLevel obj2 = ___currentLevel; obj2.maxDaytimeEnemyPowerCount += maskedPrefab.enemyType.MaxCount; SelectableLevel obj3 = ___currentLevel; obj3.maxOutsideEnemyPowerCount += maskedPrefab.enemyType.MaxCount; ___currentLevel.Enemies.Add(maskedPrefab); } catch { } } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] internal class MaskedVisualRework { private static int randomPlayerIndex; private static IEnumerator coroutine; [HarmonyPatch("Start")] [HarmonyBefore(new string[] { "AdvancedCompany" })] [HarmonyPostfix] private static void ReformVisuals(ref MaskedPlayerEnemy __instance) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; int num = StartOfRound.Instance.ClientPlayerList.Count; if (num == 0) { num = 1; val.LogError((object)"Player count was zero"); } if (Plugin.PlayerMimicList.Count <= 1 || Plugin.InitialPlayerCount != num) { Plugin.InitialPlayerCount = num; State state = Random.state; Random.InitState(1234); for (int i = 0; i < 50; i++) { Plugin.PlayerMimicList.Add(Random.Range(0, num)); } Random.state = state; } randomPlayerIndex = Plugin.PlayerMimicList[Plugin.PlayerMimicIndex % 50]; randomPlayerIndex = Mathf.Clamp(randomPlayerIndex, 0, num); Plugin.PlayerMimicIndex++; if ((Object)(object)__instance.mimickingPlayer == (Object)null) { __instance.mimickingPlayer = allPlayerScripts[randomPlayerIndex]; } __instance.SetSuit(__instance.mimickingPlayer.currentSuitID); if (Plugin.RemoveMasks || Plugin.RevealMasks) { ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject.SetActive(false); ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskTragedy")).gameObject.SetActive(false); } if (Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany") && !Chainloader.PluginInfos.ContainsKey("com.potatoepet.AdvancedCompany")) { MoreCompanyPatch.ApplyCosmetics(__instance); } if (Plugin.ShowMaskedNames) { MaskedNamePatch.SetNameBillboard(__instance); } } [HarmonyPatch("SetHandsOutClientRpc")] [HarmonyPrefix] private static void MaskAndArmsReveal(ref bool setOut, ref MaskedPlayerEnemy __instance) { GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject; if (Plugin.RevealMasks && !gameObject.activeSelf && ((EnemyAI)__instance).currentBehaviourStateIndex == 1) { ManualLogSource val = Logger.CreateLogSource("MaskedEnemyRework"); IEnumerator enumerator = FadeInAndOut(gameObject, fadeIn: true, 1f); ((MonoBehaviour)__instance).StartCoroutine(enumerator); } if (Plugin.RemoveZombieArms) { setOut = false; } if (Plugin.ShowMaskedNames) { MaskedNamePatch.SetNameBillboard(__instance); } } [HarmonyPatch("SetEnemyOutside")] [HarmonyPostfix] [HarmonyPriority(300)] private static void HideCosmeticsIfMarked(ref MaskedPlayerEnemy __instance) { if (Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany") && !Chainloader.PluginInfos.ContainsKey("com.potatoepet.AdvancedCompany")) { MoreCompanyPatch.ApplyCosmetics(__instance); } } [HarmonyPatch("DoAIInterval")] [HarmonyPostfix] private static void HideRevealedMask(ref MaskedPlayerEnemy __instance) { if (Plugin.RevealMasks && (Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null) { GameObject gameObject = ((Component)((Component)__instance).gameObject.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/spine.004/HeadMaskComedy")).gameObject; if (gameObject.activeSelf) { IEnumerator enumerator = FadeInAndOut(gameObject, fadeIn: false, 1f); ((MonoBehaviour)__instance).StartCoroutine(enumerator); } } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdateMaskName(ref MaskedPlayerEnemy __instance) { if (Plugin.ShowMaskedNames) { MaskedNamePatch.UpdateNameBillboard(__instance); } } private static IEnumerator FadeInAndOut(GameObject mask, bool fadeIn, float duration) { float counter = 0f; mask.SetActive(true); float startLoc; float endLoc; if (fadeIn) { startLoc = 0.095f; endLoc = 0.215f; } else { startLoc = 0.215f; endLoc = 0.095f; } while (counter < duration) { counter += Time.deltaTime; float loc = Mathf.Lerp(startLoc, endLoc, counter / duration); mask.transform.localPosition = new Vector3(-0.009f, 0.143f, loc); yield return null; } if (!fadeIn) { mask.SetActive(false); } } } internal class MoreCompanyPatch { public static void ApplyCosmetics(MaskedPlayerEnemy masked) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (!MainClass.showCosmetics || MainClass.playerIdsAndCosmetics.Count == 0) { return; } Transform val = ((Component)masked).transform.Find("ScavengerModel").Find("metarig"); CosmeticApplication component = ((Component)val).GetComponent<CosmeticApplication>(); if (Object.op_Implicit((Object)(object)component)) { component.ClearCosmetics(); Object.Destroy((Object)(object)component); } List<string> list = MainClass.playerIdsAndCosmetics[(int)masked.mimickingPlayer.playerClientId]; component = ((Component)val).gameObject.AddComponent<CosmeticApplication>(); foreach (string item in list) { component.ApplyCosmetic(item, true); } foreach (CosmeticInstance spawnedCosmetic in component.spawnedCosmetics) { Transform transform = ((Component)spawnedCosmetic).transform; transform.localScale *= 0.38f; } } } internal class RemoveZombieArms { [HarmonyPatch(typeof(MaskedPlayerEnemy), "SetHandsOutClientRpc")] [HarmonyPrefix] private static void RemoveArms(ref bool setOut) { if (Plugin.RemoveZombieArms) { setOut = false; } } } } namespace MaskedEnemyRework.External_Classes { internal class MaskedMimicFields : MonoBehaviour { public PlayerControllerB MimickingPlayerController { get; set; } } internal class MaskedNameBillboard : MonoBehaviour { public Canvas usernameCanvas; public TextMeshProUGUI usernameText; } }
plugins/Mimics.dll
Decompiled 10 months agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using DunGen; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyMimics.Properties; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Mimics")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A mod that adds mimics to Lethal Company")] [assembly: AssemblyFileVersion("2.3.2.0")] [assembly: AssemblyInformationalVersion("2.3.2")] [assembly: AssemblyProduct("Mimics")] [assembly: AssemblyTitle("Mimics")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.3.2.0")] [module: UnverifiableCode] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } namespace LethalCompanyMimics.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("LethalCompanyMimics.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] mimicdoor { get { object @object = ResourceManager.GetObject("mimicdoor", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace Mimics { [BepInPlugin("x753.Mimics", "Mimics", "2.3.2")] public class Mimics : BaseUnityPlugin { [HarmonyPatch(typeof(GameNetworkManager))] internal class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().AddNetworkPrefab(MimicNetworkerPrefab); } } [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref StartOfRound __instance) { if (((NetworkBehaviour)__instance).IsServer && (Object)(object)MimicNetworker.Instance == (Object)null) { GameObject val = Object.Instantiate<GameObject>(MimicNetworkerPrefab); val.GetComponent<NetworkObject>().Spawn(true); MimicNetworker.SpawnWeight0.Value = SpawnRates[0]; MimicNetworker.SpawnWeight1.Value = SpawnRates[1]; MimicNetworker.SpawnWeight2.Value = SpawnRates[2]; MimicNetworker.SpawnWeight3.Value = SpawnRates[3]; MimicNetworker.SpawnWeight4.Value = SpawnRates[4]; MimicNetworker.SpawnWeightMax.Value = SpawnRates[5]; MimicNetworker.SpawnRateDynamic.Value = DynamicSpawnRate; } } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref StartOfRound __instance) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00c5: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown Terminal val = Object.FindObjectOfType<Terminal>(); if (!Object.op_Implicit((Object)(object)val.enemyFiles.Find((TerminalNode node) => node.creatureName == "Mimics"))) { MimicCreatureID = val.enemyFiles.Count; MimicFile.creatureFileID = MimicCreatureID; val.enemyFiles.Add(MimicFile); TerminalKeyword val2 = val.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); TerminalKeyword val3 = new TerminalKeyword { word = "mimics", isVerb = false, defaultVerb = val2 }; List<CompatibleNoun> list = val2.compatibleNouns.ToList(); list.Add(new CompatibleNoun { noun = val3, result = MimicFile }); val2.compatibleNouns = list.ToArray(); List<TerminalKeyword> list2 = val.terminalNodes.allKeywords.ToList(); list2.Add(val3); val.terminalNodes.allKeywords = list2.ToArray(); } } } [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { [HarmonyPatch("SetExitIDs")] [HarmonyPostfix] private static void SetExitIDsPatch(ref RoundManager __instance, Vector3 mainEntrancePosition) { //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0286: 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_029b: 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_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_07d3: Unknown result type (might be due to invalid IL or missing references) //IL_07dd: Expected O, but got Unknown //IL_08ac: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_0874: Unknown result type (might be due to invalid IL or missing references) //IL_0987: Unknown result type (might be due to invalid IL or missing references) //IL_09ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)MimicNetworker.Instance == (Object)null) { return; } MimicDoor.allMimics = new List<MimicDoor>(); int num = 0; Dungeon currentDungeon = __instance.dungeonGenerator.Generator.CurrentDungeon; if (!((Object)currentDungeon.DungeonFlow).name.StartsWith("Level1") && !((Object)currentDungeon.DungeonFlow).name.StartsWith("Level2")) { return; } int num2 = 0; int[] array = new int[6] { MimicNetworker.SpawnWeight0.Value, MimicNetworker.SpawnWeight1.Value, MimicNetworker.SpawnWeight2.Value, MimicNetworker.SpawnWeight3.Value, MimicNetworker.SpawnWeight4.Value, MimicNetworker.SpawnWeightMax.Value }; int num3 = 0; int[] array2 = array; foreach (int num4 in array2) { num3 += num4; } Random random = new Random(StartOfRound.Instance.randomMapSeed + 753); int num5 = random.Next(0, num3); int num6 = 0; for (int j = 0; j < array.Length; j++) { if (num5 < array[j] + num6) { num2 = j; break; } num6 += array[j]; } if (num2 == 5) { num2 = 999; } EntranceTeleport[] array3 = Object.FindObjectsOfType<EntranceTeleport>(false); int num7 = (array3.Length - 2) / 2; if (MimicNetworker.SpawnRateDynamic.Value && num2 < num7 && num7 > 1) { num2 += random.Next(0, 2); } if (MimicNetworker.SpawnRateDynamic.Value && currentDungeon.AllTiles.Count > 100) { num2 += random.Next(0, 2); } List<Doorway> list = new List<Doorway>(); Bounds val2 = default(Bounds); foreach (Tile allTile in currentDungeon.AllTiles) { foreach (Doorway unusedDoorway in allTile.UnusedDoorways) { if (unusedDoorway.HasDoorPrefabInstance || (Object)(object)((Component)unusedDoorway).GetComponentInChildren<SpawnSyncedObject>(true) == (Object)null) { continue; } GameObject gameObject = ((Component)((Component)((Component)unusedDoorway).GetComponentInChildren<SpawnSyncedObject>(true)).transform.parent).gameObject; if (!((Object)gameObject).name.StartsWith("AlleyExitDoorContainer") || gameObject.activeSelf) { continue; } bool flag = false; Matrix4x4 val = Matrix4x4.TRS(((Component)unusedDoorway).transform.position, ((Component)unusedDoorway).transform.rotation, new Vector3(1f, 1f, 1f)); ((Bounds)(ref val2))..ctor(new Vector3(0f, 1.5f, 5.5f), new Vector3(2f, 6f, 8f)); ((Bounds)(ref val2)).center = ((Matrix4x4)(ref val)).MultiplyPoint3x4(((Bounds)(ref val2)).center); Collider[] array4 = Physics.OverlapBox(((Bounds)(ref val2)).center, ((Bounds)(ref val2)).extents, ((Component)unusedDoorway).transform.rotation, LayerMask.GetMask(new string[3] { "Room", "Railing", "MapHazards" })); Collider[] array5 = array4; int num8 = 0; if (num8 < array5.Length) { Collider val3 = array5[num8]; flag = true; } if (flag) { continue; } foreach (Tile allTile2 in currentDungeon.AllTiles) { if (!((Object)(object)allTile == (Object)(object)allTile2)) { Vector3 origin = ((Component)unusedDoorway).transform.position + 5f * ((Component)unusedDoorway).transform.forward; Bounds val4 = UnityUtil.CalculateProxyBounds(((Component)allTile2).gameObject, true, Vector3.up); Ray val5 = default(Ray); ((Ray)(ref val5)).origin = origin; ((Ray)(ref val5)).direction = Vector3.up; if (((Bounds)(ref val4)).IntersectRay(val5) && (((Object)allTile2).name.Contains("Catwalk") || ((Object)allTile2).name.Contains("LargeForkTile") || ((Object)allTile2).name.Contains("4x4BigStair") || ((Object)allTile2).name.Contains("ElevatorConnector") || (((Object)allTile2).name.Contains("StartRoom") && !((Object)allTile2).name.Contains("Manor")))) { flag = true; } val5 = default(Ray); ((Ray)(ref val5)).origin = origin; ((Ray)(ref val5)).direction = Vector3.down; if (((Bounds)(ref val4)).IntersectRay(val5) && (((Object)allTile2).name.Contains("MediumRoomHallway1B") || ((Object)allTile2).name.Contains("LargeForkTile") || ((Object)allTile2).name.Contains("4x4BigStair") || ((Object)allTile2).name.Contains("ElevatorConnector") || ((Object)allTile2).name.Contains("StartRoom"))) { flag = true; } } } if (!flag) { list.Add(unusedDoorway); } } } Shuffle(list, StartOfRound.Instance.randomMapSeed); List<Vector3> list2 = new List<Vector3>(); foreach (Doorway item in list) { if (num >= num2) { break; } bool flag2 = false; Vector3 val6 = ((Component)item).transform.position + 5f * ((Component)item).transform.forward; foreach (Vector3 item2 in list2) { if (Vector3.Distance(val6, item2) < 4f) { flag2 = true; break; } } if (flag2) { continue; } list2.Add(val6); GameObject gameObject2 = ((Component)((Component)((Component)item).GetComponentInChildren<SpawnSyncedObject>(true)).transform.parent).gameObject; GameObject val7 = Object.Instantiate<GameObject>(MimicPrefab, ((Component)item).transform); val7.transform.position = gameObject2.transform.position; MimicDoor component = val7.GetComponent<MimicDoor>(); component.scanNode.creatureScanID = MimicCreatureID; AudioSource[] componentsInChildren = val7.GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val8 in componentsInChildren) { val8.volume = MimicVolume / 100f; val8.outputAudioMixerGroup = StartOfRound.Instance.ship3DAudio.outputAudioMixerGroup; } if (SpawnRates[5] == 9753 && num == 0) { val7.transform.position = new Vector3(-7f, 0f, -10f); } MimicDoor.allMimics.Add(component); component.mimicIndex = num; num++; GameObject gameObject3 = ((Component)((Component)item).transform.GetChild(0)).gameObject; gameObject3.SetActive(false); Bounds bounds = ((Collider)component.frameBox).bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = ((Collider)component.frameBox).bounds; Collider[] array6 = Physics.OverlapBox(center, ((Bounds)(ref bounds)).extents, Quaternion.identity); foreach (Collider val9 in array6) { if (((Object)((Component)val9).gameObject).name.Contains("Shelf")) { ((Component)val9).gameObject.SetActive(false); } } Light componentInChildren = gameObject2.GetComponentInChildren<Light>(true); ((Component)componentInChildren).transform.parent.SetParent(val7.transform); MeshRenderer[] componentsInChildren2 = val7.GetComponentsInChildren<MeshRenderer>(); MeshRenderer[] array7 = componentsInChildren2; foreach (MeshRenderer val10 in array7) { Material[] materials = ((Renderer)val10).materials; foreach (Material val11 in materials) { val11.shader = ((Renderer)gameObject3.GetComponentInChildren<MeshRenderer>(true)).material.shader; val11.renderQueue = ((Renderer)gameObject3.GetComponentInChildren<MeshRenderer>(true)).material.renderQueue; } } component.interactTrigger.onInteract = new InteractEvent(); ((UnityEvent<PlayerControllerB>)(object)component.interactTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)component.TouchMimic); if (MimicPerfection) { continue; } component.interactTrigger.timeToHold = 0.9f; if (!ColorBlindMode) { if ((StartOfRound.Instance.randomMapSeed + num) % 2 == 0) { ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.490566f, 0.1226415f, 0.1302275f); ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(0.4339623f, 0.1043965f, 0.1150277f); componentInChildren.colorTemperature = 1250f; } else { ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.5f, 0.1580188f, 0.1657038f); ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(43f / 106f, 0.1358579f, 0.1393619f); componentInChildren.colorTemperature = 1300f; } } else if ((StartOfRound.Instance.randomMapSeed + num) % 2 == 0) { component.interactTrigger.timeToHold = 1.1f; } else { component.interactTrigger.timeToHold = 1f; } if (!EasyMode) { continue; } Random random2 = new Random(StartOfRound.Instance.randomMapSeed + num); switch (random2.Next(0, 4)) { case 0: if (!ColorBlindMode) { ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[0]).material.color = new Color(0.489f, 0.2415526f, 0.1479868f); ((Renderer)val7.GetComponentsInChildren<MeshRenderer>()[1]).material.color = new Color(0.489f, 0.2415526f, 0.1479868f); } else { component.interactTrigger.timeToHold = 1.5f; } break; case 1: component.interactTrigger.hoverTip = "Feed : [LMB]"; component.interactTrigger.holdTip = "Feed : [LMB]"; break; case 2: component.interactTrigger.hoverIcon = component.LostFingersIcon; break; case 3: component.interactTrigger.holdTip = "DIE : [LMB]"; component.interactTrigger.timeToHold = 0.5f; break; default: component.interactTrigger.hoverTip = "BUG, REPORT TO DEVELOPER"; break; } } } } [HarmonyPatch(typeof(SprayPaintItem))] internal class SprayPaintItemPatch { private static FieldInfo SprayHit = typeof(SprayPaintItem).GetField("sprayHit", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch("SprayPaintClientRpc")] [HarmonyPostfix] private static void SprayPaintClientRpcPatch(SprayPaintItem __instance, Vector3 sprayPos, Vector3 sprayRot) { //IL_0019: 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) if ((Object)(object)MimicNetworker.Instance == (Object)null) { return; } RaycastHit val = (RaycastHit)SprayHit.GetValue(__instance); if ((Object)(object)((RaycastHit)(ref val)).collider != (Object)null && ((Object)((RaycastHit)(ref val)).collider).name == "MimicSprayCollider") { MimicDoor component = ((Component)((Component)((RaycastHit)(ref val)).collider).transform.parent.parent).GetComponent<MimicDoor>(); component.sprayCount++; if (component.sprayCount > 8) { MimicNetworker.Instance.MimicAddAnger(1, component.mimicIndex); } } } } [HarmonyPatch(typeof(LockPicker))] internal class LockPickerPatch { private static FieldInfo RayHit = typeof(LockPicker).GetField("hit", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch("ItemActivate")] [HarmonyPostfix] private static void ItemActivatePatch(LockPicker __instance, bool used, bool buttonDown = true) { //IL_0019: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)MimicNetworker.Instance == (Object)null) { return; } RaycastHit val = (RaycastHit)RayHit.GetValue(__instance); if (!((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) && !((object)(RaycastHit)(ref val)).Equals((object)default(RaycastHit)) && !((Object)(object)((RaycastHit)(ref val)).transform.parent == (Object)null)) { Transform parent = ((RaycastHit)(ref val)).transform.parent; if (((Object)parent).name.StartsWith("MimicDoor")) { MimicNetworker.Instance.MimicLockPick(__instance, ((Component)parent).GetComponent<MimicDoor>().mimicIndex); } } } } private const string modGUID = "x753.Mimics"; private const string modName = "Mimics"; private const string modVersion = "2.3.2"; private readonly Harmony harmony = new Harmony("x753.Mimics"); private static Mimics Instance; public static GameObject MimicPrefab; public static GameObject MimicNetworkerPrefab; public static TerminalNode MimicFile; public static int MimicCreatureID; public static int[] SpawnRates; public static bool MimicPerfection; public static bool EasyMode; public static bool ColorBlindMode; public static float MimicVolume; public static bool DynamicSpawnRate; private void Awake() { AssetBundle val = AssetBundle.LoadFromMemory(Resources.mimicdoor); MimicPrefab = val.LoadAsset<GameObject>("Assets/MimicDoor.prefab"); MimicNetworkerPrefab = val.LoadAsset<GameObject>("Assets/MimicNetworker.prefab"); MimicFile = val.LoadAsset<TerminalNode>("Assets/MimicFile.asset"); if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Mimics is loaded!"); SpawnRates = new int[6] { ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Zero Mimics", 23, "Weight of zero mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "One Mimic", 69, "Weight of one mimic spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Two Mimics", 7, "Weight of two mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Three Mimics", 1, "Weight of three mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Four Mimics", 0, "Weight of four mimics spawning").Value, ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Maximum Mimics", 0, "Weight of maximum mimics spawning").Value }; DynamicSpawnRate = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawn Rate", "Dynamic Spawn Rate", true, "Increases mimic spawn rate based on dungeon size and the number of instances of the real thing.").Value; MimicPerfection = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Perfect Mimics", false, "Select this if you want mimics to be the exact same color as the real thing. Overrides all difficulty settings.").Value; EasyMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Easy Mode", false, "Each mimic will have one of several possible imperfections to help you tell if it's a mimic.").Value; ColorBlindMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Difficulty", "Color Blind Mode", false, "Replaces all color differences with another way to differentiate mimics.").Value; MimicVolume = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SFX Volume", 100, "Volume of the mimic's SFX (0-100)").Value; if (MimicVolume < 0f) { MimicVolume = 0f; } if (MimicVolume > 100f) { MimicVolume = 100f; } ((BaseUnityPlugin)this).Config.Bind<int>("Difficulty", "Difficulty Level", 0, "This is an old setting, ignore it."); ((BaseUnityPlugin)this).Config.Remove(((BaseUnityPlugin)this).Config["Difficulty", "Difficulty Level"].Definition); ((BaseUnityPlugin)this).Config.Bind<int>("Spawn Rate", "Five Mimics", 0, "This is an old setting, ignore it."); ((BaseUnityPlugin)this).Config.Remove(((BaseUnityPlugin)this).Config["Spawn Rate", "Five Mimics"].Definition); ((BaseUnityPlugin)this).Config.Save(); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } public static void Shuffle<T>(IList<T> list, int seed) { Random random = new Random(seed); int num = list.Count; while (num > 1) { num--; int index = random.Next(num + 1); T value = list[index]; list[index] = list[num]; list[num] = value; } } } public class MimicNetworker : NetworkBehaviour { public static MimicNetworker Instance; public static NetworkVariable<int> SpawnWeight0 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight1 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight2 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight3 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeight4 = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<int> SpawnWeightMax = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static NetworkVariable<bool> SpawnRateDynamic = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); private void Awake() { Instance = this; } public void MimicAttack(int playerId, int mimicIndex, bool ownerOnly = false) { if (((NetworkBehaviour)this).IsOwner) { Instance.MimicAttackClientRpc(playerId, mimicIndex); } else if (!ownerOnly) { Instance.MimicAttackServerRpc(playerId, mimicIndex); } } [ClientRpc] public void MimicAttackClientRpc(int playerId, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2885019175u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2885019175u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].Attack(playerId)); } } } [ServerRpc(RequireOwnership = false)] public void MimicAttackServerRpc(int playerId, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1024971481u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1024971481u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Instance.MimicAttackClientRpc(playerId, mimicIndex); } } } public void MimicAddAnger(int amount, int mimicIndex) { if (((NetworkBehaviour)this).IsOwner) { Instance.MimicAddAngerClientRpc(amount, mimicIndex); } else { Instance.MimicAddAngerServerRpc(amount, mimicIndex); } } [ClientRpc] public void MimicAddAngerClientRpc(int amount, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1137632670u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, amount); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1137632670u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].AddAnger(amount)); } } } [ServerRpc(RequireOwnership = false)] public void MimicAddAngerServerRpc(int amount, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(669208889u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, amount); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 669208889u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Instance.MimicAddAngerClientRpc(amount, mimicIndex); } } } public void MimicLockPick(LockPicker lockPicker, int mimicIndex, bool ownerOnly = false) { int playerId = (int)((GrabbableObject)lockPicker).playerHeldBy.playerClientId; if (((NetworkBehaviour)this).IsOwner) { Instance.MimicLockPickClientRpc(playerId, mimicIndex); } else if (!ownerOnly) { Instance.MimicLockPickServerRpc(playerId, mimicIndex); } } [ClientRpc] public void MimicLockPickClientRpc(int playerId, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3716888238u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3716888238u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(MimicDoor.allMimics[mimicIndex].MimicLockPick(playerId)); } } } [ServerRpc(RequireOwnership = false)] public void MimicLockPickServerRpc(int playerId, int mimicIndex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1897916243u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, mimicIndex); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1897916243u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { Instance.MimicLockPickClientRpc(playerId, mimicIndex); } } } protected override void __initializeVariables() { if (SpawnWeight0 == null) { throw new Exception("MimicNetworker.SpawnWeight0 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight0).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight0, "SpawnWeight0"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight0); if (SpawnWeight1 == null) { throw new Exception("MimicNetworker.SpawnWeight1 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight1).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight1, "SpawnWeight1"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight1); if (SpawnWeight2 == null) { throw new Exception("MimicNetworker.SpawnWeight2 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight2).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight2, "SpawnWeight2"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight2); if (SpawnWeight3 == null) { throw new Exception("MimicNetworker.SpawnWeight3 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight3).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight3, "SpawnWeight3"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight3); if (SpawnWeight4 == null) { throw new Exception("MimicNetworker.SpawnWeight4 cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeight4).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeight4, "SpawnWeight4"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeight4); if (SpawnWeightMax == null) { throw new Exception("MimicNetworker.SpawnWeightMax cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnWeightMax).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnWeightMax, "SpawnWeightMax"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnWeightMax); if (SpawnRateDynamic == null) { throw new Exception("MimicNetworker.SpawnRateDynamic cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)SpawnRateDynamic).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SpawnRateDynamic, "SpawnRateDynamic"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)SpawnRateDynamic); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_MimicNetworker() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2885019175u, new RpcReceiveHandler(__rpc_handler_2885019175)); NetworkManager.__rpc_func_table.Add(1024971481u, new RpcReceiveHandler(__rpc_handler_1024971481)); NetworkManager.__rpc_func_table.Add(1137632670u, new RpcReceiveHandler(__rpc_handler_1137632670)); NetworkManager.__rpc_func_table.Add(669208889u, new RpcReceiveHandler(__rpc_handler_669208889)); NetworkManager.__rpc_func_table.Add(3716888238u, new RpcReceiveHandler(__rpc_handler_3716888238)); NetworkManager.__rpc_func_table.Add(1897916243u, new RpcReceiveHandler(__rpc_handler_1897916243)); } private static void __rpc_handler_2885019175(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((MimicNetworker)(object)target).MimicAttackClientRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1024971481(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((MimicNetworker)(object)target).MimicAttackServerRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1137632670(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int amount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref amount); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((MimicNetworker)(object)target).MimicAddAngerClientRpc(amount, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_669208889(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int amount = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref amount); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((MimicNetworker)(object)target).MimicAddAngerServerRpc(amount, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3716888238(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)2; ((MimicNetworker)(object)target).MimicLockPickClientRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1897916243(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int mimicIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((MimicNetworker)(object)target).MimicLockPickServerRpc(playerId, mimicIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "MimicNetworker"; } } public class MimicDoor : MonoBehaviour { public GameObject playerTarget; public BoxCollider frameBox; public Sprite LostFingersIcon; public Animator mimicAnimator; public GameObject grabPoint; public InteractTrigger interactTrigger; public ScanNodeProperties scanNode; public int anger; public bool angering; public int sprayCount; private bool attacking; public static List<MimicDoor> allMimics; public int mimicIndex; private static MethodInfo RetractClaws = typeof(LockPicker).GetMethod("RetractClaws", BindingFlags.Instance | BindingFlags.NonPublic); public void TouchMimic(PlayerControllerB player) { if (!attacking) { MimicNetworker.Instance.MimicAttack((int)player.playerClientId, mimicIndex); } } public IEnumerator Attack(int playerId) { attacking = true; interactTrigger.interactable = false; PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerId]; mimicAnimator.SetTrigger("Attack"); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); playerTarget.transform.position = ((Component)player).transform.position; yield return (object)new WaitForSeconds(0.1f); float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)frameBox).transform.position); if (num < 8f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } yield return (object)new WaitForSeconds(0.2f); if (((NetworkBehaviour)player).IsOwner && Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position) < 8.75f) { player.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0); } float startTime = Time.timeSinceLevelLoad; yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)player.deadBody != (Object)null || Time.timeSinceLevelLoad - startTime > 4f)); if ((Object)(object)player.deadBody != (Object)null) { player.deadBody.attachedTo = grabPoint.transform; player.deadBody.attachedLimb = player.deadBody.bodyParts[5]; player.deadBody.matchPositionExactly = true; for (int i = 0; i < player.deadBody.bodyParts.Length; i++) { ((Component)player.deadBody.bodyParts[i]).GetComponent<Collider>().excludeLayers = LayerMask.op_Implicit(-1); } } yield return (object)new WaitForSeconds(2f); if ((Object)(object)player.deadBody != (Object)null) { player.deadBody.attachedTo = null; player.deadBody.attachedLimb = null; player.deadBody.matchPositionExactly = false; ((Component)((Component)player.deadBody).transform.GetChild(0)).gameObject.SetActive(false); player.deadBody = null; } yield return (object)new WaitForSeconds(4.5f); attacking = false; interactTrigger.interactable = true; } public IEnumerator MimicLockPick(int playerId) { if (angering || attacking) { yield break; } LockPicker lockPicker = default(LockPicker); ref LockPicker reference = ref lockPicker; GrabbableObject currentlyHeldObjectServer = StartOfRound.Instance.allPlayerScripts[playerId].currentlyHeldObjectServer; reference = (LockPicker)(object)((currentlyHeldObjectServer is LockPicker) ? currentlyHeldObjectServer : null); if ((Object)(object)lockPicker == (Object)null) { yield break; } attacking = true; interactTrigger.interactable = false; AudioSource component = ((Component)lockPicker).GetComponent<AudioSource>(); component.PlayOneShot(lockPicker.placeLockPickerClips[Random.Range(0, lockPicker.placeLockPickerClips.Length)]); lockPicker.armsAnimator.SetBool("mounted", true); lockPicker.armsAnimator.SetBool("picking", true); component.Play(); component.pitch = Random.Range(0.94f, 1.06f); lockPicker.isOnDoor = true; lockPicker.isPickingLock = true; ((GrabbableObject)lockPicker).grabbable = false; if (((NetworkBehaviour)lockPicker).IsOwner) { ((GrabbableObject)lockPicker).playerHeldBy.DiscardHeldObject(true, ((NetworkBehaviour)MimicNetworker.Instance).NetworkObject, ((Component)this).transform.position + ((Component)this).transform.up * 1.5f - ((Component)this).transform.forward * 1.15f, true); } float startTime = Time.timeSinceLevelLoad; yield return (object)new WaitUntil((Func<bool>)(() => !((GrabbableObject)lockPicker).isHeld || Time.timeSinceLevelLoad - startTime > 10f)); ((Component)lockPicker).transform.localEulerAngles = new Vector3(((Component)this).transform.eulerAngles.x, ((Component)this).transform.eulerAngles.y + 90f, ((Component)this).transform.eulerAngles.z); yield return (object)new WaitForSeconds(5f); RetractClaws.Invoke(lockPicker, null); ((Component)lockPicker).transform.SetParent((Transform)null); ((GrabbableObject)lockPicker).startFallingPosition = ((Component)lockPicker).transform.position; ((GrabbableObject)lockPicker).FallToGround(false); ((GrabbableObject)lockPicker).grabbable = true; yield return (object)new WaitForSeconds(1f); anger = 3; attacking = false; interactTrigger.interactable = false; PlayerControllerB val = null; float num = 9999f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } if ((Object)(object)val != (Object)null) { MimicNetworker.Instance.MimicAttackClientRpc((int)val.playerClientId, mimicIndex); } else { interactTrigger.interactable = true; } } public IEnumerator AddAnger(int amount) { if (angering || attacking) { yield break; } angering = true; anger += amount; if (anger == 1) { Sprite oldIcon2 = interactTrigger.hoverIcon; interactTrigger.hoverIcon = LostFingersIcon; mimicAnimator.SetTrigger("Growl"); yield return (object)new WaitForSeconds(2.75f); interactTrigger.hoverIcon = oldIcon2; sprayCount = 0; angering = false; yield break; } if (anger == 2) { interactTrigger.holdTip = "DIE : [LMB]"; interactTrigger.timeToHold = 0.25f; Sprite oldIcon2 = interactTrigger.hoverIcon; interactTrigger.hoverIcon = LostFingersIcon; mimicAnimator.SetTrigger("Growl"); yield return (object)new WaitForSeconds(2.75f); interactTrigger.hoverIcon = oldIcon2; sprayCount = 0; angering = false; yield break; } if (anger > 2) { PlayerControllerB val = null; float num = 9999f; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } if ((Object)(object)val != (Object)null) { MimicNetworker.Instance.MimicAttackClientRpc((int)val.playerClientId, mimicIndex); } } sprayCount = 0; angering = false; } } public class MimicCollider : MonoBehaviour, IHittable { public MimicDoor mimic; bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false) { MimicNetworker.Instance.MimicAddAnger(force, mimic.mimicIndex); return true; } } public class MimicListener : MonoBehaviour, INoiseListener { public MimicDoor mimic; private int tolerance = 100; void INoiseListener.DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID) { //IL_0014: 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) if ((noiseLoudness >= 0.9f || noiseID == 101158) && Vector3.Distance(noisePosition, ((Component)mimic).transform.position) < 5f) { switch (noiseID) { case 75: tolerance--; break; case 5: tolerance -= 15; break; case 101158: tolerance -= 35; break; default: tolerance -= 30; break; } if (tolerance <= 0) { tolerance = 100; MimicNetworker.Instance.MimicAddAnger(1, mimic.mimicIndex); } } } } }
plugins/MoreCompany.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreCompany.Cosmetics; using MoreCompany.Utils; using Steamworks; using Steamworks.Data; using TMPro; using Unity.Netcode; using Unity.Netcode.Transports.UTP; using UnityEngine; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MoreCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © NotNotSwipez 2023")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MoreCompany")] [assembly: AssemblyTitle("MoreCompany")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MoreCompany { [HarmonyPatch(typeof(AudioMixer), "SetFloat")] public static class AudioMixerSetFloatPatch { public static bool Prefix(string name, float value) { if (name.StartsWith("PlayerVolume") || name.StartsWith("PlayerPitch")) { string s = name.Replace("PlayerVolume", "").Replace("PlayerPitch", ""); int num = int.Parse(s); PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[num]; if ((Object)(object)val != (Object)null) { AudioSource currentVoiceChatAudioSource = val.currentVoiceChatAudioSource; if (Object.op_Implicit((Object)(object)currentVoiceChatAudioSource)) { if (name.StartsWith("PlayerVolume")) { currentVoiceChatAudioSource.volume = value / 16f; } else if (name.StartsWith("PlayerPitch")) { currentVoiceChatAudioSource.pitch = value; } } return false; } } return true; } } [HarmonyPatch(typeof(HUDManager), "AddTextToChatOnServer")] public static class SendChatToServerPatch { public static bool Prefix(HUDManager __instance, string chatMessage, int playerId = -1) { if (((NetworkBehaviour)StartOfRound.Instance).IsHost && chatMessage.StartsWith("/mc") && DebugCommandRegistry.commandEnabled) { string text = chatMessage.Replace("/mc ", ""); DebugCommandRegistry.HandleCommand(text.Split(' ')); return false; } if (chatMessage.StartsWith("[morecompanycosmetics]")) { ReflectionUtils.InvokeMethod(__instance, "AddPlayerChatMessageServerRpc", new object[2] { chatMessage, 99 }); return false; } return true; } } [HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageServerRpc")] public static class ServerReceiveMessagePatch { public static string previousDataMessage = ""; public static bool Prefix(HUDManager __instance, ref string chatMessage, int playerId) { NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening) { return false; } if (chatMessage.StartsWith("[morecompanycosmetics]") && networkManager.IsServer) { previousDataMessage = chatMessage; chatMessage = "[replacewithdata]"; } return true; } } [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static class ConnectClientToPlayerObjectPatch { public static void Postfix(PlayerControllerB __instance) { string text = "[morecompanycosmetics]"; text = text + ";" + __instance.playerClientId; foreach (string locallySelectedCosmetic in CosmeticRegistry.locallySelectedCosmetics) { text = text + ";" + locallySelectedCosmetic; } HUDManager.Instance.AddTextToChatOnServer(text, -1); } } [HarmonyPatch(typeof(HUDManager), "AddChatMessage")] public static class AddChatMessagePatch { public static bool Prefix(HUDManager __instance, string chatMessage, string nameOfUserWhoTyped = "") { if (chatMessage.StartsWith("[replacewithdata]") || chatMessage.StartsWith("[morecompanycosmetics]")) { return false; } return true; } } [HarmonyPatch(typeof(HUDManager), "AddPlayerChatMessageClientRpc")] public static class ClientReceiveMessagePatch { public static bool ignoreSample; public static bool Prefix(ref HUDManager __instance, ref string chatMessage, int playerId) { NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening) { return false; } if (networkManager.IsServer) { if (chatMessage.StartsWith("[replacewithdata]")) { chatMessage = ServerReceiveMessagePatch.previousDataMessage; HandleDataMessage(ref chatMessage); } else if (chatMessage.StartsWith("[morecompanycosmetics]")) { return false; } } else if (chatMessage.StartsWith("[morecompanycosmetics]")) { HandleDataMessage(ref chatMessage); } return true; } private static void HandleDataMessage(ref string chatMessage) { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if (ignoreSample) { return; } chatMessage = chatMessage.Replace("[morecompanycosmetics]", ""); string[] array = chatMessage.Split(';'); string text = array[1]; int num = int.Parse(text); CosmeticApplication component = ((Component)((Component)StartOfRound.Instance.allPlayerScripts[num]).transform.Find("ScavengerModel").Find("metarig")).gameObject.GetComponent<CosmeticApplication>(); if (Object.op_Implicit((Object)(object)component)) { component.ClearCosmetics(); Object.Destroy((Object)(object)component); } CosmeticApplication cosmeticApplication = ((Component)((Component)StartOfRound.Instance.allPlayerScripts[num]).transform.Find("ScavengerModel").Find("metarig")).gameObject.AddComponent<CosmeticApplication>(); cosmeticApplication.ClearCosmetics(); List<string> list = new List<string>(); string[] array2 = array; foreach (string text2 in array2) { if (!(text2 == text)) { list.Add(text2); if (MainClass.showCosmetics) { cosmeticApplication.ApplyCosmetic(text2, startEnabled: true); } } } if (num == StartOfRound.Instance.thisClientPlayerId) { cosmeticApplication.ClearCosmetics(); } foreach (CosmeticInstance spawnedCosmetic in cosmeticApplication.spawnedCosmetics) { Transform transform = ((Component)spawnedCosmetic).transform; transform.localScale *= 0.38f; } MainClass.playerIdsAndCosmetics.Remove(num); MainClass.playerIdsAndCosmetics.Add(num, list); if (!GameNetworkManager.Instance.isHostingGame || num == 0) { return; } ignoreSample = true; foreach (KeyValuePair<int, List<string>> playerIdsAndCosmetic in MainClass.playerIdsAndCosmetics) { string text3 = "[morecompanycosmetics]"; text3 = text3 + ";" + playerIdsAndCosmetic.Key; foreach (string item in playerIdsAndCosmetic.Value) { text3 = text3 + ";" + item; } HUDManager.Instance.AddTextToChatOnServer(text3, -1); } ignoreSample = false; } } public class DebugCommandRegistry { public static bool commandEnabled; public static void HandleCommand(string[] args) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0284: 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_029b: Unknown result type (might be due to invalid IL or missing references) if (!commandEnabled) { return; } PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; switch (args[0]) { case "money": { int groupCredits = int.Parse(args[1]); Terminal val5 = Resources.FindObjectsOfTypeAll<Terminal>().First(); val5.groupCredits = groupCredits; break; } case "spawnscrap": { string text = ""; for (int i = 1; i < args.Length; i++) { text = text + args[i] + " "; } text = text.Trim(); Vector3 val = ((Component)localPlayerController).transform.position + ((Component)localPlayerController).transform.forward * 2f; SpawnableItemWithRarity val2 = null; foreach (SpawnableItemWithRarity item in StartOfRound.Instance.currentLevel.spawnableScrap) { if (item.spawnableItem.itemName.ToLower() == text.ToLower()) { val2 = item; break; } } GameObject val3 = Object.Instantiate<GameObject>(val2.spawnableItem.spawnPrefab, val, Quaternion.identity, (Transform)null); GrabbableObject component = val3.GetComponent<GrabbableObject>(); ((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation); component.fallTime = 0f; NetworkObject component2 = val3.GetComponent<NetworkObject>(); component2.Spawn(false); break; } case "spawnenemy": { string text2 = ""; for (int j = 1; j < args.Length; j++) { text2 = text2 + args[j] + " "; } text2 = text2.Trim(); SpawnableEnemyWithRarity val4 = null; foreach (SpawnableEnemyWithRarity enemy in StartOfRound.Instance.currentLevel.Enemies) { if (enemy.enemyType.enemyName.ToLower() == text2.ToLower()) { val4 = enemy; break; } } RoundManager.Instance.SpawnEnemyGameObject(((Component)localPlayerController).transform.position + ((Component)localPlayerController).transform.forward * 2f, 0f, -1, val4.enemyType); break; } case "listall": MainClass.StaticLogger.LogInfo((object)"Spawnable scrap:"); foreach (SpawnableItemWithRarity item2 in StartOfRound.Instance.currentLevel.spawnableScrap) { MainClass.StaticLogger.LogInfo((object)item2.spawnableItem.itemName); } MainClass.StaticLogger.LogInfo((object)"Spawnable enemies:"); { foreach (SpawnableEnemyWithRarity enemy2 in StartOfRound.Instance.currentLevel.Enemies) { MainClass.StaticLogger.LogInfo((object)enemy2.enemyType.enemyName); } break; } } } } [HarmonyPatch(typeof(ForestGiantAI), "LookForPlayers")] public static class LookForPlayersForestGiantPatch { public static void Prefix(ref ForestGiantAI __instance) { if (__instance.playerStealthMeters.Length != MainClass.newPlayerCount) { Array.Resize(ref __instance.playerStealthMeters, MainClass.newPlayerCount); for (int i = 0; i < MainClass.newPlayerCount; i++) { __instance.playerStealthMeters[i] = 0f; } } } } [HarmonyPatch(typeof(BlobAI), "Start")] public static class BlobAIStartPatch { public static void Postfix(ref BlobAI __instance) { Collider[] value = (Collider[])(object)new Collider[MainClass.newPlayerCount]; ReflectionUtils.SetFieldValue(__instance, "ragdollColliders", value); } } [HarmonyPatch(typeof(CrawlerAI), "Start")] public static class CrawlerAIStartPatch { public static void Postfix(ref CrawlerAI __instance) { Collider[] value = (Collider[])(object)new Collider[MainClass.newPlayerCount]; ReflectionUtils.SetFieldValue(__instance, "nearPlayerColliders", value); } } [HarmonyPatch(typeof(SpringManAI), "Update")] public static class SpringManAIUpdatePatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "call static float UnityEngine.Vector3::Distance(UnityEngine.Vector3 a, UnityEngine.Vector3 b)") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(SpringManAI), "DoAIInterval")] public static class SpringManAIIntervalPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "call void EnemyAI::SwitchToBehaviourState(int stateIndex)") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(EnemyAI), "GetClosestPlayer")] public static class GetClosestPlayerPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; foreach (CodeInstruction instruction in instructions) { if (!flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); } else { list.Add(instruction); } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(EnemyAI), "GetAllPlayersInLineOfSight")] public static class GetAllPlayersInLineOfSightPatch { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; foreach (CodeInstruction instruction in instructions) { if (!flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); } else { list.Add(instruction); } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(DressGirlAI), "ChoosePlayerToHaunt")] public static class DressGirlHauntPatch { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if (((object)instruction).ToString() == "ldc.i4.4 NULL") { CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); } else { list.Add(instruction); } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(HUDManager), "AddChatMessage")] public static class HudChatPatch { public static void Prefix(HUDManager __instance, ref string chatMessage, string nameOfUserWhoTyped = "") { if (!(__instance.lastChatMessage == chatMessage)) { StringBuilder stringBuilder = new StringBuilder(chatMessage); for (int i = 0; i < MainClass.newPlayerCount; i++) { string oldValue = $"[playerNum{i}]"; string playerUsername = StartOfRound.Instance.allPlayerScripts[i].playerUsername; stringBuilder.Replace(oldValue, playerUsername); } chatMessage = stringBuilder.ToString(); } } } [HarmonyPatch(typeof(MenuManager), "Awake")] public static class MenuManagerLogoOverridePatch { public static List<TMP_InputField> inputFields = new List<TMP_InputField>(); public static void Postfix(MenuManager __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) try { MainClass.ReadSettingsFromFile(); GameObject gameObject = ((Component)((Component)__instance).transform.parent).gameObject; Sprite sprite = Sprite.Create(MainClass.mainLogo, new Rect(0f, 0f, (float)((Texture)MainClass.mainLogo).width, (float)((Texture)MainClass.mainLogo).height), new Vector2(0.5f, 0.5f)); Transform val = gameObject.transform.Find("MenuContainer/MainButtons/HeaderImage"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.GetComponent<Image>().sprite = sprite; } Transform val2 = gameObject.transform.Find("MenuContainer/LoadingScreen"); if ((Object)(object)val2 != (Object)null) { val2.localScale = new Vector3(1.02f, 1.06f, 1.02f); Transform val3 = val2.Find("Image"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).GetComponent<Image>().sprite = sprite; } } CosmeticRegistry.SpawnCosmeticGUI(); LANMenu.InitializeMenu(); inputFields.Clear(); Transform val4 = gameObject.transform.Find("MenuContainer/LobbyHostSettings/HostSettingsContainer/LobbyHostOptions"); if ((Object)(object)val4 != (Object)null) { CreateCrewCountInput(val4.Find(GameNetworkManager.Instance.disableSteam ? "LANOptions" : "OptionsNormal")); } Transform val5 = gameObject.transform.Find("MenuContainer/LobbyJoinSettings/JoinSettingsContainer/LobbyJoinOptions"); if ((Object)(object)val5 != (Object)null) { CreateCrewCountInput(val5.Find("LANOptions")); } } catch (Exception ex) { MainClass.StaticLogger.LogError((object)ex); } } private static void CreateCrewCountInput(Transform parent) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(MainClass.crewCountUI, parent); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).localPosition = new Vector3(96.9f, -70f, -6.7f); TMP_InputField inputField = ((Component)val.transform.Find("InputField (TMP)")).GetComponent<TMP_InputField>(); inputField.characterLimit = 3; inputField.text = MainClass.newPlayerCount.ToString(); inputFields.Add(inputField); ((UnityEvent<string>)(object)inputField.onValueChanged).AddListener((UnityAction<string>)delegate(string s) { if (!(inputField.text == MainClass.newPlayerCount.ToString())) { if (int.TryParse(s, out var result)) { MainClass.newPlayerCount = Mathf.Clamp(result, MainClass.minPlayerCount, MainClass.maxPlayerCount); foreach (TMP_InputField inputField2 in inputFields) { inputField2.text = MainClass.newPlayerCount.ToString(); } MainClass.SaveSettingsToFile(); MainClass.StaticLogger.LogInfo((object)$"Changed Crew Count: {MainClass.newPlayerCount}"); } else if (s.Length != 0) { foreach (TMP_InputField inputField3 in inputFields) { inputField3.text = MainClass.newPlayerCount.ToString(); inputField3.caretPosition = 1; } } } }); } } [HarmonyPatch(typeof(QuickMenuManager), "AddUserToPlayerList")] public static class AddUserPlayerListPatch { private static bool Prefix(QuickMenuManager __instance, ulong steamId, string playerName, int playerObjectId) { QuickmenuVisualInjectPatch.PopulateQuickMenu(__instance); MainClass.EnablePlayerObjectsBasedOnConnected(); return false; } } [HarmonyPatch(typeof(QuickMenuManager), "RemoveUserFromPlayerList")] public static class RemoveUserPlayerListPatch { public static bool Prefix(QuickMenuManager __instance) { QuickmenuVisualInjectPatch.PopulateQuickMenu(__instance); return false; } } [HarmonyPatch(typeof(QuickMenuManager), "Update")] public static class QuickMenuUpdatePatch { public static bool Prefix() { return false; } } [HarmonyPatch(typeof(QuickMenuManager), "NonHostPlayerSlotsEnabled")] public static class QuickMenuDisplayPatch { public static bool Prefix(ref bool __result) { __result = false; for (int i = 1; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; if (val.isPlayerControlled || val.isPlayerDead) { __result = true; break; } } return false; } } [HarmonyPatch(typeof(QuickMenuManager), "Start")] public static class QuickmenuVisualInjectPatch { public static GameObject quickMenuScrollInstance; public static void Postfix(QuickMenuManager __instance) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)__instance.playerListPanel.transform.Find("Image")).gameObject; GameObject val = Object.Instantiate<GameObject>(MainClass.quickMenuScrollParent); val.transform.SetParent(gameObject.transform); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).localPosition = new Vector3(0f, -31.2f, 0f); ((Transform)component).localScale = Vector3.one; quickMenuScrollInstance = val; } public static void PopulateQuickMenu(QuickMenuManager __instance) { //IL_0147: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Expected O, but got Unknown int childCount = quickMenuScrollInstance.transform.Find("Holder").childCount; List<GameObject> list = new List<GameObject>(); for (int i = 0; i < childCount; i++) { list.Add(((Component)quickMenuScrollInstance.transform.Find("Holder").GetChild(i)).gameObject); } foreach (GameObject item in list) { Object.Destroy((Object)(object)item); } if (!Object.op_Implicit((Object)(object)StartOfRound.Instance)) { return; } for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++) { PlayerControllerB playerScript = StartOfRound.Instance.allPlayerScripts[j]; if (!playerScript.isPlayerControlled && !playerScript.isPlayerDead) { continue; } GameObject val = Object.Instantiate<GameObject>(MainClass.playerEntry, quickMenuScrollInstance.transform.Find("Holder")); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).localScale = Vector3.one; ((Transform)component).localPosition = new Vector3(0f, 0f - ((Transform)component).localPosition.y, 0f); TextMeshProUGUI component2 = ((Component)val.transform.Find("PlayerNameButton").Find("PName")).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component2).text = playerScript.playerUsername; Slider playerVolume = ((Component)val.transform.Find("PlayerVolumeSlider")).GetComponent<Slider>(); int finalIndex = j; ((UnityEvent<float>)(object)playerVolume.onValueChanged).AddListener((UnityAction<float>)delegate(float f) { if (playerScript.isPlayerControlled || playerScript.isPlayerDead) { float num = f / playerVolume.maxValue + 1f; if (num <= -1f) { SoundManager.Instance.playerVoiceVolumes[finalIndex] = -70f; } else { SoundManager.Instance.playerVoiceVolumes[finalIndex] = num; } } }); if ((Object)(object)StartOfRound.Instance.localPlayerController != (Object)null && StartOfRound.Instance.localPlayerController.playerClientId == playerScript.playerClientId) { ((Component)playerVolume).gameObject.SetActive(false); ((Component)val.transform.Find("Text (1)")).gameObject.SetActive(false); } Button component3 = ((Component)val.transform.Find("KickButton")).GetComponent<Button>(); ((UnityEvent)component3.onClick).AddListener((UnityAction)delegate { __instance.KickUserFromServer(finalIndex); }); if (!GameNetworkManager.Instance.isHostingGame) { ((Component)component3).gameObject.SetActive(false); } Button component4 = ((Component)val.transform.Find("ProfileIcon")).GetComponent<Button>(); ((UnityEvent)component4.onClick).AddListener((UnityAction)delegate { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!GameNetworkManager.Instance.disableSteam) { SteamFriends.OpenUserOverlay(SteamId.op_Implicit(playerScript.playerSteamId), "steamid"); } }); } } } [HarmonyPatch(typeof(QuickMenuManager), "ConfirmKickUserFromServer")] public static class KickPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "ldfld int QuickMenuManager::playerObjToKick") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.3 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(HUDManager), "UpdateBoxesSpectateUI")] public static class SpectatorBoxUpdatePatch { public static void Postfix(HUDManager __instance) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) Dictionary<Animator, PlayerControllerB> fieldValue = ReflectionUtils.GetFieldValue<Dictionary<Animator, PlayerControllerB>>(__instance, "spectatingPlayerBoxes"); int num = -64; int num2 = 0; int num3 = 0; int num4 = -70; int num5 = 230; int num6 = 4; foreach (KeyValuePair<Animator, PlayerControllerB> item in fieldValue) { if (((Component)item.Key).gameObject.activeInHierarchy) { GameObject gameObject = ((Component)item.Key).gameObject; RectTransform component = gameObject.GetComponent<RectTransform>(); int num7 = (int)Math.Floor((double)num3 / (double)num6); int num8 = num3 % num6; int num9 = num8 * num4; int num10 = num7 * num5; component.anchoredPosition = Vector2.op_Implicit(new Vector3((float)(num + num10), (float)(num2 + num9), 0f)); num3++; } } } } [HarmonyPatch(typeof(HUDManager), "Start")] public static class HudStartPatch { public static void Postfix(HUDManager __instance) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) EndOfGameStatUIElements statsUIElements = __instance.statsUIElements; GameObject gameObject = ((Component)((Component)statsUIElements.playerNamesText[0]).gameObject.transform.parent).gameObject; GameObject gameObject2 = ((Component)gameObject.transform.parent.parent).gameObject; GameObject gameObject3 = ((Component)gameObject2.transform.Find("BGBoxes")).gameObject; gameObject2.transform.parent.Find("DeathScreen").SetSiblingIndex(3); gameObject3.transform.localScale = new Vector3(2.5f, 1f, 1f); MakePlayerHolder(4, gameObject, statsUIElements, new Vector3(426.9556f, -0.7932f, 0f)); MakePlayerHolder(5, gameObject, statsUIElements, new Vector3(426.9556f, -115.4483f, 0f)); MakePlayerHolder(6, gameObject, statsUIElements, new Vector3(-253.6783f, -115.4483f, 0f)); MakePlayerHolder(7, gameObject, statsUIElements, new Vector3(-253.6783f, -0.7932f, 0f)); for (int i = 8; i < MainClass.newPlayerCount; i++) { MakePlayerHolder(i, gameObject, statsUIElements, new Vector3(10000f, 10000f, 0f)); } } public static void MakePlayerHolder(int index, GameObject original, EndOfGameStatUIElements uiElements, Vector3 localPosition) { //IL_0049: 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_009f: Unknown result type (might be due to invalid IL or missing references) if (index + 1 <= MainClass.newPlayerCount) { GameObject val = Object.Instantiate<GameObject>(original); RectTransform component = val.GetComponent<RectTransform>(); RectTransform component2 = original.GetComponent<RectTransform>(); ((Transform)component).SetParent(((Transform)component2).parent); ((Transform)component).localScale = new Vector3(1f, 1f, 1f); ((Transform)component).localPosition = localPosition; GameObject gameObject = ((Component)val.transform.Find("PlayerName1")).gameObject; GameObject gameObject2 = ((Component)val.transform.Find("Notes")).gameObject; ((Transform)gameObject2.GetComponent<RectTransform>()).localPosition = new Vector3(-95.7222f, 43.3303f, 0f); GameObject gameObject3 = ((Component)val.transform.Find("Symbol")).gameObject; if (index >= uiElements.playerNamesText.Length) { Array.Resize(ref uiElements.playerNamesText, index + 1); Array.Resize(ref uiElements.playerStates, index + 1); Array.Resize(ref uiElements.playerNotesText, index + 1); } uiElements.playerNamesText[index] = gameObject.GetComponent<TextMeshProUGUI>(); uiElements.playerNotesText[index] = gameObject2.GetComponent<TextMeshProUGUI>(); uiElements.playerStates[index] = gameObject3.GetComponent<Image>(); } } } public class LANMenu : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__0_0; internal void <InitializeMenu>b__0_0() { TextMeshProUGUI component = GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings/JoinSettingsContainer/PrivatePublicDescription").GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = "The mod will attempt to auto-detect the crew size however you can manually specify it to reduce chance of failure."; } GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings").gameObject.SetActive(true); } } public static void InitializeMenu() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown CreateUI(); GameObject val = GameObject.Find("Canvas/MenuContainer/MainButtons/StartLAN"); if (!((Object)(object)val != (Object)null)) { return; } MainClass.StaticLogger.LogInfo((object)"LANMenu startLAN Patched"); val.GetComponent<Button>().onClick = new ButtonClickedEvent(); ButtonClickedEvent onClick = val.GetComponent<Button>().onClick; object obj = <>c.<>9__0_0; if (obj == null) { UnityAction val2 = delegate { TextMeshProUGUI component = GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings/JoinSettingsContainer/PrivatePublicDescription").GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = "The mod will attempt to auto-detect the crew size however you can manually specify it to reduce chance of failure."; } GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings").gameObject.SetActive(true); }; <>c.<>9__0_0 = val2; obj = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj); } private static GameObject CreateUI() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown if ((Object)(object)GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings") != (Object)null) { return null; } GameObject val = GameObject.Find("Canvas/MenuContainer"); if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = GameObject.Find("Canvas/MenuContainer/LobbyHostSettings"); if ((Object)(object)val2 == (Object)null) { return null; } GameObject val3 = Object.Instantiate<GameObject>(val2, val2.transform.position, val2.transform.rotation, val.transform); ((Object)val3).name = "LobbyJoinSettings"; Transform val4 = val3.transform.Find("HostSettingsContainer"); if ((Object)(object)val4 != (Object)null) { ((Object)val4).name = "JoinSettingsContainer"; ((Object)((Component)val4).transform.Find("LobbyHostOptions")).name = "LobbyJoinOptions"; Object.Destroy((Object)(object)((Component)val3.transform.Find("ChallengeLeaderboard")).gameObject); Object.Destroy((Object)(object)((Component)val3.transform.Find("FilesPanel")).gameObject); Object.Destroy((Object)(object)((Component)((Component)val4).transform.Find("LobbyJoinOptions/OptionsNormal")).gameObject); Object.Destroy((Object)(object)((Component)((Component)val4).transform.Find("LobbyJoinOptions/LANOptions/AllowRemote")).gameObject); Object.Destroy((Object)(object)((Component)((Component)val4).transform.Find("LobbyJoinOptions/LANOptions/Local")).gameObject); Transform val5 = ((Component)val4).transform.Find("LobbyJoinOptions/LANOptions/Header"); if ((Object)(object)val5 != (Object)null) { ((TMP_Text)((Component)val5).GetComponent<TextMeshProUGUI>()).text = "Join LAN Server:"; } Transform val6 = ((Component)val4).transform.Find("LobbyJoinOptions/LANOptions/ServerNameField"); if ((Object)(object)val6 != (Object)null) { ((Component)val6).transform.localPosition = new Vector3(0f, 15f, -6.5f); ((Component)val6).gameObject.SetActive(true); } TMP_InputField ip_field = ((Component)val6).GetComponent<TMP_InputField>(); if ((Object)(object)ip_field != (Object)null) { TextMeshProUGUI ip_placeholder = ((Component)ip_field.placeholder).GetComponent<TextMeshProUGUI>(); ((TMP_Text)ip_placeholder).text = ES3.Load<string>("LANIPAddress", "LCGeneralSaveData", "127.0.0.1"); Transform obj = ((Component)val4).transform.Find("Confirm"); Button val7 = ((obj != null) ? ((Component)obj).GetComponent<Button>() : null); if ((Object)(object)val7 != (Object)null) { val7.onClick = new ButtonClickedEvent(); ((UnityEvent)val7.onClick).AddListener((UnityAction)delegate { string text = "127.0.0.1"; text = ((!(ip_field.text != "")) ? ((TMP_Text)ip_placeholder).text : ip_field.text); ES3.Save<string>("LANIPAddress", text, "LCGeneralSaveData"); GameObject.Find("Canvas/MenuContainer/LobbyJoinSettings").gameObject.SetActive(false); ((Component)NetworkManager.Singleton).GetComponent<UnityTransport>().ConnectionData.Address = text; MainClass.StaticLogger.LogInfo((object)("Listening to LAN server: " + text)); GameObject.Find("MenuManager").GetComponent<MenuManager>().StartAClient(); }); } } TextMeshProUGUI component = ((Component)((Component)val4).transform.Find("PrivatePublicDescription")).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = "The mod will attempt to auto-detect the crew size however you can manually specify it to reduce chance of failure."; } ((Component)((Component)val4).transform.Find("LobbyJoinOptions/LANOptions")).gameObject.SetActive(true); } return val3; } } [HarmonyPatch(typeof(GameNetworkManager), "SetConnectionDataBeforeConnecting")] public static class ConnectionDataPatch { public static void Postfix(ref GameNetworkManager __instance) { if (__instance.disableSteam) { NetworkManager.Singleton.NetworkConfig.ConnectionData = Encoding.ASCII.GetBytes(__instance.gameVersionNum + "," + MainClass.newPlayerCount); } } } [HarmonyPatch(typeof(GameNetworkManager), "OnLocalClientConnectionDisapproved")] public static class ConnectionDisapprovedPatch { private static int crewSizeMismatch; private static IEnumerator delayedReconnect() { yield return (object)new WaitForSeconds(0.5f); GameObject.Find("MenuManager").GetComponent<MenuManager>().StartAClient(); } private static void Prefix(ref GameNetworkManager __instance, ulong clientId) { crewSizeMismatch = 0; if (!__instance.disableSteam) { return; } try { if (!string.IsNullOrEmpty(NetworkManager.Singleton.DisconnectReason) && NetworkManager.Singleton.DisconnectReason.StartsWith("Crew size mismatch!")) { crewSizeMismatch = int.Parse(NetworkManager.Singleton.DisconnectReason.Split("Their size: ")[1].Split(". ")[0]); } } catch { } } private static void Postfix(ref GameNetworkManager __instance, ulong clientId) { if (__instance.disableSteam && crewSizeMismatch != 0) { MainClass.newPlayerCount = Mathf.Clamp(crewSizeMismatch, MainClass.minPlayerCount, MainClass.maxPlayerCount); GameObject.Find("MenuManager").GetComponent<MenuManager>().menuNotification.SetActive(false); Object.FindObjectOfType<MenuManager>().SetLoadingScreen(true, (RoomEnter)5, ""); ((MonoBehaviour)__instance).StartCoroutine(delayedReconnect()); crewSizeMismatch = 0; } } } public static class PluginInformation { public const string PLUGIN_NAME = "MoreCompany"; public const string PLUGIN_VERSION = "1.8.1"; public const string PLUGIN_GUID = "me.swipez.melonloader.morecompany"; } [BepInPlugin("me.swipez.melonloader.morecompany", "MoreCompany", "1.8.1")] public class MainClass : BaseUnityPlugin { public static int newPlayerCount = 32; public static int minPlayerCount = 4; public static int maxPlayerCount = 50; public static bool showCosmetics = true; public static List<PlayerControllerB> notSupposedToExistPlayers = new List<PlayerControllerB>(); public static Texture2D mainLogo; public static GameObject quickMenuScrollParent; public static GameObject playerEntry; public static GameObject crewCountUI; public static GameObject cosmeticGUIInstance; public static GameObject cosmeticButton; public static ManualLogSource StaticLogger; public static Dictionary<int, List<string>> playerIdsAndCosmetics = new Dictionary<int, List<string>>(); public static string cosmeticSavePath = Application.persistentDataPath + "/morecompanycosmetics.txt"; public static string moreCompanySave = Application.persistentDataPath + "/morecompanysave.txt"; public static string dynamicCosmeticsPath = Paths.PluginPath + "/MoreCompanyCosmetics"; private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown StaticLogger = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("me.swipez.melonloader.morecompany"); try { val.PatchAll(); } catch (Exception ex) { StaticLogger.LogError((object)("Failed to patch: " + ex)); } StaticLogger.LogInfo((object)"Loading MoreCompany..."); SteamFriends.OnGameLobbyJoinRequested += delegate(Lobby lobby, SteamId steamId) { newPlayerCount = ((Lobby)(ref lobby)).MaxMembers; }; SteamMatchmaking.OnLobbyEntered += delegate(Lobby lobby) { newPlayerCount = ((Lobby)(ref lobby)).MaxMembers; }; StaticLogger.LogInfo((object)("Checking: " + dynamicCosmeticsPath)); if (!Directory.Exists(dynamicCosmeticsPath)) { StaticLogger.LogInfo((object)"Creating cosmetics directory"); Directory.CreateDirectory(dynamicCosmeticsPath); } ReadSettingsFromFile(); ReadCosmeticsFromFile(); StaticLogger.LogInfo((object)"Read settings and cosmetics"); AssetBundle bundle = BundleUtilities.LoadBundleFromInternalAssembly("morecompany.assets", Assembly.GetExecutingAssembly()); AssetBundle val2 = BundleUtilities.LoadBundleFromInternalAssembly("morecompany.cosmetics", Assembly.GetExecutingAssembly()); CosmeticRegistry.LoadCosmeticsFromBundle(val2); val2.Unload(false); StaticLogger.LogInfo((object)"Loading USER COSMETICS..."); RecursiveCosmeticLoad(Paths.PluginPath); LoadAssets(bundle); StaticLogger.LogInfo((object)"Loaded MoreCompany FULLY"); } private void RecursiveCosmeticLoad(string directory) { string[] directories = Directory.GetDirectories(directory); foreach (string directory2 in directories) { RecursiveCosmeticLoad(directory2); } string[] files = Directory.GetFiles(directory); foreach (string text in files) { if (text.EndsWith(".cosmetics")) { AssetBundle val = AssetBundle.LoadFromFile(text); CosmeticRegistry.LoadCosmeticsFromBundle(val); val.Unload(false); } } } public static void EnablePlayerObjectsBasedOnConnected() { int connectedPlayersAmount = StartOfRound.Instance.connectedPlayersAmount; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { for (int j = 0; j < connectedPlayersAmount + 1; j++) { if (!val.isPlayerControlled) { ((Component)val).gameObject.SetActive(false); } else { ((Component)val).gameObject.SetActive(true); } } } } private void ReadCosmeticsFromFile() { if (File.Exists(cosmeticSavePath)) { string[] array = File.ReadAllLines(cosmeticSavePath); string[] array2 = array; foreach (string item in array2) { CosmeticRegistry.locallySelectedCosmetics.Add(item); } } } public static void WriteCosmeticsToFile() { string text = ""; foreach (string locallySelectedCosmetic in CosmeticRegistry.locallySelectedCosmetics) { text = text + locallySelectedCosmetic + "\n"; } File.WriteAllText(cosmeticSavePath, text); } public static void SaveSettingsToFile() { string text = ""; text = text + newPlayerCount + "\n"; text = text + showCosmetics + "\n"; File.WriteAllText(moreCompanySave, text); } public static void ReadSettingsFromFile() { if (File.Exists(moreCompanySave)) { string[] array = File.ReadAllLines(moreCompanySave); try { newPlayerCount = Mathf.Clamp(int.Parse(array[0]), minPlayerCount, maxPlayerCount); showCosmetics = bool.Parse(array[1]); } catch (Exception) { StaticLogger.LogError((object)"Failed to read settings from file, resetting to default"); newPlayerCount = 32; showCosmetics = true; } } } private static void LoadAssets(AssetBundle bundle) { if (Object.op_Implicit((Object)(object)bundle)) { mainLogo = bundle.LoadPersistentAsset<Texture2D>("assets/morecompanyassets/morecompanytransparentred.png"); quickMenuScrollParent = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/quickmenuoverride.prefab"); playerEntry = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/playerlistslot.prefab"); cosmeticGUIInstance = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/testoverlay.prefab"); cosmeticButton = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/cosmeticinstance.prefab"); crewCountUI = bundle.LoadPersistentAsset<GameObject>("assets/morecompanyassets/crewcountfield.prefab"); bundle.Unload(false); } } public static void ResizePlayerCache(Dictionary<uint, Dictionary<int, NetworkObject>> ScenePlacedObjects) { //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Expected O, but got Unknown StartOfRound instance = StartOfRound.Instance; if (instance.allPlayerObjects.Length != newPlayerCount) { StaticLogger.LogInfo((object)$"ResizePlayerCache: {newPlayerCount}"); playerIdsAndCosmetics.Clear(); uint num = 10000u; int num2 = instance.allPlayerObjects.Length; int num3 = newPlayerCount - num2; Array.Resize(ref instance.allPlayerObjects, newPlayerCount); Array.Resize(ref instance.allPlayerScripts, newPlayerCount); Array.Resize(ref instance.gameStats.allPlayerStats, newPlayerCount); Array.Resize(ref instance.playerSpawnPositions, newPlayerCount); StaticLogger.LogInfo((object)$"Resizing player cache from {num2} to {newPlayerCount} with difference of {num3}"); if (num3 > 0) { GameObject val = instance.allPlayerObjects[3]; for (int i = 0; i < num3; i++) { uint num4 = num + (uint)i; GameObject val2 = Object.Instantiate<GameObject>(val, val.transform.parent); NetworkObject component = val2.GetComponent<NetworkObject>(); ReflectionUtils.SetFieldValue(component, "GlobalObjectIdHash", num4); Scene scene = ((Component)component).gameObject.scene; int handle = ((Scene)(ref scene)).handle; uint num5 = num4; if (!ScenePlacedObjects.ContainsKey(num5)) { ScenePlacedObjects.Add(num5, new Dictionary<int, NetworkObject>()); } if (ScenePlacedObjects[num5].ContainsKey(handle)) { string arg = (((Object)(object)ScenePlacedObjects[num5][handle] != (Object)null) ? ((Object)ScenePlacedObjects[num5][handle]).name : "Null Entry"); throw new Exception(((Object)component).name + " tried to registered with ScenePlacedObjects which already contains " + string.Format("the same {0} value {1} for {2}!", "GlobalObjectIdHash", num5, arg)); } ScenePlacedObjects[num5].Add(handle, component); ((Object)val2).name = $"Player ({4 + i})"; PlayerControllerB componentInChildren = val2.GetComponentInChildren<PlayerControllerB>(); notSupposedToExistPlayers.Add(componentInChildren); componentInChildren.playerClientId = (ulong)(4 + i); componentInChildren.playerUsername = $"Player #{componentInChildren.playerClientId}"; componentInChildren.isPlayerControlled = false; componentInChildren.isPlayerDead = false; componentInChildren.DropAllHeldItems(false, false); componentInChildren.TeleportPlayer(instance.notSpawnedPosition.position, false, 0f, false, true); UnlockableSuit.SwitchSuitForPlayer(componentInChildren, 0, false); instance.allPlayerObjects[num2 + i] = val2; instance.gameStats.allPlayerStats[num2 + i] = new PlayerStats(); instance.allPlayerScripts[num2 + i] = componentInChildren; instance.playerSpawnPositions[num2 + i] = instance.playerSpawnPositions[3]; } } } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts) { ((TMP_Text)val3.usernameBillboardText).text = val3.playerUsername; } } } [HarmonyPatch(typeof(PlayerControllerB), "Start")] public static class PlayerControllerBStartPatch { public static void Postfix(ref PlayerControllerB __instance) { Collider[] value = (Collider[])(object)new Collider[MainClass.newPlayerCount]; ReflectionUtils.SetFieldValue(__instance, "nearByPlayers", value); } } [HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesServerRpc")] public static class SendNewPlayerValuesServerRpcPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "callvirt virtual void System.Collections.Generic.List<ulong>::Add(ulong item)") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesClientRpc")] public static class SendNewPlayerValuesClientRpcPatch { public static void Prefix(PlayerControllerB __instance, ref ulong[] playerSteamIds) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown NetworkManager networkManager = ((NetworkBehaviour)__instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening || StartOfRound.Instance.mapScreen.radarTargets.Count == StartOfRound.Instance.allPlayerScripts.Length) { return; } List<PlayerControllerB> useless = new List<PlayerControllerB>(); foreach (PlayerControllerB notSupposedToExistPlayer in MainClass.notSupposedToExistPlayers) { if (Object.op_Implicit((Object)(object)notSupposedToExistPlayer)) { StartOfRound.Instance.mapScreen.radarTargets.Add(new TransformAndName(((Component)notSupposedToExistPlayer).transform, notSupposedToExistPlayer.playerUsername, false)); } else { useless.Add(notSupposedToExistPlayer); } } MainClass.notSupposedToExistPlayers.RemoveAll((PlayerControllerB x) => useless.Contains(x)); } } [HarmonyPatch(typeof(HUDManager), "SyncAllPlayerLevelsServerRpc", new Type[] { })] public static class SyncAllPlayerLevelsPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if (((object)instruction).ToString() == "ldc.i4.4 NULL") { CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); } else { list.Add(instruction); } } return list.AsEnumerable(); } } [HarmonyPatch] public static class SyncShipUnlockablesPatch { [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesServerRpc")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ServerTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; int num = 0; foreach (CodeInstruction instruction in instructions) { if (num != 2) { if (!flag && ((object)instruction).ToString() == "callvirt bool Unity.Netcode.NetworkManager::get_IsHost()") { flag = true; } else if (((object)instruction).ToString().StartsWith("ldc.i4.4 NULL")) { num++; CodeInstruction val = new CodeInstruction(instruction); val.opcode = OpCodes.Ldsfld; val.operand = AccessTools.Field(typeof(MainClass), "newPlayerCount"); list.Add(val); continue; } } list.Add(instruction); } return list.AsEnumerable(); } [HarmonyPatch(typeof(StartOfRound), "SyncShipUnlockablesClientRpc")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> ClientTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "callvirt void UnityEngine.Renderer::set_sharedMaterial(UnityEngine.Material value)") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(NetworkSceneManager), "PopulateScenePlacedObjects")] public static class ScenePlacedObjectsInitPatch { public static void Postfix(ref Dictionary<uint, Dictionary<int, NetworkObject>> ___ScenePlacedObjects) { MainClass.ResizePlayerCache(___ScenePlacedObjects); } } [HarmonyPatch(typeof(GameNetworkManager), "LobbyDataIsJoinable")] public static class LobbyDataJoinablePatch { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "call int Steamworks.Data.Lobby::get_MemberCount()") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "maxPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(SteamMatchmaking), "CreateLobbyAsync")] public static class LobbyThingPatch { public static void Prefix(ref int maxMembers) { MainClass.ReadSettingsFromFile(); maxMembers = MainClass.newPlayerCount; } } [HarmonyPatch(typeof(GameNetworkManager), "ConnectionApproval")] public static class ConnectionApproval { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "ldfld int GameNetworkManager::connectedPlayers") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } private static void Postfix(ref GameNetworkManager __instance, ref ConnectionApprovalRequest request, ref ConnectionApprovalResponse response) { if (response.Approved && __instance.disableSteam) { string @string = Encoding.ASCII.GetString(request.Payload); string[] array = @string.Split(","); if (!string.IsNullOrEmpty(@string) && (array.Length < 2 || array[1] != MainClass.newPlayerCount.ToString())) { response.Reason = $"Crew size mismatch! Their size: {MainClass.newPlayerCount}. Your size: {array[1]}"; response.Approved = false; } } } } public class MimicPatches { [HarmonyPatch(typeof(MaskedPlayerEnemy), "SetEnemyOutside")] public class MaskedPlayerEnemyOnEnablePatch { public static void Postfix(MaskedPlayerEnemy __instance) { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance.mimickingPlayer != (Object)null) || !MainClass.showCosmetics) { return; } List<string> list = MainClass.playerIdsAndCosmetics[(int)__instance.mimickingPlayer.playerClientId]; Transform val = ((Component)__instance).transform.Find("ScavengerModel").Find("metarig"); CosmeticApplication component = ((Component)val).GetComponent<CosmeticApplication>(); if (Object.op_Implicit((Object)(object)component)) { component.ClearCosmetics(); Object.Destroy((Object)(object)component); } component = ((Component)val).gameObject.AddComponent<CosmeticApplication>(); foreach (string item in list) { component.ApplyCosmetic(item, startEnabled: true); } foreach (CosmeticInstance spawnedCosmetic in component.spawnedCosmetics) { Transform transform = ((Component)spawnedCosmetic).transform; transform.localScale *= 0.38f; } } } } public class ReflectionUtils { public static void InvokeMethod(object obj, string methodName, object[] parameters) { Type type = obj.GetType(); MethodInfo method = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); method.Invoke(obj, parameters); } public static void InvokeMethod(object obj, Type forceType, string methodName, object[] parameters) { MethodInfo method = forceType.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); method.Invoke(obj, parameters); } public static void SetPropertyValue(object obj, string propertyName, object value) { Type type = obj.GetType(); PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); property.SetValue(obj, value); } public static T InvokeMethod<T>(object obj, string methodName, object[] parameters) { Type type = obj.GetType(); MethodInfo method = type.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); return (T)method.Invoke(obj, parameters); } public static T GetFieldValue<T>(object obj, string fieldName) { Type type = obj.GetType(); FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); return (T)field.GetValue(obj); } public static void SetFieldValue(object obj, string fieldName, object value) { Type type = obj.GetType(); FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); field.SetValue(obj, value); } } [HarmonyPatch(typeof(ShipTeleporter), "Awake")] public static class ShipTeleporterAwakePatch { public static void Postfix(ref ShipTeleporter __instance) { int[] array = new int[MainClass.newPlayerCount]; for (int i = 0; i < MainClass.newPlayerCount; i++) { array[i] = -1; } ReflectionUtils.SetFieldValue(__instance, "playersBeingTeleported", array); } } [HarmonyPatch(typeof(PlayerControllerB), "SpectateNextPlayer")] public static class SpectatePatches { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if (((object)instruction).ToString() == "ldc.i4.4 NULL") { CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); } else { list.Add(instruction); } } return list.AsEnumerable(); } } [HarmonyPatch(typeof(SoundManager), "Start")] public static class SoundManagerStartPatch { public static void Postfix(ref SoundManager __instance) { Array.Resize(ref __instance.playerVoicePitchLerpSpeed, MainClass.newPlayerCount); Array.Resize(ref __instance.playerVoicePitchTargets, MainClass.newPlayerCount); Array.Resize(ref __instance.playerVoicePitches, MainClass.newPlayerCount); Array.Resize(ref __instance.playerVoiceVolumes, MainClass.newPlayerCount); Array.Resize(ref __instance.playerVoiceMixers, MainClass.newPlayerCount); AudioMixerGroup val = ((IEnumerable<AudioMixerGroup>)Resources.FindObjectsOfTypeAll<AudioMixerGroup>()).FirstOrDefault((Func<AudioMixerGroup, bool>)((AudioMixerGroup x) => ((Object)x).name.Contains("Voice"))); for (int i = 0; i < MainClass.newPlayerCount; i++) { __instance.playerVoicePitchLerpSpeed[i] = 3f; __instance.playerVoicePitchTargets[i] = 1f; __instance.playerVoicePitches[i] = 1f; __instance.playerVoiceVolumes[i] = 0.5f; if (!Object.op_Implicit((Object)(object)__instance.playerVoiceMixers[i])) { __instance.playerVoiceMixers[i] = val; } } } } [HarmonyPatch(typeof(StartOfRound), "GetPlayerSpawnPosition")] public static class SpawnPositionClampPatch { public static void Prefix(ref StartOfRound __instance, ref int playerNum, bool simpleTeleport = false) { if (!Object.op_Implicit((Object)(object)__instance.playerSpawnPositions[playerNum])) { playerNum = __instance.playerSpawnPositions.Length - 1; } } } [HarmonyPatch(typeof(StartOfRound), "OnClientConnect")] public static class OnClientConnectedPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); bool flag = false; bool flag2 = false; foreach (CodeInstruction instruction in instructions) { if (!flag2) { if (!flag && ((object)instruction).ToString() == "callvirt virtual bool System.Collections.Generic.List<int>::Contains(int item)") { flag = true; } else if (flag && ((object)instruction).ToString() == "ldc.i4.4 NULL") { flag2 = true; CodeInstruction item = new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(MainClass), "newPlayerCount")); list.Add(item); continue; } } list.Add(instruction); } return list.AsEnumerable(); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class LoadLobbyListAndFilterPatch { private static void Postfix() { LobbySlot[] array = Object.FindObjectsOfType<LobbySlot>(); LobbySlot[] array2 = array; foreach (LobbySlot val in array2) { ((TMP_Text)val.playerCount).text = $"{((Lobby)(ref val.thisLobby)).MemberCount} / {((Lobby)(ref val.thisLobby)).MaxMembers}"; } } } [HarmonyPatch(typeof(GameNetworkManager), "Awake")] public static class GameNetworkAwakePatch { public static int originalVersion; public static void Postfix(GameNetworkManager __instance) { originalVersion = __instance.gameVersionNum; if (!AssemblyChecker.HasAssemblyLoaded("lc_api")) { __instance.gameVersionNum = 9999; } } } [HarmonyPatch(typeof(MenuManager), "Awake")] public static class MenuManagerVersionDisplayPatch { public static void Postfix(MenuManager __instance) { if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)__instance.versionNumberText != (Object)null) { ((TMP_Text)__instance.versionNumberText).text = $"v{GameNetworkAwakePatch.originalVersion} (MC)"; } } } } namespace MoreCompany.Utils { public class AssemblyChecker { public static bool HasAssemblyLoaded(string name) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); Assembly[] array = assemblies; foreach (Assembly assembly in array) { if (assembly.GetName().Name.ToLower().Equals(name)) { return true; } } return false; } } public class BundleUtilities { public static byte[] GetResourceBytes(string filename, Assembly assembly) { string[] manifestResourceNames = assembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (!text.Contains(filename)) { continue; } using Stream stream = assembly.GetManifestResourceStream(text); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); return array; } return null; } public static AssetBundle LoadBundleFromInternalAssembly(string filename, Assembly assembly) { return AssetBundle.LoadFromMemory(GetResourceBytes(filename, assembly)); } } public static class AssetBundleExtension { public static T LoadPersistentAsset<T>(this AssetBundle bundle, string name) where T : Object { Object val = bundle.LoadAsset(name); if (val != (Object)null) { val.hideFlags = (HideFlags)32; return (T)(object)val; } return default(T); } } } namespace MoreCompany.Cosmetics { public class CosmeticApplication : MonoBehaviour { public Transform head; public Transform hip; public Transform lowerArmRight; public Transform shinLeft; public Transform shinRight; public Transform chest; public List<CosmeticInstance> spawnedCosmetics = new List<CosmeticInstance>(); public void Awake() { head = ((Component)this).transform.Find("spine").Find("spine.001").Find("spine.002") .Find("spine.003") .Find("spine.004"); chest = ((Component)this).transform.Find("spine").Find("spine.001").Find("spine.002") .Find("spine.003"); lowerArmRight = ((Component)this).transform.Find("spine").Find("spine.001").Find("spine.002") .Find("spine.003") .Find("shoulder.R") .Find("arm.R_upper") .Find("arm.R_lower"); hip = ((Component)this).transform.Find("spine"); shinLeft = ((Component)this).transform.Find("spine").Find("thigh.L").Find("shin.L"); shinRight = ((Component)this).transform.Find("spine").Find("thigh.R").Find("shin.R"); RefreshAllCosmeticPositions(); } private void OnDisable() { foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics) { ((Component)spawnedCosmetic).gameObject.SetActive(false); } } private void OnEnable() { foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics) { ((Component)spawnedCosmetic).gameObject.SetActive(true); } } public void ClearCosmetics() { foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics) { Object.Destroy((Object)(object)((Component)spawnedCosmetic).gameObject); } spawnedCosmetics.Clear(); } public void ApplyCosmetic(string cosmeticId, bool startEnabled) { if (CosmeticRegistry.cosmeticInstances.ContainsKey(cosmeticId)) { CosmeticInstance cosmeticInstance = CosmeticRegistry.cosmeticInstances[cosmeticId]; GameObject val = Object.Instantiate<GameObject>(((Component)cosmeticInstance).gameObject); val.SetActive(startEnabled); CosmeticInstance component = val.GetComponent<CosmeticInstance>(); spawnedCosmetics.Add(component); if (startEnabled) { ParentCosmetic(component); } } } public void RefreshAllCosmeticPositions() { foreach (CosmeticInstance spawnedCosmetic in spawnedCosmetics) { ParentCosmetic(spawnedCosmetic); } } private void ParentCosmetic(CosmeticInstance cosmeticInstance) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Transform val = null; switch (cosmeticInstance.cosmeticType) { case CosmeticType.HAT: val = head; break; case CosmeticType.R_LOWER_ARM: val = lowerArmRight; break; case CosmeticType.HIP: val = hip; break; case CosmeticType.L_SHIN: val = shinLeft; break; case CosmeticType.R_SHIN: val = shinRight; break; case CosmeticType.CHEST: val = chest; break; } ((Component)cosmeticInstance).transform.position = val.position; ((Component)cosmeticInstance).transform.rotation = val.rotation; ((Component)cosmeticInstance).transform.parent = val; } } public class CosmeticInstance : MonoBehaviour { public CosmeticType cosmeticType; public string cosmeticId; public Texture2D icon; } public class CosmeticGeneric { public virtual string gameObjectPath { get; } public virtual string cosmeticId { get; } public virtual string textureIconPath { get; } public CosmeticType cosmeticType { get; } public void LoadFromBundle(AssetBundle bundle) { GameObject val = bundle.LoadPersistentAsset<GameObject>(gameObjectPath); Texture2D icon = bundle.LoadPersistentAsset<Texture2D>(textureIconPath); CosmeticInstance cosmeticInstance = val.AddComponent<CosmeticInstance>(); cosmeticInstance.cosmeticId = cosmeticId; cosmeticInstance.icon = icon; cosmeticInstance.cosmeticType = cosmeticType; MainClass.StaticLogger.LogInfo((object)("Loaded cosmetic: " + cosmeticId + " from bundle: " + ((Object)bundle).name)); CosmeticRegistry.cosmeticInstances.Add(cosmeticId, cosmeticInstance); } } public enum CosmeticType { HAT, WRIST, CHEST, R_LOWER_ARM, HIP, L_SHIN, R_SHIN } public class CosmeticRegistry { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__8_0; public static UnityAction <>9__8_1; internal void <SpawnCosmeticGUI>b__8_0() { MainClass.showCosmetics = true; MainClass.SaveSettingsToFile(); } internal void <SpawnCosmeticGUI>b__8_1() { MainClass.showCosmetics = false; MainClass.SaveSettingsToFile(); } } public static Dictionary<string, CosmeticInstance> cosmeticInstances = new Dictionary<string, CosmeticInstance>(); public static GameObject cosmeticGUI; private static GameObject displayGuy; private static CosmeticApplication cosmeticApplication; public static List<string> locallySelectedCosmetics = new List<string>(); public const float COSMETIC_PLAYER_SCALE_MULT = 0.38f; public static void LoadCosmeticsFromBundle(AssetBundle bundle) { string[] allAssetNames = bundle.GetAllAssetNames(); foreach (string text in allAssetNames) { if (!text.EndsWith(".prefab")) { continue; } GameObject val = bundle.LoadPersistentAsset<GameObject>(text); CosmeticInstance component = val.GetComponent<CosmeticInstance>(); if (!((Object)(object)component == (Object)null)) { MainClass.StaticLogger.LogInfo((object)("Loaded cosmetic: " + component.cosmeticId + " from bundle")); if (cosmeticInstances.ContainsKey(component.cosmeticId)) { MainClass.StaticLogger.LogError((object)("Duplicate cosmetic id: " + component.cosmeticId)); } else { cosmeticInstances.Add(component.cosmeticId, component); } } } } public static void LoadCosmeticsFromAssembly(Assembly assembly, AssetBundle bundle) { Type[] types = assembly.GetTypes(); foreach (Type type in types) { if (type.IsSubclassOf(typeof(CosmeticGeneric))) { CosmeticGeneric cosmeticGeneric = (CosmeticGeneric)type.GetConstructor(new Type[0]).Invoke(new object[0]); cosmeticGeneric.LoadFromBundle(bundle); } } } public static void SpawnCosmeticGUI() { //IL_0042: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown cosmeticGUI = Object.Instantiate<GameObject>(MainClass.cosmeticGUIInstance); ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale")).transform.localScale = new Vector3(2f, 2f, 2f); displayGuy = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen") .Find("ObjectHolder") .Find("ScavengerModel") .Find("metarig")).gameObject; cosmeticApplication = displayGuy.AddComponent<CosmeticApplication>(); GameObject gameObject = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen") .Find("EnableButton")).gameObject; ButtonClickedEvent onClick = gameObject.GetComponent<Button>().onClick; object obj = <>c.<>9__8_0; if (obj == null) { UnityAction val = delegate { MainClass.showCosmetics = true; MainClass.SaveSettingsToFile(); }; <>c.<>9__8_0 = val; obj = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj); GameObject gameObject2 = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen") .Find("DisableButton")).gameObject; ButtonClickedEvent onClick2 = gameObject2.GetComponent<Button>().onClick; object obj2 = <>c.<>9__8_1; if (obj2 == null) { UnityAction val2 = delegate { MainClass.showCosmetics = false; MainClass.SaveSettingsToFile(); }; <>c.<>9__8_1 = val2; obj2 = (object)val2; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); if (MainClass.showCosmetics) { gameObject.SetActive(false); gameObject2.SetActive(true); } else { gameObject.SetActive(true); gameObject2.SetActive(false); } PopulateCosmetics(); UpdateCosmeticsOnDisplayGuy(startEnabled: false); } public static void PopulateCosmetics() { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown GameObject gameObject = ((Component)cosmeticGUI.transform.Find("Canvas").Find("GlobalScale").Find("CosmeticsScreen") .Find("CosmeticsHolder") .Find("Content")).gameObject; List<Transform> list = new List<Transform>(); for (int i = 0; i < gameObject.transform.childCount; i++) { list.Add(gameObject.transform.GetChild(i)); } foreach (Transform item in list) { Object.Destroy((Object)(object)((Component)item).gameObject); } foreach (KeyValuePair<string, CosmeticInstance> cosmeticInstance in cosmeticInstances) { GameObject val = Object.Instantiate<GameObject>(MainClass.cosmeticButton, gameObject.transform); val.transform.localScale = Vector3.one; GameObject disabledOverlay = ((Component)val.transform.Find("Deselected")).gameObject; disabledOverlay.SetActive(true); GameObject enabledOverlay = ((Component)val.transform.Find("Selected")).gameObject; enabledOverlay.SetActive(true); if (IsEquipped(cosmeticInstance.Value.cosmeticId)) { enabledOverlay.SetActive(true); disabledOverlay.SetActive(false); } else { enabledOverlay.SetActive(false); disabledOverlay.SetActive(true); } RawImage component = ((Component)val.transform.Find("Icon")).GetComponent<RawImage>(); component.texture = (Texture)(object)cosmeticInstance.Value.icon; Button component2 = val.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { ToggleCosmetic(cosmeticInstance.Value.cosmeticId); if (IsEquipped(cosmeticInstance.Value.cosmeticId)) { enabledOverlay.SetActive(true); disabledOverlay.SetActive(false); } else { enabledOverlay.SetActive(false); disabledOverlay.SetActive(true); } MainClass.WriteCosmeticsToFile(); UpdateCosmeticsOnDisplayGuy(startEnabled: true); }); } } private static Color HexToColor(string hex) { //IL_0003: 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_0013: 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) Color result = default(Color); ColorUtility.TryParseHtmlString(hex, ref result); return result; } public static void UpdateCosmeticsOnDisplayGuy(bool startEnabled) { cosmeticApplication.ClearCosmetics(); foreach (string locallySelectedCosmetic in locallySelectedCosmetics) { cosmeticApplication.ApplyCosmetic(locallySelectedCosmetic, startEnabled); } foreach (CosmeticInstance spawnedCosmetic in cosmeticApplication.spawnedCosmetics) { RecursiveLayerChange(((Component)spawnedCosmetic).transform, 5); } } private static void RecursiveLayerChange(Transform transform, int layer) { ((Component)transform).gameObject.layer = layer; for (int i = 0; i < transform.childCount; i++) { RecursiveLayerChange(transform.GetChild(i), layer); } } public static bool IsEquipped(string cosmeticId) { return locallySelectedCosmetics.Contains(cosmeticId); } public static void ToggleCosmetic(string cosmeticId) { if (locallySelectedCosmetics.Contains(cosmeticId)) { locallySelectedCosmetics.Remove(cosmeticId); } else { locallySelectedCosmetics.Add(cosmeticId); } } } } namespace MoreCompany.Behaviors { public class SpinDragger : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler { public float speed = 1f; private Vector2 lastMousePosition; private bool dragging = false; private Vector3 rotationalVelocity = Vector3.zero; public float dragSpeed = 1f; public float airDrag = 0.99f; public GameObject target; private void Update() { //IL_0076: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (dragging) { Vector3 val = Vector2.op_Implicit(((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue() - lastMousePosition); rotationalVelocity += new Vector3(0f, 0f - val.x, 0f) * dragSpeed; lastMousePosition = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue(); } rotationalVelocity *= airDrag; target.transform.Rotate(rotationalVelocity * Time.deltaTime * speed, (Space)0); } public void OnPointerDown(PointerEventData eventData) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) lastMousePosition = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue(); dragging = true; } public void OnPointerUp(PointerEventData eventData) { dragging = false; } } }
plugins/MoreScreams.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dissonance.Audio.Playback; using GameNetcodeStuff; using HarmonyLib; using MoreScreams.Configuration; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MoreScreams")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MoreScreams")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ba7e5619-9c03-4b8d-9888-381fda81ea0f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoreScreams { [BepInPlugin("egeadam.MoreScreams", "MoreScreams", "1.0.3")] public class MoreScreams : BaseUnityPlugin { private const string modGUID = "egeadam.MoreScreams"; private const string modName = "MoreScreams"; private const string modVersion = "1.0.3"; private readonly Harmony harmony = new Harmony("egeadam.MoreScreams"); private static MoreScreams Instance; internal static ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("egeadam.MoreScreams"); Config.Init(); harmony.PatchAll(); } } } namespace MoreScreams.Patches { public class AudioConfig { private PlayerControllerB playerControllerB; private float shutUpAt; private bool lowPassFilter; private bool highPassFilter; private float panStereo; private float playerVoicePitchTargets; private float playerPitch; private float spatialBlend; private bool set2D; private float volume; public bool IsAliveOrShuttedUp { get { if (!(shutUpAt < Time.time)) { return !playerControllerB.isPlayerDead; } return true; } } public float ShutUpAt => shutUpAt; public bool LowPassFilter => lowPassFilter; public bool HighPassFilter => highPassFilter; public float PanStereo => panStereo; public float PlayerVoicePitchTargets => playerVoicePitchTargets; public float PlayerPitch => playerPitch; public float SpatialBlend => spatialBlend; public bool Set2D => set2D; public float Volume => volume; public Transform DeadBodyT => ((Component)playerControllerB.deadBody).transform; public Transform AudioSourceT => ((Component)playerControllerB.currentVoiceChatAudioSource).transform; public AudioConfig(PlayerControllerB playerControllerB, float shutUpAt, bool lowPassFilter, bool highPassFilter, float panStereo, float playerVoicePitchTargets, float playerPitch, float spatialBlend, bool set2D, float volume) { this.playerControllerB = playerControllerB; this.shutUpAt = shutUpAt; this.lowPassFilter = lowPassFilter; this.highPassFilter = highPassFilter; this.panStereo = panStereo; this.playerVoicePitchTargets = playerVoicePitchTargets; this.playerPitch = playerPitch; this.spatialBlend = spatialBlend; this.set2D = set2D; this.volume = volume; } } [HarmonyPatch(typeof(StartOfRound), "UpdatePlayerVoiceEffects")] internal class UpdatePlayerVoiceEffectsPatch { private static bool updateStarted = false; private static Dictionary<PlayerControllerB, AudioConfig> configs = new Dictionary<PlayerControllerB, AudioConfig>(); public static Dictionary<PlayerControllerB, AudioConfig> Configs => configs; [HarmonyBefore(new string[] { "BiggerLobby" })] private static void Prefix() { if (configs == null) { configs = new Dictionary<PlayerControllerB, AudioConfig>(); } if (!updateStarted) { ((MonoBehaviour)HUDManager.Instance).StartCoroutine(UpdateNumerator()); updateStarted = true; } if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { return; } for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; if (!((Object)(object)val == (Object)null) && (val.isPlayerControlled || val.isPlayerDead) && (Object)(object)val != (Object)(object)GameNetworkManager.Instance.localPlayerController) { AudioSource currentVoiceChatAudioSource = val.currentVoiceChatAudioSource; if (!((Object)(object)currentVoiceChatAudioSource == (Object)null) && val.isPlayerDead && !configs.ContainsKey(val)) { Dictionary<PlayerControllerB, AudioConfig> dictionary = configs; float shutUpAt = Time.time + Config.ShutUpAfter; bool enabled = ((Behaviour)((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>()).enabled; bool enabled2 = ((Behaviour)((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>()).enabled; float panStereo = (currentVoiceChatAudioSource.panStereo = 0f); dictionary.Add(val, new AudioConfig(val, shutUpAt, enabled, enabled2, panStereo, SoundManager.Instance.playerVoicePitchTargets[(int)(IntPtr)(long)val.playerClientId], GetPitch(val), currentVoiceChatAudioSource.spatialBlend, val.currentVoiceChatIngameSettings.set2D, val.voicePlayerState.Volume)); } } } } private static void Postfix() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) if (configs == null) { configs = new Dictionary<PlayerControllerB, AudioConfig>(); } if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } PlayerControllerB[] array = configs.Keys.ToArray(); foreach (PlayerControllerB val in array) { if ((Object)(object)val == (Object)null) { continue; } AudioConfig audioConfig = configs[val]; if (audioConfig == null) { continue; } if ((val.isPlayerControlled || val.isPlayerDead) && !((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController)) { if ((Object)(object)val.currentVoiceChatAudioSource == (Object)null) { continue; } AudioSource currentVoiceChatAudioSource = val.currentVoiceChatAudioSource; if (!audioConfig.IsAliveOrShuttedUp) { if ((Object)(object)val.deadBody != (Object)null) { ((Component)currentVoiceChatAudioSource).transform.position = ((Component)val.deadBody).transform.position; } currentVoiceChatAudioSource.panStereo = audioConfig.PanStereo; currentVoiceChatAudioSource.spatialBlend = audioConfig.SpatialBlend; AudioLowPassFilter component = ((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>(); AudioHighPassFilter component2 = ((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = audioConfig.LowPassFilter; } if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = audioConfig.HighPassFilter; } if ((Object)(object)SoundManager.Instance != (Object)null) { SoundManager.Instance.playerVoicePitchTargets[(int)(IntPtr)(long)val.playerClientId] = audioConfig.PlayerVoicePitchTargets; SoundManager.Instance.SetPlayerPitch(audioConfig.PlayerPitch, (int)val.playerClientId); } val.currentVoiceChatIngameSettings.set2D = audioConfig.Set2D; val.voicePlayerState.Volume = audioConfig.Volume; val.currentVoiceChatAudioSource.volume = audioConfig.Volume; } } else if (!val.isPlayerDead) { configs.Remove(val); } } } private static IEnumerator UpdateNumerator() { yield return 0; while (true) { UpdatePlayersStatus(); yield return (object)new WaitForFixedUpdate(); } } private static void UpdatePlayersStatus() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (configs == null) { return; } bool flag = false; KeyValuePair<PlayerControllerB, AudioConfig>[] array = configs.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair<PlayerControllerB, AudioConfig> keyValuePair = array[i]; if (!((Object)(object)keyValuePair.Key == (Object)null)) { if (!keyValuePair.Key.isPlayerDead) { configs.Remove(keyValuePair.Key); flag = true; } else if ((Object)(object)keyValuePair.Value.DeadBodyT != (Object)null && (Object)(object)keyValuePair.Value.AudioSourceT != (Object)null) { keyValuePair.Value.AudioSourceT.position = keyValuePair.Value.DeadBodyT.position; } } } if (flag) { StartOfRound.Instance.UpdatePlayerVoiceEffects(); } } private static float GetPitch(PlayerControllerB playerControllerB) { int num = (int)playerControllerB.playerClientId; float result = default(float); SoundManager.Instance.diageticMixer.GetFloat($"PlayerPitch{num}", ref result); return result; } } [HarmonyPatch] internal class DissonancePatch { public static MethodBase TargetMethod() { return AccessTools.FirstMethod(typeof(VoicePlayback), (Func<MethodInfo, bool>)((MethodInfo method) => method.Name.Contains("SetTransform"))); } private static bool Prefix(object __instance) { foreach (AudioConfig value in UpdatePlayerVoiceEffectsPatch.Configs.Values) { if (!value.IsAliveOrShuttedUp && ((object)((Component)((__instance is VoicePlayback) ? __instance : null)).transform).Equals((object?)value.AudioSourceT)) { return false; } } return true; } } } namespace MoreScreams.Configuration { internal static class Config { private const string CONFIG_FILE_NAME = "MoreScreams.cfg"; private static ConfigFile config; private static ConfigEntry<float> shutUpAfter; public static float ShutUpAfter => shutUpAfter.Value; public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown config = new ConfigFile(Path.Combine(Paths.ConfigPath, "MoreScreams.cfg"), true); shutUpAfter = config.Bind<float>("Config", "Shut up after", 2f, "Mutes death player after given seconds."); } } }
plugins/MoreShipUpgrades/MoreShipUpgrades.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Extras; using LethalLib.Modules; using Microsoft.CodeAnalysis; using MoreShipUpgrades.Managers; using MoreShipUpgrades.Misc; using MoreShipUpgrades.UpgradeComponents.Commands; using MoreShipUpgrades.UpgradeComponents.Contracts; using MoreShipUpgrades.UpgradeComponents.Items; using MoreShipUpgrades.UpgradeComponents.Items.Contracts.BombDefusal; using MoreShipUpgrades.UpgradeComponents.Items.Contracts.DataRetrieval; using MoreShipUpgrades.UpgradeComponents.Items.Contracts.Exorcism; using MoreShipUpgrades.UpgradeComponents.Items.Contracts.Exterminator; using MoreShipUpgrades.UpgradeComponents.Items.Contracts.Extraction; using MoreShipUpgrades.UpgradeComponents.Items.PortableTeleporter; using MoreShipUpgrades.UpgradeComponents.Items.Wheelbarrow; using MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades; using MoreShipUpgrades.UpgradeComponents.TierUpgrades; using Newtonsoft.Json; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("0.0.0.0")] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace MoreShipUpgrades { [BepInPlugin("com.malco.lethalcompany.moreshipupgrades", "More Ship Upgrades", "3.1.1")] [BepInDependency("evaisa.lethallib", "0.13.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.malco.lethalcompany.moreshipupgrades"); public static Plugin instance; public static ManualLogSource mls; private AudioClip itemBreak; private AudioClip buttonPressed; private AudioClip error; private string root = "Assets/ShipUpgrades/"; private AudioClip[] wheelbarrowSound; private AudioClip[] shoppingCartSound; public static PluginConfig cfg { get; private set; } private void Awake() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown cfg = new PluginConfig(((BaseUnityPlugin)this).Config); cfg.InitBindings(); mls = Logger.CreateLogSource("More Ship Upgrades"); instance = this; Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "shipupgrades"); AssetBundle bundle = AssetBundle.LoadFromFile(text); GameObject val = new GameObject("UpgradeBus"); val.AddComponent<UpgradeBus>(); UpgradeBus.instance.version = "3.1.1"; UpgradeBus.instance.UpgradeAssets = bundle; UpgradeBus.instance.internNames = AssetBundleHandler.GetInfoFromJSON("InternNames").Split(","); UpgradeBus.instance.internInterests = AssetBundleHandler.GetInfoFromJSON("InternInterests").Split(","); SetupModStore(ref bundle); SetupIntroScreen(ref bundle); SetupItems(); SetupPerks(); SetupContractMapObjects(ref bundle); harmony.PatchAll(); mls.LogDebug((object)"LGU has been patched"); } public void sendModInfo() { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { if (pluginInfo.Value.Metadata.GUID.Contains("ModSync")) { try { List<string> list = new List<string> { "malco", "LateGameUpgrades" }; ((Component)pluginInfo.Value.Instance).BroadcastMessage("getModInfo", (object)list, (SendMessageOptions)1); break; } catch (Exception) { mls.LogDebug((object)"Failed to send info to ModSync, go yell at Minx"); break; } } } } private void SetupContractMapObjects(ref AssetBundle bundle) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 1f), new Keyframe(1f, 1f) }); SetupScavContract(ref bundle, curve); SetupExterminatorContract(ref bundle, curve); SetupDataContract(ref bundle, curve); SetupExorcismContract(ref bundle, curve); SetupBombContract(ref bundle, curve); } private void SetupBombContract(ref AssetBundle bundle, AnimationCurve curve) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "BombItem.asset"); if (!((Object)(object)val == (Object)null)) { val.isConductiveMetal = false; DefusalContract defusalContract = val.spawnPrefab.AddComponent<DefusalContract>(); defusalContract.SetPosition = true; BombDefusalScript bombDefusalScript = val.spawnPrefab.AddComponent<BombDefusalScript>(); bombDefusalScript.snip = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "scissors.mp3"); bombDefusalScript.tick = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "tick.mp3"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterItem(val); SpawnableMapObjectDef val2 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>(); val2.spawnableMapObject = new SpawnableMapObject(); val2.spawnableMapObject.prefabToSpawn = val.spawnPrefab; MapObjects.RegisterMapObject(val2, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve)); } } private void SetupExorcismContract(ref AssetBundle bundle, AnimationCurve curve) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "ExorcLootItem.asset"); val.spawnPrefab.AddComponent<ScrapValueSyncer>(); Items.RegisterItem(val); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Item val2 = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "PentagramItem.asset"); string[] array = new string[5] { "Heart.asset", "Crucifix.asset", "candelabraItem.asset", "Teddy Bear.asset", "Bones.asset" }; string[] array2 = array; foreach (string text in array2) { Item val3 = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "RitualItems/" + text); ExorcismContract exorcismContract = val3.spawnPrefab.AddComponent<ExorcismContract>(); Items.RegisterItem(val3); Utilities.FixMixerGroups(val3.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab); SpawnableMapObjectDef val4 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>(); val4.spawnableMapObject = new SpawnableMapObject(); val4.spawnableMapObject.prefabToSpawn = val3.spawnPrefab; MapObjects.RegisterMapObject(val4, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 3f), new Keyframe(1f, 3f) }))); } if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val == (Object)null)) { ExorcismContract exorcismContract2 = val2.spawnPrefab.AddComponent<ExorcismContract>(); exorcismContract2.SetPosition = true; PentagramScript pentagramScript = val2.spawnPrefab.AddComponent<PentagramScript>(); pentagramScript.loot = val.spawnPrefab; pentagramScript.chant = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "ritualSFX.mp3"); pentagramScript.portal = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "portal.mp3"); Utilities.FixMixerGroups(val2.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Items.RegisterItem(val2); SpawnableMapObjectDef val5 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>(); val5.spawnableMapObject = new SpawnableMapObject(); val5.spawnableMapObject.prefabToSpawn = val2.spawnPrefab; MapObjects.RegisterMapObject(val5, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve)); } } private void SetupExterminatorContract(ref AssetBundle bundle, AnimationCurve curve) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "EggLootItem.asset"); Items.RegisterItem(val); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Item val2 = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "HoardingEggItem.asset"); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val == (Object)null)) { ExterminatorContract exterminatorContract = val2.spawnPrefab.AddComponent<ExterminatorContract>(); exterminatorContract.SetPosition = true; BugNestScript bugNestScript = val2.spawnPrefab.AddComponent<BugNestScript>(); bugNestScript.loot = val.spawnPrefab; Utilities.FixMixerGroups(val2.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Items.RegisterItem(val2); SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>(); val3.spawnableMapObject = new SpawnableMapObject(); val3.spawnableMapObject.prefabToSpawn = val2.spawnPrefab; MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve)); } } private void SetupScavContract(ref AssetBundle bundle, AnimationCurve curve) { //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "ScavItem.asset"); if (!((Object)(object)val == (Object)null)) { val.weight = UpgradeBus.instance.cfg.CONTRACT_EXTRACT_WEIGHT; ExtractionContract extractionContract = val.spawnPrefab.AddComponent<ExtractionContract>(); extractionContract.SetPosition = true; ExtractPlayerScript extractPlayerScript = val.spawnPrefab.AddComponent<ExtractPlayerScript>(); TextAsset val2 = AssetBundleHandler.TryLoadOtherAsset<TextAsset>(ref bundle, root + "scavSounds/scavAudio.json"); Dictionary<string, string[]> dictionary = JsonConvert.DeserializeObject<Dictionary<string, string[]>>(val2.text); ExtractPlayerScript.clipDict.Add("lost", CreateAudioClipArray(dictionary["lost"], ref bundle)); ExtractPlayerScript.clipDict.Add("heal", CreateAudioClipArray(dictionary["heal"], ref bundle)); ExtractPlayerScript.clipDict.Add("safe", CreateAudioClipArray(dictionary["safe"], ref bundle)); ExtractPlayerScript.clipDict.Add("held", CreateAudioClipArray(dictionary["held"], ref bundle)); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterItem(val); SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>(); val3.spawnableMapObject = new SpawnableMapObject(); val3.spawnableMapObject.prefabToSpawn = val.spawnPrefab; MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve)); } } private void SetupDataContract(ref AssetBundle bundle, AnimationCurve curve) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown Item val = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "DiscItem.asset"); Items.RegisterItem(val); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Item val2 = AssetBundleHandler.TryLoadItemAsset(ref bundle, root + "DataPCItem.asset"); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val == (Object)null)) { DataRetrievalContract dataRetrievalContract = val2.spawnPrefab.AddComponent<DataRetrievalContract>(); dataRetrievalContract.SetPosition = true; DataPCScript dataPCScript = val2.spawnPrefab.AddComponent<DataPCScript>(); dataPCScript.error = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "winError.mp3"); dataPCScript.startup = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, root + "startup.mp3"); dataPCScript.loot = val.spawnPrefab; Utilities.FixMixerGroups(val2.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Items.RegisterItem(val2); SpawnableMapObjectDef val3 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>(); val3.spawnableMapObject = new SpawnableMapObject(); val3.spawnableMapObject.prefabToSpawn = val2.spawnPrefab; MapObjects.RegisterMapObject(val3, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve)); } } private AudioClip[] CreateAudioClipArray(string[] paths, ref AssetBundle bundle) { AudioClip[] array = (AudioClip[])(object)new AudioClip[paths.Length]; for (int i = 0; i < paths.Length; i++) { array[i] = AssetBundleHandler.TryLoadAudioClipAsset(ref bundle, paths[i]); } return array; } private void SetupModStore(ref AssetBundle bundle) { GameObject val = AssetBundleHandler.TryLoadGameObjectAsset(ref bundle, "Assets/ShipUpgrades/LGUStore.prefab"); if (!((Object)(object)val == (Object)null)) { val.AddComponent<LGUStore>(); NetworkPrefabs.RegisterNetworkPrefab(val); UpgradeBus.instance.modStorePrefab = val; } } private void SetupIntroScreen(ref AssetBundle bundle) { UpgradeBus.instance.introScreen = AssetBundleHandler.TryLoadGameObjectAsset(ref bundle, "Assets/ShipUpgrades/IntroScreen.prefab"); if ((Object)(object)UpgradeBus.instance.introScreen != (Object)null) { UpgradeBus.instance.introScreen.AddComponent<IntroScreenScript>(); } } private void SetupItems() { SetupTeleporterButtons(); SetupNightVision(); SetupMedkit(); SetupPeeper(); SetupSamples(); SetupHelmet(); SetupDivingKit(); SetupWheelbarrows(); } private void SetupSamples() { Dictionary<string, int> dictionary = new Dictionary<string, int> { { "centipede", cfg.SNARE_FLEA_SAMPLE_MINIMUM_VALUE }, { "bunker spider", cfg.BUNKER_SPIDER_SAMPLE_MINIMUM_VALUE }, { "hoarding bug", cfg.HOARDING_BUG_SAMPLE_MINIMUM_VALUE }, { "flowerman", cfg.BRACKEN_SAMPLE_MINIMUM_VALUE }, { "mouthdog", cfg.EYELESS_DOG_SAMPLE_MINIMUM_VALUE }, { "baboon hawk", cfg.BABOON_HAWK_SAMPLE_MINIMUM_VALUE }, { "crawler", cfg.THUMPER_SAMPLE_MINIMUM_VALUE } }; Dictionary<string, int> dictionary2 = new Dictionary<string, int> { { "centipede", cfg.SNARE_FLEA_SAMPLE_MAXIMUM_VALUE }, { "bunker spider", cfg.BUNKER_SPIDER_SAMPLE_MAXIMUM_VALUE }, { "hoarding bug", cfg.HOARDING_BUG_SAMPLE_MAXIMUM_VALUE }, { "flowerman", cfg.BRACKEN_SAMPLE_MAXIMUM_VALUE }, { "mouthdog", cfg.EYELESS_DOG_SAMPLE_MAXIMUM_VALUE }, { "baboon hawk", cfg.BABOON_HAWK_SAMPLE_MAXIMUM_VALUE }, { "crawler", cfg.THUMPER_SAMPLE_MAXIMUM_VALUE } }; foreach (string key in AssetBundleHandler.samplePaths.Keys) { Item itemObject = AssetBundleHandler.GetItemObject(key); MonsterSample monsterSample = itemObject.spawnPrefab.AddComponent<MonsterSample>(); ((GrabbableObject)monsterSample).grabbable = true; ((GrabbableObject)monsterSample).grabbableToEnemies = true; ((GrabbableObject)monsterSample).itemProperties = itemObject; ((GrabbableObject)monsterSample).itemProperties.minValue = dictionary[key]; ((GrabbableObject)monsterSample).itemProperties.maxValue = dictionary2[key]; NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab); UpgradeBus.instance.samplePrefabs.Add(key, itemObject.spawnPrefab); } } private void SetupTeleporterButtons() { itemBreak = AssetBundleHandler.GetAudioClip("Break"); error = AssetBundleHandler.GetAudioClip("Error"); buttonPressed = AssetBundleHandler.GetAudioClip("Button Press"); if (!((Object)(object)itemBreak == (Object)null) && !((Object)(object)error == (Object)null) && !((Object)(object)buttonPressed == (Object)null)) { SetupRegularTeleporterButton(); SetupAdvancedTeleporterButton(); } } private void SetupHelmet() { Item itemObject = AssetBundleHandler.GetItemObject("HelmetItem"); UpgradeBus.instance.helmetModel = AssetBundleHandler.GetPerkGameObject("HelmetModel"); if (!((Object)(object)itemObject == (Object)null)) { UpgradeBus.instance.SFX.Add("helmet", AssetBundleHandler.GetAudioClip("HelmetHit")); UpgradeBus.instance.SFX.Add("breakWood", AssetBundleHandler.GetAudioClip("breakWood")); Helmet helmet = itemObject.spawnPrefab.AddComponent<Helmet>(); ((GrabbableObject)helmet).itemProperties = itemObject; ((GrabbableObject)helmet).grabbable = true; ((GrabbableObject)helmet).grabbableToEnemies = true; itemObject.creditsWorth = cfg.HELMET_PRICE; NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab); UpgradeBus.instance.ItemsToSync.Add("Helmet", itemObject); TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.displayText = string.Format(AssetBundleHandler.GetInfoFromJSON("Helmet"), cfg.HELMET_HITS_BLOCKED); Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth); } } private void SetupRegularTeleporterButton() { Item itemObject = AssetBundleHandler.GetItemObject("Portable Tele"); if (!((Object)(object)itemObject == (Object)null)) { itemObject.itemName = "Portable Tele"; itemObject.itemId = 492012; RegularPortableTeleporter regularPortableTeleporter = itemObject.spawnPrefab.AddComponent<RegularPortableTeleporter>(); ((GrabbableObject)regularPortableTeleporter).itemProperties = itemObject; ((GrabbableObject)regularPortableTeleporter).grabbable = true; ((GrabbableObject)regularPortableTeleporter).grabbableToEnemies = true; regularPortableTeleporter.ItemBreak = itemBreak; ((GrabbableObject)regularPortableTeleporter).useCooldown = 2f; regularPortableTeleporter.error = error; regularPortableTeleporter.buttonPress = buttonPressed; itemObject.creditsWorth = cfg.WEAK_TELE_PRICE; NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab); UpgradeBus.instance.ItemsToSync.Add("Tele", itemObject); TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.displayText = string.Format(AssetBundleHandler.GetInfoFromJSON("Portable Tele"), (int)(cfg.CHANCE_TO_BREAK * 100f)); Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth); } } private void SetupAdvancedTeleporterButton() { Item itemObject = AssetBundleHandler.GetItemObject("Advanced Portable Tele"); if (!((Object)(object)itemObject == (Object)null)) { itemObject.creditsWorth = cfg.ADVANCED_TELE_PRICE; itemObject.itemName = "Advanced Portable Tele"; itemObject.itemId = 492013; AdvancedPortableTeleporter advancedPortableTeleporter = itemObject.spawnPrefab.AddComponent<AdvancedPortableTeleporter>(); ((GrabbableObject)advancedPortableTeleporter).itemProperties = itemObject; ((GrabbableObject)advancedPortableTeleporter).grabbable = true; ((GrabbableObject)advancedPortableTeleporter).useCooldown = 2f; ((GrabbableObject)advancedPortableTeleporter).grabbableToEnemies = true; advancedPortableTeleporter.ItemBreak = itemBreak; advancedPortableTeleporter.error = error; advancedPortableTeleporter.buttonPress = buttonPressed; NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab); UpgradeBus.instance.ItemsToSync.Add("AdvTele", itemObject); TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.displayText = string.Format(AssetBundleHandler.GetInfoFromJSON("Advanced Portable Tele"), (int)(cfg.ADV_CHANCE_TO_BREAK * 100f)); Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth); } } private void SetupNightVision() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) Item itemObject = AssetBundleHandler.GetItemObject("Night Vision"); if (!((Object)(object)itemObject == (Object)null)) { itemObject.creditsWorth = cfg.NIGHT_VISION_PRICE; itemObject.spawnPrefab.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); itemObject.itemId = 492014; NightVisionGoggles nightVisionGoggles = itemObject.spawnPrefab.AddComponent<NightVisionGoggles>(); ((GrabbableObject)nightVisionGoggles).itemProperties = itemObject; ((GrabbableObject)nightVisionGoggles).grabbable = true; ((GrabbableObject)nightVisionGoggles).useCooldown = 2f; ((GrabbableObject)nightVisionGoggles).grabbableToEnemies = true; NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab); UpgradeBus.instance.nightVisionPrefab = itemObject.spawnPrefab; UpgradeBus.instance.ItemsToSync.Add("Night", itemObject); TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); string arg = ((cfg.NIGHT_VISION_INDIVIDUAL || UpgradeBus.instance.cfg.SHARED_UPGRADES) ? "one" : "all"); string arg2 = (cfg.LOSE_NIGHT_VIS_ON_DEATH ? "be" : "not be"); val.displayText = string.Format(AssetBundleHandler.GetInfoFromJSON("Night Vision"), arg, arg2); Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth); } } private void SetupDivingKit() { Item itemObject = AssetBundleHandler.GetItemObject("Diving Kit"); if (!((Object)(object)itemObject == (Object)null)) { itemObject.creditsWorth = cfg.DIVEKIT_PRICE; itemObject.itemId = 492015; itemObject.twoHanded = cfg.DIVEKIT_TWO_HANDED; itemObject.weight = cfg.DIVEKIT_WEIGHT; itemObject.itemSpawnsOnGround = true; DivingKit divingKit = itemObject.spawnPrefab.AddComponent<DivingKit>(); ((GrabbableObject)divingKit).itemProperties = itemObject; ((GrabbableObject)divingKit).grabbable = true; ((GrabbableObject)divingKit).grabbableToEnemies = true; NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab); UpgradeBus.instance.ItemsToSync.Add("Dive", itemObject); TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); string arg = (cfg.DIVEKIT_TWO_HANDED ? "two" : "one"); val.displayText = $"DIVING KIT - ${cfg.DIVEKIT_PRICE}\n\nBreath underwater.\nWeights {Mathf.RoundToInt((itemObject.weight - 1f) * 100f)} lbs and is {arg} handed.\n\n"; Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth); } } private void SetupMedkit() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown Item itemObject = AssetBundleHandler.GetItemObject("Medkit"); if ((Object)(object)itemObject == (Object)null) { return; } AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 3f), new Keyframe(1f, 3f) }); itemObject.creditsWorth = cfg.MEDKIT_PRICE; itemObject.itemId = 492016; Medkit medkit = itemObject.spawnPrefab.AddComponent<Medkit>(); ((GrabbableObject)medkit).itemProperties = itemObject; ((GrabbableObject)medkit).grabbable = true; ((GrabbableObject)medkit).useCooldown = 2f; ((GrabbableObject)medkit).grabbableToEnemies = true; medkit.error = error; medkit.use = buttonPressed; NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab); TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.displayText = $"MEDKIT - ${cfg.MEDKIT_PRICE}\n\nLeft click to heal yourself for {cfg.MEDKIT_HEAL_VALUE} health.\nCan be used {cfg.MEDKIT_USES} times.\n"; Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth); Item itemObject2 = AssetBundleHandler.GetItemObject("MedkitMapItem"); if (!((Object)(object)itemObject2 == (Object)null)) { Medkit medkit2 = itemObject2.spawnPrefab.AddComponent<Medkit>(); ExtractionContract extractionContract = itemObject2.spawnPrefab.AddComponent<ExtractionContract>(); ((GrabbableObject)medkit2).itemProperties = itemObject2; ((GrabbableObject)medkit2).grabbable = true; ((GrabbableObject)medkit2).useCooldown = 2f; ((GrabbableObject)medkit2).grabbableToEnemies = true; medkit2.error = error; medkit2.use = buttonPressed; NetworkPrefabs.RegisterNetworkPrefab(itemObject2.spawnPrefab); SpawnableMapObjectDef val2 = ScriptableObject.CreateInstance<SpawnableMapObjectDef>(); val2.spawnableMapObject = new SpawnableMapObject(); val2.spawnableMapObject.prefabToSpawn = itemObject2.spawnPrefab; MapObjects.RegisterMapObject(val2, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve)); UpgradeBus.instance.ItemsToSync.Add("Medkit", itemObject); } } private void SetupPeeper() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) Item itemObject = AssetBundleHandler.GetItemObject("Peeper"); if (!((Object)(object)itemObject == (Object)null)) { itemObject.creditsWorth = cfg.PEEPER_PRICE; itemObject.twoHanded = false; itemObject.itemId = 492017; itemObject.twoHandedAnimation = false; itemObject.spawnPrefab.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); Peeper peeper = itemObject.spawnPrefab.AddComponent<Peeper>(); ((GrabbableObject)peeper).itemProperties = itemObject; ((GrabbableObject)peeper).grabbable = true; ((GrabbableObject)peeper).grabbableToEnemies = true; NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab); UpgradeBus.instance.ItemsToSync.Add("Peeper", itemObject); TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.displayText = "Looks at coil heads, don't lose it\n"; Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth); } } private void SetupWheelbarrows() { wheelbarrowSound = GetAudioClipList("Wheelbarrow Sound", 4); shoppingCartSound = GetAudioClipList("Scrap Wheelbarrow Sound", 4); SetupStoreWheelbarrow(); SetupScrapWheelbarrow(); } private AudioClip[] GetAudioClipList(string name, int length) { AudioClip[] array = (AudioClip[])(object)new AudioClip[length]; for (int i = 0; i < length; i++) { array[i] = AssetBundleHandler.GetAudioClip($"{name} {i}"); } return array; } private void SetupScrapWheelbarrow() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown Item itemObject = AssetBundleHandler.GetItemObject("Scrap Wheelbarrow"); if (!((Object)(object)itemObject == (Object)null)) { itemObject.itemId = 492018; itemObject.minValue = cfg.SCRAP_WHEELBARROW_MINIMUM_VALUE; itemObject.maxValue = cfg.SCRAP_WHEELBARROW_MAXIMUM_VALUE; itemObject.twoHanded = true; itemObject.twoHandedAnimation = true; itemObject.grabAnim = "HoldJetpack"; itemObject.floorYOffset = -90; itemObject.positionOffset = new Vector3(0f, -1.7f, 0.35f); itemObject.allowDroppingAheadOfPlayer = true; itemObject.isConductiveMetal = true; itemObject.isScrap = true; itemObject.weight = 0.99f + cfg.SCRAP_WHEELBARROW_WEIGHT / 100f; itemObject.toolTips = new string[1] { "Drop all items: [MMB]" }; itemObject.canBeGrabbedBeforeGameStart = true; ScrapWheelbarrow scrapWheelbarrow = itemObject.spawnPrefab.AddComponent<ScrapWheelbarrow>(); ((GrabbableObject)scrapWheelbarrow).itemProperties = itemObject; scrapWheelbarrow.wheelsClip = shoppingCartSound; NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab); Items.RegisterItem(itemObject); Utilities.FixMixerGroups(itemObject.spawnPrefab); int num = (cfg.SCRAP_WHEELBARROW_ENABLED ? 1 : 0); AnimationCurve curve = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, 0f), new Keyframe(1f - cfg.SCRAP_WHEELBARROW_RARITY, (float)num), new Keyframe(1f, (float)num) }); SpawnableMapObjectDef val = ScriptableObject.CreateInstance<SpawnableMapObjectDef>(); val.spawnableMapObject = new SpawnableMapObject(); val.spawnableMapObject.prefabToSpawn = itemObject.spawnPrefab; MapObjects.RegisterMapObject(val, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel level) => curve)); } } private void SetupStoreWheelbarrow() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Item itemObject = AssetBundleHandler.GetItemObject("Store Wheelbarrow"); if (!((Object)(object)itemObject == (Object)null)) { itemObject.itemId = 492019; itemObject.creditsWorth = cfg.WHEELBARROW_PRICE; itemObject.twoHanded = true; itemObject.twoHandedAnimation = true; itemObject.grabAnim = "HoldJetpack"; itemObject.floorYOffset = -90; itemObject.verticalOffset = 0.3f; itemObject.positionOffset = new Vector3(0f, -0.7f, 1.4f); itemObject.allowDroppingAheadOfPlayer = true; itemObject.isConductiveMetal = true; itemObject.weight = 0.99f + cfg.WHEELBARROW_WEIGHT / 100f; itemObject.toolTips = new string[1] { "Drop all items: [MMB] " }; itemObject.canBeGrabbedBeforeGameStart = true; StoreWheelbarrow storeWheelbarrow = itemObject.spawnPrefab.AddComponent<StoreWheelbarrow>(); ((GrabbableObject)storeWheelbarrow).itemProperties = itemObject; storeWheelbarrow.wheelsClip = wheelbarrowSound; NetworkPrefabs.RegisterNetworkPrefab(itemObject.spawnPrefab); Utilities.FixMixerGroups(itemObject.spawnPrefab); UpgradeBus.instance.ItemsToSync.Add("Wheel", itemObject); TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.displayText = $"A portable container which has a maximum capacity of {cfg.WHEELBARROW_MAXIMUM_AMOUNT_ITEMS} and reduces the effective weight of the inserted items by {cfg.WHEELBARROW_WEIGHT_REDUCTION_MULTIPLIER * 100f} %.\nIt weighs {1f + cfg.WHEELBARROW_WEIGHT / 100f} lbs"; Items.RegisterShopItem(itemObject, (TerminalNode)null, (TerminalNode)null, val, itemObject.creditsWorth); } } private void SetupPerks() { SetupBeekeeper(); SetupProteinPowder(); SetupBiggerLungs(); SetupRunningShoes(); SetupStrongLegs(); SetupMalwareBroadcaster(); SetupNightVisionBattery(); SetupDiscombobulator(); SetupBetterScanner(); SetupWalkieGPS(); SetupBackMuscles(); SetupInterns(); SetupPager(); SetupLightningRod(); SetupLocksmith(); SetupPlayerHealth(); SetupHunter(); SetupContract(); SetupSickBeats(); SetupExtendDeadline(); SetupDoorsHydraulicsBattery(); SetupScrapInsurance(); } private void SetupSickBeats() { SetupGenericPerk<BeatScript>(BeatScript.UPGRADE_NAME); } private void SetupContract() { SetupGenericPerk<ContractScript>(ContractScript.UPGRADE_NAME); } private void SetupBeekeeper() { SetupGenericPerk<beekeeperScript>(beekeeperScript.UPGRADE_NAME); } private void SetupHunter() { SetupGenericPerk<hunterScript>(hunterScript.UPGRADE_NAME); } private void SetupProteinPowder() { SetupGenericPerk<proteinPowderScript>(proteinPowderScript.UPGRADE_NAME); } private void SetupBiggerLungs() { SetupGenericPerk<biggerLungScript>(biggerLungScript.UPGRADE_NAME); } private void SetupRunningShoes() { SetupGenericPerk<runningShoeScript>(runningShoeScript.UPGRADE_NAME); } private void SetupStrongLegs() { SetupGenericPerk<strongLegsScript>(strongLegsScript.UPGRADE_NAME); } private void SetupMalwareBroadcaster() { SetupGenericPerk<trapDestroyerScript>(trapDestroyerScript.UPGRADE_NAME); } private void SetupNightVisionBattery() { SetupGenericPerk<nightVisionScript>(nightVisionScript.UPGRADE_NAME); } private void SetupDiscombobulator() { AudioClip audioClip = AssetBundleHandler.GetAudioClip("Flashbang"); if ((Object)(object)audioClip != (Object)null) { UpgradeBus.instance.flashNoise = audioClip; } SetupGenericPerk<terminalFlashScript>(terminalFlashScript.UPGRADE_NAME); } private void SetupBetterScanner() { SetupGenericPerk<strongerScannerScript>(strongerScannerScript.UPGRADE_NAME); } private void SetupWalkieGPS() { SetupGenericPerk<walkieScript>(walkieScript.UPGRADE_NAME); } private void SetupBackMuscles() { SetupGenericPerk<exoskeletonScript>(exoskeletonScript.UPGRADE_NAME); } private void SetupInterns() { SetupGenericPerk<defibScript>(defibScript.UPGRADE_NAME); } private void SetupPager() { SetupGenericPerk<pagerScript>(pagerScript.UPGRADE_NAME); } private void SetupLightningRod() { SetupGenericPerk<lightningRodScript>(lightningRodScript.UPGRADE_NAME); } private void SetupLocksmith() { SetupGenericPerk<lockSmithScript>(lockSmithScript.UPGRADE_NAME); } private void SetupPlayerHealth() { SetupGenericPerk<playerHealthScript>(playerHealthScript.UPGRADE_NAME); } private void SetupExtendDeadline() { SetupGenericPerk<ExtendDeadlineScript>(ExtendDeadlineScript.UPGRADE_NAME); } private void SetupDoorsHydraulicsBattery() { SetupGenericPerk<DoorsHydraulicsBattery>("Shutter Batteries"); } private void SetupScrapInsurance() { SetupGenericPerk<ScrapInsurance>(ScrapInsurance.COMMAND_NAME); } private void SetupGenericPerk<T>(string upgradeName) where T : Component { GameObject perkGameObject = AssetBundleHandler.GetPerkGameObject(upgradeName); if (Object.op_Implicit((Object)(object)perkGameObject)) { perkGameObject.AddComponent<T>(); NetworkPrefabs.RegisterNetworkPrefab(perkGameObject); } } } } namespace MoreShipUpgrades.UpgradeComponents.TierUpgrades { internal class beekeeperScript : BaseUpgrade { private static LGULogger logger = new LGULogger(UPGRADE_NAME); public static string UPGRADE_NAME = "Beekeeper"; public static string PRICES_DEFAULT = "225,280,340"; private void Start() { upgradeName = UPGRADE_NAME; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } public override void Increment() { UpgradeBus.instance.beeLevel++; if (UpgradeBus.instance.beeLevel == UpgradeBus.instance.cfg.BEEKEEPER_UPGRADE_PRICES.Split(',').Length) { LGUStore.instance.ToggleIncreaseHivePriceServerRpc(); } } public override void load() { base.load(); UpgradeBus.instance.beekeeper = true; } public override void Register() { base.Register(); } public override void Unwind() { base.Unwind(); UpgradeBus.instance.beeLevel = 0; UpgradeBus.instance.beekeeper = false; } public static int CalculateBeeDamage(int damageNumber) { if (!UpgradeBus.instance.beekeeper) { return damageNumber; } return Mathf.Clamp((int)((float)damageNumber * (UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER - (float)UpgradeBus.instance.beeLevel * UpgradeBus.instance.cfg.BEEKEEPER_DAMAGE_MULTIPLIER_INCREMENT)), 0, damageNumber); } public static int GetHiveScrapValue(int originalValue) { if (!UpgradeBus.instance.increaseHivePrice) { return originalValue; } return (int)((float)originalValue * UpgradeBus.instance.cfg.BEEKEEPER_HIVE_VALUE_INCREASE); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "beekeeperScript"; } } internal class biggerLungScript : BaseUpgrade { private static LGULogger logger; public static string UPGRADE_NAME = "Bigger Lungs"; public static string PRICES_DEFAULT = "350,450,550"; private int currentLevel = 0; private static bool active = false; private void Start() { upgradeName = UPGRADE_NAME; logger = new LGULogger(UPGRADE_NAME); Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } public override void Increment() { PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer(); localPlayer.sprintTime += UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT; logger.LogDebug($"Adding {UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT} to the player's sprint time..."); UpgradeBus.instance.lungLevel++; currentLevel++; } public override void load() { PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer(); if (!active) { logger.LogDebug($"Adding {UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE_UNLOCK} to the player's sprint time..."); localPlayer.sprintTime += UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE_UNLOCK; } UpgradeBus.instance.biggerLungs = true; active = true; base.load(); float num = 0f; for (int i = 1; i < UpgradeBus.instance.lungLevel + 1; i++) { if (i > currentLevel) { logger.LogDebug($"Adding {UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT} to the player's sprint time..."); num += UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT; } } localPlayer.sprintTime += num; currentLevel = UpgradeBus.instance.lungLevel; } public override void Unwind() { PlayerControllerB player = UpgradeBus.instance.GetLocalPlayer(); if (active) { ResetBiggerLungsBuff(ref player); } base.Unwind(); UpgradeBus.instance.biggerLungs = false; UpgradeBus.instance.lungLevel = 0; active = false; currentLevel = 0; } public override void Register() { base.Register(); } public static void ResetBiggerLungsBuff(ref PlayerControllerB player) { float num = UpgradeBus.instance.cfg.SPRINT_TIME_INCREASE_UNLOCK; for (int i = 0; i < UpgradeBus.instance.lungLevel; i++) { num += UpgradeBus.instance.cfg.SPRINT_TIME_INCREMENT; } logger.LogDebug($"Removing {player.playerUsername}'s sprint time boost ({player.sprintTime}) with a boost of {num}"); PlayerControllerB obj = player; obj.sprintTime -= num; logger.LogDebug("Upgrade reset on " + player.playerUsername); active = false; } public static float ApplyPossibleIncreasedStaminaRegen(float regenValue) { if (!UpgradeBus.instance.biggerLungs || UpgradeBus.instance.lungLevel < 0) { return regenValue * UpgradeBus.instance.staminaDrainCoefficient; } return regenValue * UpgradeBus.instance.cfg.BIGGER_LUNGS_STAMINA_REGEN_INCREASE * UpgradeBus.instance.staminaDrainCoefficient; } public static float ApplyPossibleReducedJumpStaminaCost(float jumpCost) { if (!UpgradeBus.instance.biggerLungs || UpgradeBus.instance.lungLevel < 1) { return jumpCost; } return jumpCost * UpgradeBus.instance.cfg.BIGGER_LUNGS_JUMP_STAMINA_COST_DECREASE; } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "biggerLungScript"; } } internal class DoorsHydraulicsBattery : BaseUpgrade { private static LGULogger logger; public const string UPGRADE_NAME = "Shutter Batteries"; public const string PRICES_DEFAULT = "200,300,400"; public static string ENABLED_SECTION = "Enable Shutter Batteries"; public static string ENABLED_DESCRIPTION = "Increases the amount of time the doors can remain shut"; public static string PRICE_SECTION = "Price of Shutter Batteries"; public static int PRICE_DEFAULT = 300; public static string INITIAL_SECTION = "Initial battery boost"; public static float INITIAL_DEFAULT = 5f; public static string INITIAL_DESCRIPTION = "Initial battery boost for the doors' lock on first purchase"; public static string INCREMENTAL_SECTION = "Incremental battery boost"; public static float INCREMENTAL_DEFAULT = 5f; public static string INCREMENTAL_DESCRIPTION = "Incremental battery boost for the doors' lock after purchase"; private static bool active; private int currentLevel; private void Start() { upgradeName = "Shutter Batteries"; logger = new LGULogger(upgradeName); Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } public override void load() { HangarShipDoor shipDoors = UpgradeBus.instance.GetShipDoors(); if (!active) { logger.LogDebug($"Adding initial {UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INITIAL} to the door's power duration..."); shipDoors.doorPowerDuration += UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INITIAL; } UpgradeBus.instance.doorsHydraulicsBattery = true; active = true; base.load(); float num = 0f; for (int i = 1; i < UpgradeBus.instance.doorsHydraulicsBatteryLevel + 1; i++) { if (i > currentLevel) { logger.LogDebug($"Adding incremental {UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INCREMENTAL} to the door's power duration..."); num += UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INCREMENTAL; } } logger.LogDebug(num); logger.LogDebug(shipDoors.doorPowerDuration); shipDoors.doorPowerDuration += num; currentLevel = UpgradeBus.instance.doorsHydraulicsBatteryLevel; } public override void Increment() { HangarShipDoor shipDoors = UpgradeBus.instance.GetShipDoors(); shipDoors.doorPowerDuration += UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INCREMENTAL; logger.LogDebug($"Adding incremental {UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INCREMENTAL} to the ship door's battery..."); UpgradeBus.instance.doorsHydraulicsBatteryLevel++; currentLevel++; } public override void Unwind() { HangarShipDoor shipDoors = UpgradeBus.instance.GetShipDoors(); if (active) { ResetDoorsHydraulicsBattery(ref shipDoors); } base.Unwind(); UpgradeBus.instance.doorsHydraulicsBattery = false; UpgradeBus.instance.doorsHydraulicsBatteryLevel = 0; active = false; currentLevel = 0; } public static void ResetDoorsHydraulicsBattery(ref HangarShipDoor shipDoors) { float num = UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INITIAL; for (int i = 0; i < UpgradeBus.instance.doorsHydraulicsBatteryLevel; i++) { num += UpgradeBus.instance.cfg.DOOR_HYDRAULICS_BATTERY_INCREMENTAL; } logger.LogDebug($"Removing ship door's battery boost ({shipDoors.doorPowerDuration}) with a boost of {num}"); HangarShipDoor obj = shipDoors; obj.doorPowerDuration -= num; logger.LogDebug("Upgrade reset on ship doors"); active = false; } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "DoorsHydraulicsBattery"; } } internal class exoskeletonScript : BaseUpgrade { public static string UPGRADE_NAME = "Back Muscles"; public static string PRICES_DEFAULT = "600,700,800"; private void Start() { upgradeName = UPGRADE_NAME; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } public override void Increment() { UpgradeBus.instance.backLevel++; UpdatePlayerWeight(); } public override void load() { base.load(); UpgradeBus.instance.exoskeleton = true; UpdatePlayerWeight(); } public override void Unwind() { base.Unwind(); UpgradeBus.instance.exoskeleton = false; UpgradeBus.instance.backLevel = 0; UpdatePlayerWeight(); } public override void Register() { base.Register(); } public static float DecreasePossibleWeight(float defaultWeight) { if (!UpgradeBus.instance.exoskeleton) { return defaultWeight; } return defaultWeight * (UpgradeBus.instance.cfg.CARRY_WEIGHT_REDUCTION - (float)UpgradeBus.instance.backLevel * UpgradeBus.instance.cfg.CARRY_WEIGHT_INCREMENT); } public static void UpdatePlayerWeight() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController.ItemSlots.Length == 0) { return; } UpgradeBus.instance.alteredWeight = 1f; for (int i = 0; i < localPlayerController.ItemSlots.Length; i++) { GrabbableObject val = localPlayerController.ItemSlots[i]; if (!((Object)(object)val == (Object)null)) { UpgradeBus.instance.alteredWeight += Mathf.Clamp(DecreasePossibleWeight(val.itemProperties.weight - 1f), 0f, 10f); } } localPlayerController.carryWeight = UpgradeBus.instance.alteredWeight; if (localPlayerController.carryWeight < 1f) { localPlayerController.carryWeight = 1f; } } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "exoskeletonScript"; } } internal class hunterScript : BaseUpgrade { public static string UPGRADE_NAME = "Hunter"; private static LGULogger logger = new LGULogger(UPGRADE_NAME); private static Dictionary<string, string> monsterNames = new Dictionary<string, string> { { "hoarding", "Hoarding Bug" }, { "hoarding bug", "Hoarding Bug" }, { "snare", "Snare Flea" }, { "flea", "Snare Flea" }, { "snare flea", "Snare Flea" }, { "centipede", "Snare Flea" }, { "bunker spider", "Bunker Spider" }, { "bunker", "Bunker Spider" }, { "bunk", "Bunker Spider" }, { "spider", "Bunker Spider" }, { "baboon hawk", "Baboon Hawk" }, { "baboon", "Baboon Hawk" }, { "hawk", "Baboon Hawk" }, { "flowerman", "Bracken" }, { "bracken", "Bracken" }, { "crawler", "Half/Thumper" }, { "half", "Half/Thumper" }, { "thumper", "Half/Thumper" }, { "mouthdog", "Eyeless Dog" }, { "eyeless dog", "Eyeless Dog" }, { "eyeless", "Eyeless Dog" }, { "dog", "Eyeless Dog" } }; public static Dictionary<int, string[]> tiers; public static void SetupTierList() { logger = new LGULogger(UPGRADE_NAME); tiers = new Dictionary<int, string[]>(); string[] array = UpgradeBus.instance.cfg.HUNTER_SAMPLE_TIERS.ToLower().Split('-'); tiers[0] = (from x in array[0].Split(",") select x.Trim()).ToArray(); for (int i = 1; i < array.Length; i++) { tiers[i] = tiers[i - 1].Concat(from x in array[i].Split(",") select x.Trim()).ToArray(); } } private void Start() { upgradeName = UPGRADE_NAME; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } public override void Increment() { UpgradeBus.instance.huntLevel++; } public override void load() { base.load(); UpgradeBus.instance.hunter = true; } public override void Unwind() { base.Unwind(); UpgradeBus.instance.hunter = false; UpgradeBus.instance.huntLevel = 0; } public override void Register() { base.Register(); } public static string GetHunterInfo(int level, int price) { string text = ((level == 1) ? string.Join(", ", tiers[level - 1]) : string.Join(", ", tiers[level - 1].Except(tiers[level - 2]).ToArray())); string text2 = ""; string[] array = text.Split(", "); foreach (string text3 in array) { logger.LogDebug(text3.Trim().ToLower()); logger.LogDebug(monsterNames[text3.Trim().ToLower()]); text2 = text2 + monsterNames[text3.Trim().ToLower()] + ", "; } text2 = text2.Substring(0, text2.Length - 2); text2 += "\n"; return string.Format(AssetBundleHandler.GetInfoFromJSON(UPGRADE_NAME), level, price, text2); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "hunterScript"; } } internal class nightVisionScript : BaseUpgrade { private float nightBattery; private Transform batteryBar; private PlayerControllerB client; private bool batteryExhaustion; private Key toggleKey; public static string UPGRADE_NAME = "NV Headset Batteries"; public static string PRICES_DEFAULT = "300,400,500"; private static LGULogger logger = new LGULogger(UPGRADE_NAME); private void Start() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) upgradeName = UPGRADE_NAME; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); batteryBar = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).transform; ((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false); if (Enum.TryParse<Key>(UpgradeBus.instance.cfg.TOGGLE_NIGHT_VISION_KEY, out Key result)) { toggleKey = result; return; } logger.LogWarning("Error parsing the key for toggle night vision, defaulted to LeftAlt"); toggleKey = (Key)53; } public override void Register() { base.Register(); } private void LateUpdate() { //IL_001d: 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) if ((Object)(object)client == (Object)null) { return; } if (((ButtonControl)Keyboard.current[toggleKey]).wasPressedThisFrame && !batteryExhaustion) { Toggle(); } float num = UpgradeBus.instance.cfg.NIGHT_BATTERY_MAX + (float)UpgradeBus.instance.nightVisionLevel * UpgradeBus.instance.cfg.NIGHT_VIS_BATTERY_INCREMENT; if (UpgradeBus.instance.nightVisionActive) { nightBattery -= Time.deltaTime * (UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_SPEED - (float)UpgradeBus.instance.nightVisionLevel * UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_INCREMENT); nightBattery = Mathf.Clamp(nightBattery, 0f, num); ((Component)batteryBar.parent).gameObject.SetActive(true); if (nightBattery <= 0f) { TurnOff(exhaust: true); } } else if (!batteryExhaustion) { nightBattery += Time.deltaTime * (UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_SPEED + (float)UpgradeBus.instance.nightVisionLevel * UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_INCREMENT); nightBattery = Mathf.Clamp(nightBattery, 0f, num); if (nightBattery >= num) { ((Component)batteryBar.parent).gameObject.SetActive(false); } else { ((Component)batteryBar.parent).gameObject.SetActive(true); } } if (client.isInsideFactory || UpgradeBus.instance.nightVisionActive) { ((Behaviour)client.nightVision).enabled = true; } else { ((Behaviour)client.nightVision).enabled = false; } float num2 = nightBattery / num; batteryBar.localScale = new Vector3(num2, 1f, 1f); } private void Toggle() { UpgradeBus.instance.nightVisionActive = !UpgradeBus.instance.nightVisionActive; if (UpgradeBus.instance.nightVisionActive) { TurnOn(); } else { TurnOff(); } } private void TurnOff(bool exhaust = false) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) UpgradeBus.instance.nightVisionActive = false; client.nightVision.color = UpgradeBus.instance.nightVisColor; client.nightVision.range = UpgradeBus.instance.nightVisRange; client.nightVision.intensity = UpgradeBus.instance.nightVisIntensity; if (exhaust) { batteryExhaustion = true; ((MonoBehaviour)this).StartCoroutine(BatteryRecovery()); } } private void TurnOn() { //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_0064: Unknown result type (might be due to invalid IL or missing references) UpgradeBus.instance.nightVisColor = client.nightVision.color; UpgradeBus.instance.nightVisRange = client.nightVision.range; UpgradeBus.instance.nightVisIntensity = client.nightVision.intensity; client.nightVision.color = UpgradeBus.instance.cfg.NIGHT_VIS_COLOR; client.nightVision.range = UpgradeBus.instance.cfg.NIGHT_VIS_RANGE + (float)UpgradeBus.instance.nightVisionLevel * UpgradeBus.instance.cfg.NIGHT_VIS_RANGE_INCREMENT; client.nightVision.intensity = UpgradeBus.instance.cfg.NIGHT_VIS_INTENSITY + (float)UpgradeBus.instance.nightVisionLevel * UpgradeBus.instance.cfg.NIGHT_VIS_INTENSITY_INCREMENT; nightBattery -= UpgradeBus.instance.cfg.NIGHT_VIS_STARTUP; } private IEnumerator BatteryRecovery() { yield return (object)new WaitForSeconds(UpgradeBus.instance.cfg.NIGHT_VIS_EXHAUST); batteryExhaustion = false; } public override void Increment() { UpgradeBus.instance.nightVisionLevel++; LGUStore.instance.UpdateLGUSaveServerRpc(GameNetworkManager.Instance.localPlayerController.playerSteamId, JsonConvert.SerializeObject((object)new SaveInfo())); } public override void load() { EnableOnClient(save: false); } public override void Unwind() { base.Unwind(); UpgradeBus.instance.nightVision = false; UpgradeBus.instance.nightVisionLevel = 0; DisableOnClient(); } public void EnableOnClient(bool save = true) { if ((Object)(object)client == (Object)null) { client = GameNetworkManager.Instance.localPlayerController; } ((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(true); UpgradeBus.instance.nightVision = true; if (save) { LGUStore.instance.UpdateLGUSaveServerRpc(client.playerSteamId, JsonConvert.SerializeObject((object)new SaveInfo())); } TextMeshProUGUI chatText = HUDManager.Instance.chatText; ((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Press " + UpgradeBus.instance.cfg.TOGGLE_NIGHT_VISION_KEY + " to toggle Night Vision!!!</color>"; } public void DisableOnClient() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) UpgradeBus.instance.nightVisionActive = false; client.nightVision.color = UpgradeBus.instance.nightVisColor; client.nightVision.range = UpgradeBus.instance.nightVisRange; client.nightVision.intensity = UpgradeBus.instance.nightVisIntensity; ((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false); UpgradeBus.instance.nightVision = false; LGUStore.instance.UpdateLGUSaveServerRpc(client.playerSteamId, JsonConvert.SerializeObject((object)new SaveInfo())); client = null; } public static string GetNightVisionInfo(int level, int price) { if (level == 1) { float num = (UpgradeBus.instance.cfg.NIGHT_BATTERY_MAX - UpgradeBus.instance.cfg.NIGHT_BATTERY_MAX * UpgradeBus.instance.cfg.NIGHT_VIS_STARTUP) / UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_SPEED; float num2 = UpgradeBus.instance.cfg.NIGHT_BATTERY_MAX / UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_SPEED; return string.Format(AssetBundleHandler.GetInfoFromJSON(UPGRADE_NAME), level, price, num, num2); } float num3 = Mathf.Clamp(UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_SPEED + UpgradeBus.instance.cfg.NIGHT_VIS_REGEN_INCREMENT * (float)(level - 1), 0f, 1000f); float num4 = Mathf.Clamp(UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_SPEED - UpgradeBus.instance.cfg.NIGHT_VIS_DRAIN_INCREMENT * (float)(level - 1), 0f, 1000f); float num5 = UpgradeBus.instance.cfg.NIGHT_BATTERY_MAX + UpgradeBus.instance.cfg.NIGHT_VIS_BATTERY_INCREMENT * (float)(level - 1); string text = "infinite"; if (num4 != 0f) { text = ((num5 - num5 * UpgradeBus.instance.cfg.NIGHT_VIS_STARTUP) / num4).ToString("F2"); } string text2 = "infinite"; if (num3 != 0f) { text2 = (num5 / num3).ToString("F2"); } return string.Format(AssetBundleHandler.GetInfoFromJSON(UPGRADE_NAME), level, price, text, text2); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "nightVisionScript"; } } internal class playerHealthScript : BaseUpgrade { public static string UPGRADE_NAME = "Stimpack"; private static bool active; private int previousLevel; private static LGULogger logger; public static string ENABLED_SECTION = "Enable " + UPGRADE_NAME + " Upgrade"; public static bool ENABLED_DEFAULT = true; public static string ENABLED_DESCRIPTION = "Increases player's health."; public static string PRICE_SECTION = UPGRADE_NAME + " Price"; public static int PRICE_DEFAULT = 600; public static string PRICES_DEFAULT = "300, 450, 600"; public static string ADDITIONAL_HEALTH_UNLOCK_SECTION = "Initial health boost"; public static int ADDITIONAL_HEALTH_UNLOCK_DEFAULT = 20; public static string ADDITIONAL_HEALTH_UNLOCK_DESCRIPTION = "Amount of health gained when unlocking the upgrade"; public static string ADDITIONAL_HEALTH_INCREMENT_SECTION = "Additional health boost"; public static int ADDITIONAL_HEALTH_INCREMENT_DEFAULT = 20; public static string ADDITIONAL_HEALTH_INCREMENT_DESCRIPTION = "Every time " + UPGRADE_NAME + " is upgraded this value will be added to the value above."; private void Start() { upgradeName = UPGRADE_NAME; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); UpgradeBus.instance.UpgradeObjects.Add(UPGRADE_NAME, ((Component)this).gameObject); logger = new LGULogger(UPGRADE_NAME); } public override void Increment() { PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer(); localPlayer.health += UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT; logger.LogDebug($"Adding {UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT} to the player's health..."); UpgradeBus.instance.playerHealthLevel++; previousLevel++; LGUStore.instance.PlayerHealthUpdateLevelServerRpc(localPlayer.playerSteamId, UpgradeBus.instance.playerHealthLevel); } public override void load() { PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer(); if (!active) { logger.LogDebug($"Adding {UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK} to the player's health on unlock..."); localPlayer.health += UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK; } base.load(); UpgradeBus.instance.playerHealth = true; active = true; int num = 0; for (int i = 1; i < UpgradeBus.instance.playerHealthLevel + 1; i++) { if (i > previousLevel) { logger.LogDebug($"Adding {UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT} to the player's health on increment..."); num += UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT; } } localPlayer.health += num; previousLevel = UpgradeBus.instance.playerHealthLevel; LGUStore.instance.PlayerHealthUpdateLevelServerRpc(localPlayer.playerSteamId, UpgradeBus.instance.playerHealthLevel); } public override void Register() { base.Register(); } public override void Unwind() { PlayerControllerB player = UpgradeBus.instance.GetLocalPlayer(); if (active) { ResetStimpackBuff(ref player); } base.Unwind(); UpgradeBus.instance.playerHealthLevel = 0; UpgradeBus.instance.playerHealth = false; previousLevel = 0; active = false; LGUStore.instance.PlayerHealthUpdateLevelServerRpc(player.playerSteamId, -1); } public static int CheckForAdditionalHealth(int health) { PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer(); if (!UpgradeBus.instance.playerHealthLevels.ContainsKey(localPlayer.playerSteamId)) { return health; } int num = UpgradeBus.instance.playerHealthLevels[localPlayer.playerSteamId]; return health + UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK + num * UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT; } public static int GetHealthFromPlayer(int health, ulong steamId) { int num = UpgradeBus.instance.playerHealthLevels[steamId]; return health + UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK + num * UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT; } public static void ResetStimpackBuff(ref PlayerControllerB player) { int num = UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_UNLOCK; for (int i = 0; i < UpgradeBus.instance.playerHealthLevel; i++) { num += UpgradeBus.instance.cfg.PLAYER_HEALTH_ADDITIONAL_HEALTH_INCREMENT; } logger.LogDebug($"Removing {player.playerUsername}'s health boost ({player.health}) with a boost of {num}"); PlayerControllerB obj = player; obj.health -= num; logger.LogDebug("Upgrade reset on " + player.playerUsername); active = false; } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "playerHealthScript"; } } internal class proteinPowderScript : BaseUpgrade { public static string UPGRADE_NAME = "Protein Powder"; private static int CRIT_DAMAGE_VALUE = 100; public static string ENABLED_SECTION = "Enable " + UPGRADE_NAME + " Upgrade"; public static bool ENABLED_DEFAULT = true; public static string ENABLED_DESCRIPTION = "Do more damage with shovels"; public static string PRICE_SECTION = "Price of " + UPGRADE_NAME + " Upgrade"; public static int PRICE_DEFAULT = 1000; public static string UNLOCK_FORCE_SECTION = "Initial additional hit force"; public static int UNLOCK_FORCE_DEFAULT = 1; public static string UNLOCK_FORCE_DESCRIPTION = "The value added to hit force on initial unlock."; public static string INCREMENT_FORCE_SECTION = "Additional hit force per level"; public static int INCREMENT_FORCE_DEFAULT = 1; public static string INCREMENT_FORCE_DESCRIPTION = "Every time " + UPGRADE_NAME + " is upgraded this value will be added to the value above."; public static string PRICES_DEFAULT = "700"; public static string CRIT_CHANCE_SECTION = "Chance of dealing a crit which will instakill the enemy."; public static float CRIT_CHANCE_DEFAULT = 0.01f; public static string CRIT_CHANCE_DESCRIPTION = "This value is only valid when maxed out " + UPGRADE_NAME + ". Any previous levels will not apply crit."; private void Start() { upgradeName = UPGRADE_NAME; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } public override void Increment() { UpgradeBus.instance.proteinLevel++; } public override void load() { base.load(); UpgradeBus.instance.proteinPowder = true; } public override void Register() { base.Register(); } public override void Unwind() { base.Unwind(); UpgradeBus.instance.proteinLevel = 0; UpgradeBus.instance.proteinPowder = false; } public static int GetShovelHitForce(int force) { return ((!UpgradeBus.instance.proteinPowder) ? force : (TryToCritEnemy() ? CRIT_DAMAGE_VALUE : (UpgradeBus.instance.cfg.PROTEIN_INCREMENT * UpgradeBus.instance.proteinLevel + UpgradeBus.instance.cfg.PROTEIN_UNLOCK_FORCE + force))) + UpgradeBus.instance.damageBoost; } private static bool TryToCritEnemy() { int num = UpgradeBus.instance.cfg.PROTEIN_UPGRADE_PRICES.Split(',').Length; int proteinLevel = UpgradeBus.instance.proteinLevel; if (proteinLevel != num) { return false; } return Random.value < UpgradeBus.instance.cfg.PROTEIN_CRIT_CHANCE; } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "proteinPowderScript"; } } internal class runningShoeScript : BaseUpgrade { public static string UPGRADE_NAME = "Running Shoes"; private static LGULogger logger; public static string PRICES_DEFAULT = "500,750,1000"; private int currentLevel = 0; private static bool active = false; private void Start() { upgradeName = UPGRADE_NAME; logger = new LGULogger(UPGRADE_NAME); Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } public override void Increment() { PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer(); localPlayer.movementSpeed += UpgradeBus.instance.cfg.MOVEMENT_INCREMENT; logger.LogDebug($"Adding {UpgradeBus.instance.cfg.MOVEMENT_INCREMENT} to the player's movement speed..."); UpgradeBus.instance.runningLevel++; currentLevel++; } public override void Unwind() { base.Unwind(); PlayerControllerB player = UpgradeBus.instance.GetLocalPlayer(); if (UpgradeBus.instance.runningShoes) { ResetRunningShoesBuff(ref player); } UpgradeBus.instance.runningShoes = false; UpgradeBus.instance.runningLevel = 0; active = false; currentLevel = 0; } public override void Register() { base.Register(); } public override void load() { base.load(); UpgradeBus.instance.runningShoes = true; PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer(); if (!active) { logger.LogDebug($"Adding {UpgradeBus.instance.cfg.MOVEMENT_SPEED_UNLOCK} to the player's movement speed..."); localPlayer.movementSpeed += UpgradeBus.instance.cfg.MOVEMENT_SPEED_UNLOCK; } float num = 0f; for (int i = 1; i < UpgradeBus.instance.runningLevel + 1; i++) { if (i > currentLevel) { logger.LogDebug($"Adding {UpgradeBus.instance.cfg.MOVEMENT_INCREMENT} to the player's movement speed..."); num += UpgradeBus.instance.cfg.MOVEMENT_INCREMENT; } } logger.LogDebug($"Adding player's movement speed ({localPlayer.movementSpeed}) with {num}"); localPlayer.movementSpeed += num; active = true; currentLevel = UpgradeBus.instance.runningLevel; } public static void ResetRunningShoesBuff(ref PlayerControllerB player) { float num = UpgradeBus.instance.cfg.MOVEMENT_SPEED_UNLOCK; for (int i = 0; i < UpgradeBus.instance.runningLevel; i++) { num += UpgradeBus.instance.cfg.MOVEMENT_INCREMENT; } logger.LogDebug($"Removing {player.playerUsername}'s movement speed boost ({player.movementSpeed}) with a boost of {num}"); PlayerControllerB obj = player; obj.movementSpeed -= num; logger.LogDebug("Upgrade reset on " + player.playerUsername); active = false; } public static float ApplyPossibleReducedNoiseRange(float defaultValue) { if (!UpgradeBus.instance.runningShoes || UpgradeBus.instance.runningLevel != UpgradeBus.instance.cfg.RUNNING_SHOES_UPGRADE_PRICES.Split(',').Length) { return defaultValue; } return Mathf.Clamp(defaultValue - UpgradeBus.instance.cfg.NOISE_REDUCTION, 0f, defaultValue); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "runningShoeScript"; } } internal class strongerScannerScript : BaseUpgrade { public static string UPGRADE_NAME = "Better Scanner"; private static LGULogger logger; private void Awake() { logger = new LGULogger(UPGRADE_NAME); } private void Start() { upgradeName = UPGRADE_NAME; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } public override void Increment() { UpgradeBus.instance.scanLevel++; } public override void load() { base.load(); UpgradeBus.instance.scannerUpgrade = true; } public override void Unwind() { base.Unwind(); UpgradeBus.instance.scannerUpgrade = false; UpgradeBus.instance.scanLevel = 0; } public override void Register() { base.Register(); } public static void AddScannerNodeToValve(ref SteamValveHazard steamValveHazard) { //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_003f: Unknown result type (might be due to invalid IL or missing references) if (UpgradeBus.instance.scannerUpgrade) { logger.LogDebug("Inserting a Scan Node on a broken steam valve..."); GameObject val = Object.Instantiate<GameObject>(GameObject.Find("ScanNode"), ((Component)steamValveHazard).transform.position, Quaternion.Euler(Vector3.zero), ((Component)steamValveHazard).transform); ScanNodeProperties component = val.GetComponent<ScanNodeProperties>(); component.headerText = "Bursted Steam Valve"; component.subText = "Fix it to get rid of the steam"; component.nodeType = 0; component.creatureScanID = -1; } } public static void RemoveScannerNodeFromValve(ref SteamValveHazard steamValveHazard) { logger.LogDebug("Removing the Scan Node from a fixed steam valve..."); Object.Destroy((Object)(object)((Component)steamValveHazard).gameObject.GetComponentInChildren<ScanNodeProperties>()); } public static string GetBetterScannerInfo(int level, int price) { switch (level) { case 1: return string.Format(AssetBundleHandler.GetInfoFromJSON("Better Scanner1"), level, price, UpgradeBus.instance.cfg.NODE_DISTANCE_INCREASE, UpgradeBus.instance.cfg.SHIP_AND_ENTRANCE_DISTANCE_INCREASE); case 2: return string.Format(AssetBundleHandler.GetInfoFromJSON("Better Scanner2"), level, price); case 3: { string text = string.Format(AssetBundleHandler.GetInfoFromJSON("Better Scanner3"), level, price, UpgradeBus.instance.cfg.BETTER_SCANNER_ENEMIES ? " and enemies" : ""); return text + "hives and scrap command display the location of the most valuable hives and scrap on the map.\n"; } default: return ""; } } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "strongerScannerScript"; } } internal class strongLegsScript : BaseUpgrade { public static string UPGRADE_NAME = "Strong Legs"; private static LGULogger logger; public static string PRICES_DEFAULT = "150,190,250"; private int currentLevel = 0; private static bool active = false; private void Start() { upgradeName = UPGRADE_NAME; logger = new LGULogger(UPGRADE_NAME); Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } public override void Increment() { PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer(); localPlayer.jumpForce += UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT; UpgradeBus.instance.legLevel++; currentLevel++; } public override void Unwind() { base.Unwind(); PlayerControllerB player = UpgradeBus.instance.GetLocalPlayer(); logger.LogDebug($"Adding {UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT} to the player's jump force..."); if (UpgradeBus.instance.strongLegs) { ResetStrongLegsBuff(ref player); } UpgradeBus.instance.strongLegs = false; UpgradeBus.instance.legLevel = 0; active = false; currentLevel = 0; } public override void Register() { base.Register(); } public override void load() { base.load(); UpgradeBus.instance.strongLegs = true; PlayerControllerB localPlayer = UpgradeBus.instance.GetLocalPlayer(); if (!active) { logger.LogDebug($"Adding {UpgradeBus.instance.cfg.JUMP_FORCE_UNLOCK} to the player's jump force..."); localPlayer.jumpForce += UpgradeBus.instance.cfg.JUMP_FORCE_UNLOCK; } float num = 0f; for (int i = 1; i < UpgradeBus.instance.legLevel + 1; i++) { if (i > currentLevel) { logger.LogDebug($"Adding {UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT} to the player's jump force..."); num += UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT; } } localPlayer.jumpForce += num; active = true; currentLevel = UpgradeBus.instance.legLevel; } public static void ResetStrongLegsBuff(ref PlayerControllerB player) { float num = UpgradeBus.instance.cfg.JUMP_FORCE_UNLOCK; for (int i = 0; i < UpgradeBus.instance.legLevel; i++) { num += UpgradeBus.instance.cfg.JUMP_FORCE_INCREMENT; } logger.LogDebug($"Removing {player.playerUsername}'s jump force boost ({player.jumpForce}) with a boost of {num}"); PlayerControllerB obj = player; obj.jumpForce -= num; logger.LogDebug("Upgrade reset on " + player.playerUsername); active = false; } public static int ReduceFallDamage(int defaultValue) { if (!UpgradeBus.instance.strongLegs || UpgradeBus.instance.legLevel != UpgradeBus.instance.cfg.STRONG_LEGS_UPGRADE_PRICES.Split(',').Length) { return defaultValue; } return (int)((float)defaultValue * (1f - UpgradeBus.instance.cfg.STRONG_LEGS_REDUCE_FALL_DAMAGE_MULTIPLIER)); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "strongLegsScript"; } } public class terminalFlashScript : BaseUpgrade { public static string UPGRADE_NAME = "Discombobulator"; public static string PRICES_DEFAULT = "330,460,620"; private static LGULogger logger = new LGULogger("terminalFlashScript"); private void Start() { upgradeName = UPGRADE_NAME; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } private void Update() { if (UpgradeBus.instance.flashCooldown > 0f) { UpgradeBus.instance.flashCooldown -= Time.deltaTime; } } public override void load() { UpgradeBus.instance.terminalFlash = true; UpgradeBus.instance.flashScript = this; TextMeshProUGUI chatText = HUDManager.Instance.chatText; ((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=#FF0000>Discombobulator is active!\nType 'cooldown' into the terminal for info!!!</color>"; } public override void Register() { base.Register(); } public override void Increment() { UpgradeBus.instance.discoLevel++; } public override void Unwind() { base.Unwind(); UpgradeBus.instance.terminalFlash = false; UpgradeBus.instance.discoLevel = 0; } [ServerRpc(RequireOwnership = false)] public void PlayAudioAndUpdateCooldownServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(418065963u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 418065963u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayAudioAndUpdateCooldownClientRpc(); } } } [ClientRpc] private void PlayAudioAndUpdateCooldownClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(524331225u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 524331225u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } Terminal terminal = UpgradeBus.instance.GetTerminal(); terminal.terminalAudio.maxDistance = 100f; terminal.terminalAudio.PlayOneShot(UpgradeBus.instance.flashNoise); ((MonoBehaviour)this).StartCoroutine(ResetRange(terminal)); UpgradeBus.instance.flashCooldown = UpgradeBus.instance.cfg.DISCOMBOBULATOR_COOLDOWN; Collider[] array = Physics.OverlapSphere(((Component)terminal).transform.position, UpgradeBus.instance.cfg.DISCOMBOBULATOR_RADIUS, 524288); if (array.Length == 0) { return; } for (int i = 0; i < array.Length; i++) { EnemyAICollisionDetect component = ((Component)array[i]).GetComponent<EnemyAICollisionDetect>(); if (!((Object)(object)component == (Object)null)) { EnemyAI mainScript = component.mainScript; if (CanDealDamage()) { int num = UpgradeBus.instance.cfg.DISCOMBOBULATOR_INITIAL_DAMAGE + UpgradeBus.instance.cfg.DISCOMBOBULATOR_DAMAGE_INCREASE * (UpgradeBus.instance.discoLevel - UpgradeBus.instance.cfg.DISCOMBOBULATOR_DAMAGE_LEVEL); mainScript.HitEnemy(num, (PlayerControllerB)null, false); } if (!mainScript.isEnemyDead) { mainScript.SetEnemyStunned(true, UpgradeBus.instance.cfg.DISCOMBOBULATOR_STUN_DURATION + UpgradeBus.instance.cfg.DISCOMBOBULATOR_INCREMENT * (float)UpgradeBus.instance.discoLevel, (PlayerControllerB)null); } } } } private bool CanDealDamage() { return UpgradeBus.instance.cfg.DISCOMBOBULATOR_DAMAGE_LEVEL > 0 && UpgradeBus.instance.discoLevel + 1 >= UpgradeBus.instance.cfg.DISCOMBOBULATOR_DAMAGE_LEVEL; } private IEnumerator ResetRange(Terminal terminal) { yield return (object)new WaitForSeconds(2f); terminal.terminalAudio.maxDistance = 17f; } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_terminalFlashScript() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(418065963u, new RpcReceiveHandler(__rpc_handler_418065963)); NetworkManager.__rpc_func_table.Add(524331225u, new RpcReceiveHandler(__rpc_handler_524331225)); } private static void __rpc_handler_418065963(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((terminalFlashScript)(object)target).PlayAudioAndUpdateCooldownServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_524331225(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((terminalFlashScript)(object)target).PlayAudioAndUpdateCooldownClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "terminalFlashScript"; } } } namespace MoreShipUpgrades.UpgradeComponents.OneTimeUpgrades { public class BeatScript : BaseUpgrade { public static string UPGRADE_NAME = "Sick Beats"; private static LGULogger logger = new LGULogger(UPGRADE_NAME); private void Start() { upgradeName = UPGRADE_NAME; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); UpgradeBus.instance.BoomboxIcon = ((Component)((Component)this).transform.GetChild(0).GetChild(0)).gameObject; } public override void load() { base.load(); UpgradeBus.instance.sickBeats = true; } public override void Register() { base.Register(); } public override void Unwind() { base.Unwind(); UpgradeBus.instance.sickBeats = false; } public static void HandlePlayerEffects(PlayerControllerB player) { UpgradeBus.instance.BoomboxIcon.SetActive(UpgradeBus.instance.EffectsActive); if (UpgradeBus.instance.EffectsActive) { logger.LogDebug("Applying effects!"); logger.LogDebug($"Updating player's movement speed ({player.movementSpeed})"); if (UpgradeBus.instance.cfg.BEATS_SPEED) { player.movementSpeed += UpgradeBus.instance.cfg.BEATS_SPEED_INC; } logger.LogDebug($"Updated player's movement speed ({player.movementSpeed})"); if (UpgradeBus.instance.cfg.BEATS_STAMINA) { UpgradeBus.instance.staminaDrainCoefficient = UpgradeBus.instance.cfg.BEATS_STAMINA_CO; } if (UpgradeBus.instance.cfg.BEATS_DEF) { UpgradeBus.instance.incomingDamageCoefficient = UpgradeBus.instance.cfg.BEATS_DEF_CO; } if (UpgradeBus.instance.cfg.BEATS_DMG) { UpgradeBus.instance.damageBoost = UpgradeBus.instance.cfg.BEATS_DMG_INC; } } else { logger.LogDebug("Removing effects!"); logger.LogDebug($"Updating player's movement speed ({player.movementSpeed})"); if (UpgradeBus.instance.cfg.BEATS_SPEED) { player.movementSpeed -= UpgradeBus.instance.cfg.BEATS_SPEED_INC; } logger.LogDebug($"Updated player's movement speed ({player.movementSpeed})"); UpgradeBus.instance.staminaDrainCoefficient = 1f; UpgradeBus.instance.incomingDamageCoefficient = 1f; UpgradeBus.instance.damageBoost = 0; } } public static int CalculateDefense(int dmg) { if (!UpgradeBus.instance.sickBeats || dmg < 0) { return dmg; } return (int)((float)dmg * UpgradeBus.instance.incomingDamageCoefficient); } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "BeatScript"; } } internal class lightningRodScript : BaseUpgrade { public static string UPGRADE_NAME = "Lightning Rod"; public static lightningRodScript instance; private static LGULogger logger; public static string ENABLED_SECTION = "Enable " + UPGRADE_NAME + " Upgrade"; public static bool ENABLED_DEFAULT = true; public static string ENABLED_DESCRIPTION = "A device which redirects lightning bolts to the ship."; public static string PRICE_SECTION = UPGRADE_NAME + " Price"; public static int PRICE_DEFAULT = 1000; public static string ACTIVE_SECTION = "Active on Purchase"; public static bool ACTIVE_DEFAULT = true; public static string ACTIVE_DESCRIPTION = "If true: " + UPGRADE_NAME + " will be active on purchase."; private static string LOAD_COLOUR = "#FF0000"; private static string LOAD_MESSAGE = "\n<color=" + LOAD_COLOUR + ">" + UPGRADE_NAME + " is active!</color>"; private static string UNLOAD_COLOUR = LOAD_COLOUR; private static string UNLOAD_MESSAGE = "\n<color=" + UNLOAD_COLOUR + ">" + UPGRADE_NAME + " has been disabled</color>"; public static string ACCESS_DENIED_MESSAGE = "You don't have access to this command yet. Purchase the '" + UPGRADE_NAME + "'.\n"; public static string TOGGLE_ON_MESSAGE = UPGRADE_NAME + " has been enabled. Lightning bolts will now be redirected to the ship.\n"; public static string TOGGLE_OFF_MESSAGE = UPGRADE_NAME + " has been disabled. Lightning bolts will no longer be redirected to the ship.\n"; public static string DIST_SECTION = "Effective Distance of " + UPGRADE_NAME + "."; public static float DIST_DEFAULT = 175f; public static string DIST_DESCRIPTION = "The closer you are the more likely the rod will reroute lightning."; public bool CanTryInterceptLightning { get; internal set; } public bool LightningIntercepted { get; internal set; } private void Awake() { instance = this; logger = new LGULogger(UPGRADE_NAME); } private void Start() { Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); UpgradeBus.instance.UpgradeObjects.Add(UPGRADE_NAME, ((Component)this).gameObject); } public override void Increment() { } public override void load() { UpgradeBus.instance.lightningRod = true; UpgradeBus.instance.lightningRodActive = UpgradeBus.instance.cfg.LIGHTNING_ROD_ACTIVE; TextMeshProUGUI chatText = HUDManager.Instance.chatText; ((TMP_Text)chatText).text = ((TMP_Text)chatText).text + LOAD_MESSAGE; } public override void Register() { if (!UpgradeBus.instance.UpgradeObjects.ContainsKey(UPGRADE_NAME)) { UpgradeBus.instance.UpgradeObjects.Add(UPGRADE_NAME, ((Component)this).gameObject); } } public override void Unwind() { UpgradeBus.instance.lightningRod = false; UpgradeBus.instance.lightningRodActive = false; TextMeshProUGUI chatText = HUDManager.Instance.chatText; ((TMP_Text)chatText).text = ((TMP_Text)chatText).text + UNLOAD_MESSAGE; } public static void TryInterceptLightning(ref StormyWeather __instance, ref GrabbableObject ___targetingMetalObject) { //IL_0037: 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) if (!instance.CanTryInterceptLightning) { return; } instance.CanTryInterceptLightning = false; Terminal terminal = UpgradeBus.instance.GetTerminal(); float num = Vector3.Distance(((Component)___targetingMetalObject).transform.position, ((Component)terminal).transform.position); logger.LogDebug($"Distance from ship: {num}"); logger.LogDebug($"Effective distance of the lightning rod: {UpgradeBus.instance.cfg.LIGHTNING_ROD_DIST}"); if (!(num > UpgradeBus.instance.cfg.LIGHTNING_ROD_DIST)) { num /= UpgradeBus.instance.cfg.LIGHTNING_ROD_DIST; float num2 = 1f - num; float value = Random.value; logger.LogDebug($"Number to beat: {num2}"); logger.LogDebug($"Number: {value}"); if (value < num2) { logger.LogDebug("Planning interception..."); __instance.staticElectricityParticle.Stop(); instance.LightningIntercepted = true; LGUStore.instance.CoordinateInterceptionClientRpc(); } } } public static void RerouteLightningBolt(ref Vector3 strikePosition, ref StormyWeather __instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) logger.LogDebug("Intercepted Lightning Strike..."); Terminal terminal = UpgradeBus.instance.GetTerminal(); strikePosition = ((Component)terminal).transform.position; instance.LightningIntercepted = false; ((Component)__instance.staticElectricityParticle).gameObject.SetActive(true); } public static void ToggleLightningRod(ref TerminalNode __result) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown UpgradeBus.instance.lightningRodActive = !UpgradeBus.instance.lightningRodActive; TerminalNode val = new TerminalNode(); val.displayText = (UpgradeBus.instance.lightningRodActive ? TOGGLE_ON_MESSAGE : TOGGLE_OFF_MESSAGE); val.clearPreviousText = true; __result = val; } public static void AccessDeniedMessage(ref TerminalNode __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown TerminalNode val = new TerminalNode(); val.displayText = ACCESS_DENIED_MESSAGE; val.clearPreviousText = true; __result = val; } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "lightningRodScript"; } } public class lockSmithScript : BaseUpgrade { public static string UPGRADE_NAME = "Locksmith"; private GameObject pin1; private GameObject pin2; private GameObject pin3; private GameObject pin4; private GameObject pin5; private List<GameObject> pins; private List<int> order = new List<int> { 0, 1, 2, 3, 4 }; private int currentPin = 0; public DoorLock currentDoor = null; private bool canPick = false; public int timesStruck; private void Start() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown upgradeName = UPGRADE_NAME; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); Transform child = ((Component)this).transform.GetChild(0).GetChild(0).GetChild(0); pin1 = ((Component)child.GetChild(0)).gameObject; pin2 = ((Component)child.GetChild(1)).gameObject; pin3 = ((Component)child.GetChild(2)).gameObject; pin4 = ((Component)child.GetChild(3)).gameObject; pin5 = ((Component)child.GetChild(4)).gameObject; ((UnityEvent)((Component)pin1.transform.GetChild(0)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { StrikePin(0); }); ((UnityEvent)((Component)pin2.transform.GetChild(0)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { StrikePin(1); }); ((UnityEvent)((Component)pin3.transform.GetChild(0)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { StrikePin(2); }); ((UnityEvent)((Component)pin4.transform.GetChild(0)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { StrikePin(3); }); ((UnityEvent)((Component)pin5.transform.GetChild(0)).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { StrikePin(4); }); pins = new List<GameObject> { pin1, pin2, pin3, pin4, pin5 }; } public override void load() { base.load(); UpgradeBus.instance.lockSmith = true; UpgradeBus.instance.lockScript = this; } public override void Register() { base.Register(); } private void Update() { if (((ButtonControl)Keyboard.current[(Key)60]).wasPressedThisFrame && ((Component)((Component)this).transform.GetChild(0)).gameObject.activeInHierarchy) { ((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false); Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } } public void BeginLockPick() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) ((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(true); Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; canPick = false; currentPin = 0; for (int i = 0; i < pins.Count; i++) { float num = Random.Range(40f, 90f); pins[i].transform.localPosition = new Vector3(pins[i].transform.localPosition.x, num, pins[i].transform.localPosition.z); } RandomizeListOrder(order); ((MonoBehaviour)this).StartCoroutine(CommunicateOrder(order)); } public override void Unwind() { base.Unwind(); UpgradeBus.instance.lockSmith = false; } public void StrikePin(int i) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (!canPick) { return; } timesStruck++; if (i != order[currentPin]) { BeginLockPick(); RoundManager.Instance.PlayAudibleNoise(((Component)currentDoor).transform.position, 30f, 0.65f, timesStruck, false, 0); return; } currentPin++; pins[i].transform.localPosition = new Vector3(pins[i].transform.localPosition.x, 35f, pins[i].transform.localPosition.z); if (currentPin == 5) { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; ((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false); currentDoor.UnlockDoorSyncWithServer(); } RoundManager.Instance.PlayAudibleNoise(((Component)currentDoor).transform.position, 10f, 0.65f, timesStruck, false, 0); } private void RandomizeListOrder<T>(List<T> list) { int num = list.Count; Random random = new Random(); while (num > 1) { num--; int index = random.Next(num + 1); T value = list[index]; list[index] = list[num]; list[num] = value; } } private IEnumerator CommunicateOrder(List<int> lst) { yield return (object)new WaitForSeconds(0.75f); for (int i = 0; i < lst.Count; i++) { ((Graphic)pins[lst[i]].GetComponent<Image>()).color = Color.green; yield return (object)new WaitForSeconds(0.25f); ((Graphic)pins[lst[i]].GetComponent<Image>()).color = Color.white; } canPick = true; } protected override void __initializeVariables() { base.__initializeVariables(); } protected internal override string __getTypeName() { return "lockSmithScript"; } } public class pagerScript : BaseUpgrade { public static string UPGRADE_NAME = "Fast Encryption"; private static LGULogger logger; private void Start() { upgradeName = UPGRADE_NAME; logger = new LGULogger(upgradeName); Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Register(); } public override void load() { base.load(); UpgradeBus.instance.pager = true; UpgradeBus.instance.pageScript = this; } public override void Register() { base.Register(); } [ServerRpc(RequireOwnership = false)] public void ReqBroadcastChatServerRpc(string msg) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3873629904u, val, (RpcDelivery)0); bool flag = msg != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(msg, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3873629904u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { logger.LogInfo("Instructing clients to print broadcasted message..."); ReceiveChatClientRpc(msg); } } [ClientRpc] public void ReceiveChatClientRpc(string msg) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00
plugins/NeedyCats.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using Unity.Netcode.Samples; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("NeedyCats")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NeedyCats")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c7d3e258-85ed-4246-9766-b0915f7aec88")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] internal class <Module> { static <Module>() { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace NeedyCats { public class NeedyCatProp : PhysicsProp, INoiseListener { [Space(3f)] public Animator animator; public AudioSource audioSource; public SkinnedMeshRenderer skinnedMeshRenderer; [Space(3f)] public Vector2 IntervalMeow; public Vector2 IntervalMove; public Vector2 IntervalSitAnimChange; public Vector2 IntervalIdleAnimChange; public float WalkingSpeed = 1f; public float RunningSpeed = 8f; private (int, float)[] placeableMeowInterval; [HideInInspector] public (string, int)[] CatNames; private float timeBeforeNextMove = 1f; private float timeBeforeNextMeow = 1f; private float timeBeforeNextSitAnim = 1f; private int sitAnimationsLength = 3; private float timeBeforeNextIdleAnim = 1f; private int idleAnimationsLength = 4; private bool isSitting; private int materialIndex; private int nameIndex; private bool hasLoadedSave; private HoarderBugItem hoarderBugItem; [Space(3f)] public AudioClip[] noiseSFX; public AudioClip[] fleeSFX; public AudioClip[] calmSFX; [Space(3f)] public float noiseRange = 65f; public float maxLoudness = 1f; public float minLoudness = 0.95f; public float minPitch = 0.9f; public float maxPitch = 1f; private NavMeshAgent agent; private Random random; [Space(3f)] public Vector3 destination; private GameObject[] allAINodes; private NavMeshPath navmeshPath; private float velX; private float velY; private Vector3 previousPosition; private Vector3 agentLocalVelocity; private ClientNetworkTransform clientNetworkTransform; private bool isBeingHoarded { get { //IL_000e: 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) if (hoarderBugItem != null) { return Vector3.Distance(((Component)this).transform.position, hoarderBugItem.itemNestPosition) < 2f; } return false; } } public void Awake() { } public override void Start() { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown ((GrabbableObject)this).Start(); try { if ((Object)(object)agent == (Object)null) { agent = ((Component)this).GetComponent<NavMeshAgent>(); } if ((Object)(object)animator == (Object)null) { animator = ((Component)this).GetComponentInChildren<Animator>(); } if ((Object)(object)skinnedMeshRenderer == (Object)null) { skinnedMeshRenderer = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>(); } clientNetworkTransform = ((Component)this).GetComponent<ClientNetworkTransform>(); random = new Random(StartOfRound.Instance.randomMapSeed + 85); GameObject[] first = GameObject.FindGameObjectsWithTag("AINode"); GameObject[] second = GameObject.FindGameObjectsWithTag("OutsideAINode"); allAINodes = first.Concat(second).ToArray(); agent.updatePosition = false; destination = ((Component)this).transform.position; navmeshPath = new NavMeshPath(); ((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback += NetworkManager_OnClientConnectedCallback; placeableMeowInterval = new(int, float)[3] { (22, 10f), (21, 2f), (4, 6f) }; } catch (Exception arg) { Debug.LogError((object)$"Error when initializing variables for {((Object)((Component)this).gameObject).name} : {arg}"); } if (((NetworkBehaviour)this).IsServer && !hasLoadedSave) { nameIndex = Random.Range(0, CatNames.Length); SetCatNameServerRpc(CatNames[nameIndex].Item1); if (CatNames[nameIndex].Item2 != -1) { materialIndex = CatNames[nameIndex].Item2; } else { materialIndex = Random.Range(0, ((GrabbableObject)this).itemProperties.materialVariants.Length); } SetCatMaterialServerRpc(materialIndex); } } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); ((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback -= NetworkManager_OnClientConnectedCallback; } private void NetworkManager_OnClientConnectedCallback(ulong obj) { if (((NetworkBehaviour)this).IsServer) { SetCatMaterialServerRpc(materialIndex); SetCatNameServerRpc(CatNames[nameIndex].Item1); if (isSitting) { MakeCatSitServerRpc(sit: true); } } } public override void LoadItemSaveData(int saveData) { ((MonoBehaviour)this).StartCoroutine(NetworkSafeLoadItemSaveData(saveData)); } private IEnumerator NetworkSafeLoadItemSaveData(int saveData) { yield return ((NetworkBehaviour)this).IsSpawned; if (((NetworkBehaviour)this).IsServer) { <>n__0(saveData); int catMaterialServerRpc = (saveData >> 16) & 0xFFFF; int num = saveData & 0xFFFF; if (num > CatNames.Length) { num = Random.Range(0, CatNames.Length); } SetCatNameServerRpc(CatNames[num].Item1); if (CatNames[num].Item2 != -1) { catMaterialServerRpc = CatNames[num].Item2; } SetCatMaterialServerRpc(catMaterialServerRpc); materialIndex = catMaterialServerRpc; nameIndex = num; hasLoadedSave = true; } } public override int GetItemDataToSave() { return (materialIndex << 16) | nameIndex; } private void SynchronizeAnimator(float maxSpeed = 4f) { //IL_0012: 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) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) agentLocalVelocity = ((Component)animator).transform.InverseTransformDirection(Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f) / (Time.deltaTime * 2f)); animator.SetBool("move", ((Vector3)(ref agentLocalVelocity)).magnitude > 0.05f); velX = Mathf.Lerp(velX, agentLocalVelocity.x, 10f * Time.deltaTime); animator.SetFloat("velx", Mathf.Clamp(velX, 0f - maxSpeed, maxSpeed)); velY = Mathf.Lerp(velY, agentLocalVelocity.z, 10f * Time.deltaTime); animator.SetFloat("vely", Mathf.Clamp(velY, 0f - maxSpeed, maxSpeed)); previousPosition = ((Component)this).transform.position; } public override void GrabItem() { animator.SetBool("move", false); animator.SetFloat("velx", 0f); animator.SetFloat("vely", 0f); animator.SetBool("held", true); isSitting = false; ((GrabbableObject)this).GrabItem(); if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.DisplayTip("Cat Facts", "Too noisy? Give your cat a pet to quiet it down for a bit!", false, true, "LC_NeedyCatsTip"); } } public override void DiscardItem() { animator.SetBool("held", false); ((GrabbableObject)this).DiscardItem(); } public override void GrabItemFromEnemy(EnemyAI enemy) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown ((GrabbableObject)this).isHeldByEnemy = true; animator.SetBool("move", false); animator.SetFloat("velx", 0f); animator.SetFloat("vely", 0f); animator.SetBool("held", true); ((GrabbableObject)this).GrabItemFromEnemy(enemy); if (((NetworkBehaviour)this).IsServer && enemy is HoarderBugAI) { HoarderBugAI val = (HoarderBugAI)enemy; hoarderBugItem = (((Object)(object)val.heldItem.itemGrabbableObject == (Object)(object)this) ? val.heldItem : null); } } public override void DiscardItemFromEnemy() { ((GrabbableObject)this).isHeldByEnemy = false; animator.SetBool("held", false); ((GrabbableObject)this).DiscardItemFromEnemy(); } public override void Update() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)clientNetworkTransform).enabled = !((GrabbableObject)this).isHeld && !((GrabbableObject)this).isHeldByEnemy; if (((NetworkBehaviour)this).IsServer && !((GrabbableObject)this).isHeld && !((GrabbableObject)this).isHeldByEnemy && !((NetworkBehaviour)this).IsOwner) { ((Component)this).GetComponent<NetworkObject>().RemoveOwnership(); } if (!((GrabbableObject)this).isInElevator && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { ((Behaviour)agent).enabled = !((GrabbableObject)this).isHeld && !((GrabbableObject)this).isHeldByEnemy && ((GrabbableObject)this).reachedFloorTarget && !(((GrabbableObject)this).fallTime < 1f); if (((GrabbableObject)this).fallTime >= 1f && !((GrabbableObject)this).reachedFloorTarget) { ((GrabbableObject)this).targetFloorPosition = ((Component)this).transform.position; destination = ((Component)this).transform.position; previousPosition = ((Component)this).transform.position; ((Behaviour)agent).enabled = true; } } if (((GrabbableObject)this).fallTime >= 1f && !((GrabbableObject)this).reachedFloorTarget && animator.GetBool("held")) { animator.SetBool("held", false); } if (((GrabbableObject)this).isHeld || ((GrabbableObject)this).isHeldByEnemy || !((GrabbableObject)this).reachedFloorTarget || ((GrabbableObject)this).fallTime < 1f || ((GrabbableObject)this).isInElevator) { ((GrabbableObject)this).Update(); } if (((NetworkBehaviour)this).IsServer && !((GrabbableObject)this).isHeld && !((GrabbableObject)this).isHeldByEnemy && (((GrabbableObject)this).isInElevator || isBeingHoarded) && !isSitting) { MakeCatSitServerRpc(sit: true); } else if (((NetworkBehaviour)this).IsServer && !((GrabbableObject)this).isHeld && !((GrabbableObject)this).isHeldByEnemy && !((GrabbableObject)this).isInElevator && !isBeingHoarded && isSitting && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { MakeCatSitServerRpc(sit: false); } if (((NetworkBehaviour)this).IsServer) { if (isSitting) { if (timeBeforeNextSitAnim <= 0f) { SetCatSitAnimationServerRpc(Random.Range(0, sitAnimationsLength)); timeBeforeNextSitAnim = Random.Range(IntervalSitAnimChange.x, IntervalSitAnimChange.y); } timeBeforeNextSitAnim -= Time.deltaTime; } else { if (timeBeforeNextIdleAnim <= 0f) { SetCatIdleAnimationServerRpc(Random.Range(0, idleAnimationsLength)); timeBeforeNextIdleAnim = Random.Range(IntervalIdleAnimChange.x, IntervalIdleAnimChange.y); } timeBeforeNextIdleAnim -= Time.deltaTime; } if (timeBeforeNextMeow <= 0f) { MakeCatMeowServerRpc(); float num = 0f; if (((GrabbableObject)this).isInElevator) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isInElevator) { num += 2f; break; } } (int, float)[] array = placeableMeowInterval; for (int j = 0; j < array.Length; j++) { (int, float) tuple = array[j]; if (StartOfRound.Instance.SpawnedShipUnlockables.ContainsKey(tuple.Item1)) { num += tuple.Item2; } } } timeBeforeNextMeow = Random.Range(IntervalMeow.x + num, IntervalMeow.y + num); } timeBeforeNextMeow -= Time.deltaTime; if (!((GrabbableObject)this).isHeld && !((GrabbableObject)this).isHeldByEnemy && !((GrabbableObject)this).isInElevator && !isBeingHoarded && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { if (timeBeforeNextMove <= 0f) { SetRandomDestination(); timeBeforeNextMove = Random.Range(IntervalMove.x, IntervalMove.y); } timeBeforeNextMove -= Time.deltaTime; ((Component)this).transform.position = agent.nextPosition; } } if (!((GrabbableObject)this).isHeld && !((GrabbableObject)this).isHeldByEnemy) { SynchronizeAnimator(); } } public void SetDestinationToPosition(Vector3 position, bool checkForPath = false) { //IL_00c4: 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_00d5: 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_00e6: 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_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) //IL_0021: 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_002e: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) if (checkForPath) { position = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 1.75f, -1); navmeshPath = new NavMeshPath(); if (!agent.CalculatePath(position, navmeshPath)) { Debug.Log((object)(((Object)((Component)this).gameObject).name + " calculatepath returned false.")); return; } if (Vector3.Distance(navmeshPath.corners[navmeshPath.corners.Length - 1], RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 2.7f, -1)) > 1.55f) { Debug.Log((object)(((Object)((Component)this).gameObject).name + " path calculation went wrong.")); return; } } destination = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, -1f, -1); agent.SetDestination(destination); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (((NetworkBehaviour)this).IsOwner) { MakeCatCalmServerRpc(); } } public void SetRandomDestination() { //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_0015: 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_0032: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position + Random.insideUnitSphere * 5f; agent.speed = WalkingSpeed; SetDestinationToPosition(position); } private void PlayCatNoise(AudioClip[] array, bool audible = true) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) int num = random.Next(0, array.Length); float num2 = (float)random.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f; float pitch = (float)random.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f; audioSource.pitch = pitch; audioSource.PlayOneShot(array[num], num2); WalkieTalkie.TransmitOneShotAudio(audioSource, array[num], num2 - 0.4f); if (audible) { noiseRange = (((GrabbableObject)this).isInElevator ? (noiseRange - 2.5f) : noiseRange); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num2, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 8881); } } [ServerRpc(RequireOwnership = false)] public void MakeCatMeowServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3454429685u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3454429685u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { MakeCatMeowClientRpc(); } } } [ClientRpc] public void MakeCatMeowClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1946573138u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1946573138u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayCatNoise(noiseSFX); animator.SetTrigger("meow"); } } } [ServerRpc] public void MakeCatCalmServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2784153610u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2784153610u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } float num = 0f; if (((GrabbableObject)this).isInElevator) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val3 in allPlayerScripts) { if (val3.isInElevator) { num += 2f; break; } } (int, float)[] array = placeableMeowInterval; for (int j = 0; j < array.Length; j++) { (int, float) tuple = array[j]; if (StartOfRound.Instance.SpawnedShipUnlockables.ContainsKey(tuple.Item1)) { num += tuple.Item2; } } } timeBeforeNextMeow = Random.Range(IntervalMeow.x + num + 3f, IntervalMeow.y + num + 6f); MakeCatCalmClientRpc(); } [ClientRpc] public void MakeCatCalmClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2302897036u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2302897036u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((GrabbableObject)this).playerHeldBy.doingUpperBodyEmote = 1.16f; ((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetTrigger("PullGrenadePin2"); ((MonoBehaviour)this).StartCoroutine(PlayCatCalmNoiseDelayed()); } } } private IEnumerator PlayCatCalmNoiseDelayed() { yield return (object)new WaitForSeconds(0.5f); PlayCatNoise(calmSFX, audible: false); } [ServerRpc] public void MakeCatSitServerRpc(bool sit) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Invalid comparison between Unknown and I4 //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00dd: 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_0084: Invalid comparison between Unknown and I4 NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } return; } ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2411027775u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref sit, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2411027775u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { MakeCatSitClientRpc(sit); } } [ClientRpc] public void MakeCatSitClientRpc(bool sit) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3921800473u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref sit, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3921800473u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { animator.SetBool("sit", sit); isSitting = sit; } } } [ServerRpc(RequireOwnership = false)] public void SetCatMaterialServerRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2046492207u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2046492207u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetCatMaterialClientRpc(index); } } } [ClientRpc] public void SetCatMaterialClientRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3875721248u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3875721248u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (Object)(object)skinnedMeshRenderer != (Object)null) { ((Renderer)skinnedMeshRenderer).sharedMaterial = ((GrabbableObject)this).itemProperties.materialVariants[index]; } } } [ServerRpc(RequireOwnership = false)] public void SetCatNameServerRpc(string name) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3049925245u, val, (RpcDelivery)0); bool flag = name != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(name, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3049925245u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetCatNameClientRpc(name); } } [ClientRpc] public void SetCatNameClientRpc(string name) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1321450034u, val, (RpcDelivery)0); bool flag = name != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(name, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1321450034u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((Component)this).GetComponentInChildren<ScanNodeProperties>().headerText = "Cat (" + name + ")"; } } [ServerRpc(RequireOwnership = false)] public void SetCatIdleAnimationServerRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1770904636u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1770904636u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetCatIdleAnimationClientRpc(index); } } } [ClientRpc] public void SetCatIdleAnimationClientRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(283245169u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 283245169u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { animator.SetInteger("idleAnimation", index); } } } [ServerRpc(RequireOwnership = false)] public void SetCatSitAnimationServerRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1062797608u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1062797608u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetCatSitAnimationClientRpc(index); } } } [ClientRpc] public void SetCatSitAnimationClientRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4162097660u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4162097660u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { animator.SetInteger("sitAnimation", index); } } } public virtual void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (((GrabbableObject)this).isHeld || ((GrabbableObject)this).isHeldByEnemy || noiseID == 8881 || noiseID == 75 || ((GrabbableObject)this).isInShipRoom || !StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { return; } Vector3 val = noisePosition - ((Component)this).transform.position; if (!(((Vector3)(ref val)).magnitude < 5f) || !(noiseLoudness > 0.8f)) { return; } PlayCatNoise(fleeSFX); if (((NetworkBehaviour)this).IsServer) { Vector3 position = ((Component)this).transform.position - ((Vector3)(ref val)).normalized * 20f; GameObject[] array = allAINodes.OrderBy((GameObject x) => Vector3.Distance(position, x.transform.position)).ToArray(); SetDestinationToPosition(array[0].transform.position); agent.speed = RunningSpeed; timeBeforeNextMove = Random.Range(IntervalMove.x + 1f, IntervalMove.y + 2f); } } [CompilerGenerated] [DebuggerHidden] private void <>n__0(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_NeedyCatProp() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3454429685u, new RpcReceiveHandler(__rpc_handler_3454429685)); NetworkManager.__rpc_func_table.Add(1946573138u, new RpcReceiveHandler(__rpc_handler_1946573138)); NetworkManager.__rpc_func_table.Add(2784153610u, new RpcReceiveHandler(__rpc_handler_2784153610)); NetworkManager.__rpc_func_table.Add(2302897036u, new RpcReceiveHandler(__rpc_handler_2302897036)); NetworkManager.__rpc_func_table.Add(2411027775u, new RpcReceiveHandler(__rpc_handler_2411027775)); NetworkManager.__rpc_func_table.Add(3921800473u, new RpcReceiveHandler(__rpc_handler_3921800473)); NetworkManager.__rpc_func_table.Add(2046492207u, new RpcReceiveHandler(__rpc_handler_2046492207)); NetworkManager.__rpc_func_table.Add(3875721248u, new RpcReceiveHandler(__rpc_handler_3875721248)); NetworkManager.__rpc_func_table.Add(3049925245u, new RpcReceiveHandler(__rpc_handler_3049925245)); NetworkManager.__rpc_func_table.Add(1321450034u, new RpcReceiveHandler(__rpc_handler_1321450034)); NetworkManager.__rpc_func_table.Add(1770904636u, new RpcReceiveHandler(__rpc_handler_1770904636)); NetworkManager.__rpc_func_table.Add(283245169u, new RpcReceiveHandler(__rpc_handler_283245169)); NetworkManager.__rpc_func_table.Add(1062797608u, new RpcReceiveHandler(__rpc_handler_1062797608)); NetworkManager.__rpc_func_table.Add(4162097660u, new RpcReceiveHandler(__rpc_handler_4162097660)); } private static void __rpc_handler_3454429685(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((NeedyCatProp)(object)target).MakeCatMeowServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1946573138(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((NeedyCatProp)(object)target).MakeCatMeowClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2784153610(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { target.__rpc_exec_stage = (__RpcExecStage)1; ((NeedyCatProp)(object)target).MakeCatCalmServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2302897036(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((NeedyCatProp)(object)target).MakeCatCalmClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2411027775(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_00ab: 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_0055: Invalid comparison between Unknown and I4 NetworkManager networkManager = target.NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId) { if ((int)networkManager.LogLevel <= 1) { Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!"); } } else { bool sit = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sit, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NeedyCatProp)(object)target).MakeCatSitServerRpc(sit); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3921800473(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool sit = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sit, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((NeedyCatProp)(object)target).MakeCatSitClientRpc(sit); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2046492207(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int catMaterialServerRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref catMaterialServerRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((NeedyCatProp)(object)target).SetCatMaterialServerRpc(catMaterialServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3875721248(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int catMaterialClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref catMaterialClientRpc); target.__rpc_exec_stage = (__RpcExecStage)2; ((NeedyCatProp)(object)target).SetCatMaterialClientRpc(catMaterialClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3049925245(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string catNameServerRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref catNameServerRpc, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((NeedyCatProp)(object)target).SetCatNameServerRpc(catNameServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1321450034(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string catNameClientRpc = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref catNameClientRpc, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((NeedyCatProp)(object)target).SetCatNameClientRpc(catNameClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1770904636(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int catIdleAnimationServerRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref catIdleAnimationServerRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((NeedyCatProp)(object)target).SetCatIdleAnimationServerRpc(catIdleAnimationServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_283245169(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int catIdleAnimationClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref catIdleAnimationClientRpc); target.__rpc_exec_stage = (__RpcExecStage)2; ((NeedyCatProp)(object)target).SetCatIdleAnimationClientRpc(catIdleAnimationClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1062797608(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int catSitAnimationServerRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref catSitAnimationServerRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((NeedyCatProp)(object)target).SetCatSitAnimationServerRpc(catSitAnimationServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4162097660(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int catSitAnimationClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref catSitAnimationClientRpc); target.__rpc_exec_stage = (__RpcExecStage)2; ((NeedyCatProp)(object)target).SetCatSitAnimationClientRpc(catSitAnimationClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "NeedyCatProp"; } } public class NoiseListenerRedirect : MonoBehaviour, INoiseListener { private INoiseListener target; public void Awake() { target = ((Component)((Component)this).transform.parent).GetComponent<INoiseListener>(); } public void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) INoiseListener obj = target; if (obj != null) { obj.DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID); } } } [BepInPlugin("Jordo.NeedyCats", "Needy Cats", "1.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class NeedyCatsBase : BaseUnityPlugin { public static class Assets { public static string mainAssetBundleName = "needycats"; public static AssetBundle MainAssetBundle = null; private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0]; } public static void PopulateAssets() { if ((Object)(object)MainAssetBundle == (Object)null) { using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName)) { MainAssetBundle = AssetBundle.LoadFromStream(stream); } } } } private const string modGUID = "Jordo.NeedyCats"; private const string modName = "Needy Cats"; private const string modVersion = "1.1.1"; private readonly Harmony harmony = new Harmony("Jordo.NeedyCats"); public static NeedyCatsBase Instance; private static List<(string, int)> catNames = new List<(string, int)>(); private static ConfigEntry<int> spawnRate; private static ConfigEntry<string> catNamesConfig; internal static ManualLogSource mls; private string defaultCatNames = "One:Stripes,Bella,Tigger,Chloe,Shadow,Luna,Oreo,Oliver,Kitty,Lucy,Molly,Jasper,Smokey,Gizmo,Simba,Tiger,Charlie,Angel,Jack,Lily,Peanut,Toby,Baby,Loki,Midnight,Milo,Princess,Sophie,Harley,Max,Missy,Rocky,Zoe,CoCo,Misty,Nala,Oscar,Pepper,Sasha,Buddy,Pumpkin,Kiki,Mittens,Bailey,Callie,Lucky,Patches,Simon,Garfield:Orange,George,Maggie,Sammy,Sebastian,Boots,Cali,Felix,Lilly,Phoebe,Sassy,Tucker,Bandit,Dexter,Fiona,Jake,Precious,Romeo,Snickers,Socks,Daisy,Gracie,Lola,Sadie,Sox,Casper,Fluffy,Marley,Minnie,Sweetie,Ziggy,Belle,Blackie,Chester,Frankie,Ginger,Muffin,Murphy,Rusty,Scooter,Batman,Boo,Cleo,Izzy,Jasmine,Mimi,Sugar,Cupcake,Dusty,Leo,Noodle,Panda,Peaches"; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Jordo.NeedyCats"); PatchNetcode(); Assets.PopulateAssets(); spawnRate = ((BaseUnityPlugin)this).Config.Bind<int>("NeedyCats", "Spawn rate", 20, "Sets the cat's spawn rate (This affects all moons)."); catNamesConfig = ((BaseUnityPlugin)this).Config.Bind<string>("NeedyCats", "Cat names", defaultCatNames, "Possible cat names separated by a colon (,). If the cat's name is followed by ':', you can input a material that'll be forced for that name among the following: Black, White, Spots, Boots, Orange, Stripes. You can find an image showcasing each material on the mod's wiki on Thunderstore. This list must contain at least one name. Example string: 'Daisy,Garfield:Orange,Chloe'"); string[] array = catNamesConfig.Value.Split(new char[1] { ',' }); foreach (string text in array) { string[] array2 = text.Split(new char[1] { ':' }); catNames.Add((array2[0], (array2.Length > 1) ? GetMaterialID(array2[1]) : (-1))); } harmony.PatchAll(typeof(NeedyCatsBase)); mls.LogInfo((object)"Initialized Needy Cats"); } private int GetMaterialID(string name) { return name.ToLower() switch { "black" => 0, "white" => 1, "boots" => 2, "spots" => 3, "orange" => 4, "stripes" => 5, _ => -1, }; } private void PatchNetcode() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void AddNeedyCatsToNetworkManager(GameNetworkManager __instance) { ((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(Assets.MainAssetBundle.LoadAsset<GameObject>("Cat.prefab")); mls.LogInfo((object)"Added Needy Cats prefab to Network Manager."); } [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPostfix] private static void AddNeedyCatsToItems(StartOfRound __instance) { Item item = Assets.MainAssetBundle.LoadAsset<Item>("CatItem"); if (!__instance.allItemsList.itemsList.Contains(item)) { __instance.allItemsList.itemsList.Add(item); } mls.LogInfo((object)"Added Needy Cats to items list."); } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPrefix] private static void AddNeedyCatsToAllLevels(StartOfRound __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown Item item = Assets.MainAssetBundle.LoadAsset<Item>("CatItem"); SpawnableItemWithRarity val = new SpawnableItemWithRarity(); val.rarity = spawnRate.Value; val.spawnableItem = item; SelectableLevel[] levels = __instance.levels; foreach (SelectableLevel val2 in levels) { if (val2.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)item)) { return; } val2.spawnableScrap.Add(val); } mls.LogInfo((object)"Added Needy Cats to all levels."); } [HarmonyPatch(typeof(HoarderBugAI), "GrabTargetItemIfClose")] [HarmonyPrefix] private static bool GrabTargetItemIfClose(HoarderBugAI __instance) { //IL_003c: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) float num = ((__instance.targetItem is NeedyCatProp) ? 1f : 0.75f); if ((Object)(object)__instance.targetItem != (Object)null && __instance.heldItem == null && Vector3.Distance(((Component)__instance).transform.position, ((Component)__instance.targetItem).transform.position) < num) { if (!((EnemyAI)__instance).SetDestinationToPosition(__instance.nestPosition, true)) { __instance.nestPosition = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position; ((EnemyAI)__instance).SetDestinationToPosition(__instance.nestPosition, false); } NetworkObject component = ((Component)__instance.targetItem).GetComponent<NetworkObject>(); ((EnemyAI)__instance).SwitchToBehaviourStateOnLocalClient(1); __instance.GrabItem(component); __instance.sendingGrabOrDropRPC = true; __instance.GrabItemServerRpc(NetworkObjectReference.op_Implicit(component)); return true; } return false; } [HarmonyPatch(typeof(NeedyCatProp), "Awake")] [HarmonyPrefix] private static void AddNeedyCatsNames(NeedyCatProp __instance) { __instance.CatNames = catNames.ToArray(); } } }
plugins/NoSellLimit.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("NoSellLimit")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Remove the limit of items that can be placed on the deposit desk")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("NoSellLimit")] [assembly: AssemblyTitle("NoSellLimit")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace NoSellLimit { [BepInPlugin("viviko.NoSellLimit", "NoSellLimit", "1.0.1")] public class NoSellLimit : BaseUnityPlugin { [HarmonyPatch(typeof(DepositItemsDesk))] [HarmonyPatch("PlaceItemOnCounter")] public static class PlaceItemOnCounterPatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0142: Unknown result type (might be due to invalid IL or missing references) CodeMatch[] array = (CodeMatch[])(object)new CodeMatch[7] { new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldarg_0), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.LoadsField(i, AccessTools.Field(typeof(DepositItemsDesk), "deskObjectsContainer"), false)), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldlen), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Conv_I4), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Ldc_I4_S), (string)null), new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Bge), (string)null) }; CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.Start(); val.MatchForward(false, array); val.SetOpcodeAndAdvance(OpCodes.Nop); val.RemoveInstructions(array.Length - 1); return val.Instructions(); } } private const string modGUID = "viviko.NoSellLimit"; private const string modName = "NoSellLimit"; private const string modVersion = "1.0.1"; private readonly Harmony harmony = new Harmony("viviko.NoSellLimit"); private static NoSellLimit Instance; public static ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("NoSellLimit"); harmony.PatchAll(); mls.LogInfo((object)"Plugin NoSellLimit is loaded!"); } } internal static class GeneratedPluginInfo { public const string Identifier = "viviko.NoSellLimit"; public const string Name = "NoSellLimit"; public const string Version = "1.0.1"; } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }
plugins/Pinger.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using LC_API.ServerAPI; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Pinger.Overrider; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Pinger")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Pings Player")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Pinger")] [assembly: AssemblyTitle("Pinger")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Pinger { internal struct CustomScanNode { public long created { get; set; } public ScanNodeProperties scanNode { get; set; } public string owner { get; set; } } [JsonObject(/*Could not decode attribute arguments.*/)] internal class PingData { [JsonProperty] public float x { get; set; } [JsonProperty] public float y { get; set; } [JsonProperty] public float z { get; set; } [JsonProperty] public long created { get; set; } [JsonProperty] public string owner { get; set; } [JsonProperty] public bool isDanger { get; set; } } [BepInPlugin("Pinger", "Pinger", "1.0.0")] public class Plugin : BaseUnityPlugin { private const string SIGNATURE = "player_ping"; private const int LIFESPAN = 10000; private Harmony _harmony; private ScanNodeProperties _scanNodeMaster; private LinkedList<CustomScanNode> _scanNodes = new LinkedList<CustomScanNode>(); private static bool _isPatched; private static bool _isPatching; private static PlayerControllerB _mainPlayer; private static HUDManager _hudManager; public static Plugin Instance { get; private set; } private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown Instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Pinger is loaded!"); _harmony = new Harmony("Pinger"); _harmony.PatchAll(typeof(StartOfRound_Awake)); _harmony.PatchAll(typeof(KeyboardPing)); StartLogicLoop(); } private async void StartLogicLoop() { while ((Object)(object)StartOfRound.Instance == (Object)null) { await Task.Delay(1000); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"StartOfRound.Instance found..."); _mainPlayer = StartOfRound.Instance.localPlayerController; while ((Object)(object)_mainPlayer == (Object)null) { await Task.Delay(250); _mainPlayer = StartOfRound.Instance.localPlayerController; } while ((Object)(object)_hudManager == (Object)null) { await Task.Delay(250); _hudManager = HUDManager.Instance; } _isPatched = true; handleIncomingPings(); } private void handleIncomingPings() { Networking.GetString = (Action<string, string>)Delegate.Combine(Networking.GetString, (Action<string, string>)delegate(string message, string signature) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (signature.Equals("player_ping")) { PingData pingData = JsonConvert.DeserializeObject<PingData>(message); if (pingData == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Failed to parse ping data"); } else { ((BaseUnityPlugin)this).Logger.LogMessage((object)$"Received ping from {pingData.owner} at {pingData.x} {pingData.y} {pingData.z}"); float x = pingData.x; float y = pingData.y; float z = pingData.z; RaycastHit hit = default(RaycastHit); createPing(x, y, z, in hit, pingData.isDanger, pingData.owner); } } }); } private void DeletePings(string owner) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) ScanNodeProperties[] array = Object.FindObjectsByType<ScanNodeProperties>((FindObjectsSortMode)0); for (LinkedListNode<CustomScanNode> linkedListNode = _scanNodes.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { if (!((Object)(object)linkedListNode.Value.scanNode == (Object)null)) { if (linkedListNode.Value.owner != owner) { Debug.Log((object)$"Skipping ping at {((Component)linkedListNode.Value.scanNode).transform.position} (Predicate failed: {linkedListNode.Value.owner} != {owner})"); } else { Debug.Log((object)$"Deleting ping at {((Component)linkedListNode.Value.scanNode).transform.position}"); Object.Destroy((Object)(object)linkedListNode.Value.scanNode); for (int i = 0; i < array.Length; i++) { if (((Component)array[i]).transform.position == ((Component)linkedListNode.Value.scanNode).transform.position) { Object.Destroy((Object)(object)array[i]); break; } } } } } } private async void checkAndDeleteOldPings() { int lifespan = 10000; while (true) { await Task.Delay(1000); long now = DateTimeOffset.Now.ToUnixTimeMilliseconds(); for (LinkedListNode<CustomScanNode> node = _scanNodes.First; node != null; node = node.Next) { if (!((Object)(object)node.Value.scanNode == (Object)null) && now - node.Value.created > lifespan) { ((BaseUnityPlugin)this).Logger.LogMessage((object)$"Deleting ping at {((Component)node.Value.scanNode).transform.position}"); Object.Destroy((Object)(object)node.Value.scanNode); _scanNodes.Remove(node); } } } } private void OnDestroy() { //IL_0038: 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) ScanNodeProperties[] array = Object.FindObjectsByType<ScanNodeProperties>((FindObjectsSortMode)0); for (LinkedListNode<CustomScanNode> linkedListNode = _scanNodes.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { Object.Destroy((Object)(object)linkedListNode.Value.scanNode); for (int i = 0; i < array.Length; i++) { if (((Component)array[i]).transform.position == ((Component)linkedListNode.Value.scanNode).transform.position) { Object.Destroy((Object)(object)array[i]); break; } } } } public bool createPingWherePlayerIsLooking(bool is_danger = false) { //IL_005b: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_mainPlayer == (Object)null || (Object)(object)_hudManager == (Object)null) { if (_isPatching) { return false; } StartLogicLoop(); _isPatching = true; return false; } float x = ((Component)_mainPlayer.gameplayCamera).transform.position.x; float y = ((Component)_mainPlayer.gameplayCamera).transform.position.y; float z = ((Component)_mainPlayer.gameplayCamera).transform.position.z; RaycastHit hit = shootRay(x, y, z); float x2 = ((RaycastHit)(ref hit)).point.x; float y2 = ((RaycastHit)(ref hit)).point.y; float z2 = ((RaycastHit)(ref hit)).point.z; ((BaseUnityPlugin)this).Logger.LogMessage((object)("Creating Ping on the surface of " + ((Object)((RaycastHit)(ref hit)).transform).name)); CustomScanNode customScanNode = createPing(x2, y2, z2, in hit, is_danger); if ((Object)(object)customScanNode.scanNode == (Object)null) { return false; } string text = JsonConvert.SerializeObject((object)new PingData { x = x2, y = y2, z = z2, created = customScanNode.created, owner = _mainPlayer.playerUsername, isDanger = is_danger }); Networking.Broadcast(text, "player_ping"); return true; } private CustomScanNode createPing(float x, float y, float z, in RaycastHit hit) { return createPing(x, y, z, in hit, isDanger: false, _mainPlayer.playerUsername); } private CustomScanNode createPing(float x, float y, float z, in RaycastHit hit, bool isDanger) { return createPing(x, y, z, in hit, isDanger, _mainPlayer.playerUsername); } private CustomScanNode createPing(float x, float y, float z, in RaycastHit hit, string playerName) { return createPing(x, y, z, in hit, isDanger: false, playerName); } private CustomScanNode createPing(float x, float y, float z, in RaycastHit hit, bool isDanger, string playerName) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (hasPlayerPinged(playerName)) { DeletePings(playerName); } string headerText = playerName + "'s ping"; string subText = "Player Ping <!>"; ((BaseUnityPlugin)this).Logger.LogMessage((object)$"Creating Ping at : {x} {y} {z}"); ScanNodeProperties[] array = Object.FindObjectsByType<ScanNodeProperties>((FindObjectsSortMode)0); if ((Object)(object)_scanNodeMaster == (Object)null) { if (array.Length == 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"No scan node master found"); return default(CustomScanNode); } _scanNodeMaster = array[0]; checkAndDeleteOldPings(); } ScanNodeProperties val = Object.Instantiate<ScanNodeProperties>(_scanNodeMaster); ((Object)val).name = "PlayerPing"; val.headerText = headerText; val.subText = subText; ((Component)val).transform.position = new Vector3(x, y, z); val.maxRange = 200; val.minRange = 0; val.requiresLineOfSight = true; if (isDanger) { val.nodeType = 1; val.subText = "DANGER <!>"; } else { val.nodeType = 2; } CustomScanNode customScanNode = default(CustomScanNode); long created = DateTimeOffset.Now.ToUnixTimeMilliseconds(); customScanNode.created = created; customScanNode.scanNode = val; customScanNode.owner = playerName; _scanNodes.AddLast(customScanNode); if ((Object)(object)_hudManager == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"HUDManager is null"); } else if (customScanNode.owner == _mainPlayer.playerUsername) { _hudManager.UIAudio.PlayOneShot(_hudManager.scanSFX); } return customScanNode; } private bool hasPlayerPinged(string name) { for (LinkedListNode<CustomScanNode> linkedListNode = _scanNodes.First; linkedListNode != null; linkedListNode = linkedListNode.Next) { if (linkedListNode.Value.owner == name) { return true; } } return false; } private RaycastHit shootRay(float x, float y, float z) { //IL_0018: 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_0024: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) float num = 2.5f; Transform transform = ((Component)_mainPlayer.gameplayCamera).transform; Vector3 val = transform.position + transform.forward * num; RaycastHit result = default(RaycastHit); Physics.Raycast(val, transform.forward, ref result, 1000f); return result; } } public static class PluginInfo { public const string PLUGIN_GUID = "Pinger"; public const string PLUGIN_NAME = "Pinger"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Pinger.Overrider { [HarmonyPatch(typeof(StartOfRound), "Awake")] internal class StartOfRound_Awake { [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPrefix] private static bool Prefix() { Debug.Log((object)"StartOfRound.Awake() is called"); return true; } } [HarmonyPatch] internal class KeyboardPing { private static float lastQPress; private const float PING_RESET = 0.3f; private static bool isWaiting; private static bool pingPressed; private static IEnumerator WaitForNextQ() { if (!isWaiting) { isWaiting = true; yield return (object)new WaitForSeconds(0.3f); if (!pingPressed) { Plugin.Instance.createPingWherePlayerIsLooking(); } isWaiting = false; } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void PingCommand(PlayerControllerB __instance) { long num = DateTimeOffset.Now.ToUnixTimeMilliseconds(); bool flag = false; if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled || __instance.inTerminalMenu || __instance.isTypingChat || __instance.isPlayerDead) { flag = true; } if (flag) { return; } if (((ButtonControl)Keyboard.current.qKey).wasPressedThisFrame) { if (!pingPressed) { pingPressed = true; ((MonoBehaviour)__instance).StartCoroutine(WaitForNextQ()); } else { bool flag2 = Plugin.Instance.createPingWherePlayerIsLooking(is_danger: true); } } else if (pingPressed) { lastQPress += Time.deltaTime; if (lastQPress >= 0.3f) { pingPressed = false; isWaiting = false; lastQPress = 0f; } } } } } namespace Pinger.CircleHelper { public static class Helper { private const string TAG = "[Pinger::CircleHelper]"; public static void debug_DisplayEntireComponentTree(Transform obj) { if ((Object)(object)obj == (Object)null) { return; } int childCount = obj.childCount; if (childCount > 0) { for (int i = 0; i < childCount; i++) { Transform child = obj.GetChild(i); Debug.Log((object)("[Pinger::CircleHelper]: " + ((Object)obj).name + "/" + ((Object)child).name)); debug_DisplayComponent(obj); debug_DisplayEntireComponentTree(child); } Debug.Log((object)("EOF - " + ((Object)obj).name)); } } private static void debug_DisplayComponent(Transform obj) { Debug.Log((object)string.Format("{0}: {1} :: typeof {2}", "[Pinger::CircleHelper]", ((Object)obj).name, ((object)obj).GetType())); } public static Transform debug_GrabInnerCircle(Transform obj) { if ((Object)(object)obj == (Object)null) { return null; } int childCount = obj.childCount; if (childCount <= 0) { return null; } Transform result = null; for (int i = 0; i < childCount; i++) { Transform child = obj.GetChild(i); if (((Object)child).name == "Inner") { result = child; break; } } return result; } } } namespace Pinger.Adder { internal static class Adder { public static void AddToClass<T>(this T obj, Action action) { obj.GetType().GetMethod("AddToClass").Invoke(obj, new object[1] { action }); } } }
plugins/QuickRestart.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("QuickRestart")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a395cfe8aac0ee2687d75817f75fae451f729511")] [assembly: AssemblyProduct("QuickRestart")] [assembly: AssemblyTitle("QuickRestart")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace QuickRestart { [BepInPlugin("QuickRestart", "QuickRestart", "1.0.0")] public class Plugin : BaseUnityPlugin { public static bool verifying; private ConfigEntry<bool> overrideConfirmation; public static bool bypassConfirm; private Harmony harmony; private static MethodInfo chat; private void Awake() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown overrideConfirmation = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "Override Confirmation", false, "Ignore the confirmation step of restarting."); bypassConfirm = overrideConfirmation.Value; harmony = new Harmony("QuickRestart"); harmony.PatchAll(); chat = AccessTools.Method(typeof(HUDManager), "AddChatMessage", (Type[])null, (Type[])null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"QuickRestart loaded!"); } public static void SendChatMessage(string message) { chat?.Invoke(HUDManager.Instance, new object[2] { message, "" }); HUDManager.Instance.lastChatMessage = ""; } public static void ConfirmRestart() { verifying = true; SendChatMessage("Are you sure? Type CONFIRM or DENY."); } public static void AcceptRestart(StartOfRound manager) { SendChatMessage("Restart confirmed."); verifying = false; int[] array = new int[4] { manager.gameStats.daysSpent, manager.gameStats.scrapValueCollected, manager.gameStats.deaths, manager.gameStats.allStepsTaken }; manager.FirePlayersAfterDeadlineClientRpc(array, false); } public static void DeclineRestart() { SendChatMessage("Restart aborted."); verifying = false; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "QuickRestart"; public const string PLUGIN_NAME = "QuickRestart"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace QuickRestart.Patches { [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] public class SubmitChat { private static bool Prefix(HUDManager __instance, ref CallbackContext context) { if (!((CallbackContext)(ref context)).performed) { return true; } if (string.IsNullOrEmpty(__instance.chatTextField.text)) { return true; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null) { return true; } StartOfRound playersManager = localPlayerController.playersManager; if ((Object)(object)playersManager == (Object)null) { return true; } string text = __instance.chatTextField.text; if (Plugin.verifying) { if (text.ToLower() == "confirm") { ResetTextbox(__instance, localPlayerController); if (!localPlayerController.isInHangarShipRoom || !playersManager.inShipPhase || playersManager.travellingToNewLevel) { Plugin.SendChatMessage("Cannot restart, ship must be in orbit."); return false; } Plugin.AcceptRestart(playersManager); return false; } if (text.ToLower() == "deny") { ResetTextbox(__instance, localPlayerController); Plugin.DeclineRestart(); return false; } return true; } if (text == "/restart") { ResetTextbox(__instance, localPlayerController); if (!GameNetworkManager.Instance.isHostingGame) { Plugin.SendChatMessage("Only the host can restart."); return false; } if (!localPlayerController.isInHangarShipRoom || !playersManager.inShipPhase || playersManager.travellingToNewLevel) { Plugin.SendChatMessage("Cannot restart, ship must be in orbit."); return false; } if (Plugin.bypassConfirm) { Plugin.AcceptRestart(playersManager); } else { Plugin.ConfirmRestart(); } return false; } return true; } private static void ResetTextbox(HUDManager manager, PlayerControllerB local) { local.isTypingChat = false; manager.chatTextField.text = ""; EventSystem.current.SetSelectedGameObject((GameObject)null); manager.PingHUDElement(manager.Chat, 2f, 1f, 0.2f); ((Behaviour)manager.typingIndicator).enabled = false; } } }
plugins/Scopophobia.dll
Decompiled 10 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Scopophobia; using Scopophobia.NetcodePatcher; using Scopophobia.Patches; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Scopophobia")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds the Shy Guy (SCP-096) to Lethal Company. Fully custom animations and behavior. Model from SCP: Containment Breach..")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1")] [assembly: AssemblyProduct("Scopophobia")] [assembly: AssemblyTitle("Scopophobia")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [Serializable] public class SyncedInstance<T> { [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Plugin.logger.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { Plugin.logger.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } } namespace ShyGuy.AI { public class ShyGuyAI : EnemyAI { private Transform localPlayerCamera; private Vector3 mainEntrancePosition; public Collider mainCollider; public AudioSource farAudio; public AudioSource footstepSource; public AudioClip screamSFX; public AudioClip panicSFX; public AudioClip crySFX; public AudioClip crySittingSFX; public AudioClip killPlayerSFX; [Header("Containment Breach Sounds")] public AudioClip screamSFX_CB; public AudioClip panicSFX_CB; public AudioClip crySFX_CB; public AudioClip killPlayerSFX_CB; [Header("Alpha Containment Breach Sounds")] public AudioClip screamSFX_ACB; public AudioClip panicSFX_ACB; public AudioClip crySFX_ACB; public AudioClip killPlayerSFX_ACB; [Header("Secret Laboratory Sounds")] public AudioClip screamSFX_SL; public AudioClip panicSFX_SL; public AudioClip crySFX_SL; public AudioClip killPlayerSFX_SL; public Material bloodyMaterial; public AISearchRoutine roamMap; public Transform shyGuyFace; private Vector3 spawnPosition; private Vector3 previousPosition; private int previousState = -1; private float roamWaitTime = 40f; private bool roamShouldSit; private bool sitting; private float lastRunSpeed; private float seeFaceTime; private float triggerTime; private float triggerDuration = 66.4f; private float timeToTrigger = 0.5f; private float lastInterval = Time.realtimeSinceStartup; private bool inKillAnimation; public List<PlayerControllerB> SCP096Targets = new List<PlayerControllerB>(); public override void Start() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Expected O, but got Unknown ((EnemyAI)this).Start(); triggerDuration = Config.triggerTime; Transform val = null; Queue<Transform> queue = new Queue<Transform>(); queue.Enqueue(((Component)this).transform); while (queue.Count > 0) { Transform val2 = queue.Dequeue(); if (((Object)val2).name == "lefteye") { val = val2; break; } foreach (Transform item3 in val2) { Transform item = item3; queue.Enqueue(item); } } Transform val3 = null; queue = new Queue<Transform>(); queue.Enqueue(((Component)this).transform); while (queue.Count > 0) { Transform val4 = queue.Dequeue(); if (((Object)val4).name == "righteye") { val3 = val4; break; } foreach (Transform item4 in val4) { Transform item2 = item4; queue.Enqueue(item2); } } if (!Config.hasGlowingEyes && (Object)(object)val != (Object)null && (Object)(object)val3 != (Object)null) { ((Component)val).gameObject.SetActive(false); ((Component)val3).gameObject.SetActive(false); } if (Config.bloodyTexture && (Object)(object)bloodyMaterial != (Object)null) { Transform val5 = ((Component)this).transform.Find("SCP096Model"); if ((Object)(object)val5 != (Object)null) { Transform val6 = val5.Find("tsg_placeholder"); if ((Object)(object)val6 != (Object)null) { SkinnedMeshRenderer component = ((Component)val6).GetComponent<SkinnedMeshRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).material = bloodyMaterial; } } } } switch (Config.soundPack) { case "SCPCB": screamSFX = screamSFX_CB; crySFX = crySFX_CB; crySittingSFX = crySFX_CB; panicSFX = panicSFX_CB; killPlayerSFX = killPlayerSFX_CB; break; case "SCPCBOld": screamSFX = screamSFX_ACB; crySFX = crySFX_ACB; crySittingSFX = crySFX_ACB; panicSFX = panicSFX_ACB; killPlayerSFX = killPlayerSFX_ACB; break; case "SecretLab": screamSFX = screamSFX_SL; crySFX = crySFX_SL; crySittingSFX = crySFX_SL; panicSFX = panicSFX_SL; killPlayerSFX = killPlayerSFX_SL; break; } localPlayerCamera = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform; spawnPosition = ((Component)this).transform.position; base.isOutside = ((Component)this).transform.position.y > -80f; mainEntrancePosition = RoundManager.Instance.GetNavMeshPosition(RoundManager.FindMainEntrancePosition(true, base.isOutside), default(NavMeshHit), 5f, -1); if (base.isOutside) { if (base.allAINodes == null || base.allAINodes.Length == 0) { base.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); } if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { ((EnemyAI)this).EnableEnemyMesh(!StartOfRound.Instance.hangarDoorsClosed || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom, false); } } else if (base.allAINodes == null || base.allAINodes.Length == 0) { base.allAINodes = GameObject.FindGameObjectsWithTag("AINode"); } base.path1 = new NavMeshPath(); base.openDoorSpeedMultiplier = 450f; SetShyGuyInitialValues(); } private void CalculateAnimationSpeed() { //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) //IL_0017: 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) Vector3 val = ((Component)this).transform.position - previousPosition; float num = ((Vector3)(ref val)).magnitude; if (num > 0f) { num = 1f; } lastRunSpeed = Mathf.Lerp(lastRunSpeed, num, 5f * Time.deltaTime); base.creatureAnimator.SetFloat("VelocityZ", lastRunSpeed); previousPosition = ((Component)this).transform.position; } public override void DoAIInterval() { //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (StartOfRound.Instance.livingPlayers == 0) { lastInterval = Time.realtimeSinceStartup; return; } if (base.isEnemyDead) { lastInterval = Time.realtimeSinceStartup; return; } if (!((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsOwner && base.currentBehaviourStateIndex != 2) { ((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId); } switch (base.currentBehaviourStateIndex) { case 0: { if (base.stunNormalizedTimer > 0f) { base.agent.speed = 0f; } else if (sitting) { base.agent.speed = 0f; } else { roamWaitTime -= Time.realtimeSinceStartup - lastInterval; base.openDoorSpeedMultiplier = 1f; base.agent.speed = 2.75f * Config.speedDocileMultiplier; } base.movingTowardsTargetPlayer = false; base.agent.stoppingDistance = 4f; base.addPlayerVelocityToDestination = 0f; PlayerControllerB targetPlayer2 = base.targetPlayer; if (roamWaitTime <= 20f && roamMap.inProgress && (Object)(object)base.targetPlayer == (Object)null) { ((EnemyAI)this).StopSearch(roamMap, true); lastInterval = Time.realtimeSinceStartup; } else if (roamWaitTime > 2.5f && roamWaitTime <= 15f && !roamMap.inProgress && (Object)(object)base.targetPlayer == (Object)null && roamShouldSit) { sitting = true; base.creatureAnimator.SetBool("Sitting", true); float time = base.creatureVoice.time; base.creatureVoice.volume = 0.3f; base.creatureVoice.clip = crySittingSFX; base.creatureVoice.Play(); base.creatureVoice.time = time; lastInterval = Time.realtimeSinceStartup; } else if (!((Object)(object)base.targetPlayer != (Object)null) && (Object)(object)base.targetPlayer == (Object)null && !roamMap.inProgress && roamWaitTime <= 0f) { if (!sitting) { roamShouldSit = Random.Range(1, 5) == 1; roamWaitTime = Random.Range(25f, 32.5f); ((EnemyAI)this).StartSearch(spawnPosition, roamMap); lastInterval = Time.realtimeSinceStartup; break; } sitting = false; roamShouldSit = false; roamWaitTime = Random.Range(21f, 25f); base.creatureAnimator.SetBool("Sitting", false); float time2 = base.creatureVoice.time; base.creatureVoice.volume = 0.3f; base.creatureVoice.clip = crySFX; base.creatureVoice.Play(); base.creatureVoice.time = time2; lastInterval = Time.realtimeSinceStartup; } break; } case 1: base.agent.speed = 0f; lastInterval = Time.realtimeSinceStartup; base.movingTowardsTargetPlayer = false; break; case 2: { base.agent.stoppingDistance = 0f; base.agent.avoidancePriority = 60; base.openDoorSpeedMultiplier = 450f; mainCollider.isTrigger = true; base.addPlayerVelocityToDestination = 1f; if (inKillAnimation) { base.agent.speed = 0f; } else { base.agent.speed = Mathf.Clamp(base.agent.speed + (Time.realtimeSinceStartup - lastInterval) * Config.speedRageMultiplier * 1.1f, 5f * Config.speedRageMultiplier, 14.75f * Config.speedRageMultiplier); } if (SCP096Targets.Count <= 0) { SitDown(); break; } PlayerControllerB targetPlayer = base.targetPlayer; float num = float.PositiveInfinity; foreach (PlayerControllerB sCP096Target in SCP096Targets) { bool flag = sCP096Target.isInsideFactory == !base.isOutside; bool flag2 = true; if (!Config.canExitFacility && !flag) { flag2 = false; } if (!sCP096Target.isPlayerDead && flag2) { if (((EnemyAI)this).PlayerIsTargetable(sCP096Target, false, true) && Vector3.Distance(((Component)sCP096Target).transform.position, ((Component)this).transform.position) < num) { num = Vector3.Magnitude(((Component)sCP096Target).transform.position - ((Component)this).transform.position); base.targetPlayer = sCP096Target; } } else { AddTargetToList((int)sCP096Target.actualClientId, remove: true); } } if ((Object)(object)base.targetPlayer != (Object)null) { base.creatureAnimator.SetFloat("DistanceToTarget", Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position)); if (roamMap.inProgress) { ((EnemyAI)this).StopSearch(roamMap, true); } if ((Object)(object)base.targetPlayer != (Object)(object)targetPlayer) { ((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId); } if (base.targetPlayer.isInsideFactory != !base.isOutside) { if (Vector3.Distance(((Component)this).transform.position, mainEntrancePosition) < 2f) { TeleportEnemy(RoundManager.FindMainEntrancePosition(true, !base.isOutside), !base.isOutside); base.agent.speed = 0f; } else { base.movingTowardsTargetPlayer = false; ((EnemyAI)this).SetDestinationToPosition(mainEntrancePosition, false); } } else { ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); } } else if (SCP096Targets.Count <= 0) { SitDown(); } break; } default: lastInterval = Time.realtimeSinceStartup; break; } } public void TeleportEnemy(Vector3 pos, bool setOutside) { //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) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(pos, default(NavMeshHit), 5f, -1); if (((NetworkBehaviour)this).IsOwner) { ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = navMeshPosition; ((Behaviour)base.agent).enabled = true; } else { ((Component)this).transform.position = navMeshPosition; } base.serverPosition = navMeshPosition; SetEnemyOutside(setOutside); EntranceTeleport val = RoundManager.FindMainEntranceScript(setOutside); if (val.doorAudios != null && val.doorAudios.Length != 0) { val.entrancePointAudio.PlayOneShot(val.doorAudios[0]); WalkieTalkie.TransmitOneShotAudio(val.entrancePointAudio, val.doorAudios[0], 1f); } } public override void Update() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead || (Object)(object)GameNetworkManager.Instance == (Object)null) { return; } CalculateAnimationSpeed(); bool flag = GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(shyGuyFace.position, Config.faceTriggerRange, 45, -1f); if (flag) { float num = Quaternion.Angle(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.rotation, shyGuyFace.rotation); if (!(num <= 145f)) { flag = false; } } if (flag) { seeFaceTime += Time.deltaTime; if (seeFaceTime >= Config.faceTriggerGracePeriod) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1.25f, true); if (!Config.hasMaxTargets || SCP096Targets.Count < Config.maxTargets) { AddTargetToList((int)GameNetworkManager.Instance.localPlayerController.playerClientId); } if (base.currentBehaviourStateIndex == 0) { ((EnemyAI)this).SwitchToBehaviourState(1); } } } else { seeFaceTime = Mathf.Clamp(seeFaceTime - Time.deltaTime, 0f, timeToTrigger); if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1f, 30f, 60, -1f) && base.currentBehaviourStateIndex == 0) { if (!base.thisNetworkObject.IsOwner) { ((EnemyAI)this).ChangeOwnershipOfEnemy(GameNetworkManager.Instance.localPlayerController.actualClientId); } if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) < 10f) { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.65f, true); } else { GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.25f, true); } } } switch (base.currentBehaviourStateIndex) { case 0: if (previousState != 0) { SetShyGuyInitialValues(); previousState = 0; mainCollider.isTrigger = true; farAudio.volume = 0f; base.creatureVoice.volume = 0.3f; base.creatureVoice.clip = crySFX; base.creatureVoice.Play(); } if (!base.creatureVoice.isPlaying) { base.creatureVoice.volume = 0.3f; base.creatureVoice.clip = crySFX; base.creatureVoice.Play(); } break; case 1: if (previousState != 1) { previousState = 1; sitting = false; mainCollider.isTrigger = true; base.creatureAnimator.SetBool("Rage", false); base.creatureAnimator.SetBool("Sitting", false); base.creatureAnimator.SetBool("triggered", true); base.creatureVoice.Stop(); farAudio.volume = 0.275f; farAudio.PlayOneShot(panicSFX); base.agent.speed = 0f; triggerTime = triggerDuration; } triggerTime -= Time.deltaTime; if (triggerTime <= 0f) { ((EnemyAI)this).SwitchToBehaviourState(2); } break; case 2: mainCollider.isTrigger = true; if (previousState != 2) { mainCollider.isTrigger = true; previousState = 2; base.creatureAnimator.SetBool("Rage", true); base.creatureAnimator.SetBool("triggered", false); farAudio.Stop(); farAudio.volume = 0.4f; farAudio.clip = screamSFX; farAudio.Play(); } break; } ((EnemyAI)this).Update(); } public void SetEnemyOutside(bool outside = false) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0029: Unknown result type (might be due to invalid IL or missing references) base.isOutside = outside; mainEntrancePosition = RoundManager.Instance.GetNavMeshPosition(RoundManager.FindMainEntrancePosition(true, outside), default(NavMeshHit), 5f, -1); if (outside) { base.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode"); } else { base.allAINodes = GameObject.FindGameObjectsWithTag("AINode"); } } public override void OnCollideWithPlayer(Collider other) { if (!Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>())) { return; } ((EnemyAI)this).OnCollideWithPlayer(other); if (!inKillAnimation && !base.isEnemyDead && base.currentBehaviourStateIndex == 2) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if ((Object)(object)val != (Object)null) { inKillAnimation = true; ((MonoBehaviour)this).StartCoroutine(killPlayerAnimation((int)val.playerClientId)); KillPlayerServerRpc((int)val.playerClientId); } } } [ServerRpc(RequireOwnership = false)] private void KillPlayerServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2556963367u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2556963367u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { KillPlayerClientRpc(playerId); } } } [ClientRpc] private void KillPlayerClientRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2298532976u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2298532976u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(killPlayerAnimation(playerId)); } } } private IEnumerator killPlayerAnimation(int playerId) { inKillAnimation = true; PlayerControllerB playerScript = StartOfRound.Instance.allPlayerScripts[playerId]; if (base.isOutside && ((Component)this).transform.position.y < -80f) { SetEnemyOutside(); } else if (!base.isOutside && ((Component)this).transform.position.y > -80f) { SetEnemyOutside(outside: true); } int preAmount = SCP096Targets.Count; playerScript.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 0); AddTargetToList(playerId, remove: true); base.creatureSFX.PlayOneShot(killPlayerSFX); base.creatureAnimator.SetInteger("TargetsLeft", preAmount - 1); base.creatureAnimator.SetTrigger("kill"); if (preAmount - 1 <= 0) { SitDown(); } if (Config.deathMakesBloody && (Object)(object)bloodyMaterial != (Object)null) { Transform model = ((Component)this).transform.Find("SCP096Model"); if ((Object)(object)model != (Object)null) { Transform modelMesh = model.Find("tsg_placeholder"); if ((Object)(object)modelMesh != (Object)null) { SkinnedMeshRenderer skinnedModel = ((Component)modelMesh).GetComponent<SkinnedMeshRenderer>(); if ((Object)(object)skinnedModel != (Object)null) { ((Renderer)skinnedModel).material = bloodyMaterial; } } } } yield return (object)new WaitForSeconds(1f); inKillAnimation = false; } public void SitDown() { ((EnemyAI)this).SwitchToBehaviourState(0); SitDownOnLocalClient(); SitDownServerRpc(); } [ServerRpc(RequireOwnership = false)] private void SitDownServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(652446748u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 652446748u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SitDownClientRpc(); } } } [ClientRpc] private void SitDownClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2536632143u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2536632143u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SitDownOnLocalClient(); } } } public void SitDownOnLocalClient() { sitting = true; roamWaitTime = Random.Range(45f, 50f); base.creatureAnimator.SetBool("Rage", false); base.creatureAnimator.SetBool("Sitting", true); } public void AddTargetToList(int playerId, bool remove = false) { PlayerControllerB item = StartOfRound.Instance.allPlayerScripts[playerId]; if (remove) { if (!SCP096Targets.Contains(item)) { return; } } else if (SCP096Targets.Contains(item)) { return; } AddTargetToListOnLocalClient(playerId, remove); AddTargetToListServerRpc(playerId, remove); } [ServerRpc(RequireOwnership = false)] public void AddTargetToListServerRpc(int playerId, bool remove) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1207108010u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref remove, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1207108010u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { AddTargetToListClientRpc(playerId, remove); } } } [ClientRpc] public void AddTargetToListClientRpc(int playerId, bool remove) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1413965488u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref remove, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1413965488u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { AddTargetToListOnLocalClient(playerId, remove); } } } public void AddTargetToListOnLocalClient(int playerId, bool remove) { PlayerControllerB item = StartOfRound.Instance.allPlayerScripts[playerId]; if (remove) { if (SCP096Targets.Contains(item)) { SCP096Targets.Remove(item); } } else if (!SCP096Targets.Contains(item)) { SCP096Targets.Add(item); } } private void SetShyGuyInitialValues() { mainCollider = ((Component)this).gameObject.GetComponentInChildren<Collider>(); farAudio = ((Component)((Component)this).transform.Find("FarAudio")).GetComponent<AudioSource>(); base.targetPlayer = null; inKillAnimation = false; SCP096Targets.Clear(); base.creatureAnimator.SetFloat("VelocityX", 0f); base.creatureAnimator.SetFloat("VelocityZ", 0f); base.creatureAnimator.SetFloat("DistanceToTarget", 999f); base.creatureAnimator.SetInteger("SitActionTimer", 0); base.creatureAnimator.SetInteger("TargetsLeft", 0); base.creatureAnimator.SetBool("Rage", false); base.creatureAnimator.SetBool("Sitting", false); base.creatureAnimator.SetBool("triggered", false); mainCollider.isTrigger = true; farAudio.volume = 0f; farAudio.Stop(); base.creatureVoice.Stop(); } protected override void __initializeVariables() { ((EnemyAI)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_ShyGuyAI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2556963367u, new RpcReceiveHandler(__rpc_handler_2556963367)); NetworkManager.__rpc_func_table.Add(2298532976u, new RpcReceiveHandler(__rpc_handler_2298532976)); NetworkManager.__rpc_func_table.Add(652446748u, new RpcReceiveHandler(__rpc_handler_652446748)); NetworkManager.__rpc_func_table.Add(2536632143u, new RpcReceiveHandler(__rpc_handler_2536632143)); NetworkManager.__rpc_func_table.Add(1207108010u, new RpcReceiveHandler(__rpc_handler_1207108010)); NetworkManager.__rpc_func_table.Add(1413965488u, new RpcReceiveHandler(__rpc_handler_1413965488)); } private static void __rpc_handler_2556963367(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).KillPlayerServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2298532976(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)2; ((ShyGuyAI)(object)target).KillPlayerClientRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_652446748(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).SitDownServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2536632143(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((ShyGuyAI)(object)target).SitDownClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1207108010(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool remove = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref remove, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ShyGuyAI)(object)target).AddTargetToListServerRpc(playerId, remove); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1413965488(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool remove = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref remove, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((ShyGuyAI)(object)target).AddTargetToListClientRpc(playerId, remove); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "ShyGuyAI"; } } } namespace Scopophobia { [Serializable] public class Config : SyncedInstance<Config> { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } public static ConfigEntry<bool> AppearsConfig; public static ConfigEntry<bool> HasGlowingEyesConfig; public static ConfigEntry<string> SoundPackConfig; public static ConfigEntry<bool> BloodyTextureConfig; public static ConfigEntry<bool> DeathMakesBloodyConfig; public static ConfigEntry<float> SpeedDocileMultiplierConfig; public static ConfigEntry<float> SpeedRageMultiplierConfig; public static ConfigEntry<int> SpawnRarityConfig; public static ConfigEntry<float> TriggerTimeConfig; public static ConfigEntry<float> FaceTriggerRangeConfig; public static ConfigEntry<float> FaceTriggerGracePeriodConfig; public static ConfigEntry<bool> HasMaxTargetsConfig; public static ConfigEntry<int> MaxTargetsConfig; public static ConfigEntry<bool> CanExitFacilityConfig; public static ConfigEntry<int> MaxSpawnCountConfig; public static ConfigEntry<bool> CanSpawnOutsideConfig; public static ConfigEntry<bool> SpawnOutsideHardPlanetsConfig; public static ConfigEntry<float> StartEnemySpawnCurveConfig; public static ConfigEntry<float> MidEnemySpawnCurveConfig; public static ConfigEntry<float> EndEnemySpawnCurveConfig; public static bool appears; public static bool hasGlowingEyes; public static string soundPack; public static bool bloodyTexture; public static bool deathMakesBloody; public static float speedDocileMultiplier; public static float speedRageMultiplier; public static int spawnRarity; public static float triggerTime; public static float faceTriggerRange; public static float faceTriggerGracePeriod; public static bool hasMaxTargets; public static int maxTargets; public static bool canExitFacility; public static bool canSpawnOutside; public static int maxSpawnCount; public static bool spawnsOutside; public static bool spawnOutsideHardPlanets; public static float startEnemySpawnCurve; public static float midEnemySpawnCurve; public static float endEnemySpawnCurve; public Config(ConfigFile cfg) { InitInstance(this); AppearsConfig = cfg.Bind<bool>("General", "Enable the Shy Guy", true, "Allows the Shy Guy to spawn in-game."); HasGlowingEyesConfig = cfg.Bind<bool>("Appearance", "Glowing Eyes", true, "Gives the Shy Guy glowing eyes similar to the Bracken/Flowerman."); BloodyTextureConfig = cfg.Bind<bool>("Appearance", "Bloody Texture", false, "Gives the Shy Guy his bloodier, original texture from SCP: Containment Breach."); DeathMakesBloodyConfig = cfg.Bind<bool>("Appearance", "Bloody Death", true, "Causes the Shy Guy's material to become bloody once getting his first kill. Useless if Bloody Texture is enabled lol"); SoundPackConfig = cfg.Bind<string>("Appearance", "Sound Pack (Curated, SCPCB, SCPCBOld, SecretLab)", "Curated", "Determines the sounds the Shy Guy uses. (SOME MAY NOT SYNC WELL WITH TRIGGER TIME) (Curated = Default, curated for the Lethal Company experience) (SCPCB = SCP-096 sounds from SCP: Containment Breach) (SCPCBOld = Old alpha SCP-096 sounds from SCP: Containment Breach) (SecretLab = SCP-096 sounds from SCP: Secret Laboratory)"); SpeedDocileMultiplierConfig = cfg.Bind<float>("Values", "Speed Multiplier (Docile)", 1f, "Determines the speed multiplier of the Shy Guy while docile."); SpeedRageMultiplierConfig = cfg.Bind<float>("Values", "Speed Multiplier (Rage)", 1f, "Determines the speed multiplier of the Shy Guy while enraged."); SpawnRarityConfig = cfg.Bind<int>("Values", "Spawn Rarity", 15, "Determines the spawn weight of the Shy Guy. Higher weights mean the Shy Guy is more likely appear. (just dont set this astronomically high)"); TriggerTimeConfig = cfg.Bind<float>("Values.Triggering", "Trigger Time", 66.4f, "Determines how long the Shy Guy must remain in the Triggered state to become fully enraged."); FaceTriggerRangeConfig = cfg.Bind<float>("Values.Triggering", "Face Trigger Range", 17.5f, "Determines the face's trigger radius."); FaceTriggerGracePeriodConfig = cfg.Bind<float>("Values.Triggering", "Face Trigger Grace Period", 0.5f, "Determines the grace period when you see the face of the Shy Guy before he becomes enraged."); HasMaxTargetsConfig = cfg.Bind<bool>("Values.Triggering", "Has Max Targets", false, "Determines if the Shy Guy has a maximum amount of targets."); MaxTargetsConfig = cfg.Bind<int>("Values.Triggering", "Max Targets", 32, "Determines the max amount of targets the Shy Guy can have. (requires HasMaxTargets)"); CanExitFacilityConfig = cfg.Bind<bool>("Values.Triggering", "Can Exit Facility", true, "Determines if the Shy Guy can exit the facility and into the outdoors (and vice versa) to attack its target."); MaxSpawnCountConfig = cfg.Bind<int>("Values.Spawning", "Max Spawn Count", 1, "Determines how many Shy Guy can spawn total."); CanSpawnOutsideConfig = cfg.Bind<bool>("Values.Spawning", "Can Spawn Outside", true, "Determines if the Shy Guy can spawn outside. "); SpawnOutsideHardPlanetsConfig = cfg.Bind<bool>("Values.Spawning", "Spawn Outside Only Hard Moons", true, "If set to true, the Shy Guy will only spawn outside on the highest-difficulty/modded moons."); StartEnemySpawnCurveConfig = cfg.Bind<float>("Values.Spawning", "Start Spawn Curve", 0.2f, "Spawn curve for the Shy Guy when the day starts. (typically 0-1)"); MidEnemySpawnCurveConfig = cfg.Bind<float>("Values.Spawning", "Midday Spawn Curve", 1f, "Spawn curve for the Shy Guy midday. (typically 0-1)"); EndEnemySpawnCurveConfig = cfg.Bind<float>("Values.Spawning", "End of Day Spawn Curve", 0.75f, "Spawn curve for the Shy Guy at the end of day. (typically 0-1)"); appears = AppearsConfig.Value; hasGlowingEyes = HasGlowingEyesConfig.Value; bloodyTexture = BloodyTextureConfig.Value; deathMakesBloody = DeathMakesBloodyConfig.Value; soundPack = SoundPackConfig.Value; speedDocileMultiplier = SpeedDocileMultiplierConfig.Value; speedRageMultiplier = SpeedRageMultiplierConfig.Value; spawnRarity = SpawnRarityConfig.Value; triggerTime = TriggerTimeConfig.Value; faceTriggerRange = FaceTriggerRangeConfig.Value; faceTriggerGracePeriod = FaceTriggerGracePeriodConfig.Value; hasMaxTargets = HasMaxTargetsConfig.Value; maxTargets = MaxTargetsConfig.Value; canExitFacility = CanExitFacilityConfig.Value; maxSpawnCount = MaxSpawnCountConfig.Value; canSpawnOutside = CanSpawnOutsideConfig.Value; spawnOutsideHardPlanets = SpawnOutsideHardPlanetsConfig.Value; startEnemySpawnCurve = StartEnemySpawnCurveConfig.Value; midEnemySpawnCurve = MidEnemySpawnCurveConfig.Value; endEnemySpawnCurve = EndEnemySpawnCurveConfig.Value; } public static void RequestSync() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { SyncedInstance<Config>.MessageManager.SendNamedMessage("Scopophobia_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (!SyncedInstance<Config>.IsHost) { return; } Plugin.logger.LogInfo((object)$"Config sync request received from client: {clientId}"); byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); SyncedInstance<Config>.MessageManager.SendNamedMessage("Scopophobia_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { Plugin.logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } public static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize)) { Plugin.logger.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Plugin.logger.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncedInstance<Config>.SyncInstance(data); Plugin.logger.LogInfo((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (SyncedInstance<Config>.IsHost) { CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("Scopophobia_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); SyncedInstance<Config>.Synced = true; return; } SyncedInstance<Config>.Synced = false; CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("Scopophobia_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); RequestSync(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { SyncedInstance<Config>.RevertSync(); } } [BepInPlugin("Scopophobia", "Scopophobia", "1.1.1")] public class ScopophobiaPlugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("Scopophobia"); public static EnemyType shyGuy; public static AssetBundle Assets; public static bool spawnsOutside; public static SpawnableEnemyWithRarity maskedPrefab; public static ManualLogSource logger; public static SpawnableEnemyWithRarity shyPrefab; public static Config MyConfig { get; internal set; } internal Assembly assembly => Assembly.GetExecutingAssembly(); internal string GetFilePath(string path) { return assembly.Location.Replace(assembly.GetName().Name + ".dll", path); } private void LoadAssets() { try { Assets = AssetBundle.LoadFromFile(GetFilePath("scp096")); } catch (Exception arg) { logger.LogError((object)$"Failed to load asset bundle! {arg}"); } } private void Awake() { harmony.PatchAll(typeof(Config)); LoadAssets(); logger = ((BaseUnityPlugin)this).Logger; MyConfig = new Config(((BaseUnityPlugin)this).Config); ConfigEntry<bool> val = default(ConfigEntry<bool>); ((BaseUnityPlugin)this).Config.TryGetEntry<bool>("General", "Enable the Shy Guy", ref val); if (!val.Value) { return; } ConfigEntry<int> val2 = default(ConfigEntry<int>); ((BaseUnityPlugin)this).Config.TryGetEntry<int>("Values", "Spawn Rarity", ref val2); int num = val2?.Value ?? 15; shyGuy = Assets.LoadAsset<EnemyType>("ShyGuyDef.asset"); TerminalNode val3 = Assets.LoadAsset<TerminalNode>("ShyGuyTerminal.asset"); TerminalKeyword val4 = Assets.LoadAsset<TerminalKeyword>("ShyGuyKeyword.asset"); NetworkPrefabs.RegisterNetworkPrefab(shyGuy.enemyPrefab); Enemies.RegisterEnemy(shyGuy, num, (LevelTypes)(-1), (SpawnType)0, val3, val4); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } logger.LogInfo((object)"Scopophobia | SCP-096 has entered the facility. All remaining personnel proceed with caution."); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(GetShyGuyPrefabForLaterUse)); harmony.PatchAll(typeof(ShyGuySpawnSettings)); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Scopophobia"; public const string PLUGIN_NAME = "Scopophobia"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace Scopophobia.Patches { [HarmonyPatch] internal class GetShyGuyPrefabForLaterUse { [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] private static void SavesPrefabForLaterUse(ref SelectableLevel[] ___moonsCatalogueList) { SelectableLevel[] array = ___moonsCatalogueList; SelectableLevel[] array2 = array; foreach (SelectableLevel val in array2) { foreach (SpawnableEnemyWithRarity enemy in val.Enemies) { if (enemy.enemyType.enemyName == "Shy guy") { ScopophobiaPlugin.shyPrefab = enemy; } } } } } [HarmonyPatch(typeof(RoundManager))] internal class ShyGuySpawnSettings { public static string[] nonoOutside = new string[5] { "Level1Experimentation", "Level2Assurance", "Level3Vow", "Level4March", "Level7Offense" }; [HarmonyPatch("BeginEnemySpawning")] [HarmonyPrefix] private static void UpdateSpawnRates(ref SelectableLevel ___currentLevel) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown if (!Config.appears || ScopophobiaPlugin.shyPrefab == null) { return; } try { SpawnableEnemyWithRarity shyPrefab = ScopophobiaPlugin.shyPrefab; List<SpawnableEnemyWithRarity> enemies = ___currentLevel.Enemies; for (int i = 0; i < ___currentLevel.Enemies.Count; i++) { SpawnableEnemyWithRarity val = ___currentLevel.Enemies[i]; if (val.enemyType.enemyName == "Shy guy") { enemies.Remove(val); } } ___currentLevel.Enemies = enemies; shyPrefab.enemyType.PowerLevel = 3; shyPrefab.rarity = Config.spawnRarity; shyPrefab.enemyType.probabilityCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[3] { new Keyframe(0f, Config.startEnemySpawnCurve), new Keyframe(0.5f, Config.midEnemySpawnCurve), new Keyframe(1f, Config.endEnemySpawnCurve) }); shyPrefab.enemyType.MaxCount = Config.maxSpawnCount; shyPrefab.enemyType.isOutsideEnemy = Config.canSpawnOutside; if (Config.canSpawnOutside & (!Config.spawnOutsideHardPlanets || !nonoOutside.Contains(___currentLevel.sceneName))) { ___currentLevel.OutsideEnemies.Add(shyPrefab); SelectableLevel val2 = ___currentLevel; val2.maxOutsideEnemyPowerCount += shyPrefab.enemyType.MaxCount * shyPrefab.enemyType.PowerLevel; } ___currentLevel.Enemies.Add(shyPrefab); } catch { } } } } namespace Scopophobia.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
plugins/Skibidi.AI.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Animations.Rigging; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Skibidi.AI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Skibidi.AI")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("597be394-0d5f-4dbb-ad1d-4d432b1b4802")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Skibidi.AI { public class SkibidiAI : JesterAI { private int prevState = 0; public TwoBoneIKConstraint headIK; public AudioClip tauntClip; private float flushTime; public override void Start() { ((JesterAI)this).Start(); Debug.Log((object)"Spawning le skibidi. beware."); } public virtual void EvtFlush() { Debug.Log((object)"Flushing!"); ((EnemyAI)this).SwitchToBehaviourState(0); } public override void Update() { if (((EnemyAI)this).isEnemyDead) { return; } switch (((EnemyAI)this).currentBehaviourStateIndex) { case 0: if (prevState != 0) { ((EnemyAI)this).creatureAnimator.SetBool("flushed", true); ((EnemyAI)this).creatureVoice.Stop(true); ((EnemyAI)this).creatureVoice.PlayOneShot(((EnemyAI)this).enemyType.stunSFX); flushTime = Time.time; } ((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight, 0f, Time.deltaTime * 5f); break; case 1: if (prevState != 1) { ((EnemyAI)this).creatureAnimator.SetBool("flushed", false); base.farAudio.PlayOneShot(tauntClip); } ((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight, 1f, Time.deltaTime * 5f); break; case 2: if (prevState != 2) { ((EnemyAI)this).creatureAnimator.SetBool("flushed", false); } ((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight = Mathf.Lerp(((RigConstraint<TwoBoneIKConstraintJob, TwoBoneIKConstraintData, TwoBoneIKConstraintJobBinder<TwoBoneIKConstraintData>>)(object)headIK).weight, 1f, Time.deltaTime * 5f); break; } prevState = ((EnemyAI)this).currentBehaviourStateIndex; if (((EnemyAI)this).currentBehaviourStateIndex != 0 || !(Time.time - flushTime < 15f)) { ((JesterAI)this).Update(); ((EnemyAI)this).agent.speed = Mathf.Clamp(((EnemyAI)this).agent.speed, 0f, 7.5f); if (base.popUpTimer > 10f) { base.popUpTimer = 10f; } } } } public class SkibidiSFX : MonoBehaviour { public SkibidiAI enemy; public AudioClip brrClip; public AudioClip skibidiClip; public float skibidiRamp = 0f; public virtual void PlayBrrSFX() { if (skibidiRamp > 1f) { skibidiRamp = 1f; } ((JesterAI)enemy).farAudio.pitch = 1f + skibidiRamp; ((JesterAI)enemy).farAudio.PlayOneShot(brrClip); skibidiRamp += 0.02f; } public virtual void PlaySkibidiSFX() { ((JesterAI)enemy).farAudio.pitch = 1f; skibidiRamp = 0f; ((EnemyAI)enemy).creatureVoice.PlayOneShot(skibidiClip); } } }
plugins/Skibidi.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Skibidi.AI; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyCompany("Skibidi")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Skibidi Toilet core")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Skibidi")] [assembly: AssemblyTitle("Skibidi")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Skibidi { public static class Assets { public static string mainAssetBundleName = "skibidibundle"; public static AssetBundle MainAssetBundle = null; private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().FullName.Split(',')[0]; } public static void PopulateAssets() { if ((Object)(object)MainAssetBundle == (Object)null) { using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName)) { MainAssetBundle = AssetBundle.LoadFromStream(stream); } } } } [BepInPlugin("rileyzzz.Skibidi", "Skibidi Toilet", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private void Awake() { Assets.PopulateAssets(); EnemyType val = Assets.MainAssetBundle.LoadAsset<EnemyType>("SkibidiDef"); TerminalNode val2 = Assets.MainAssetBundle.LoadAsset<TerminalNode>("SkibidiFile"); TerminalKeyword val3 = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("Skibidi"); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); Type typeFromHandle = typeof(SkibidiAI); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Skibidi AI {typeFromHandle}"); Enemies.RegisterEnemy(val, 22, (LevelTypes)(-1), (SpawnType)0, val2, val3); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Skibidi is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "Skibidi"; public const string PLUGIN_NAME = "Skibidi"; public const string PLUGIN_VERSION = "1.0.0"; } }
plugins/SkinwalkerMod.dll
Decompiled 10 months agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dissonance; using Dissonance.Config; using HarmonyLib; using SkinwalkerMod.Properties; using Steamworks; using Unity.Netcode; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SkinwalkerMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SkinwalkerMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("fd4979a2-cef0-46af-8bf8-97e630b11475")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>(); } } namespace SkinwalkerMod { internal class LogoManager : MonoBehaviour { private AssetBundle bundle; private readonly Logo[] logos = new Logo[6] { new Logo { fileName = "Teo", playerNames = new string[9] { "SAMMY", "paddy", "Ozias", "Teo", "Rugbug Redfern", "WuluKing", "Boolie", "TeaEditor", "FlashGamesNemesis" } }, new Logo { fileName = "OfflineTV", playerNames = new string[3] { "Masayoshi", "QUARTERJADE", "DisguisedToast" } }, new Logo { fileName = "Neuro", playerNames = new string[1] { "vedal" } }, new Logo { fileName = "Mogul", playerNames = new string[2] { "ludwig", "AirCoots" } }, new Logo { fileName = "Imp", playerNames = new string[1] { "camila" } }, new Logo { fileName = "Iron", playerNames = new string[1] { "ironmouse" } } }; private Image cachedHeader; private Image cachedLogoHeader; private void Awake() { try { bundle = AssetBundle.LoadFromMemory(Resources.logos); SceneManager.sceneLoaded += OnSceneLoaded; } catch (Exception ex) { SkinwalkerLogger.LogError("LogoManager Awake Error: " + ex.Message); } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { try { if (!(((Scene)(ref scene)).name == "MainMenu")) { return; } cachedHeader = GameObject.Find("HeaderImage").GetComponent<Image>(); cachedLogoHeader = ((Component)GameObject.Find("Canvas/MenuContainer").transform.GetChild(0).GetChild(1)).GetComponent<Image>(); string value = SteamClient.Name.ToString(); Logo[] array = logos; foreach (Logo logo in array) { string[] playerNames = logo.playerNames; foreach (string text in playerNames) { if (text.Equals(value, StringComparison.OrdinalIgnoreCase)) { ((MonoBehaviour)this).StartCoroutine(I_ChangeLogo(bundle.LoadAsset<Sprite>("Assets/Logos/" + logo.fileName + ".png"))); return; } } } } catch (Exception ex) { SkinwalkerLogger.LogError("LogoManager OnSceneLoaded Error: " + ex.Message + ". If you launched in LAN mode, then this is just gonna happen, it doesn't break anything so don't worry about it."); } } private IEnumerator I_ChangeLogo(Sprite sprite) { for (int i = 0; i < 20; i++) { if ((Object)(object)cachedHeader == (Object)null) { break; } if ((Object)(object)cachedLogoHeader == (Object)null) { break; } SetHeaderImage(sprite); yield return null; } } private void SetHeaderImage(Sprite sprite) { if (!((Object)(object)sprite == (Object)null)) { cachedHeader.sprite = sprite; cachedLogoHeader.sprite = sprite; } } } internal class Logo { public string fileName; public string[] playerNames; } [BepInPlugin("RugbugRedfern.SkinwalkerMod", "Skinwalker Mod", "2.0.7")] internal class PluginLoader : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("RugbugRedfern.SkinwalkerMod"); private const string modGUID = "RugbugRedfern.SkinwalkerMod"; private const string modVersion = "2.0.7"; private static bool initialized; public static PluginLoader Instance { get; private set; } private void Awake() { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown if (initialized) { return; } initialized = true; Instance = this; harmony.PatchAll(Assembly.GetExecutingAssembly()); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } SkinwalkerLogger.Initialize("RugbugRedfern.SkinwalkerMod"); SkinwalkerLogger.Log("SKINWALKER MOD STARTING UP 2.0.7"); SkinwalkerConfig.InitConfig(); SceneManager.sceneLoaded += SkinwalkerNetworkManagerHandler.ClientConnectInitializer; GameObject val = new GameObject("Skinwalker Mod"); val.AddComponent<SkinwalkerModPersistent>(); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); Logs.SetLogLevel((LogCategory)1, (LogLevel)4); Logs.SetLogLevel((LogCategory)3, (LogLevel)4); Logs.SetLogLevel((LogCategory)2, (LogLevel)4); GameObject val2 = new GameObject("Logo Manager"); val2.AddComponent<LogoManager>(); ((Object)val2).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val2); } public void BindConfig<T>(ref ConfigEntry<T> config, string section, string key, T defaultValue, string description = "") { config = ((BaseUnityPlugin)this).Config.Bind<T>(section, key, defaultValue, description); } } internal class SkinwalkerBehaviour : MonoBehaviour { private AudioSource audioSource; public const float PLAY_INTERVAL_MIN = 15f; public const float PLAY_INTERVAL_MAX = 40f; private const float MAX_DIST = 100f; private float nextTimeToPlayAudio; private EnemyAI ai; public void Initialize(EnemyAI ai) { this.ai = ai; audioSource = ai.creatureVoice; SetNextTime(); } private void Update() { if (Time.time > nextTimeToPlayAudio) { SetNextTime(); AttemptPlaySound(); } } private void AttemptPlaySound() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) float num = -1f; if (Object.op_Implicit((Object)(object)ai) && !ai.isEnemyDead) { if (((Object)((Component)ai).gameObject).name == "DressGirl(Clone)") { DressGirlAI val = (DressGirlAI)ai; if ((Object)(object)val.hauntingPlayer != (Object)(object)StartOfRound.Instance.localPlayerController) { SkinwalkerLogger.Log(((Object)this).name + " played voice line no (not haunted) EnemyAI: " + (object)ai); return; } if (!val.staringInHaunt && !((EnemyAI)val).moveTowardsDestination) { SkinwalkerLogger.Log(((Object)this).name + " played voice line no (not visible) EnemyAI: " + (object)ai); return; } } Vector3 val2 = (StartOfRound.Instance.localPlayerController.isPlayerDead ? ((Component)StartOfRound.Instance.spectateCamera).transform.position : ((Component)StartOfRound.Instance.localPlayerController).transform.position); if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.localPlayerController == (Object)null || (num = Vector3.Distance(val2, ((Component)this).transform.position)) < 100f) { AudioClip sample = SkinwalkerModPersistent.Instance.GetSample(); if (Object.op_Implicit((Object)(object)sample)) { SkinwalkerLogger.Log(((Object)this).name + " played voice line 1"); audioSource.PlayOneShot(sample); } else { SkinwalkerLogger.Log(((Object)this).name + " played voice line 0"); } } else { SkinwalkerLogger.Log(((Object)this).name + " played voice line no (too far away) " + num); } } else { SkinwalkerLogger.Log(((Object)this).name + " played voice line no (dead) EnemyAI: " + (object)ai); } } private void SetNextTime() { if (SkinwalkerNetworkManager.Instance.VoiceLineFrequency.Value <= 0f) { nextTimeToPlayAudio = Time.time + 100000000f; } else { nextTimeToPlayAudio = Time.time + Random.Range(15f, 40f) / SkinwalkerNetworkManager.Instance.VoiceLineFrequency.Value; } } private T CopyComponent<T>(T original, GameObject destination) where T : Component { Type type = ((object)original).GetType(); Component val = destination.AddComponent(type); FieldInfo[] fields = type.GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(val, fieldInfo.GetValue(original)); } return (T)(object)((val is T) ? val : null); } } internal class SkinwalkerConfig { public static ConfigEntry<bool> VoiceEnabled_BaboonHawk; public static ConfigEntry<bool> VoiceEnabled_Bracken; public static ConfigEntry<bool> VoiceEnabled_BunkerSpider; public static ConfigEntry<bool> VoiceEnabled_Centipede; public static ConfigEntry<bool> VoiceEnabled_CoilHead; public static ConfigEntry<bool> VoiceEnabled_EyelessDog; public static ConfigEntry<bool> VoiceEnabled_ForestGiant; public static ConfigEntry<bool> VoiceEnabled_GhostGirl; public static ConfigEntry<bool> VoiceEnabled_GiantWorm; public static ConfigEntry<bool> VoiceEnabled_HoardingBug; public static ConfigEntry<bool> VoiceEnabled_Hygrodere; public static ConfigEntry<bool> VoiceEnabled_Jester; public static ConfigEntry<bool> VoiceEnabled_Masked; public static ConfigEntry<bool> VoiceEnabled_Nutcracker; public static ConfigEntry<bool> VoiceEnabled_SporeLizard; public static ConfigEntry<bool> VoiceEnabled_Thumper; public static ConfigEntry<bool> VoiceEnabled_OtherEnemies; public static ConfigEntry<float> VoiceLineFrequency; public static void InitConfig() { PluginLoader.Instance.BindConfig(ref VoiceLineFrequency, "Voice Settings", "VoiceLineFrequency", 1f, "1 is the default, and voice lines will occur every " + 15f.ToString("0") + " to " + 40f.ToString("0") + " seconds per enemy. Setting this to 2 means they will occur twice as often, 0.5 means half as often, etc."); PluginLoader.Instance.BindConfig(ref VoiceEnabled_BaboonHawk, "Monster Voices", "Baboon Hawk", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Bracken, "Monster Voices", "Bracken", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_BunkerSpider, "Monster Voices", "Bunker Spider", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Centipede, "Monster Voices", "Centipede", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_CoilHead, "Monster Voices", "Coil Head", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_EyelessDog, "Monster Voices", "Eyeless Dog", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_ForestGiant, "Monster Voices", "Forest Giant", defaultValue: false); PluginLoader.Instance.BindConfig(ref VoiceEnabled_GhostGirl, "Monster Voices", "Ghost Girl", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_GiantWorm, "Monster Voices", "Giant Worm", defaultValue: false); PluginLoader.Instance.BindConfig(ref VoiceEnabled_HoardingBug, "Monster Voices", "Hoarding Bug", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Hygrodere, "Monster Voices", "Hygrodere", defaultValue: false); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Jester, "Monster Voices", "Jester", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Masked, "Monster Voices", "Masked", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Nutcracker, "Monster Voices", "Nutcracker", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_SporeLizard, "Monster Voices", "Spore Lizard", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_Thumper, "Monster Voices", "Thumper", defaultValue: true); PluginLoader.Instance.BindConfig(ref VoiceEnabled_OtherEnemies, "Monster Voices", "Other Enemies (Including Modded)", defaultValue: true); SkinwalkerLogger.Log("VoiceEnabled_BaboonHawk" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_BaboonHawk.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Bracken" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Bracken.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_BunkerSpider" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_BunkerSpider.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Centipede" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Centipede.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_CoilHead" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_CoilHead.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_EyelessDog" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_EyelessDog.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_ForestGiant" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_ForestGiant.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_GhostGirl" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_GhostGirl.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_GiantWorm" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_GiantWorm.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_HoardingBug" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_HoardingBug.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Hygrodere" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Hygrodere.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Jester" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Jester.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Masked" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Masked.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Nutcracker" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Nutcracker.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_SporeLizard" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_SporeLizard.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_Thumper" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Thumper.Value}]"); SkinwalkerLogger.Log("VoiceEnabled_OtherEnemies" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_OtherEnemies.Value}]"); SkinwalkerLogger.Log("VoiceLineFrequency" + $" VALUE LOADED FROM CONFIG: [{VoiceLineFrequency.Value}]"); } } internal static class SkinwalkerLogger { internal static ManualLogSource logSource; public static void Initialize(string modGUID) { logSource = Logger.CreateLogSource(modGUID); } public static void Log(object message) { logSource.LogInfo(message); } public static void LogError(object message) { logSource.LogError(message); } public static void LogWarning(object message) { logSource.LogWarning(message); } } public class SkinwalkerModPersistent : MonoBehaviour { private string audioFolder; private List<AudioClip> cachedAudio = new List<AudioClip>(); private float nextTimeToCheckFolder = 30f; private float nextTimeToCheckEnemies = 30f; private const float folderScanInterval = 8f; private const float enemyScanInterval = 5f; public static SkinwalkerModPersistent Instance { get; private set; } private void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) Instance = this; ((Component)this).transform.position = Vector3.zero; SkinwalkerLogger.Log("Skinwalker Mod Object Initialized"); audioFolder = Path.Combine(Application.dataPath, "..", "Dissonance_Diagnostics"); EnableRecording(); if (!Directory.Exists(audioFolder)) { Directory.CreateDirectory(audioFolder); } } private void Start() { try { if (Directory.Exists(audioFolder)) { Directory.Delete(audioFolder, recursive: true); } } catch (Exception message) { SkinwalkerLogger.Log(message); } } private void OnApplicationQuit() { DisableRecording(); } private void EnableRecording() { DebugSettings.Instance.EnablePlaybackDiagnostics = true; DebugSettings.Instance.RecordFinalAudio = true; } private void Update() { if (Time.realtimeSinceStartup > nextTimeToCheckFolder) { nextTimeToCheckFolder = Time.realtimeSinceStartup + 8f; if (!Directory.Exists(audioFolder)) { SkinwalkerLogger.Log("Audio folder not present. Don't worry about it, it will be created automatically when you play with friends. (" + audioFolder + ")"); return; } string[] files = Directory.GetFiles(audioFolder); SkinwalkerLogger.Log($"Got audio file paths ({files.Length})"); string[] array = files; foreach (string path in array) { ((MonoBehaviour)this).StartCoroutine(LoadWavFile(path, delegate(AudioClip audioClip) { cachedAudio.Add(audioClip); })); } } if (!(Time.realtimeSinceStartup > nextTimeToCheckEnemies)) { return; } nextTimeToCheckEnemies = Time.realtimeSinceStartup + 5f; EnemyAI[] array2 = Object.FindObjectsOfType<EnemyAI>(true); EnemyAI[] array3 = array2; SkinwalkerBehaviour skinwalkerBehaviour = default(SkinwalkerBehaviour); foreach (EnemyAI val in array3) { SkinwalkerLogger.Log("IsEnemyEnabled " + ((Object)val).name + " " + IsEnemyEnabled(val)); if (IsEnemyEnabled(val) && !((Component)val).TryGetComponent<SkinwalkerBehaviour>(ref skinwalkerBehaviour)) { ((Component)val).gameObject.AddComponent<SkinwalkerBehaviour>().Initialize(val); } } } private bool IsEnemyEnabled(EnemyAI enemy) { if ((Object)(object)enemy == (Object)null) { return false; } return ((Object)((Component)enemy).gameObject).name switch { "MaskedPlayerEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Masked.Value, "NutcrackerEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Nutcracker.Value, "BaboonHawkEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_BaboonHawk.Value, "Flowerman(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Bracken.Value, "SandSpider(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_BunkerSpider.Value, "RedLocustBees(Clone)" => false, "Centipede(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Centipede.Value, "SpringMan(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_CoilHead.Value, "MouthDog(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_EyelessDog.Value, "ForestGiant(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_ForestGiant.Value, "DressGirl(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_GhostGirl.Value, "SandWorm(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_GiantWorm.Value, "HoarderBug(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_HoardingBug.Value, "Blob(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Hygrodere.Value, "JesterEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Jester.Value, "PufferEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_SporeLizard.Value, "Crawler(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Thumper.Value, "DocileLocustBees(Clone)" => false, "DoublewingedBird(Clone)" => false, _ => SkinwalkerNetworkManager.Instance.VoiceEnabled_OtherEnemies.Value, }; } internal IEnumerator LoadWavFile(string path, Action<AudioClip> callback) { UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(path, (AudioType)20); try { yield return www.SendWebRequest(); if ((int)www.result == 1) { SkinwalkerLogger.Log("Loaded clip from path " + path); AudioClip audioClip = DownloadHandlerAudioClip.GetContent(www); if (audioClip.length > 0.9f) { callback(audioClip); } try { File.Delete(path); } catch (Exception e) { SkinwalkerLogger.LogWarning(e); } } } finally { ((IDisposable)www)?.Dispose(); } } private void DisableRecording() { DebugSettings.Instance.EnablePlaybackDiagnostics = false; DebugSettings.Instance.RecordFinalAudio = false; if (Directory.Exists(audioFolder)) { Directory.Delete(audioFolder, recursive: true); } } public AudioClip GetSample() { while (cachedAudio.Count > 200) { cachedAudio.RemoveAt(Random.Range(0, cachedAudio.Count)); } if (cachedAudio.Count > 0) { int index = Random.Range(0, cachedAudio.Count - 1); AudioClip result = cachedAudio[index]; cachedAudio.RemoveAt(index); return result; } return null; } public void ClearCache() { cachedAudio.Clear(); } } internal static class SkinwalkerNetworkManagerHandler { internal static void ClientConnectInitializer(Scene sceneName, LoadSceneMode sceneEnum) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown if (((Scene)(ref sceneName)).name == "SampleSceneRelay") { GameObject val = new GameObject("SkinwalkerNetworkManager"); val.AddComponent<NetworkObject>(); val.AddComponent<SkinwalkerNetworkManager>(); Debug.Log((object)"Initialized SkinwalkerNetworkManager"); } } } internal class SkinwalkerNetworkManager : NetworkBehaviour { public NetworkVariable<bool> VoiceEnabled_BaboonHawk = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Bracken = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_BunkerSpider = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Centipede = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_CoilHead = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_EyelessDog = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_ForestGiant = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_GhostGirl = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_GiantWorm = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_HoardingBug = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Hygrodere = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Jester = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Masked = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Nutcracker = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_SporeLizard = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_Thumper = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<bool> VoiceEnabled_OtherEnemies = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public NetworkVariable<float> VoiceLineFrequency = new NetworkVariable<float>(1f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public static SkinwalkerNetworkManager Instance { get; private set; } private void Awake() { Instance = this; if (GameNetworkManager.Instance.isHostingGame) { VoiceEnabled_BaboonHawk.Value = SkinwalkerConfig.VoiceEnabled_BaboonHawk.Value; VoiceEnabled_Bracken.Value = SkinwalkerConfig.VoiceEnabled_Bracken.Value; VoiceEnabled_BunkerSpider.Value = SkinwalkerConfig.VoiceEnabled_BunkerSpider.Value; VoiceEnabled_Centipede.Value = SkinwalkerConfig.VoiceEnabled_Centipede.Value; VoiceEnabled_CoilHead.Value = SkinwalkerConfig.VoiceEnabled_CoilHead.Value; VoiceEnabled_EyelessDog.Value = SkinwalkerConfig.VoiceEnabled_EyelessDog.Value; VoiceEnabled_ForestGiant.Value = SkinwalkerConfig.VoiceEnabled_ForestGiant.Value; VoiceEnabled_GhostGirl.Value = SkinwalkerConfig.VoiceEnabled_GhostGirl.Value; VoiceEnabled_GiantWorm.Value = SkinwalkerConfig.VoiceEnabled_GiantWorm.Value; VoiceEnabled_HoardingBug.Value = SkinwalkerConfig.VoiceEnabled_HoardingBug.Value; VoiceEnabled_Hygrodere.Value = SkinwalkerConfig.VoiceEnabled_Hygrodere.Value; VoiceEnabled_Jester.Value = SkinwalkerConfig.VoiceEnabled_Jester.Value; VoiceEnabled_Masked.Value = SkinwalkerConfig.VoiceEnabled_Masked.Value; VoiceEnabled_Nutcracker.Value = SkinwalkerConfig.VoiceEnabled_Nutcracker.Value; VoiceEnabled_SporeLizard.Value = SkinwalkerConfig.VoiceEnabled_SporeLizard.Value; VoiceEnabled_Thumper.Value = SkinwalkerConfig.VoiceEnabled_Thumper.Value; VoiceEnabled_OtherEnemies.Value = SkinwalkerConfig.VoiceEnabled_OtherEnemies.Value; VoiceLineFrequency.Value = SkinwalkerConfig.VoiceLineFrequency.Value; SkinwalkerLogger.Log("HOST SENDING CONFIG TO CLIENTS"); } SkinwalkerLogger.Log("SkinwalkerNetworkManager Awake"); } public override void OnDestroy() { ((NetworkBehaviour)this).OnDestroy(); SkinwalkerLogger.Log("SkinwalkerNetworkManager OnDestroy"); SkinwalkerModPersistent.Instance?.ClearCache(); } protected override void __initializeVariables() { if (VoiceEnabled_BaboonHawk == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_BaboonHawk cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_BaboonHawk).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_BaboonHawk, "VoiceEnabled_BaboonHawk"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_BaboonHawk); if (VoiceEnabled_Bracken == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Bracken cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Bracken).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Bracken, "VoiceEnabled_Bracken"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Bracken); if (VoiceEnabled_BunkerSpider == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_BunkerSpider cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_BunkerSpider).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_BunkerSpider, "VoiceEnabled_BunkerSpider"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_BunkerSpider); if (VoiceEnabled_Centipede == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Centipede cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Centipede).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Centipede, "VoiceEnabled_Centipede"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Centipede); if (VoiceEnabled_CoilHead == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_CoilHead cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_CoilHead).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_CoilHead, "VoiceEnabled_CoilHead"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_CoilHead); if (VoiceEnabled_EyelessDog == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_EyelessDog cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_EyelessDog).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_EyelessDog, "VoiceEnabled_EyelessDog"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_EyelessDog); if (VoiceEnabled_ForestGiant == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_ForestGiant cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_ForestGiant).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_ForestGiant, "VoiceEnabled_ForestGiant"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_ForestGiant); if (VoiceEnabled_GhostGirl == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_GhostGirl cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_GhostGirl).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_GhostGirl, "VoiceEnabled_GhostGirl"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_GhostGirl); if (VoiceEnabled_GiantWorm == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_GiantWorm cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_GiantWorm).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_GiantWorm, "VoiceEnabled_GiantWorm"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_GiantWorm); if (VoiceEnabled_HoardingBug == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_HoardingBug cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_HoardingBug).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_HoardingBug, "VoiceEnabled_HoardingBug"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_HoardingBug); if (VoiceEnabled_Hygrodere == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Hygrodere cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Hygrodere).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Hygrodere, "VoiceEnabled_Hygrodere"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Hygrodere); if (VoiceEnabled_Jester == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Jester cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Jester).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Jester, "VoiceEnabled_Jester"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Jester); if (VoiceEnabled_Masked == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Masked cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Masked).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Masked, "VoiceEnabled_Masked"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Masked); if (VoiceEnabled_Nutcracker == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Nutcracker cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Nutcracker).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Nutcracker, "VoiceEnabled_Nutcracker"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Nutcracker); if (VoiceEnabled_SporeLizard == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_SporeLizard cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_SporeLizard).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_SporeLizard, "VoiceEnabled_SporeLizard"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_SporeLizard); if (VoiceEnabled_Thumper == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Thumper cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_Thumper).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Thumper, "VoiceEnabled_Thumper"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Thumper); if (VoiceEnabled_OtherEnemies == null) { throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_OtherEnemies cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceEnabled_OtherEnemies).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_OtherEnemies, "VoiceEnabled_OtherEnemies"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_OtherEnemies); if (VoiceLineFrequency == null) { throw new Exception("SkinwalkerNetworkManager.VoiceLineFrequency cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)VoiceLineFrequency).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceLineFrequency, "VoiceLineFrequency"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceLineFrequency); ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "SkinwalkerNetworkManager"; } } } namespace SkinwalkerMod.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("SkinwalkerMod.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] logos { get { object @object = ResourceManager.GetObject("logos", resourceCulture); return (byte[])@object; } } internal Resources() { } } }
plugins/StrangeObjects.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dissonance.Integrations.Unity_NFGO; using GameNetcodeStuff; using HarmonyLib; using StrangeObjects.Patches; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("StrangeObjects")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("StrangeObjects")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e7e087a1-2426-4476-9b63-af35329e5ac2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace StrangeObjects { [BepInPlugin("Bits.StrangeObjects", "Strange Objects", "1.2.0.0")] public class StrangeObjectsBase : BaseUnityPlugin { private const string modGUID = "Bits.StrangeObjects"; private const string modName = "Strange Objects"; private const string modVersion = "1.2.0.0"; private readonly Harmony harmony = new Harmony("Bits.StrangeObjects"); private static StrangeObjectsBase Instance; internal ManualLogSource mls; public static ConfigEntry<int> StrangeObjectSpawnRate { get; private set; } public static ConfigEntry<float> StrangeObjectValueMultiplier { get; private set; } public static ConfigEntry<bool> EnableCurseOfPain { get; private set; } public static ConfigEntry<int> PainLevelOnePlayerDamage { get; private set; } public static ConfigEntry<bool> EnableCurseOfSight { get; private set; } public static ConfigEntry<float> SightLevelOneDrunkDebuff { get; private set; } public static ConfigEntry<float> SightLevelTwoDrunkDebuff { get; private set; } public static ConfigEntry<bool> EnableCurseOfSloth { get; private set; } public static ConfigEntry<float> SlothLevelOneMovementDebuff { get; private set; } public static ConfigEntry<float> SlothLevelTwoMovementDebuff { get; private set; } public static ConfigEntry<bool> EnableCurseOfMidas { get; private set; } public static ConfigEntry<int> MidasMaxScrapValue { get; private set; } public static ConfigEntry<bool> EnableCurseOfVoice { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Bits.StrangeObjects"); StrangeObjectSpawnRate = ((BaseUnityPlugin)this).Config.Bind<int>("General", "SpawnRate", 20, "Probability of a scrap item being strange. 20 means 20% chance. Range 1-100"); StrangeObjectValueMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ValueMultiplier", 0.3f, "Controls how much value strange objects have. 0.3 is 30% higher value. Range 0.0-infinity"); EnableCurseOfPain = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Pain", "EnableCurseofPain", true, "Disables curse if false"); PainLevelOnePlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Curse of Pain", "Level1Pain", 40, "Damage done to player from level one pain curse. Default is 40 same as falling down a cliff twice."); EnableCurseOfSight = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Sight", "EnableCurseofSight", true, "Disables curse if false"); SightLevelOneDrunkDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sight", "Level1DrunkDebuff", 0.2f, "Percentage of Drunkness for Level 1. Default is 20% or 0.2. Range 0.0-1.0"); SightLevelTwoDrunkDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sight", "Level2DrunkDebuff", 1f, "Percentage of Drunkness for Level 2. Default is 100% or 1.0. Range 0.0-1.0"); EnableCurseOfSloth = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Sloth", "EnableCurseofSloth", true, "Disables curse if false"); SlothLevelOneMovementDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sloth", "Level1MovementDebuff", 0.75f, "Percentage of Movement Speed after Level 1 Debuff. Default is 75% or 0.75. Range 0.0-1.0"); SlothLevelTwoMovementDebuff = ((BaseUnityPlugin)this).Config.Bind<float>("Curse of Sloth", "Level2MovementDebuff", 0.5f, "Percentage of Movement Speed after Level 2 Debuff. Default is 50% or 0.5. Range 0.0-1.0"); EnableCurseOfMidas = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Midas", "EnableCurseofMidas", true, "Disables curse if false"); MidasMaxScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("Curse of Midas", "MaxValueShinyObjects", 100, "This is the maximum scrap value a shiny object can randomly roll"); EnableCurseOfVoice = ((BaseUnityPlugin)this).Config.Bind<bool>("Curse of Voice", "EnableCurseofVoice", false, "Disables curse if false"); harmony.PatchAll(typeof(StrangeObjectsBase)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(SpawnScrapInLevelPatch)); harmony.PatchAll(typeof(GrabbleObjectPatch)); harmony.PatchAll(typeof(HUDManagerPatch)); harmony.PatchAll(typeof(NegativeEffectPatch)); harmony.PatchAll(typeof(ShipLeavingPatch)); harmony.PatchAll(typeof(VoiceRefreshPatch)); harmony.PatchAll(typeof(SyncScrapValuesPatch)); harmony.PatchAll(typeof(PlaceObjectPatch)); harmony.PatchAll(typeof(DropAllItemsPatch)); } } } namespace StrangeObjects.Patches { [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class DropAllItemsPatch { [HarmonyPostfix] private static void removeCurseEffectPatch(ref float ___drunkness, ref float ___movementSpeed) { ___drunkness = 0f; ___movementSpeed = 4.6f; if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f; GameNetworkManager.Instance.localPlayerController.voiceMuffledByEnemy = false; StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } } } [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbleObjectPatch { [HarmonyPatch("SetScrapValue")] [HarmonyPostfix] private static void SubtextPatch(ref GrabbableObject __instance, ref Item ___itemProperties) { if (__instance.scrapValue < 900 && !(___itemProperties.batteryUsage >= 900f)) { return; } List<string> list = new List<string> { "Strange", "Painful", "Sloth", "Shiny", "Tipsy", "Silent" }; if (__instance.scrapValue >= 9000) { ___itemProperties.batteryUsage = 999f; GrabbableObject obj = __instance; obj.scrapValue -= 9999; } Random random = new Random(__instance.scrapValue + __instance.itemProperties.minValue + __instance.itemProperties.maxValue + (int)__instance.itemProperties.weight); char c = (char)(65 + random.Next(0, 26)); string text = random.Next(0, 10).ToString() + random.Next(0, 10); ScanNodeProperties componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren<ScanNodeProperties>(); if (!((Object)(object)componentInChildren == (Object)null)) { string[] array = componentInChildren.headerText.Split(new char[1] { ' ' }); if (array.Length != 0 && !list.Contains(array[0])) { componentInChildren.headerText = "Strange " + componentInChildren.headerText; } componentInChildren.subText = $"Value: ${__instance.scrapValue}" + " \nObject: " + c + "-" + text; componentInChildren.scrapValue = __instance.scrapValue; } } } [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { [HarmonyPatch("UpdateScanNodes")] [HarmonyPostfix] private static void SubtextPatch(ref HUDManager __instance, ref TextMeshProUGUI[] ___scanElementText, ref RectTransform[] ___scanElements) { for (int i = 0; i < ___scanElements.Length; i++) { try { ___scanElementText = ((Component)___scanElements[i]).gameObject.GetComponentsInChildren<TextMeshProUGUI>(); if (___scanElementText.Length > 1) { string[] array = ((TMP_Text)___scanElementText[1]).text.Split(new char[1] { ' ' }); if (array.Length > 2 && array[2] == "\nObject:") { ((Component)___scanElements[i]).GetComponent<Animator>().SetInteger("colorNumber", 1); } } } catch (Exception arg) { Debug.LogError((object)$"Error in updatescanNodes F: {arg}"); } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class NegativeEffectPatch { [HarmonyPatch("GrabObject")] [HarmonyPostfix] private static void grabObjectPatch(ref bool ___grabInvalidated, ref GrabbableObject ___currentlyGrabbingObject, ref float ___insanityLevel, ref float ___maxSlideFriction) { if (___grabInvalidated) { return; } if (___currentlyGrabbingObject.itemProperties.batteryUsage == 995f) { Random random = new Random(); Random random2 = new Random(); ___currentlyGrabbingObject.scrapValue = random.Next(1, random2.Next(10, Math.Min(___currentlyGrabbingObject.itemProperties.maxValue, StrangeObjectsBase.MidasMaxScrapValue.Value))); } if (___currentlyGrabbingObject.itemProperties.batteryUsage == 999f) { Random random3 = new Random(___currentlyGrabbingObject.scrapValue + ___currentlyGrabbingObject.itemProperties.minValue + ___currentlyGrabbingObject.itemProperties.maxValue + (int)___currentlyGrabbingObject.itemProperties.weight); List<float> list = new List<float>(); if (StrangeObjectsBase.EnableCurseOfPain.Value) { list.Add(998f); } if (StrangeObjectsBase.EnableCurseOfSight.Value) { list.Add(997f); } if (StrangeObjectsBase.EnableCurseOfSloth.Value) { list.Add(996f); } if (StrangeObjectsBase.EnableCurseOfMidas.Value) { list.Add(995f); } if (StrangeObjectsBase.EnableCurseOfVoice.Value) { list.Add(994f); } if (list.Count == 0) { return; } int index = random3.Next(0, list.Count); float batteryUsage = list[index]; ___currentlyGrabbingObject.itemProperties.batteryUsage = batteryUsage; if (___currentlyGrabbingObject.itemProperties.batteryUsage == 995f) { Random random4 = new Random(); Random random5 = new Random(); ___currentlyGrabbingObject.scrapValue = random4.Next(1, random5.Next(10, Math.Min(___currentlyGrabbingObject.itemProperties.maxValue, StrangeObjectsBase.MidasMaxScrapValue.Value))); } ___insanityLevel += 10f; ScanNodeProperties componentInChildren = ((Component)___currentlyGrabbingObject).gameObject.GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren != (Object)null) { string[] array = componentInChildren.headerText.Split(new char[1] { ' ' }); if (___currentlyGrabbingObject.itemProperties.batteryUsage == 997f) { array[0] = "Tipsy"; } if (___currentlyGrabbingObject.itemProperties.batteryUsage == 998f) { array[0] = "Painful"; } if (___currentlyGrabbingObject.itemProperties.batteryUsage == 996f) { array[0] = "Sloth"; } if (___currentlyGrabbingObject.itemProperties.batteryUsage == 995f) { array[0] = "Shiny"; } if (___currentlyGrabbingObject.itemProperties.batteryUsage == 994f) { array[0] = "Silent"; } componentInChildren.headerText = string.Join(" ", array); } } ___currentlyGrabbingObject.SetScrapValue(___currentlyGrabbingObject.scrapValue); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class PlaceObjectPatch { [HarmonyPostfix] private static void removeCurseEffectPatch(GrabbableObject placeObject, ref float ___drunkness, ref float ___movementSpeed) { if (placeObject.itemProperties.batteryUsage == 997f) { ___drunkness = 0f; } if (placeObject.itemProperties.batteryUsage == 996f) { ___movementSpeed = 4.6f; } if (placeObject.itemProperties.batteryUsage == 994f && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f; GameNetworkManager.Instance.localPlayerController.voiceMuffledByEnemy = false; StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void addNegativePatch(ref PlayerControllerB __instance, ref GrabbableObject[] ___ItemSlots, ref float ___maxSlideFriction, ref float ___drunkness, ref float ___movementSpeed, ref bool ___isPlayerDead, ref bool ___isPlayerControlled) { //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) if (___isPlayerDead || !___isPlayerControlled) { ___drunkness = 0f; ___movementSpeed = 4.6f; if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f; } return; } int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; List<int> list = new List<int>(); for (int i = 0; i < ___ItemSlots.Length; i++) { if (!((Object)(object)___ItemSlots[i] == (Object)null)) { if (___ItemSlots[i].itemProperties.batteryUsage == 998f) { num++; num2++; list.Add(i); } if (___ItemSlots[i].itemProperties.batteryUsage == 997f) { num++; num3++; } if (___ItemSlots[i].itemProperties.batteryUsage == 996f) { num++; num4++; } if (___ItemSlots[i].itemProperties.batteryUsage == 995f) { num++; num5++; } if (___ItemSlots[i].itemProperties.batteryUsage == 994f) { num++; num6++; } } } if (num3 == 1) { ___drunkness = StrangeObjectsBase.SightLevelOneDrunkDebuff.Value; } if (num >= 2 && num3 >= 1) { ___drunkness = StrangeObjectsBase.SightLevelTwoDrunkDebuff.Value; } if (num2 == 1) { __instance.DamagePlayer(StrangeObjectsBase.PainLevelOnePlayerDamage.Value, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); for (int j = 0; j < list.Count; j++) { ___ItemSlots[list[j]].itemProperties.batteryUsage = 999f; } } if (num4 == 1) { ___movementSpeed = 4.6f * StrangeObjectsBase.SlothLevelOneMovementDebuff.Value; } if (num >= 2 && num4 >= 1) { ___movementSpeed = 4.6f * StrangeObjectsBase.SlothLevelTwoMovementDebuff.Value; } if (num6 == 1 && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { GameNetworkManager.Instance.localPlayerController.maxSlideFriction = -5f; StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } } } [HarmonyPatch(typeof(ElevatorAnimationEvents))] internal class ShipLeavingPatch { [HarmonyPatch("ElevatorFullyRunning")] [HarmonyPostfix] private static void adjustMaxSlideFrictionPatch() { if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { GameNetworkManager.Instance.localPlayerController.drunkness = 0f; GameNetworkManager.Instance.localPlayerController.movementSpeed = 4.6f; GameNetworkManager.Instance.localPlayerController.maxSlideFriction = 0f; GameNetworkManager.Instance.localPlayerController.voiceMuffledByEnemy = false; StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class SpawnScrapInLevelPatch { private static FieldInfo f_someField = AccessTools.Field(typeof(GrabbableObject), "fallTime"); private static FieldInfo f_someField_2 = AccessTools.Field(typeof(GrabbableObject), "scrapValue"); private static FieldInfo f_someField_3 = AccessTools.Field(typeof(GrabbableObject), "itemProperties"); private static FieldInfo f_someField_4 = AccessTools.Field(typeof(Item), "batteryUsage"); private static FieldInfo f_someField_5 = AccessTools.Field(typeof(RoundManager), "scrapValueMultiplier"); private static MethodInfo m_randomChance = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => randomChance())); private static MethodInfo m_multiValue = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => multiValue())); private static MethodInfo m_listCount = typeof(List<int>).GetProperty("Count").GetGetMethod(); private static MethodInfo m_listGet = typeof(List<int>).GetProperty("Item").GetGetMethod(); private static MethodInfo m_listSet = typeof(List<int>).GetProperty("Item").GetSetMethod(); private static MethodInfo getComponentGenericMethod = AccessTools.Method(typeof(Component), "GetComponent", new Type[0], (Type[])null); private static MethodInfo m_component = getComponentGenericMethod.MakeGenericMethod(typeof(GrabbableObject)); private static int myClamp(int value) { if (value < 1) { return 1; } if (value > 100) { return 100; } return value; } private static float multiValue() { return StrangeObjectsBase.StrangeObjectValueMultiplier.Value; } private static int randomChance() { Random random = new Random(); int result = 0; if (random.Next(0, 100) < myClamp(StrangeObjectsBase.StrangeObjectSpawnRate.Value)) { result = 1; } return result; } private static IEnumerable<CodeInstruction> Transpiler(ILGenerator generator, IEnumerable<CodeInstruction> instructions) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Expected O, but got Unknown //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Expected O, but got Unknown //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Expected O, but got Unknown //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Expected O, but got Unknown //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Expected O, but got Unknown //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Expected O, but got Unknown //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Expected O, but got Unknown //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Expected O, but got Unknown //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Expected O, but got Unknown //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Expected O, but got Unknown //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Expected O, but got Unknown //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Expected O, but got Unknown //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Expected O, but got Unknown //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Expected O, but got Unknown //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Expected O, but got Unknown //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Expected O, but got Unknown List<CodeInstruction> list = instructions.ToList(); bool flag = false; bool flag2 = false; Label label = generator.DefineLabel(); Label label2 = generator.DefineLabel(); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.StoresField(list[i], f_someField) && !flag) { list.Insert(i + 1, new CodeInstruction(OpCodes.Nop, (object)null) { labels = new List<Label> { label } }); list.Insert(i + 1, new CodeInstruction(OpCodes.Stfld, (object)f_someField_5)); list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_multiValue)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldfld, (object)f_someField_5)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Beq_S, (object)label)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4, (object)0)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_S, (object)1)); list.Insert(i + 1, new CodeInstruction(OpCodes.Stloc_S, (object)1)); list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_randomChance)); flag = true; } if (CodeInstructionExtensions.StoresField(list[i], f_someField_2) && !flag2) { list.Insert(i + 1, new CodeInstruction(OpCodes.Nop, (object)null) { labels = new List<Label> { label2 } }); list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listSet)); list.Insert(i + 1, new CodeInstruction(OpCodes.Add, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4, (object)9999)); list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listGet)); list.Insert(i + 1, new CodeInstruction(OpCodes.Sub, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4_1, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listCount)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_2, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_2, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Sub, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4_1, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_listCount)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_2, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_2, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Stfld, (object)f_someField_5)); list.Insert(i + 1, new CodeInstruction(OpCodes.Sub, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Callvirt, (object)m_multiValue)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldfld, (object)f_someField_5)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Beq_S, (object)label2)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldc_I4, (object)0)); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldloc_S, (object)1)); flag2 = true; } } return list; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class SyncScrapValuesPatch { [HarmonyPostfix] private static void fixScrapTotalPatch(int[] allScrapValue, ref float ___totalScrapValueInLevel) { int num = 0; if (allScrapValue != null) { for (int i = 0; i < allScrapValue.Length; i++) { num = ((allScrapValue[i] < 9000) ? (num + allScrapValue[i]) : (num + (allScrapValue[i] - 9999))); } } ___totalScrapValueInLevel = num; } } [HarmonyPatch(typeof(StartOfRound))] internal class VoiceRefreshPatch { [HarmonyPatch("RefreshPlayerVoicePlaybackObjects")] [HarmonyPostfix] private static void addMufflePatch(ref PlayerControllerB[] ___allPlayerScripts) { if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return; } PlayerVoiceIngameSettings[] array = Object.FindObjectsOfType<PlayerVoiceIngameSettings>(true); for (int i = 0; i < ___allPlayerScripts.Length; i++) { PlayerControllerB val = ___allPlayerScripts[i]; if (!val.isPlayerControlled && !val.isPlayerDead) { continue; } for (int j = 0; j < array.Length; j++) { if (array[j]._playerState == null) { array[j].FindPlayerIfNull(); if (array[j]._playerState != null) { } } else if (((Behaviour)array[j]).isActiveAndEnabled && array[j]._playerState.Name == ((Component)val).gameObject.GetComponentInChildren<NfgoPlayer>().PlayerId) { val.voicePlayerState = array[j]._playerState; val.currentVoiceChatAudioSource = array[j].voiceAudio; val.currentVoiceChatIngameSettings = array[j]; val.currentVoiceChatAudioSource.outputAudioMixerGroup = SoundManager.Instance.playerVoiceMixers[val.playerClientId]; if (GameNetworkManager.Instance.localPlayerController.maxSlideFriction == -5f) { ((Component)val.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 5f; OccludeAudio component = ((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>(); component.overridingLowPass = true; component.lowPassOverride = 500f; Debug.Log((object)$"Applied Muffle to player voice object #{j} and player object #{i}"); val.voiceMuffledByEnemy = true; } else { ((Component)val.currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>().lowpassResonanceQ = 1f; OccludeAudio component2 = ((Component)val.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>(); component2.overridingLowPass = false; component2.lowPassOverride = 20000f; val.voiceMuffledByEnemy = false; } } } } } } }
plugins/YippeeMod.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using YippeeMod.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("YippeeMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("YippeeMod")] [assembly: AssemblyTitle("YippeeMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace YippeeMod { [BepInPlugin("sunnobunno.YippeeMod", "Yippee tbh mod", "1.2.3")] public class YippeeModBase : BaseUnityPlugin { private const string modGUID = "sunnobunno.YippeeMod"; private const string modName = "Yippee tbh mod"; private const string modVersion = "1.2.3"; private readonly Harmony harmony = new Harmony("sunnobunno.YippeeMod"); private static YippeeModBase? Instance; internal ManualLogSource? mls; internal static AudioClip[]? newSFX; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("sunnobunno.YippeeMod"); mls.LogInfo((object)"sunnobunno.YippeeMod is loading."); string location = ((BaseUnityPlugin)Instance).Info.Location; string text = "YippeeMod.dll"; string text2 = location.TrimEnd(text.ToCharArray()); string text3 = text2 + "yippeesound"; AssetBundle val = AssetBundle.LoadFromFile(text3); if ((Object)(object)val == (Object)null) { mls.LogError((object)"Failed to load audio assets!"); return; } newSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/yippee-tbh.mp3"); harmony.PatchAll(typeof(HoarderBugPatch)); mls.LogInfo((object)"sunnobunno.YippeeMod is loaded. Yippee!!!"); } } } namespace YippeeMod.Patches { [HarmonyPatch(typeof(HoarderBugAI))] internal class HoarderBugPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void hoarderBugAudioPatch(ref AudioClip[] ___chitterSFX) { AudioClip[] newSFX = YippeeModBase.newSFX; ___chitterSFX = newSFX; } } }
plugins/YippeeScrap/SharedUtils.dll
Decompiled 10 months agousing System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx.Logging; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [CompilerGenerated] [EditorBrowsable(EditorBrowsableState.Never)] [GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)] internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1 { private struct MonoScriptData { public byte[] FilePathsData; public byte[] TypesData; public int TotalTypes; public int TotalFiles; public bool IsEditorOnly; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static MonoScriptData Get() { MonoScriptData result = default(MonoScriptData); result.FilePathsData = new byte[85] { 0, 0, 0, 1, 0, 0, 0, 34, 92, 65, 115, 115, 101, 116, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 83, 104, 97, 114, 101, 100, 92, 76, 111, 103, 85, 116, 105, 108, 115, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 35, 92, 65, 115, 115, 101, 116, 115, 92, 83, 99, 114, 105, 112, 116, 115, 92, 83, 104, 97, 114, 101, 100, 92, 80, 97, 116, 104, 85, 116, 105, 108, 115, 46, 99, 115 }; result.TypesData = new byte[51] { 0, 0, 0, 0, 20, 83, 104, 97, 114, 101, 100, 85, 116, 105, 108, 115, 124, 76, 111, 103, 85, 116, 105, 108, 115, 0, 0, 0, 0, 21, 83, 104, 97, 114, 101, 100, 85, 116, 105, 108, 115, 124, 80, 97, 116, 104, 85, 116, 105, 108, 115 }; result.TotalFiles = 2; result.TotalTypes = 2; result.IsEditorOnly = false; return result; } } namespace SharedUtils; public static class LogUtils { private static Dictionary<Assembly, ManualLogSource> logSources = new Dictionary<Assembly, ManualLogSource>(); public static void Init(string pluginGuid) { Assembly callingAssembly = Assembly.GetCallingAssembly(); if (!logSources.ContainsKey(callingAssembly)) { logSources.Add(callingAssembly, Logger.CreateLogSource(pluginGuid)); } } public static void LogInfo(string message) { logSources[Assembly.GetCallingAssembly()].LogInfo((object)message); } public static void LogWarning(string message) { logSources[Assembly.GetCallingAssembly()].LogWarning((object)message); } public static void LogError(string message) { logSources[Assembly.GetCallingAssembly()].LogError((object)message); } public static void LogFatal(string message) { logSources[Assembly.GetCallingAssembly()].LogFatal((object)message); } } public static class PathUtils { public static string PathForResourceInAssembly(string resourceName, Assembly assembly = null) { return Path.Combine(Path.GetDirectoryName((assembly ?? Assembly.GetCallingAssembly()).Location), resourceName); } }
plugins/YippeeScrap/YippeeScrap.dll
Decompiled 10 months agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using LethalConfig; using LethalConfig.ConfigItems; using LethalLib.Modules; using SharedUtils; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; using YippeeScrap.Assets.Mods.Yippee; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [CompilerGenerated] [EditorBrowsable(EditorBrowsableState.Never)] [GeneratedCode("Unity.MonoScriptGenerator.MonoScriptInfoGenerator", null)] internal class UnitySourceGeneratedAssemblyMonoScriptTypes_v1 { private struct MonoScriptData { public byte[] FilePathsData; public byte[] TypesData; public int TotalTypes; public int TotalFiles; public bool IsEditorOnly; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static MonoScriptData Get() { MonoScriptData result = default(MonoScriptData); result.FilePathsData = new byte[179] { 0, 0, 0, 1, 0, 0, 0, 41, 92, 65, 115, 115, 101, 116, 115, 92, 77, 111, 100, 115, 92, 89, 105, 112, 112, 101, 101, 92, 76, 101, 116, 104, 97, 108, 67, 111, 110, 102, 105, 103, 67, 111, 109, 112, 97, 116, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 29, 92, 65, 115, 115, 101, 116, 115, 92, 77, 111, 100, 115, 92, 89, 105, 112, 112, 101, 101, 92, 80, 108, 117, 103, 105, 110, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 33, 92, 65, 115, 115, 101, 116, 115, 92, 77, 111, 100, 115, 92, 89, 105, 112, 112, 101, 101, 92, 80, 108, 117, 103, 105, 110, 73, 110, 102, 111, 46, 99, 115, 0, 0, 0, 1, 0, 0, 0, 44, 92, 65, 115, 115, 101, 116, 115, 92, 77, 111, 100, 115, 92, 89, 105, 112, 112, 101, 101, 92, 85, 116, 105, 108, 115, 92, 65, 117, 100, 105, 111, 77, 105, 120, 101, 114, 70, 105, 120, 101, 114, 46, 99, 115 }; result.TypesData = new byte[136] { 0, 0, 0, 0, 49, 89, 105, 112, 112, 101, 101, 83, 99, 114, 97, 112, 46, 65, 115, 115, 101, 116, 115, 46, 77, 111, 100, 115, 46, 89, 105, 112, 112, 101, 101, 124, 76, 101, 116, 104, 97, 108, 67, 111, 110, 102, 105, 103, 67, 111, 109, 112, 97, 116, 0, 0, 0, 0, 18, 89, 105, 112, 112, 101, 101, 83, 99, 114, 97, 112, 124, 80, 108, 117, 103, 105, 110, 0, 0, 0, 0, 22, 89, 105, 112, 112, 101, 101, 83, 99, 114, 97, 112, 124, 80, 108, 117, 103, 105, 110, 73, 110, 102, 111, 0, 0, 0, 0, 27, 89, 105, 112, 112, 101, 101, 83, 99, 114, 97, 112, 124, 65, 117, 100, 105, 111, 77, 105, 120, 101, 114, 70, 105, 120, 101, 114 }; result.TotalFiles = 4; result.TotalTypes = 4; result.IsEditorOnly = false; return result; } } namespace YippeeScrap { [BepInPlugin("ainavt.lc.yippee", "YippeeScrap", "1.0.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private static Plugin instance; private static AssetBundle assetBundle; private static ConfigEntry<int> configRarity; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } LogUtils.Init("ainavt.lc.yippee"); LoadScrap(PathUtils.PathForResourceInAssembly("ainavt_yippee", (Assembly)null), "Assets/mods/Yippee/Yippee.asset", "Yippee"); LogUtils.LogInfo("YippeeScrap loaded!"); } private void LoadScrap(string assetBundlePath, string innerAssetPath, string name) { //IL_0016: 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: Expected O, but got Unknown //IL_0044: Expected O, but got Unknown configRarity = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("General", name + " Rarity"), 30, new ConfigDescription("How often " + name + " will show up. Higher value means more likely to show up", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); assetBundle = AssetBundle.LoadFromFile(assetBundlePath); Item val = assetBundle.LoadAsset<Item>(innerAssetPath); if ((Object)(object)val == (Object)null) { LogUtils.LogError("Failed to load " + name + " assets."); } else { NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, configRarity.Value, (LevelTypes)(-1)); LogUtils.LogInfo(name + " scrap loaded!"); } if (LethalConfigCompat.IsAvailable) { LethalConfigCompat.AddIntSlider(configRarity, restartRequired: true); } } } [StructLayout(LayoutKind.Sequential, Size = 1)] internal struct PluginInfo { public const string Guid = "ainavt.lc.yippee"; public const string Name = "YippeeScrap"; public const string Version = "1.0.7"; } public class AudioMixerFixer : MonoBehaviour { private static AudioMixerGroup _masterDiageticMixer; [SerializeField] private List<AudioSource> sourcesToFix; public static AudioMixerGroup MasterDiageticMixer { get { if ((Object)(object)_masterDiageticMixer == (Object)null) { AudioSource? obj = (from p in ((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().NetworkConfig.Prefabs.Prefabs select p.Prefab.GetComponentInChildren<NoisemakerProp>() into p where (Object)(object)p != (Object)null select ((Component)p).GetComponentInChildren<AudioSource>() into p where (Object)(object)p != (Object)null select p).FirstOrDefault(); if ((Object)(object)obj == (Object)null) { throw new Exception("Failed to locate a suitable AudioSource output mixer to reference! Could you be calling this method before the GameNetworkManager is initialized?"); } _masterDiageticMixer = obj.outputAudioMixerGroup; } return _masterDiageticMixer; } } private void Start() { AudioSource[] componentsInChildren = ((Component)this).GetComponentsInChildren<AudioSource>(); foreach (AudioSource item in componentsInChildren) { if (!sourcesToFix.Contains(item)) { sourcesToFix.Add(item); } } foreach (AudioSource item2 in sourcesToFix) { LogUtils.LogInfo("Replaced source to diagetic mixer."); item2.outputAudioMixerGroup = MasterDiageticMixer; } } } } namespace YippeeScrap.Assets.Mods.Yippee { internal static class LethalConfigCompat { public const string GUID = "ainavt.lc.lethalconfig"; public static bool IsAvailable => Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddIntSlider(ConfigEntry<int> entry, bool restartRequired) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(entry, restartRequired)); } } }