using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DigitalRuby.ThunderAndLightning; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib.Extras; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using ProfanityFilter; using Steamworks; using TMPro; using TwitchChatAPI; using TwitchChatAPI.Objects; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Networking; using com.github.zehsteam.TakeyPlush.Data; using com.github.zehsteam.TakeyPlush.Dependencies; using com.github.zehsteam.TakeyPlush.Enums; using com.github.zehsteam.TakeyPlush.Extensions; using com.github.zehsteam.TakeyPlush.Helpers; using com.github.zehsteam.TakeyPlush.Managers; using com.github.zehsteam.TakeyPlush.MonoBehaviours; using com.github.zehsteam.TakeyPlush.NetcodePatcher; using com.github.zehsteam.TakeyPlush.Objects; using com.github.zehsteam.TakeyPlush.Patches; using com.github.zehsteam.TakeyPlush.TTS; using com.github.zehsteam.TakeyPlush.TTS.Objects; using com.github.zehsteam.TakeyPlush.TTS.Voices; using com.github.zehsteam.ZombiesPlush.MonoBehaviours; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Zehs")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2026 Zehs")] [assembly: AssemblyDescription("Adds 3 scrap, 1 store item, and 1 decor. The Smol Takey plushie has over 22 variants with each one having a unique appearence, special abilities, and interactions. There are more secrets to be discovered \ud83d\ude08")] [assembly: AssemblyFileVersion("1.22.0.0")] [assembly: AssemblyInformationalVersion("1.22.0+99a445c6ad5d74d9591d52a5a27d4068d9cbcc58")] [assembly: AssemblyProduct("TakeyPlush")] [assembly: AssemblyTitle("com.github.zehsteam.TakeyPlush")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.22.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator { object IEnumerator.Current => _item; T IEnumerator.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => 1; T IReadOnlyList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection.Count => 1; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return EqualityComparer.Default.Equals(_item, item); } void ICollection.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { if (!EqualityComparer.Default.Equals(_item, item)) { return -1; } return 0; } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } 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 com.github.zehsteam.TakeyPlush { internal static class Assets { public static AssetBundle AssetBundle { get; private set; } public static GameObject NetworkHandlerPrefab { get; private set; } public static GameObject PartyExplosionPrefab { get; private set; } public static GameObject TakeyALOOEventReceiverPrefab { get; private set; } public static GameObject CuteSandSpiderPrefab { get; private set; } public static GameObject TakeyButlerControllerPrefab { get; private set; } public static Item SmolTakey { get; private set; } public static Item TakeyBox { get; private set; } public static Item TakeyMug { get; private set; } public static TakeyVariantDataList TakeyVariantDataList { get; private set; } public static Item Takeypack { get; private set; } public static TerminalNode Takeypack_TerminalNode { get; private set; } public static UnlockableItemDef TakeyMugShelf { get; private set; } public static TerminalNode TakeyMugShelf_TerminalNode { get; private set; } public static AudioClip BlubbersYameteKudasaiSFX { get; private set; } public static AudioClip BushWolfHit1SFX { get; private set; } public static AudioClip BushWolfHit2SFX { get; private set; } public static AudioClip BushWolfHit3SFX { get; private set; } public static AudioClip BushWolfDogHit1SFX { get; private set; } public static AudioClip BushWolfDogHit2SFX { get; private set; } public static void Load() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = "takeyplush_assets"; string text2 = Path.Combine(directoryName, text); if (!File.Exists(text2)) { Logger.LogFatal("Failed to load assets. AssetBundle file could not be found at path \"" + text2 + "\". Make sure the \"" + text + "\" file is in the same folder as the mod's DLL file."); } else { AssetBundle val = AssetBundle.LoadFromFile(text2); if ((Object)(object)val == (Object)null) { Logger.LogFatal("Failed to load assets. AssetBundle is null."); } else { OnAssetBundleLoaded(val); } } } private static void OnAssetBundleLoaded(AssetBundle assetBundle) { AssetBundle = assetBundle; NetworkHandlerPrefab = LoadAsset("NetworkHandler", assetBundle); NetworkHandlerPrefab.AddComponent(); PartyExplosionPrefab = LoadAsset("PartyExplosion", assetBundle); TakeyALOOEventReceiverPrefab = LoadAsset("TakeyALOOEventReceiver", assetBundle); CuteSandSpiderPrefab = LoadAsset("CuteSandSpider", assetBundle); TakeyButlerControllerPrefab = LoadAsset("TakeyButlerController", assetBundle); SmolTakey = LoadAsset("SmolTakey", assetBundle); TakeyBox = LoadAsset("TakeyBox", assetBundle); TakeyMug = LoadAsset("TakeyMug", assetBundle); TakeyVariantDataList = LoadAsset("TakeyVariantDataList", assetBundle); Takeypack = LoadAsset("TakeypackItem", assetBundle); Takeypack_TerminalNode = LoadAsset("TiTerminalNode", assetBundle); TakeyMugShelf = LoadAsset("TakeyMugShelf", assetBundle); TakeyMugShelf_TerminalNode = LoadAsset("TakeyMugShelfBuy", assetBundle); BlubbersYameteKudasaiSFX = LoadAsset("BlubbersYameteKudasaiSFX", assetBundle); BushWolfHit1SFX = LoadAsset("BushWolfHit1SFX", assetBundle); BushWolfHit2SFX = LoadAsset("BushWolfHit2SFX", assetBundle); BushWolfHit3SFX = LoadAsset("BushWolfHit3SFX", assetBundle); BushWolfDogHit1SFX = LoadAsset("BushWolfDogHit1SFX", assetBundle); BushWolfDogHit2SFX = LoadAsset("BushWolfDogHit2SFX", assetBundle); } private static T LoadAsset(string name, AssetBundle assetBundle) where T : Object { if (string.IsNullOrWhiteSpace(name)) { Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" from AssetBundle. Name is null or whitespace."); return default(T); } if ((Object)(object)assetBundle == (Object)null) { Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. AssetBundle is null."); return default(T); } T val = assetBundle.LoadAsset(name); if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. No asset found with that type and name."); return default(T); } return val; } private static bool TryLoadAsset(string name, AssetBundle assetBundle, out T asset) where T : Object { asset = LoadAsset(name, assetBundle); return (Object)(object)asset != (Object)null; } } internal static class Logger { public static ManualLogSource ManualLogSource { get; private set; } public static void Initialize(ManualLogSource manualLogSource) { ManualLogSource = manualLogSource; } public static void LogDebug(object data, bool extended = false) { Log((LogLevel)32, data, extended); } public static void LogInfo(object data, bool extended = false) { Log((LogLevel)16, data, extended); } public static void LogWarning(object data, bool extended = false) { Log((LogLevel)4, data, extended); } public static void LogError(object data, bool extended = false) { Log((LogLevel)2, data, extended); } public static void LogFatal(object data, bool extended = false) { Log((LogLevel)1, data, extended); } public static void Log(LogLevel logLevel, object data, bool extended = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!extended || IsExtendedLoggingEnabled()) { ManualLogSource manualLogSource = ManualLogSource; if (manualLogSource != null) { manualLogSource.Log(logLevel, data); } } } public static bool IsExtendedLoggingEnabled() { return ConfigManager.ExtendedLogging?.Value ?? false; } } [BepInPlugin("com.github.zehsteam.TakeyPlush", "TakeyPlush", "1.22.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("com.github.zehsteam.TakeyPlush"); public static Plugin Instance { get; private set; } internal static JsonSave GlobalSave { get; private set; } internal static JsonSave ModpackSave { get; private set; } private void Awake() { Instance = this; Logger.Initialize(Logger.CreateLogSource("com.github.zehsteam.TakeyPlush")); Logger.LogInfo("TakeyPlush has awoken!"); _harmony.PatchAll(typeof(GameNetworkManagerPatch)); _harmony.PatchAll(typeof(StartOfRoundPatch)); _harmony.PatchAll(typeof(RoundManagerPatch)); _harmony.PatchAll(typeof(TimeOfDayPatch)); _harmony.PatchAll(typeof(HUDManagerPatch)); _harmony.PatchAll(typeof(ShipBuildModeManagerPatch)); _harmony.PatchAll(typeof(TerminalPatch)); _harmony.PatchAll(typeof(ItemDropshipPatch)); _harmony.PatchAll(typeof(EntranceTeleportPatch)); _harmony.PatchAll(typeof(PlayerControllerBPatch)); _harmony.PatchAll(typeof(EnemyAIPatch)); _harmony.PatchAll(typeof(HoarderBugAIPatch)); _harmony.PatchAll(typeof(BaboonBirdAIPatch)); _harmony.PatchAll(typeof(PufferAIPatch)); _harmony.PatchAll(typeof(BushWolfEnemyPatch)); _harmony.PatchAll(typeof(MouthDogAIPatch)); _harmony.PatchAll(typeof(MaskedPlayerEnemyPatch)); _harmony.PatchAll(typeof(ForestGiantAIPatch)); _harmony.PatchAll(typeof(SandSpiderAIPatch)); _harmony.PatchAll(typeof(ButlerEnemyAIPatch)); _harmony.PatchAll(typeof(GrabbableObjectPatch)); _harmony.PatchAll(typeof(JetpackItemPatch)); GlobalSave = new JsonSave(Utils.GetPluginPersistentDataPath(), "GlobalSave"); ModpackSave = new JsonSave(Paths.ConfigPath, "TakeyPlush_Save.json"); Assets.Load(); ConfigManager.Initialize(((BaseUnityPlugin)this).Config); if (TwitchChatAPIProxy.Enabled) { TwitchChatAPIProxy.Initialize(); } RegisterScrapItems(); RegisterShopItems(); RegisterUnlockableItems(); SeasonalHandler.Update(); NetworkUtils.NetcodePatcherAwake(); } private void RegisterScrapItems() { ItemHelper.RegisterScrap(ConfigManager.SmolTakey); ItemHelper.RegisterScrap(ConfigManager.TakeyBox); ItemHelper.RegisterScrap(ConfigManager.TakeyMug); } private void RegisterShopItems() { } private void RegisterUnlockableItems() { UnlockableItemHelper.RegisterUnlockable(ConfigManager.TakeyMugShelf, Assets.TakeyMugShelf_TerminalNode); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.zehsteam.TakeyPlush"; public const string PLUGIN_NAME = "TakeyPlush"; public const string PLUGIN_VERSION = "1.22.0"; } } namespace com.github.zehsteam.TakeyPlush.TTS { internal static class TextToSpeech { private static readonly Dictionary _voices; public static IReadOnlyDictionary Voices => _voices; public static string[] VoiceNames => Voices.Values.Select((TTSVoice v) => v.Name).ToArray(); static TextToSpeech() { _voices = new Dictionary(); AddVoice(new TTSVoice_Streamlabs("Brian", "Brian", useForRandomSelection: true)); AddVoice(new TTSVoice_Streamlabs("Salli", "Salli", useForRandomSelection: true)); AddVoice(new TTSVoice_Streamlabs("Justin", "Justin")); AddVoice(new TTSVoice_Streamlabs("Joey", "Joey")); AddVoice(new TTSVoice_Streamlabs("Matthew", "Matthew")); AddVoice(new TTSVoice_Streamlabs("Amy", "Amy")); AddVoice(new TTSVoice_Streamlabs("Emma", "Emma")); AddVoice(new TTSVoice_Streamlabs("Geraint", "Geraint")); AddVoice(new TTSVoice_LazyPy("The Company", "Bing Translator", "en-US-ChristopherNeural")); AddVoice(new TTSVoice_LazyPy("Jessie", "TikTok", "en_us_002")); AddVoice(new TTSVoice_LazyPy("Joey", "TikTok", "en_us_006")); AddVoice(new TTSVoice_LazyPy("C-3PO", "TikTok", "en_us_c3po")); AddVoice(new TTSVoice_LazyPy("Stormtrooper", "TikTok", "en_us_stormtrooper")); AddVoice(new TTSVoice_LazyPy("Ghostface", "TikTok", "en_us_ghostface")); AddVoice(new TTSVoice_LazyPy("Rocket", "TikTok", "en_us_rocket")); AddVoice(new TTSVoice_LazyPy("Grinch", "TikTok", "en_male_grinch")); AddVoice(new TTSVoice_LazyPy("Madame Leota", "TikTok", "en_female_madam_leota")); AddVoice(new TTSVoice_LazyPy("Witch", "TikTok", "en_female_witch")); AddVoice(new TTSVoice_LazyPy("Wizard", "TikTok", "en_male_wizard")); AddVoice(new TTSVoice_LazyPy("Zombie", "TikTok", "en_female_zombie")); AddVoice(new TTSVoice_LazyPy("Werewolf", "TikTok", "en_female_werewolf")); AddVoice(new TTSVoice_LazyPy("Pirate", "TikTok", "en_male_pirate")); AddVoice(new TTSVoice_LazyPy("Santa", "TikTok", "en_male_santa")); AddVoice(new TTSVoice_LazyPy("Santa 2", "TikTok", "en_male_santa_effect")); AddVoice(new TTSVoice_LazyPy("Lord Cringe", "TikTok", "en_male_ukneighbor")); AddVoice(new TTSVoice_LazyPy("Grandma", "TikTok", "en_female_grandma")); } public static List AddVoices(List voices, bool logErrors = true) where T : TTSVoice { List list = new List(); foreach (T voice in voices) { if (AddVoice(voice, logErrors)) { list.Add(voice); } } return list; } public static bool AddVoice(TTSVoice voice, bool logErrors = true) { if (_voices.ContainsKey(voice.Name)) { if (logErrors) { Logger.LogError($"[TextToSpeech] Failed to add voice. Voice with the same name already exists. {voice}"); } return false; } _voices.Add(voice.Name, voice); return true; } public static void RequestAudio(string name, string text, Action onClipReady) { if (!TryGetVoiceByName(name, out var result)) { Logger.LogError("[TextToSpeech] RequestAudio: Failed to find voice by name: \"" + name + "\""); onClipReady(null); } else { result.RequestAudio(text, onClipReady); } } public static TTSVoice GetVoiceByName(string name) { return _voices.GetValueOrDefault(name); } public static bool TryGetVoiceByName(string name, out TTSVoice result) { return _voices.TryGetValue(name, out result); } public static List GetVoicesByService(VoiceService service) { return _voices.Values.Where((TTSVoice v) => v.Service == service).ToList(); } public static string GetRandomVoiceName() { string[] array = (from v in Voices.Values where v.UseForRandomSelection select v.Name).ToArray(); return array[Random.Range(0, array.Length)]; } } } namespace com.github.zehsteam.TakeyPlush.TTS.Voices { public enum VoiceService { Unknown = -1, Streamlabs, LazyPy, TTSMonster } public abstract class TTSVoice { protected const int DEFAULT_VOLUME = 100; protected static string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 OPR/123.0.0.0"; public string Name { get; protected set; } public string VoiceId { get; protected set; } public bool UseForRandomSelection { get; set; } public int DefaultVolume { get; protected set; } = 100; public abstract VoiceService Service { get; } protected TTSVoice(string name, string voiceId, bool useForRandomSelection = false, int defaultVolume = 100) { Name = name; VoiceId = voiceId; UseForRandomSelection = useForRandomSelection; DefaultVolume = defaultVolume; } public virtual void RequestAudio(string text, Action onClipReady) { CoroutineRunner.Start(RequestAudioCoroutine(text, onClipReady)); } public abstract IEnumerator RequestAudioCoroutine(string text, Action onClipReady); protected async Task FetchJsonAsync(string url, WWWForm form, List requestHeaders = null) { LogInfo("Sending POST request to \"" + url + "\"", extended: true); UnityWebRequest www = UnityWebRequest.Post(url, form); try { www.SetRequestHeader("User-Agent", UserAgent); if (requestHeaders != null) { foreach (RequestHeader requestHeader in requestHeaders) { www.SetRequestHeader(requestHeader.Name, requestHeader.Value); } } UnityWebRequestAsyncOperation operation = www.SendWebRequest(); while (!((AsyncOperation)operation).isDone) { await Task.Yield(); } if ((int)www.result == 4) { LogError("Failed to process data: " + www.error, extended: false, displayMessage: true); return null; } if ((int)www.result != 1) { LogError("Failed to fetch audio: " + www.error, extended: false, displayMessage: true); return null; } string text = www.downloadHandler.text; try { JObject val = JObject.Parse(text); LogInfo("Response data:\n" + JsonConvert.SerializeObject((object)val, (Formatting)1), extended: true); return val; } catch (Exception arg) { LogError($"Failed to parse response as JSON:\n\nResponse:\n\"{text}\"\n\nError:\n{arg}"); DisplayMessage("Failed to parse response. Check logs", isError: true); return null; } } finally { ((IDisposable)www)?.Dispose(); } } protected async Task FetchJsonAsync(string url, JObject body, List requestHeaders = null) { LogInfo("Sending POST request to \"" + url + "\"", extended: true); string s = ((body != null) ? ((JToken)body).ToString((Formatting)0, Array.Empty()) : "{}"); byte[] bytes = Encoding.UTF8.GetBytes(s); UnityWebRequest www = new UnityWebRequest(url, "POST"); try { www.uploadHandler = (UploadHandler)new UploadHandlerRaw(bytes); www.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); www.SetRequestHeader("Content-Type", "application/json"); www.SetRequestHeader("User-Agent", UserAgent); if (requestHeaders != null) { foreach (RequestHeader requestHeader in requestHeaders) { www.SetRequestHeader(requestHeader.Name, requestHeader.Value); } } UnityWebRequestAsyncOperation operation = www.SendWebRequest(); while (!((AsyncOperation)operation).isDone) { await Task.Yield(); } if ((int)www.result == 4) { LogError("Failed to process data: " + www.error, extended: false, displayMessage: true); return null; } if ((int)www.result != 1) { LogError("Failed to fetch audio: " + www.error, extended: false, displayMessage: true); LogError(www.downloadHandler.text, extended: true); return null; } string text = www.downloadHandler.text; try { JObject val = JObject.Parse(text); LogInfo("Response data:\n" + JsonConvert.SerializeObject((object)val, (Formatting)1), extended: true); return val; } catch (Exception arg) { LogError($"Failed to parse response as JSON:\n\nResponse:\n\"{text}\"\n\nError:\n{arg}"); DisplayMessage("Failed to parse response. Check logs", isError: true); return null; } } finally { ((IDisposable)www)?.Dispose(); } } protected async Task DownloadAudioClipAsync(string url, AudioType audioType = 13) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) LogInfo("Sending GET request to \"" + url + "\"", extended: true); UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, audioType); try { www.SetRequestHeader("User-Agent", UserAgent); UnityWebRequestAsyncOperation operation = www.SendWebRequest(); while (!((AsyncOperation)operation).isDone) { await Task.Yield(); } if ((int)www.result != 1) { LogError("Failed to download audio: " + www.error, extended: false, displayMessage: true); return null; } try { AudioClip content = DownloadHandlerAudioClip.GetContent(www); ((Object)content).name = string.Format("{0}_{1}_{2}", "TakeyPlush", Name, Guid.NewGuid()); return content; } catch (Exception ex) { LogError("Failed to download audio: " + ex.Message, extended: false, displayMessage: true); return null; } } finally { ((IDisposable)www)?.Dispose(); } } protected void DisplayMessage(string text, bool isError = false) { Utils.DisplayMessage(text, isError); } public override string ToString() { return $"(Name: \"{Name}\", Service: {Service}, VoiceId: \"{VoiceId}\")"; } protected void Log(LogLevel logLevel, object data, bool extended = false, bool displayMessage = false) { //IL_0000: 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_0030: Invalid comparison between Unknown and I4 Logger.Log(logLevel, $"[{GetType().Name}] [{Name}] {data}", extended); if (displayMessage) { DisplayMessage(data.ToString(), (int)logLevel == 2); } } protected void LogInfo(object data, bool extended = false, bool displayMessage = false) { Log((LogLevel)16, data, extended, displayMessage); } protected void LogWarning(object data, bool extended = false, bool displayMessage = false) { Log((LogLevel)4, data, extended, displayMessage); } protected void LogError(object data, bool extended = false, bool displayMessage = false) { Log((LogLevel)2, data, extended, displayMessage); } } public class TTSVoice_LazyPy : TTSVoice { [CompilerGenerated] private sealed class <>c__DisplayClass7_0 { public JObject responseJson; public Action onClipReady; internal void b__0(JObject result) { responseJson = result; } internal void b__1(AudioClip clip) { onClipReady?.Invoke(clip); } } [CompilerGenerated] private sealed class d__7 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Action onClipReady; public TTSVoice_LazyPy <>4__this; public string text; private <>c__DisplayClass7_0 <>8__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown int num = <>1__state; TTSVoice_LazyPy tTSVoice_LazyPy = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; <>8__1 = new <>c__DisplayClass7_0(); <>8__1.onClipReady = onClipReady; string url = "https://lazypy.ro/tts/request_tts.php"; WWWForm val = new WWWForm(); val.AddField("service", tTSVoice_LazyPy.RedirectService); val.AddField("voice", tTSVoice_LazyPy.VoiceId); val.AddField("text", this.text); Task task2 = tTSVoice_LazyPy.FetchJsonAsync(url, val); <>8__1.responseJson = null; <>2__current = Utils.WaitForTask(task2, delegate(JObject result) { <>8__1.responseJson = result; }); <>1__state = 1; return true; } case 1: { <>1__state = -1; if (<>8__1.responseJson == null) { tTSVoice_LazyPy.LogError("Failed to request audio. Response from server is invalid."); <>8__1.onClipReady?.Invoke(null); return false; } JToken obj = <>8__1.responseJson["success"]; if (obj == null || !obj.ToObject()) { string text = ((object)<>8__1.responseJson["error_msg"])?.ToString(); tTSVoice_LazyPy.LogError("Failed to fetch audio: " + text); tTSVoice_LazyPy.DisplayMessage(text, isError: true); <>8__1.onClipReady?.Invoke(null); return false; } string text2 = ((object)<>8__1.responseJson["audio_url"])?.ToString(); if (string.IsNullOrEmpty(text2)) { tTSVoice_LazyPy.LogError("Failed to fetch audio: 'audio_url' is missing.", extended: false, displayMessage: true); <>8__1.onClipReady?.Invoke(null); return false; } Task task = tTSVoice_LazyPy.DownloadAudioClipAsync(text2, (AudioType)13); <>2__current = Utils.WaitForTask(task, delegate(AudioClip clip) { <>8__1.onClipReady?.Invoke(clip); }); <>1__state = 2; return true; } case 2: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public override VoiceService Service => VoiceService.LazyPy; public string RedirectService { get; protected set; } public TTSVoice_LazyPy(string name, string redirectService, string voiceId, bool useForRandomSelection = false, int defaultVolume = 100) : base(name, voiceId, useForRandomSelection, defaultVolume) { RedirectService = redirectService; } [IteratorStateMachine(typeof(d__7))] public override IEnumerator RequestAudioCoroutine(string text, Action onClipReady) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__7(0) { <>4__this = this, text = text, onClipReady = onClipReady }; } } public class TTSVoice_Streamlabs : TTSVoice { [CompilerGenerated] private sealed class <>c__DisplayClass3_0 { public JObject responseJson; public Action onClipReady; internal void b__0(JObject result) { responseJson = result; } internal void b__1(AudioClip clip) { onClipReady?.Invoke(clip); } } [CompilerGenerated] private sealed class d__3 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Action onClipReady; public TTSVoice_Streamlabs <>4__this; public string text; private <>c__DisplayClass3_0 <>8__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown int num = <>1__state; TTSVoice_Streamlabs tTSVoice_Streamlabs = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; <>8__1 = new <>c__DisplayClass3_0(); <>8__1.onClipReady = onClipReady; string url = "https://streamlabs.com/tts/polly/speak"; WWWForm val = new WWWForm(); val.AddField("voice", tTSVoice_Streamlabs.VoiceId); val.AddField("text", this.text); Task task2 = tTSVoice_Streamlabs.FetchJsonAsync(url, val); <>8__1.responseJson = null; <>2__current = Utils.WaitForTask(task2, delegate(JObject result) { <>8__1.responseJson = result; }); <>1__state = 1; return true; } case 1: { <>1__state = -1; if (<>8__1.responseJson == null) { tTSVoice_Streamlabs.LogError("Failed to request audio. Response from server is invalid."); <>8__1.onClipReady?.Invoke(null); return false; } JToken obj = <>8__1.responseJson["success"]; if (obj == null || !obj.ToObject()) { string text = ((object)<>8__1.responseJson["message"])?.ToString(); tTSVoice_Streamlabs.LogError("Failed to fetch audio: " + (object)<>8__1.responseJson["message"]); tTSVoice_Streamlabs.DisplayMessage(text, isError: true); <>8__1.onClipReady?.Invoke(null); return false; } string text2 = ((object)<>8__1.responseJson["speak_url"])?.ToString(); if (string.IsNullOrEmpty(text2)) { tTSVoice_Streamlabs.LogError("Failed to fetch audio: 'speak_url' is missing.", extended: false, displayMessage: true); <>8__1.onClipReady?.Invoke(null); return false; } Task task = tTSVoice_Streamlabs.DownloadAudioClipAsync(text2, (AudioType)13); <>2__current = Utils.WaitForTask(task, delegate(AudioClip clip) { <>8__1.onClipReady?.Invoke(clip); }); <>1__state = 2; return true; } case 2: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public override VoiceService Service => VoiceService.Streamlabs; public TTSVoice_Streamlabs(string name, string voiceId, bool useForRandomSelection = false, int defaultVolume = 100) : base(name, voiceId, useForRandomSelection, defaultVolume) { } [IteratorStateMachine(typeof(d__3))] public override IEnumerator RequestAudioCoroutine(string text, Action onClipReady) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__3(0) { <>4__this = this, text = text, onClipReady = onClipReady }; } } } namespace com.github.zehsteam.TakeyPlush.TTS.Objects { public struct RequestHeader { public string Name { get; set; } public string Value { get; set; } public RequestHeader(string name, string value) { Name = name; Value = value; } } } namespace com.github.zehsteam.TakeyPlush.Patches { [HarmonyPatch(typeof(BaboonBirdAI))] internal static class BaboonBirdAIPatch { [HarmonyPatch("GrabItemAndSync")] [HarmonyPrefix] private static bool GrabItemAndSyncPatch(ref BaboonBirdAI __instance, ref NetworkObject item) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsOwner) { return true; } Takey component = ((Component)item).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { return true; } if ((!component.JetpackFly && !component.IsFlying) || !PlayerUtils.IsPlayerNearby(((Component)__instance).gameObject.transform.position, 25f)) { return true; } if (!component.IsFlying) { component.StartFlyingServerRpc(); } return false; } [HarmonyPatch("DropHeldItemAndSync")] [HarmonyPrefix] private static void DropHeldItemAndSyncPatch(ref BaboonBirdAI __instance) { Takey component = ((Component)__instance.heldScrap).gameObject.GetComponent(); if (!((Object)(object)component == (Object)null)) { component.RollJetpackFlyServerRpc(); } } } [HarmonyPatch(typeof(BushWolfEnemy))] internal static class BushWolfEnemyPatch { private static List _bushWolfsHitByDogs = new List(); [HarmonyPatch("HitEnemy")] [HarmonyPrefix] private static void HitEnemyPatch(ref BushWolfEnemy __instance, ref PlayerControllerB playerWhoHit) { if (ExtraFeatureEnabled()) { bool flag = false; if (_bushWolfsHitByDogs.Contains((EnemyAI)(object)__instance)) { _bushWolfsHitByDogs.Remove((EnemyAI)(object)__instance); flag = (Object)(object)playerWhoHit == (Object)null; } AudioClip[] array = (AudioClip[])(object)((!flag) ? new AudioClip[3] { Assets.BushWolfHit1SFX, Assets.BushWolfHit2SFX, Assets.BushWolfHit3SFX } : new AudioClip[2] { Assets.BushWolfDogHit1SFX, Assets.BushWolfDogHit2SFX }); __instance.hitBushWolfSFX = array[Random.Range(0, array.Length)]; } } [HarmonyPatch("HitTongueLocalClient")] [HarmonyPrefix] private static void HitTongueLocalClientPatch(ref BushWolfEnemy __instance) { if (ExtraFeatureEnabled()) { AudioClip[] array = (AudioClip[])(object)new AudioClip[3] { Assets.BushWolfHit1SFX, Assets.BushWolfHit2SFX, Assets.BushWolfHit3SFX }; __instance.hitBushWolfSFX = array[Random.Range(0, array.Length)]; } } public static void AddBushWolfHitByDog(EnemyAI enemyScript) { if (!_bushWolfsHitByDogs.Contains(enemyScript)) { _bushWolfsHitByDogs.Add(enemyScript); } } private static bool ExtraFeatureEnabled() { if (!ConfigManager.ExtraFeatures_Enabled.Value) { return false; } if (!ConfigManager.ExtraFeatures_EnableSpecialKidnapperFoxSounds.Value) { return false; } return true; } } [HarmonyPatch(typeof(ButlerEnemyAI))] internal static class ButlerEnemyAIPatch { private static Dictionary _takeyButlerControllerPairs; static ButlerEnemyAIPatch() { _takeyButlerControllerPairs = new Dictionary(); Events.OnShipLeave += OnShipLeave; Application.quitting += delegate { Events.OnShipLeave -= OnShipLeave; }; } private static void OnShipLeave() { if (!NetworkUtils.IsServer) { return; } TakeyButlerController[] array = _takeyButlerControllerPairs.Values.ToArray(); TakeyButlerController[] array2 = array; NetworkObject val = default(NetworkObject); foreach (TakeyButlerController takeyButlerController in array2) { if (!((Object)(object)takeyButlerController == (Object)null) && ((Component)takeyButlerController).TryGetComponent(ref val) && val.IsSpawned) { val.Despawn(true); } } _takeyButlerControllerPairs.Clear(); } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref ButlerEnemyAI __instance) { if (!NetworkUtils.IsServer || !ConfigManager.ExtraFeatures_Enabled.Value) { return; } bool flag = false; if (PlayerUtils.IsLocalPlayer(PlayerName.Takerst)) { int num = Plugin.ModpackSave.Load("TimesForceSetTakeyButler", 0); if (num < 5) { Plugin.ModpackSave.Save("TimesForceSetTakeyButler", num + 1); flag = true; } } if (Utils.RollPercentChance(ConfigManager.ExtraFeatures_ButlerReskinChance.Value) || flag) { SetTakeyButlerOnServer(__instance); } } private static void SetTakeyButlerOnServer(ButlerEnemyAI butlerEnemyAI) { if (NetworkUtils.IsServer) { if (_takeyButlerControllerPairs.ContainsKey(butlerEnemyAI)) { Logger.LogError("Failed to set Takey Butler on server. ButlerEnemyAI is already a Takey Butler."); return; } GameObject val = Object.Instantiate(Assets.TakeyButlerControllerPrefab); TakeyButlerController component = val.GetComponent(); NetworkObject component2 = val.GetComponent(); component2.Spawn(true); val.transform.SetParent(((Component)butlerEnemyAI).transform); _takeyButlerControllerPairs.Add(butlerEnemyAI, component); } } [HarmonyPatch("StabPlayerServerRpc")] [HarmonyPostfix] private static void StabPlayerServerRpcPatch(ref ButlerEnemyAI __instance, int playerId) { if (NetworkUtils.IsServer && _takeyButlerControllerPairs.TryGetValue(__instance, out var value)) { PlayerControllerB playerScript = StartOfRound.Instance.allPlayerScripts[playerId]; value.OnStabPlayerOnServer(playerScript); } } } [HarmonyPatch(typeof(EnemyAI))] internal static class EnemyAIPatch { public class EnemyAIHelper : MonoBehaviour { private EnemyAI _enemyAI; private void Awake() { _enemyAI = ((Component)this).GetComponent(); } private void OnEnable() { if (!Instances.Contains(_enemyAI)) { Instances.Add(_enemyAI); } } private void OnDisable() { Instances.Remove(_enemyAI); } } public static List Instances = new List(); [HarmonyPatch("Start")] [HarmonyPrefix] private static void StartPatch(EnemyAI __instance) { ((Component)__instance).gameObject.AddComponent(); } public static List GetInstancesOfType() where T : EnemyAI { List list = new List(); foreach (EnemyAI instance in Instances) { T val = (T)(object)((instance is T) ? instance : null); if (val != null) { list.Add(val); } } return list; } } [HarmonyPatch(typeof(EntranceTeleport))] internal static class EntranceTeleportPatch { public class EntranceTeleportHelper : MonoBehaviour { private EntranceTeleport _entranceTeleport; private void Awake() { _entranceTeleport = ((Component)this).GetComponent(); } private void OnEnable() { if (!Instances.Contains(_entranceTeleport)) { Instances.Add(_entranceTeleport); } } private void OnDisable() { Instances.Remove(_entranceTeleport); } } public static List Instances = new List(); [HarmonyPatch("Awake")] [HarmonyPrefix] private static void StartPatch(EnemyAI __instance) { ((Component)__instance).gameObject.AddComponent(); } } [HarmonyPatch(typeof(ForestGiantAI))] internal static class ForestGiantAIPatch { private static Dictionary _enemiesNearMain; private static Vector3 _mainEntrancePosition; static ForestGiantAIPatch() { _enemiesNearMain = new Dictionary(); Events.OnShipArrived += OnShipArrive; Application.quitting += delegate { Events.OnShipArrived -= OnShipArrive; }; } private static void OnShipArrive() { //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) _enemiesNearMain.Clear(); _mainEntrancePosition = Utils.GetMainEntrancePosition(); } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref ForestGiantAI __instance) { Events.InvokeOnForestGiantSpawned(__instance); } [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch(ref ForestGiantAI __instance) { //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) if (((EnemyAI)__instance).isEnemyDead) { return; } if (!_enemiesNearMain.ContainsKey(__instance)) { _enemiesNearMain.Add(__instance, value: false); } if (!_enemiesNearMain.TryGetValue(__instance, out var value)) { return; } bool flag = Vector3.Distance(((Component)__instance).transform.position, _mainEntrancePosition) <= 25f; if (value != flag) { _enemiesNearMain[__instance] = flag; if (flag) { Events.InvokeOnForestGiantNearMain(__instance); } } } } [HarmonyPatch(typeof(GameNetworkManager))] internal static class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { AddNetworkPrefabs(); } private static void AddNetworkPrefabs() { AddNetworkPrefab(Assets.NetworkHandlerPrefab); AddNetworkPrefab(Assets.TakeyButlerControllerPrefab); foreach (TakeyVariantData variant in Assets.TakeyVariantDataList.Variants) { AddNetworkPrefab(variant.Prefab); } } private static void AddNetworkPrefab(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { Logger.LogError("Failed to register network prefab. GameObject is null."); return; } NetworkManager.Singleton.AddNetworkPrefab(prefab); Logger.LogInfo("Registered \"" + ((Object)prefab).name + "\" network prefab."); } } [HarmonyPatch(typeof(GrabbableObject))] internal static class GrabbableObjectPatch { public class GrabbableObjectHelper : MonoBehaviour { private GrabbableObject _grabbableObject; private void Awake() { _grabbableObject = ((Component)this).GetComponent(); } private void OnEnable() { if (!Instances.Contains(_grabbableObject)) { Instances.Add(_grabbableObject); } } private void OnDisable() { Instances.Remove(_grabbableObject); } } public static List Instances = new List(); public static List TakeyALOOEventReceiverItemWhitelist = new List(2) { "Walkie-talkie", "Old phone" }; [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref GrabbableObject __instance) { ((Component)__instance).gameObject.AddComponent(); string itemName = __instance.itemProperties.itemName; if (TakeyALOOEventReceiverItemWhitelist.Contains(itemName)) { Object.Instantiate(Assets.TakeyALOOEventReceiverPrefab, ((Component)__instance).transform); } if (itemName.Equals("Bell", StringComparison.OrdinalIgnoreCase)) { TrySetGrabbableObjectScanNodeHeaderText_Server(__instance, 50f, "BooBooBrassBell"); } if (itemName.Equals("Toy robot", StringComparison.OrdinalIgnoreCase)) { TrySetGrabbableObjectScanNodeHeaderText_Server(__instance, 50f, "Nick"); } } private static void TrySetGrabbableObjectScanNodeHeaderText_Server(GrabbableObject grabbableObject, float chance, string headerText) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (NetworkUtils.IsServer && !((Object)(object)grabbableObject == (Object)null) && ConfigManager.ExtraFeatures_Enabled.Value && Utils.RollPercentChance(chance) && ((Component)grabbableObject).TryGetComponent(ref val) && val.IsSpawned) { PluginNetworkBehaviour.Instance.SetScanNodeHeaderTextClientRpc(NetworkObjectReference.op_Implicit(val), headerText); } } public static List GetInstancesOfType() where T : GrabbableObject { List list = new List(); foreach (GrabbableObject instance in Instances) { T val = (T)(object)((instance is T) ? instance : null); if (val != null) { list.Add(val); } } return list; } } [HarmonyPatch(typeof(HoarderBugAI))] internal static class HoarderBugAIPatch { [HarmonyPatch("GrabTargetItemIfClose")] [HarmonyPrefix] private static bool GrabTargetItemIfClosePatch(ref HoarderBugAI __instance, ref bool __result) { //IL_0030: 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_008b: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsOwner) { return true; } if ((Object)(object)__instance.targetItem != (Object)null && __instance.heldItem == null && Vector3.Distance(((Component)__instance).transform.position, ((Component)__instance.targetItem).transform.position) < 0.75f) { Takey component = ((Component)__instance.targetItem).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { return true; } if ((!component.JetpackFly && !component.IsFlying) || !PlayerUtils.IsPlayerNearby(((Component)__instance).gameObject.transform.position, 25f)) { return true; } if (!component.IsFlying) { component.StartFlyingServerRpc(); } __result = true; return false; } return true; } [HarmonyPatch("DropItemAndCallDropRPC")] [HarmonyPostfix] private static void DropItemAndCallDropRPCPatch(ref HoarderBugAI __instance, ref NetworkObject dropItemNetworkObject) { if (((NetworkBehaviour)__instance).IsOwner) { Takey component = ((Component)dropItemNetworkObject).gameObject.GetComponent(); if (!((Object)(object)component == (Object)null)) { component.RollJetpackFlyServerRpc(); } } } } [HarmonyPatch(typeof(HUDManager))] internal static class HUDManagerPatch { [HarmonyPatch("DisplayNewScrapFound")] [HarmonyPrefix] private static bool DisplayNewScrapFoundPatch(ref HUDManager __instance) { if (__instance.itemsToBeDisplayed.Count <= 0) { return true; } GrabbableObject val = __instance.itemsToBeDisplayed[0]; if ((Object)(object)val == (Object)null || (Object)(object)val.itemProperties.spawnPrefab == (Object)null) { return true; } Takey takey = val as Takey; if ((Object)(object)takey != (Object)null) { DisplayNewSmolTakeyScrapFound(__instance, takey); return false; } return true; } private static void DisplayNewSmolTakeyScrapFound(HUDManager __instance, Takey takeyBehaviour) { //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_00e4: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: 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_0212: Unknown result type (might be due to invalid IL or missing references) if (((GrabbableObject)takeyBehaviour).scrapValue < 80) { __instance.UIAudio.PlayOneShot(__instance.displayCollectedScrapSFXSmall); } else { __instance.UIAudio.PlayOneShot(__instance.displayCollectedScrapSFX); } ScrapItemHUDDisplay val = __instance.ScrapItemBoxes[__instance.nextBoxIndex]; GameObject val2 = Object.Instantiate(takeyBehaviour.VariantDataList.GetByIndex(takeyBehaviour.VariantIndex).Prefab, val.itemObjectContainer); Object.Destroy((Object)(object)val2.GetComponent()); Object.Destroy((Object)(object)val2.GetComponent()); Animator[] componentsInChildren = val2.GetComponentsInChildren(); foreach (Animator val3 in componentsInChildren) { Object.Destroy((Object)(object)val3); } Collider[] componentsInChildren2 = val2.GetComponentsInChildren(); foreach (Collider val4 in componentsInChildren2) { Object.Destroy((Object)(object)val4); } val2.transform.localPosition = Vector3.zero; val2.transform.localScale = val2.transform.localScale * 4f; val2.transform.rotation = Quaternion.Euler(((GrabbableObject)takeyBehaviour).itemProperties.restingRotation); Renderer[] componentsInChildren3 = val2.GetComponentsInChildren(); foreach (Renderer val5 in componentsInChildren3) { if (((Component)val5).gameObject.layer != 22) { val5.rendererPriority = 70; Material[] sharedMaterials = val5.sharedMaterials; for (int l = 0; l < sharedMaterials.Length; l++) { sharedMaterials[l] = __instance.hologramMaterial; } val5.sharedMaterials = sharedMaterials; ((Component)val5).gameObject.layer = 5; } } val.itemDisplayAnimator.SetTrigger("collect"); ((TMP_Text)val.headerText).text = ((GrabbableObject)takeyBehaviour).itemProperties.itemName + " collected!"; ((TMP_Text)val.valueText).text = $"Value: ${((GrabbableObject)takeyBehaviour).scrapValue}"; if (__instance.boxesDisplaying > 0) { val.UIContainer.anchoredPosition = new Vector2(val.UIContainer.anchoredPosition.x, __instance.ScrapItemBoxes[__instance.bottomBoxIndex].UIContainer.anchoredPosition.y - 124f); } else { val.UIContainer.anchoredPosition = new Vector2(val.UIContainer.anchoredPosition.x, (float)__instance.bottomBoxYPosition); } __instance.bottomBoxIndex = __instance.nextBoxIndex; ((MonoBehaviour)__instance).StartCoroutine(__instance.displayScrapTimer(val2)); __instance.playScrapDisplaySFX(); __instance.boxesDisplaying++; __instance.nextBoxIndex = (__instance.nextBoxIndex + 1) % 3; __instance.itemsToBeDisplayed.RemoveAt(0); } [HarmonyPatch("AddNewScrapFoundToDisplay")] [HarmonyPostfix] private static void AddNewScrapFoundToDisplayPatch(GrabbableObject GObject) { Events.InvokeOnNewScrapCollected(GObject); } [HarmonyPatch("DisplayNewDeadline")] [HarmonyPostfix] private static void DisplayNewDeadlinePatch() { Events.InvokeOnProfitQuotaFulfilled(); } } [HarmonyPatch(typeof(ItemDropship))] internal static class ItemDropshipPatch { [HarmonyPatch("LandShipOnServer")] [HarmonyPostfix] private static void LandShipOnServerPatch(ref List ___itemsToDeliver) { TryReplaceJetpacksWithTakeypacks(___itemsToDeliver); } private static void TryReplaceJetpacksWithTakeypacks(List itemsToDeliver) { if (!ShopHelper.TryGetBuyItemIndex("Takeypack", out var buyItemIndex)) { return; } for (int i = 0; i < itemsToDeliver.Count; i++) { if (ShopHelper.IsBuyItemIndex(itemsToDeliver[i], "Jetpack") && Utils.RollPercentChance(ConfigManager.Takeypack_JetpackReplaceChance.Value)) { itemsToDeliver[i] = buyItemIndex; } } } [HarmonyPatch("LandShipOnServer")] [HarmonyPostfix] private static void LandShipOnServerPatch() { TerminalPatch.PreviousOrderedItemsFromTerminal.Clear(); } } [HarmonyPatch(typeof(JetpackItem))] internal static class JetpackItemPatch { [HarmonyPatch("JetpackEffect")] [HarmonyPostfix] private static void JetpackEffectPatch(ref JetpackItem __instance, bool enable) { if (__instance is TakeypackItem takeypackItem) { takeypackItem.SetJetpackEffects(enable); } } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] internal static class MaskedPlayerEnemyPatch { private static Dictionary _enemiesInsideHangarShip; static MaskedPlayerEnemyPatch() { _enemiesInsideHangarShip = new Dictionary(); Events.OnShipArrived += OnShipArrive; Application.quitting += delegate { Events.OnShipArrived -= OnShipArrive; }; } private static void OnShipArrive() { _enemiesInsideHangarShip.Clear(); } [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePatch(ref MaskedPlayerEnemy __instance) { if (((EnemyAI)__instance).isEnemyDead || !StartOfRound.Instance.shipHasLanded || StartOfRound.Instance.shipIsLeaving) { return; } if (!_enemiesInsideHangarShip.ContainsKey(__instance)) { _enemiesInsideHangarShip.Add(__instance, value: false); } if (_enemiesInsideHangarShip.TryGetValue(__instance, out var value) && value != ((EnemyAI)__instance).isInsidePlayerShip) { _enemiesInsideHangarShip[__instance] = ((EnemyAI)__instance).isInsidePlayerShip; if (((EnemyAI)__instance).isInsidePlayerShip) { Events.InvokeOnMaskedEnteredShip(__instance); } } } } [HarmonyPatch(typeof(MouthDogAI))] internal static class MouthDogAIPatch { [HarmonyPatch("OnCollideWithEnemy")] [HarmonyPrefix] private static void OnCollideWithEnemyPatch(EnemyAI collidedEnemy, ref float ___timeSinceHittingOtherEnemy) { if (ExtraFeatureEnabled() && !(collidedEnemy.enemyType.enemyName != "Bush Wolf") && !(___timeSinceHittingOtherEnemy < 1f)) { BushWolfEnemyPatch.AddBushWolfHitByDog(collidedEnemy); } } private static bool ExtraFeatureEnabled() { if (!ConfigManager.ExtraFeatures_Enabled.Value) { return false; } if (!ConfigManager.ExtraFeatures_EnableSpecialKidnapperFoxSounds.Value) { return false; } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class PlayerControllerBPatch { [CompilerGenerated] private sealed class d__12 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private PlayerControllerB 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = PlayerUtils.LocalPlayerScript; if ((Object)(object)5__2 == (Object)null) { _ignoreNextFallDamage = false; return false; } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!_ignoreNextFallDamage) { return false; } if (5__2.thisController.isGrounded) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; } break; case 2: <>1__state = -1; Logger.LogInfo("Cancelled local player ignored fall damage.", extended: true); _ignoreNextFallDamage = false; break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool _isPlayerDead; private static bool _ignoreNextFallDamage; private static Coroutine _ignoreNextFallCancelCheck; private static bool _wasSinking; private static bool _wasUnderwater; public static void OnDeadPlayersRevived() { _isPlayerDead = false; } [HarmonyPatch("KillPlayer")] [HarmonyPrefix] private static void KillPlayerPatchPrefix(ref PlayerControllerB __instance) { if (PlayerUtils.IsLocalPlayer(__instance)) { _wasSinking = __instance.isSinking; _wasUnderwater = __instance.isUnderwater; } } [HarmonyPatch("KillPlayer")] [HarmonyPostfix] private static void KillPlayerPatchPostfix(ref PlayerControllerB __instance) { //IL_0048: 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 (PlayerUtils.IsLocalPlayer(__instance) && __instance.isPlayerDead && !_isPlayerDead) { _isPlayerDead = true; PlayerDeathReason playerDeathReasonFromStackTrace = GetPlayerDeathReasonFromStackTrace(__instance); Logger.LogInfo($"Local player died by {playerDeathReasonFromStackTrace}", extended: true); PluginNetworkBehaviour.Instance.PlayerDiedServerRpc(playerDeathReasonFromStackTrace); } } private static PlayerDeathReason GetPlayerDeathReasonFromStackTrace(PlayerControllerB playerScript) { StackTrace stackTrace = new StackTrace(); for (int i = 1; i < stackTrace.FrameCount; i++) { StackFrame frame = stackTrace.GetFrame(i); MethodBase method = frame.GetMethod(); Type declaringType = method.DeclaringType; string name = method.Name; if (!(declaringType == null)) { if (declaringType.Name == "PlayerControllerB" && name.Contains("PlayerHitGroundEffects")) { return PlayerDeathReason.Falling; } if (declaringType.Name == "Landmine" && name.Contains("SpawnExplosion")) { return PlayerDeathReason.Landmine; } } } if (_wasSinking && !_wasUnderwater) { return PlayerDeathReason.Quicksand; } return PlayerDeathReason.Unknown; } [HarmonyPatch("TeleportPlayer")] [HarmonyPostfix] private static void TeleportPlayerPatch(ref PlayerControllerB __instance) { if (!__instance.isPlayerDead) { _isPlayerDead = false; } } [HarmonyPatch("PlayerHitGroundEffects")] [HarmonyPrefix] private static void PlayerHitGroundEffectsPatch(ref PlayerControllerB __instance) { if (PlayerUtils.IsLocalPlayer(__instance) && _ignoreNextFallDamage) { _ignoreNextFallDamage = false; if (__instance.fallValueUncapped < -39f) { __instance.fallValueUncapped = -39f; } if (__instance.fallValue < -38f) { __instance.fallValue = -38f; } Logger.LogInfo("Local player ignored fall damage.", extended: true); } } public static void IgnoreNextFallDamage() { _ignoreNextFallDamage = true; if (_ignoreNextFallCancelCheck != null) { ((MonoBehaviour)StartOfRound.Instance).StopCoroutine(_ignoreNextFallCancelCheck); } _ignoreNextFallCancelCheck = CoroutineRunner.Start(IgnoreNextFallCancelCheck()); } [IteratorStateMachine(typeof(d__12))] private static IEnumerator IgnoreNextFallCancelCheck() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0); } [HarmonyPatch("GrabObjectServerRpc")] [HarmonyPostfix] private static void GrabObjectServerRpcPatch(ref NetworkObjectReference grabbedObject) { NetworkObject val = default(NetworkObject); GrabbableObject grabbableObject = default(GrabbableObject); if (NetworkUtils.IsServer && ((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent(ref grabbableObject)) { Events.InvokeOnGrabItem(grabbableObject); } } [HarmonyPatch("ThrowObjectServerRpc")] [HarmonyPostfix] private static void ThrowObjectServerRpcPatch(ref NetworkObjectReference grabbedObject) { NetworkObject val = default(NetworkObject); GrabbableObject grabbableObject = default(GrabbableObject); if (NetworkUtils.IsServer && ((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent(ref grabbableObject)) { Events.InvokeOnDiscardItem(grabbableObject); } } [HarmonyPatch("PlaceObjectServerRpc")] [HarmonyPostfix] private static void PlaceObjectServerRpcPatch(ref NetworkObjectReference grabbedObject) { NetworkObject val = default(NetworkObject); GrabbableObject grabbableObject = default(GrabbableObject); if (NetworkUtils.IsServer && ((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null) && ((Component)val).TryGetComponent(ref grabbableObject)) { Events.InvokeOnDiscardItem(grabbableObject); } } [HarmonyPatch("PlaceGrabbableObject")] [HarmonyPostfix] private static void PlaceGrabbableObjectPatch(Transform parentObject, bool matchRotationOfParent, GrabbableObject placeObject) { if (!((Object)(object)parentObject == (Object)null) && !((Object)(object)placeObject == (Object)null) && !((Object)(object)TakeyMugShelf.Instance == (Object)null) && (Object)(object)parentObject == (Object)(object)((Component)TakeyMugShelf.Instance).transform && matchRotationOfParent) { TakeyMugShelf.Instance.SetGrabbableObjectLocalRotation(placeObject); } } } [HarmonyPatch(typeof(PufferAI))] internal static class PufferAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref PufferAI __instance) { if (NetworkUtils.IsServer && ConfigManager.ExtraFeatures_Enabled.Value && Utils.RollPercentChance(ConfigManager.ExtraFeatures_SpecialSporeLizardSoundsChance.Value)) { SetPufferNervousAudioClipOnServer(__instance, 0); } } private static void SetPufferNervousAudioClipOnServer(PufferAI pufferAI, int clipIndex) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer) { PluginNetworkBehaviour.Instance.SetPufferNervousAudioClipClientRpc(NetworkObjectReference.op_Implicit(((Component)pufferAI).GetComponent()), clipIndex); SetNervousAudioClipOnLocalClient(pufferAI, clipIndex); } } public static void SetNervousAudioClipOnLocalClient(PufferAI pufferAI, int clipIndex) { if (!((Object)(object)pufferAI == (Object)null) && clipIndex == 0) { pufferAI.nervousMumbling = Assets.BlubbersYameteKudasaiSFX; } } } [HarmonyPatch(typeof(RoundManager))] internal static class RoundManagerPatch { [CompilerGenerated] private sealed class d__2 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float time; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(time); <>1__state = 1; return true; case 1: <>1__state = -1; ShipArrived = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool ShipArrived; private static bool _increasedSmolTakeyRarityForRound; [HarmonyPatch("FinishGeneratingNewLevelClientRpc")] [HarmonyPostfix] private static void FinishGeneratingNewLevelClientRpcPatch() { if (!ShipArrived) { ShipArrived = true; Events.InvokeOnShipArrived(); CoroutineRunner.Start(ResetShipArrivedAfterTime(10f)); } } [IteratorStateMachine(typeof(d__2))] private static IEnumerator ResetShipArrivedAfterTime(float time) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { time = time }; } [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPrefix] private static void SpawnScrapInLevelPatchPrefix() { SeasonalHandler.Update(); if (!NetworkUtils.IsServer || !PlayerUtils.IsLocalPlayer(new PlayerName[5] { PlayerName.Takerst, PlayerName.Ariesgoddess168, PlayerName.WolfsMyChocolate, PlayerName.Hiccubz, PlayerName.ZombiesAteMyChannel }) || Utils.StringContains(Utils.GetModpackName(), new string[5] { "TakeyTroup", "HQ", "HighQuota", "High Quota", "Pro" }, matchCase: false)) { return; } string key = "ISRF_15"; int num = 10; float percent = 15f; int num2 = 150; if (Utils.IsAprilFools()) { key = $"ISRF_AprilFools_{DateTime.Today.Year}"; num = 999; percent = 25f; num2 = 300; } if (!Utils.RollPercentChance(percent)) { return; } int num3 = Plugin.ModpackSave.Load(key, 0); if (num3 >= num) { return; } Plugin.ModpackSave.Save(key, num3 + 1); _increasedSmolTakeyRarityForRound = true; foreach (ItemConfigData instance in ItemConfigData.Instances) { int value = instance.SpawnWeight.Value; if (value > 0) { ItemHelper.UpdateScrapRarity(instance.Item, Mathf.Max(value, num2)); } } } [HarmonyPatch("SpawnScrapInLevel")] [HarmonyPostfix] private static void SpawnScrapInLevelPatchPostfix() { if (!NetworkUtils.IsServer || !_increasedSmolTakeyRarityForRound) { return; } _increasedSmolTakeyRarityForRound = false; foreach (ItemConfigData instance in ItemConfigData.Instances) { ItemHelper.UpdateScrapRarity(instance); } } } [HarmonyPatch(typeof(SandSpiderAI))] internal static class SandSpiderAIPatch { private static Dictionary _cuteSandSpiderPairs; static SandSpiderAIPatch() { _cuteSandSpiderPairs = new Dictionary(); Events.OnShipArrived += OnShipArrive; Application.quitting += delegate { Events.OnShipArrived -= OnShipArrive; }; } private static void OnShipArrive() { _cuteSandSpiderPairs.Clear(); } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(ref SandSpiderAI __instance) { if (!NetworkUtils.IsServer || !ConfigManager.ExtraFeatures_Enabled.Value) { return; } bool flag = false; if (PlayerUtils.IsLocalPlayer(PlayerName.Takerst)) { int num = Plugin.ModpackSave.Load("TimesForceSetCuteSandSpider", 0); if (num < 5) { Plugin.ModpackSave.Save("TimesForceSetCuteSandSpider", num + 1); flag = true; } } if (Utils.RollPercentChance(ConfigManager.ExtraFeatures_BunkerSpiderReskinChance.Value) || flag) { SetCuteSandSpiderOnServer(__instance); } } private static void SetCuteSandSpiderOnServer(SandSpiderAI sandSpiderAI) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer) { if (_cuteSandSpiderPairs.ContainsKey(sandSpiderAI)) { Logger.LogError("Failed to set cute sand spider on server. SandSpiderAI is already a cute sand spider."); return; } PluginNetworkBehaviour.Instance.SetCuteSandSpiderClientRpc(NetworkObjectReference.op_Implicit(((Component)sandSpiderAI).GetComponent())); SetCuteSandSpiderOnLocalClient(sandSpiderAI); } } public static void SetCuteSandSpiderOnLocalClient(NetworkObjectReference networkObjectReference) { NetworkObject val = default(NetworkObject); SandSpiderAI cuteSandSpiderOnLocalClient = default(SandSpiderAI); if (!((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val, (NetworkManager)null)) { Logger.LogError("Failed to set cute sand spider on local client. NetworkObject is null."); } else if (((Component)val).TryGetComponent(ref cuteSandSpiderOnLocalClient)) { SetCuteSandSpiderOnLocalClient(cuteSandSpiderOnLocalClient); } else { Logger.LogError("Failed to set cute sand spider on local client. SandSpiderAI is null."); } } private static void SetCuteSandSpiderOnLocalClient(SandSpiderAI sandSpiderAI) { //IL_005b: 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) if (_cuteSandSpiderPairs.ContainsKey(sandSpiderAI)) { Logger.LogError("Failed to set cute sand spider on local client. SandSpiderAI is already a cute sand spider."); return; } try { Transform val = ((Component)sandSpiderAI).transform.Find("MeshContainer").Find("AnimContainer").Find("Armature") .Find("Head"); GameObject val2 = Object.Instantiate(Assets.CuteSandSpiderPrefab, val); val2.transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); ScanNodeProperties componentInChildren = ((Component)sandSpiderAI).GetComponentInChildren(); componentInChildren.headerText = "Linda"; _cuteSandSpiderPairs.Add(sandSpiderAI, val2); Logger.LogInfo("Set cute sand spider on local client.", extended: true); } catch (Exception arg) { Logger.LogError($"Failed to set cute sand spider on local client. {arg}"); } } } [HarmonyPatch(typeof(ShipBuildModeManager))] internal static class ShipBuildModeManagerPatch { [HarmonyPatch("StoreObjectServerRpc")] [HarmonyPrefix] private static void StoreObjectServerRpcPatch(NetworkObjectReference objectRef) { NetworkObject val = default(NetworkObject); if (!NetworkUtils.IsServer || !((NetworkObjectReference)(ref objectRef)).TryGet(ref val, (NetworkManager)null) || !val.IsSpawned) { return; } PlaceableShipObject componentInChildren = ((Component)val).GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { UnlockableItem unlockableItem = UnlockableItemHelper.GetUnlockableItem(componentInChildren.unlockableID); if (unlockableItem != null && !unlockableItem.inStorage && unlockableItem.canBeStored && unlockableItem.spawnPrefab && unlockableItem == Assets.TakeyMugShelf.unlockable) { TakeyMugShelf.Instance?.UnparentGrabbableObjectsOnServer(); } } } } [HarmonyPatch(typeof(StartOfRound))] internal static class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch() { SpawnNetworkHandler(); } private static void SpawnNetworkHandler() { //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) if (NetworkUtils.IsServer) { GameObject val = Object.Instantiate(Assets.NetworkHandlerPrefab, Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { ConfigManager.TrySetCustomSettings(); } [HarmonyPatch("LoadUnlockables")] [HarmonyPostfix] private static void LoadUnlockablesPatch() { if (!NetworkUtils.IsServer) { return; } foreach (UnlockableItemConfigData instance in UnlockableItemConfigData.Instances) { UnlockableItem unlockableItem = instance.UnlockableItem; if (unlockableItem != null && !unlockableItem.inStorage && instance.UnlockAtStart.Value) { StartOfRound.Instance.UnlockShipObject(instance.UnlockableId); } } } [HarmonyPatch("LoadShipGrabbableItems")] [HarmonyPostfix] private static void LoadShipGrabbableItemsPatch() { TakeyMugShelf.Instance?.ParentGrabbableObjectsNextFrame(); } [HarmonyPatch("OnClientConnect")] [HarmonyPrefix] private static void OnClientConnectPatch(ref ulong clientId) { if (NetworkUtils.IsServer) { SyncedConfigEntryBase.SendConfigsToClient(clientId); } } [HarmonyPatch("OnPlayerConnectedClientRpc")] [HarmonyPostfix] private static void OnPlayerConnectedClientRpcPatch() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!NetworkUtils.IsServer && (Object)(object)TakeyMugShelf.Instance != (Object)null) { TakeyMugShelf.Instance.RequestSyncGrabbableObjectsServerRpc(); } } [HarmonyPatch("ShipLeave")] [HarmonyPostfix] private static void ShipLeavePatch() { Events.InvokeOnShipLeave(); } [HarmonyPatch("ReviveDeadPlayers")] [HarmonyPostfix] private static void ReviveDeadPlayersPatch() { PlayerControllerBPatch.OnDeadPlayersRevived(); } } [HarmonyPatch(typeof(Terminal))] internal static class TerminalPatch { private static Terminal _instance; public static List PreviousOrderedItemsFromTerminal = new List(); public static Terminal Instance { get { if (_instance == null) { _instance = Object.FindFirstObjectByType(); } return _instance; } } [HarmonyPatch("LoadNewNodeIfAffordable")] [HarmonyPostfix] private static void LoadNewNodeIfAffordablePatchPostfix(TerminalNode node) { if (node.buyItemIndex != -1) { OnItemsOrdered(); } } [HarmonyPatch("BuyItemsServerRpc")] [HarmonyPostfix] private static void BuyItemsServerRpcPatchPostfix() { if (NetworkUtils.IsServer) { OnItemsOrdered(); } } private static void OnItemsOrdered() { Logger.LogInfo("PreviousOrderedItemsFromTerminal: [" + string.Join(", ", PreviousOrderedItemsFromTerminal) + "]", extended: true); Logger.LogInfo("Terminal.orderedItemsFromTerminal: [" + string.Join(", ", Instance.orderedItemsFromTerminal) + "]", extended: true); if (PreviousOrderedItemsFromTerminal.Count >= Instance.orderedItemsFromTerminal.Count) { return; } List list = new List(); for (int i = PreviousOrderedItemsFromTerminal.Count; i < Instance.orderedItemsFromTerminal.Count; i++) { PreviousOrderedItemsFromTerminal.Add(Instance.orderedItemsFromTerminal[i]); list.Add(Instance.orderedItemsFromTerminal[i]); } Logger.LogInfo("NewOrderedItemsFromTerminal: [" + string.Join(", ", list) + "]", extended: true); if (list.Count == 0) { return; } List list2 = new List(); foreach (int item in list) { list2.Add(Instance.buyableItemsList[item]); } Events.InvokeOnItemsOrdered(list2); } [HarmonyPatch("ClearBoughtItems")] [HarmonyPostfix] private static void ClearBoughtItemsPatch() { PreviousOrderedItemsFromTerminal.Clear(); } } [HarmonyPatch(typeof(TimeOfDay))] internal static class TimeOfDayPatch { private static int previousHours; private static int previousMinutes; [HarmonyPatch("MoveTimeOfDay")] [HarmonyPostfix] private static void MoveTimeOfDayPatch() { GetCurrentTimeHoursAndMinutes(out var hours, out var minutes); if (previousHours != hours || previousMinutes != minutes) { Events.InvokeOnTimeChanged(hours, minutes); previousHours = hours; previousMinutes = minutes; } } public static void GetCurrentTimeHoursAndMinutes(out int hours, out int minutes) { if ((Object)(object)TimeOfDay.Instance == (Object)null) { hours = 0; minutes = 0; } else { int num = (int)(TimeOfDay.Instance.normalizedTimeOfDay * (60f * (float)TimeOfDay.Instance.numberOfHours)) + 360; hours = (int)Mathf.Floor((float)(num / 60)); minutes = num % 60; } } } } namespace com.github.zehsteam.TakeyPlush.Objects { public class ItemConfigData { public static List Instances { get; private set; } = new List(); public ConfigEntry SpawnWeight { get; private set; } public SyncedConfigEntry TwoHanded { get; private set; } public SyncedConfigEntry CarryWeight { get; private set; } public ConfigEntry MinValue { get; private set; } public ConfigEntry MaxValue { get; private set; } public Item Item { get; private set; } public ItemConfigData(Item item, string section, int rarity, bool twoHanded, int carryWeight, int minValue, int maxValue) { Instances.Add(this); Item = item; Bind(section, rarity, twoHanded, carryWeight, minValue, maxValue); } private void Bind(string section, int rarity, bool twoHanded, int carryWeight, int minValue, int maxValue) { if (!((Object)(object)Item == (Object)null)) { SpawnWeight = ConfigHelper.Bind(section, "SpawnWeight", rarity, Item.itemName + " spawn chance weight."); TwoHanded = ConfigHelper.BindSynced(section, "TwoHanded", twoHanded, "If enabled, " + Item.itemName + " will be two-handed."); CarryWeight = ConfigHelper.BindSynced(section, "CarryWeight", carryWeight, Item.itemName + " carry weight in pounds."); MinValue = ConfigHelper.Bind(section, "MinValue", minValue, Item.itemName + " min scrap value."); MaxValue = ConfigHelper.Bind(section, "MaxValue", maxValue, Item.itemName + " max scrap value."); SpawnWeight.SettingChanged += delegate { SpawnWeight_SettingsChanged(); }; TwoHanded.SettingChanged += delegate { Properties_SettingsChanged(); }; CarryWeight.SettingChanged += delegate { Properties_SettingsChanged(); }; MinValue.SettingChanged += delegate { Properties_SettingsChanged(); }; MaxValue.SettingChanged += delegate { Properties_SettingsChanged(); }; } } private void SpawnWeight_SettingsChanged() { ItemHelper.UpdateScrapRarity(this); } private void Properties_SettingsChanged() { ItemHelper.UpdateItemProperties(this); } } internal class JsonSave { private JObject _data; public string DirectoryPath { get; private set; } public string FileName { get; private set; } public string FilePath => Path.Combine(DirectoryPath, FileName); public JsonSave(string directoryPath, string fileName) { DirectoryPath = directoryPath; FileName = fileName; _data = ReadFile(); } public bool KeyExists(string key) { if (_data == null) { Logger.LogError("KeyExists: Data is null. Ensure the save file is properly loaded."); return false; } return _data.ContainsKey(key); } public T Load(string key, T defaultValue = default(T), bool readFile = false) { if (TryLoad(key, out var value, readFile)) { return value; } return defaultValue; } public bool TryLoad(string key, out T value, bool readFile = false) { //IL_0057: Expected O, but got Unknown value = default(T); if (readFile) { _data = ReadFile(); } if (_data == null) { Logger.LogError("Load: Data is null. Returning default value for key: " + key + "."); return false; } JToken val = default(JToken); if (_data.TryGetValue(key, ref val)) { try { value = val.ToObject(); return true; } catch (JsonException val2) { JsonException val3 = val2; Logger.LogError("Load: JSON Conversion Error for key: " + key + ". " + ((Exception)(object)val3).Message); } catch (ArgumentNullException ex) { Logger.LogError("Load: Argument Null Error for key: " + key + ". " + ex.Message); } catch (Exception ex2) { Logger.LogError("Load: Unexpected Error for key: " + key + ". " + ex2.Message); } return false; } Logger.LogWarning("Load: Key '" + key + "' does not exist. Returning default value.", extended: true); return false; } public bool Save(string key, T value) { if (_data == null) { Logger.LogError("Save: Data is null. Cannot save key: " + key + "."); return false; } try { JToken val = JToken.FromObject((object)value); if (_data.ContainsKey(key)) { _data[key] = val; } else { _data.Add(key, val); } return WriteFile(_data); } catch (Exception ex) { Logger.LogError("Save: Error saving key: " + key + ". " + ex.Message); return false; } } private JObject ReadFile() { //IL_0070: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown try { if (!File.Exists(FilePath)) { Logger.LogWarning("ReadFile: Save file does not exist at \"" + FilePath + "\". Initializing with an empty file."); return new JObject(); } using FileStream stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read); using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8); return JObject.Parse(streamReader.ReadToEnd()); } catch (JsonException val) { JsonException val2 = val; Logger.LogError("ReadFile: JSON Parsing Error for file: \"" + FilePath + "\". " + ((Exception)(object)val2).Message); } catch (Exception ex) { Logger.LogError("ReadFile: Unexpected Error for file: \"" + FilePath + "\". " + ex.Message); } return new JObject(); } private bool WriteFile(JObject data) { try { if (!Directory.Exists(DirectoryPath)) { Directory.CreateDirectory(DirectoryPath); } File.WriteAllText(FilePath, ((object)data).ToString(), Encoding.UTF8); return true; } catch (Exception ex) { Logger.LogError("WriteFile: Unexpected Error for file: \"" + FilePath + "\". " + ex.Message); } return false; } } public class LCTime { public int Hours; public int Minutes; public LCTime() { UpdateTime(); } public LCTime(int hours, int minutes) { Hours = hours; Minutes = minutes; } public void UpdateTime() { TimeOfDayPatch.GetCurrentTimeHoursAndMinutes(out Hours, out Minutes); } public bool HasMinutesPassed(int minutesToCheck) { TimeOfDayPatch.GetCurrentTimeHoursAndMinutes(out var hours, out var minutes); int num = Hours * 60 + Minutes; int num2 = hours * 60 + minutes; if (num2 < num) { num2 += 1440; } int num3 = num2 - num; return num3 >= minutesToCheck; } } public class SyncedConfigEntry : SyncedConfigEntryBase { private ConfigEntry _configEntry; private T _serverValue; public T Value { get { return GetValue(); } set { SetValue(value); } } public T DefaultValue => (T)((ConfigEntryBase)_configEntry).DefaultValue; public override ConfigDefinition Definition => ((ConfigEntryBase)_configEntry).Definition; public event Action SettingChanged; public SyncedConfigEntry(string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues = null, ConfigFile configFile = null) { SyncedConfigEntryBase.AddInstance(this); base.SettingType = typeof(T); _configEntry = ConfigHelper.Bind(section, key, defaultValue, description, requiresRestart: false, acceptableValues, null, configFile); _configEntry.SettingChanged += SettingChangedInternal; Application.quitting += delegate { _configEntry.SettingChanged -= SettingChangedInternal; }; } public T GetValue() { if (NetworkUtils.IsConnected && !NetworkUtils.IsServer) { return _serverValue; } return _configEntry.Value; } public void SetValue(T value) { if (!NetworkUtils.IsConnected || NetworkUtils.IsServer) { _configEntry.Value = value; } } public void ResetToDefault() { if (!NetworkUtils.IsConnected || NetworkUtils.IsServer) { _configEntry.Value = DefaultValue; } } private void SettingChangedInternal(object sender, EventArgs e) { if (NetworkUtils.IsConnected && NetworkUtils.IsServer) { this.SettingChanged?.Invoke(Value); SendConfigToClients(); } } private void SendConfigToClients() { //IL_003b: 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) if (NetworkUtils.IsConnected && NetworkUtils.IsServer) { PluginNetworkBehaviour.Instance?.SetSyncedConfigValueClientRpc(base.Section, base.Key, Value.ToString()); } } public override void SendConfigToClient(ulong clientId) { //IL_0011: 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_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_0060: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsConnected && NetworkUtils.IsServer) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; PluginNetworkBehaviour.Instance?.SetSyncedConfigValueClientRpc(base.Section, base.Key, Value.ToString(), clientRpcParams); } } public override void SetValueFromServer(string value) { if (NetworkUtils.IsConnected && !NetworkUtils.IsServer) { if (!Utils.TryParseValue(value, out var result)) { throw new InvalidOperationException($"Failed to parse value: \"{value}\" for type {typeof(T)}"); } _serverValue = result; Logger.LogInfo("Set synced config entry value from server. (Section: \"" + base.Section + "\", Key: \"" + base.Key + "\", Value: \"" + value + "\")", extended: true); this.SettingChanged?.Invoke(result); } } } public abstract class SyncedConfigEntryBase { private static readonly object _instancesLock = new object(); public static List Instances { get; private set; } = new List(); public abstract ConfigDefinition Definition { get; } public string Section => Definition.Section; public string Key => Definition.Key; public Type SettingType { get; protected set; } public static void AddInstance(SyncedConfigEntryBase instance) { lock (_instancesLock) { Instances.Add(instance); } } public static void RemoveInstance(SyncedConfigEntryBase instance) { lock (_instancesLock) { Instances.Remove(instance); } } public abstract void SendConfigToClient(ulong clientId); public abstract void SetValueFromServer(string value); public static void SendConfigsToClient(ulong clientId) { if (!NetworkUtils.IsConnected || !NetworkUtils.IsServer || NetworkUtils.IsLocalClientId(clientId)) { return; } foreach (SyncedConfigEntryBase instance in Instances) { instance.SendConfigToClient(clientId); } } public static void SetValueFromServer(string section, string key, string value) { if (NetworkUtils.IsConnected && !NetworkUtils.IsServer) { SyncedConfigEntryBase syncedConfigEntryBase = Instances.Find((SyncedConfigEntryBase x) => x.Section == section && x.Key == key); if (syncedConfigEntryBase == null) { Logger.LogWarning("No matching synced config entry found for section: \"" + section + "\", key: \"" + key + "\""); } else { syncedConfigEntryBase.SetValueFromServer(value); } } } } public class UnlockableItemConfigData { public static List Instances { get; private set; } = new List(); public SyncedConfigEntry Price { get; private set; } public ConfigEntry UnlockAtStart { get; private set; } public UnlockableItemDef UnlockableItemDef { get; private set; } public UnlockableItem UnlockableItem => UnlockableItemDef?.unlockable; public int UnlockableId => UnlockableItemHelper.GetUnlockableId(UnlockableItem); public UnlockableItemConfigData(UnlockableItemDef unlockableItemDef, string section, int price, bool unlockAtStart) { Instances.Add(this); UnlockableItemDef = unlockableItemDef; Bind(section, price, unlockAtStart); } private void Bind(string section, int price, bool unlockAtStart) { if (UnlockableItem != null) { Price = ConfigHelper.BindSynced(section, "Price", price, "The price of " + UnlockableItem.unlockableName + "."); UnlockAtStart = ConfigHelper.Bind(section, "UnlockAtStart", unlockAtStart, "If enabled, " + UnlockableItem.unlockableName + " will be unlocked at the start."); Price.SettingChanged += delegate { Price_SettingChanged(); }; } } private void Price_SettingChanged() { UnlockableItemHelper.UpdateUnlockablePrice(this); } } } namespace com.github.zehsteam.TakeyPlush.MonoBehaviours { public abstract class AdvancedGrabbableObject : GrabbableObject { public int UniqueId { get; private set; } public string SaveKey => string.Format("{0}_{1}", "AdvancedGrabbableObject", UniqueId); public virtual void Awake() { if (NetworkUtils.IsServer) { UniqueId = Random.Range(0, 1000000); } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (NetworkUtils.IsServer) { NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected; } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); if (NetworkUtils.IsServer) { NetworkManager.Singleton.OnClientConnectedCallback -= OnClientConnected; } } protected virtual void OnClientConnected(ulong clientId) { } public override int GetItemDataToSave() { return UniqueId; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); UniqueId = saveData; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "AdvancedGrabbableObject"; } } public class AdvancedNoisemakerProp : AdvancedGrabbableObject { [Space(20f)] [Header("Advanced Noisemaker Prop")] [Space(5f)] public AudioSourceGroup NoiseAudio; public AudioClipGroupWithWeight[] NoiseSFX = Array.Empty(); [Space(10f)] public float NoiseRange = 65f; public float MaxLoudness = 1f; public float MinLoudness = 0.95f; public float MinPitch = 1f; public float MaxPitch = 1f; [Space(10f)] public bool UseDynamicCooldown; public bool CancelActiveSFXOnItemActivate; public override void ItemActivate(bool used, bool buttonDown = true) { if (NoiseSFX.Length != 0) { int randomIndexFromWeightList = Utils.GetRandomIndexFromWeightList(NoiseSFX.Select((AudioClipGroupWithWeight x) => x.Weight).ToList()); PlaySound(randomIndexFromWeightList); } } public void PlaySound(int index) { //IL_000e: 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) if (NoiseSFX.Length != 0) { PlaySoundServerRpc(index); PlaySoundOnLocalClient(index); } } [ServerRpc(RequireOwnership = false)] protected void PlaySoundServerRpc(int index, 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_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_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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2384063148u, serverRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2384063148u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { PlaySoundClientRpc(index, senderClientId); } } } [ClientRpc] protected void PlaySoundClientRpc(int index, ulong senderClientId) { //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) //IL_00db: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1336742285u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1336742285u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsLocalClientId(senderClientId)) { PlaySoundOnLocalClient(index); } } } public void PlaySoundOnLocalClient(int index) { AudioClipGroup audioClipGroup = ((index >= 0 && index < NoiseSFX.Length) ? NoiseSFX[index] : null); PlaySoundOnLocalClient(audioClipGroup); OnPlaySoundFromIndex(index); } protected virtual void OnPlaySoundFromIndex(int index) { } public float PlaySoundOnLocalClient(AudioClip audioClip, AudioClip audioClipFar, bool stopPreviousSFX = false) { return PlaySoundOnLocalClient(new AudioClipGroup(audioClip, audioClipFar), stopPreviousSFX); } public float PlaySoundOnLocalClient(AudioClipGroup audioClipGroup, bool stopPreviousSFX = false) { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (audioClipGroup == null || (Object)(object)audioClipGroup.AudioClip == (Object)null) { return 0f; } float num = (float)Random.Range((int)(MinLoudness * 100f), (int)(MaxLoudness * 100f)) / 100f; float pitch = (float)Random.Range((int)(MinPitch * 100f), (int)(MaxPitch * 100f)) / 100f; if (CancelActiveSFXOnItemActivate || stopPreviousSFX) { NoiseAudio.Stop(); } if (UseDynamicCooldown && !CancelActiveSFXOnItemActivate) { ((GrabbableObject)this).currentUseCooldown = audioClipGroup.Length; } NoiseAudio.Pitch = pitch; NoiseAudio.PlayOneShot(audioClipGroup, num); WalkieTalkie.TransmitOneShotAudio(NoiseAudio.AudioSource, audioClipGroup.AudioClip, num); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, NoiseRange, num, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); if (MinLoudness >= 0.6f && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.timeSinceMakingLoudNoise = 0f; } return audioClipGroup.Length; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2384063148u, new RpcReceiveHandler(__rpc_handler_2384063148), "PlaySoundServerRpc"); ((NetworkBehaviour)this).__registerRpc(1336742285u, new RpcReceiveHandler(__rpc_handler_1336742285), "PlaySoundClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_2384063148(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_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_0040: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((AdvancedNoisemakerProp)(object)target).PlaySoundServerRpc(index, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1336742285(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 index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((AdvancedNoisemakerProp)(object)target).PlaySoundClientRpc(index, senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "AdvancedNoisemakerProp"; } } internal class CoroutineRunner : MonoBehaviour { public static CoroutineRunner Instance { get; private set; } public static CoroutineRunner Spawn() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { return Instance; } GameObject val = new GameObject("TakeyPlush CoroutineRunner", new Type[1] { typeof(CoroutineRunner) }) { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)(object)val); return val.GetComponent(); } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } public static Coroutine Start(IEnumerator routine) { if ((Object)(object)Instance == (Object)null) { CoroutineRunner coroutineRunner = Spawn(); return ((coroutineRunner != null) ? ((MonoBehaviour)coroutineRunner).StartCoroutine(routine) : null) ?? null; } CoroutineRunner instance = Instance; return ((instance != null) ? ((MonoBehaviour)instance).StartCoroutine(routine) : null) ?? null; } public static void Stop(IEnumerator routine) { CoroutineRunner instance = Instance; if (instance != null) { ((MonoBehaviour)instance).StopCoroutine(routine); } } public static void Stop(Coroutine routine) { CoroutineRunner instance = Instance; if (instance != null) { ((MonoBehaviour)instance).StopCoroutine(routine); } } } public class DestroyAfterTime : MonoBehaviour { [CompilerGenerated] private sealed class d__2 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float duration; public DestroyAfterTime <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown int num = <>1__state; DestroyAfterTime destroyAfterTime = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; case 1: <>1__state = -1; Object.Destroy((Object)(object)((Component)destroyAfterTime).gameObject); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public float Duration = 10f; private void Start() { ((MonoBehaviour)this).StartCoroutine(DestroyAfterTimeCO(Duration)); } [IteratorStateMachine(typeof(d__2))] private IEnumerator DestroyAfterTimeCO(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0) { <>4__this = this, duration = duration }; } } internal class PluginNetworkBehaviour : NetworkBehaviour { public static PluginNetworkBehaviour Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } else { Instance = this; } } [ClientRpc] public void SetSyncedConfigValueClientRpc(string section, string key, string value, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_017b: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3762792757u, clientRpcParams, (RpcDelivery)0); bool flag = section != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(section, false); } bool flag2 = key != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val)).WriteValueSafe(key, false); } bool flag3 = value != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val)).WriteValueSafe(value, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3762792757u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { SyncedConfigEntryBase.SetValueFromServer(section, key, value); } } } [ClientRpc] public void SetGrabbableObjectScrapValueClientRpc(NetworkObjectReference networkObjectReference, 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_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_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_008c: 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_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1911989834u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, scrapValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1911989834u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); GrabbableObject val4 = default(GrabbableObject); if (((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref val4)) { val4.SetScrapValue(scrapValue); } } } [ServerRpc(RequireOwnership = false)] public void SpawnExplosionServerRpc(Vector3 position, int damage, float maxDamageRange) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_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_00b1: 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_00fc: 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(2232256189u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); BytePacker.WriteValueBitPacked(val2, damage); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref maxDamageRange, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2232256189u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SpawnExplosionClientRpc(position, damage, maxDamageRange); } } } [ClientRpc] private void SpawnExplosionClientRpc(Vector3 position, int damage, float maxDamageRange) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_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_00b1: 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_00fb: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3392826419u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); BytePacker.WriteValueBitPacked(val2, damage); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref maxDamageRange, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3392826419u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Utils.CreateExplosion(position, spawnExplosionEffect: true, damage, 0f, maxDamageRange, 6, (CauseOfDeath)3); } } } [ServerRpc(RequireOwnership = false)] public void SpawnPartyExplosionServerRpc(Vector3 position, float physicsForce = 45f, bool fallDamage = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_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_00a5: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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(1133397419u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref physicsForce, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref fallDamage, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1133397419u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SpawnPartyExplosionClientRpc(position, physicsForce, fallDamage); } } } [ClientRpc] private void SpawnPartyExplosionClientRpc(Vector3 position, float physicsForce, bool fallDamage) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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_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_00a5: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_011a: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2294969202u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref physicsForce, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref fallDamage, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2294969202u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; Object.Instantiate(Assets.PartyExplosionPrefab, position, Quaternion.identity); Utils.SpawnExplosionForce(position, physicsForce, fallDamage); } } } [ClientRpc] public void LightningStrikeClientRpc(Vector3 strikePosition, bool useTargetedObject) { //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_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) //IL_00e9: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(106874236u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref strikePosition); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref useTargetedObject, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 106874236u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; StormyWeatherHelper.LightningStrike(strikePosition, useTargetedObject); } } } [ServerRpc(RequireOwnership = false)] public void PlayerDiedServerRpc(PlayerDeathReason playerDeathReason, 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_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) //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_00e2: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1502787031u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref playerDeathReason, default(ForEnums)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1502787031u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { PlayerControllerB playerScriptByClientId = PlayerUtils.GetPlayerScriptByClientId(senderClientId); Events.InvokeOnPlayerDied(playerScriptByClientId, playerDeathReason); } } } [ClientRpc] public void SetPufferNervousAudioClipClientRpc(NetworkObjectReference networkObjectReference, int clipIndex) { //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_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_008c: 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_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2824459976u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, clipIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2824459976u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); PufferAI pufferAI = default(PufferAI); if (!NetworkUtils.IsServer && ((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent(ref pufferAI)) { PufferAIPatch.SetNervousAudioClipOnLocalClient(pufferAI, clipIndex); } } } [ClientRpc] public void SetCuteSandSpiderClientRpc(NetworkObjectReference networkObjectReference) { //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) //IL_00dc: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4066264492u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4066264492u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { SandSpiderAIPatch.SetCuteSandSpiderOnLocalClient(networkObjectReference); } } } [ClientRpc] public void SetScanNodeHeaderTextClientRpc(NetworkObjectReference networkObjectReference, string headerText) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_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_011a: 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) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2558045967u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); bool flag = headerText != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(headerText, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2558045967u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val3 = default(NetworkObject); if (((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref val3, (NetworkManager)null)) { ScanNodeProperties componentInChildren = ((Component)val3).GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { componentInChildren.headerText = headerText; } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3762792757u, new RpcReceiveHandler(__rpc_handler_3762792757), "SetSyncedConfigValueClientRpc"); ((NetworkBehaviour)this).__registerRpc(1911989834u, new RpcReceiveHandler(__rpc_handler_1911989834), "SetGrabbableObjectScrapValueClientRpc"); ((NetworkBehaviour)this).__registerRpc(2232256189u, new RpcReceiveHandler(__rpc_handler_2232256189), "SpawnExplosionServerRpc"); ((NetworkBehaviour)this).__registerRpc(3392826419u, new RpcReceiveHandler(__rpc_handler_3392826419), "SpawnExplosionClientRpc"); ((NetworkBehaviour)this).__registerRpc(1133397419u, new RpcReceiveHandler(__rpc_handler_1133397419), "SpawnPartyExplosionServerRpc"); ((NetworkBehaviour)this).__registerRpc(2294969202u, new RpcReceiveHandler(__rpc_handler_2294969202), "SpawnPartyExplosionClientRpc"); ((NetworkBehaviour)this).__registerRpc(106874236u, new RpcReceiveHandler(__rpc_handler_106874236), "LightningStrikeClientRpc"); ((NetworkBehaviour)this).__registerRpc(1502787031u, new RpcReceiveHandler(__rpc_handler_1502787031), "PlayerDiedServerRpc"); ((NetworkBehaviour)this).__registerRpc(2824459976u, new RpcReceiveHandler(__rpc_handler_2824459976), "SetPufferNervousAudioClipClientRpc"); ((NetworkBehaviour)this).__registerRpc(4066264492u, new RpcReceiveHandler(__rpc_handler_4066264492), "SetCuteSandSpiderClientRpc"); ((NetworkBehaviour)this).__registerRpc(2558045967u, new RpcReceiveHandler(__rpc_handler_2558045967), "SetScanNodeHeaderTextClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3762792757(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_0067: 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_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_00cb: 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_00db: 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_0101: 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(ref flag, default(ForPrimitives)); string section = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref section, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag2, default(ForPrimitives)); string key = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref key, false); } bool flag3 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag3, default(ForPrimitives)); string value = null; if (flag3) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, false); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SetSyncedConfigValueClientRpc(section, key, value, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1911989834(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_003e: 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_005c: 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) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SetGrabbableObjectScrapValueClientRpc(networkObjectReference, scrapValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2232256189(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0069: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); int damage = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref damage); float maxDamageRange = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref maxDamageRange, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SpawnExplosionServerRpc(position, damage, maxDamageRange); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3392826419(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0069: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); int damage = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref damage); float maxDamageRange = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref maxDamageRange, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SpawnExplosionClientRpc(position, damage, maxDamageRange); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1133397419(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_0057: 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_006c: 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_008e: 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); float physicsForce = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref physicsForce, default(ForPrimitives)); bool fallDamage = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref fallDamage, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SpawnPartyExplosionServerRpc(position, physicsForce, fallDamage); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2294969202(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_0057: 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_006c: 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_008e: 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); float physicsForce = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref physicsForce, default(ForPrimitives)); bool fallDamage = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref fallDamage, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SpawnPartyExplosionClientRpc(position, physicsForce, fallDamage); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_106874236(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //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_005c: 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) { Vector3 strikePosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref strikePosition); bool useTargetedObject = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref useTargetedObject, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).LightningStrikeClientRpc(strikePosition, useTargetedObject); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1502787031(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { PlayerDeathReason playerDeathReason = default(PlayerDeathReason); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playerDeathReason, default(ForEnums)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).PlayerDiedServerRpc(playerDeathReason, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2824459976(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_003e: 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_005c: 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) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); int clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SetPufferNervousAudioClipClientRpc(networkObjectReference, clipIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4066264492(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_004f: 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) { NetworkObjectReference cuteSandSpiderClientRpc = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref cuteSandSpiderClientRpc, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SetCuteSandSpiderClientRpc(cuteSandSpiderClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2558045967(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_004a: 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_007c: 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_009a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string headerText = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref headerText, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SetScanNodeHeaderTextClientRpc(networkObjectReference, headerText); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PluginNetworkBehaviour"; } } public class ObjectSeasonalHandler : MonoBehaviour { public SeasonalProps[] SeasonalProps = Array.Empty(); private void OnEnable() { SeasonalHandler.OnEventChanged = (Action)Delegate.Combine(SeasonalHandler.OnEventChanged, new Action(UpdateProps)); } private void OnDisable() { SeasonalHandler.OnEventChanged = (Action)Delegate.Remove(SeasonalHandler.OnEventChanged, new Action(UpdateProps)); } private void Start() { UpdateProps(SeasonalHandler.CurrentEvent); } private void UpdateProps(SeasonalEvent seasonalEvent) { SeasonalProps[] seasonalProps = SeasonalProps; foreach (SeasonalProps seasonalProps2 in seasonalProps) { if (seasonalProps2.Event == seasonalEvent) { seasonalProps2.Show(); } else { seasonalProps2.Hide(); } } } } [Serializable] public class MeshReplacement { public MeshFilter MeshFilter; public Mesh Mesh; private bool _replaced; private Mesh _previousMesh; public void Replace() { if (!_replaced) { _previousMesh = MeshFilter.mesh; MeshFilter.mesh = Mesh; _replaced = true; } } public void Restore() { if (_replaced) { MeshFilter.mesh = _previousMesh; _replaced = false; } } } [Serializable] public class SeasonalProps { public SeasonalEvent Event; public GameObject[] GameObjects = Array.Empty(); public MeshReplacement[] MeshReplacements = Array.Empty(); public void Show() { GameObject[] gameObjects = GameObjects; foreach (GameObject val in gameObjects) { val.SetActive(true); } MeshReplacement[] meshReplacements = MeshReplacements; foreach (MeshReplacement meshReplacement in meshReplacements) { meshReplacement.Replace(); } } public void Hide() { GameObject[] gameObjects = GameObjects; foreach (GameObject val in gameObjects) { val.SetActive(false); } MeshReplacement[] meshReplacements = MeshReplacements; foreach (MeshReplacement meshReplacement in meshReplacements) { meshReplacement.Restore(); } } } public class Takey : AdvancedNoisemakerProp { [CompilerGenerated] private sealed class d__71 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Takey <>4__this; public float flyDuration; private float 5__2; private float 5__3; private float 5__4; private float 5__5; private float 5__6; private float 5__7; private bool 5__8; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__71(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0075: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; Takey takey = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; 5__5 += Time.deltaTime; 5__6 += Time.deltaTime; } else { <>1__state = -1; takey.IsFlying = true; takey.IsHovering = false; ((GrabbableObject)takey).grabbable = false; if (!takey.Variant.InSpecialAnimation) { takey.PlaySoundOnLocalClient(takey.LiftOffSFX, takey.LiftOffSFXFar); } takey.TakeyJetpack.ShowJetpack(); takey.TakeyJetpack.PlayEffects(); 5__2 = ((Component)takey).transform.localPosition.y; 5__3 = 0f; 5__4 = takey.FlySpeed; 5__5 = 0f; 5__6 = 0f; 5__7 = 0f; 5__8 = false; } if (((GrabbableObject)takey).isHeld || ((GrabbableObject)takey).isPocketed) { return false; } if (!(5__5 > flyDuration)) { Vector3 localPosition = ((Component)takey).transform.localPosition; 5__4 += takey.FlySpeedMultiplier * Time.deltaTime; if (5__4 > takey.MaxFlySpeed) { 5__4 = takey.MaxFlySpeed; } if (!takey.IsHovering) { localPosition.y += 5__4 * Time.deltaTime; } else { localPosition.y = 5__3 + Mathf.Sin(5__7 * takey.HoverSpeed) * takey.HoverRange; 5__7 += Time.deltaTime; } float num2 = localPosition.y - 5__2; if (!takey.IsHovering && num2 >= takey.HoverYOffset) { 5__3 = localPosition.y; takey.IsHovering = true; ((GrabbableObject)takey).grabbable = true; } if (5__5 >= flyDuration - 1f && !5__8) { 5__8 = true; takey.TakeyJetpack.PlayWarningBeepSFX(); } ((Component)takey).transform.localPosition = localPosition; if (((NetworkBehaviour)takey).IsOwner && 5__6 > 0.25f) { 5__6 = 0f; RoundManager.Instance.PlayAudibleNoise(((Component)takey).transform.position, takey.NoiseRange, 1f, 0, ((GrabbableObject)takey).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } <>2__current = null; <>1__state = 1; return true; } takey.TakeyJetpack.HideJetpack(); takey.TakeyJetpack.StopEffects(); if (NetworkUtils.IsServer) { int damage = 50; float maxDamageRange = 6.4f; PluginNetworkBehaviour.Instance.SpawnExplosionServerRpc(((Component)takey).transform.position, damage, maxDamageRange); ((Component)takey).GetComponent().Despawn(true); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static List Instances = new List(); [Space(20f)] [Header("Takey")] [Space(5f)] public TakeyVariantDataList VariantDataList; [Header("Jetpack")] [Space(5f)] public TakeyJetpack TakeyJetpack; public AudioClip LiftOffSFX; public AudioClip LiftOffSFXFar; public float FlySpeed = 0.2f; public float MaxFlySpeed = 2f; public float FlySpeedMultiplier = 1.2f; public float HoverYOffset = 2f; public float HoverSpeed = 5f; public float HoverRange = 0.5f; private bool _loadVariantData; private Coroutine _startFlyingAnimationOnLocalClient; public PlayerControllerB PreviousPlayerHeldBy { get; private set; } public TakeyVariant Variant { get; private set; } public TakeyVariantType VariantType { get { if ((Object)(object)Variant == (Object)null) { return VariantDataList.GetByIndex(VariantIndex).VariantType; } return Variant.VariantType; } } public int VariantIndex { get; private set; } public bool JetpackFly { get; private set; } public bool IsFlying { get; private set; } public bool IsHovering { get; private set; } public override void Awake() { base.Awake(); if (NetworkUtils.IsServer) { VariantIndex = VariantDataList.GetRandomIndex(); JetpackFly = GetJetpackFlyRoll(); } } public override void Start() { ((GrabbableObject)this).Start(); TakeyJetpack.HideJetpack(); TakeyJetpack.StopEffects(); if (NetworkUtils.IsServer) { SpawnVariant(); SetJetpackFlyServerRpc(JetpackFly); } else { Variant = ((Component)this).GetComponentInChildren(); Variant.Takey = this; VariantIndex = VariantDataList.GetIndex(VariantType); } SetNoiseSFX(); } private void OnEnable() { if (!Instances.Contains(this)) { Instances.Add(this); } } private void OnDisable() { Instances.Remove(this); } public override void OnNetworkDespawn() { base.OnNetworkDespawn(); if (NetworkUtils.IsServer) { DespawnVariant(); } } protected override void OnClientConnected(ulong clientId) { //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_0028: 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_0037: Unknown result type (might be due to invalid IL or missing references) if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(JetpackFly, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(bool jetpackFly, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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) //IL_00dc: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1278842631u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref jetpackFly, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1278842631u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; JetpackFly = jetpackFly; LogInfoExtended($"Received data. (JetpackFly: {JetpackFly})"); } } } public override void OnGainedOwnership() { //IL_000e: 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) LogInfoExtended("Requested ownership of variant."); ChangeOwnershipOfVariantServerRpc(); } public override void Update() { if (JetpackFly) { ((GrabbableObject)this).grabbable = false; } if (!IsFlying) { ((GrabbableObject)this).Update(); } } private void SetNoiseSFX() { if (!((Object)(object)Variant == (Object)null)) { NoiseSFX = Variant.SqueezeVoiceLines; } } public override int GetItemDataToSave() { GameSaveFileHelper.Save(base.SaveKey + "_VariantIndex", VariantIndex); GameSaveFileHelper.Save(base.SaveKey + "_JetpackFly", JetpackFly); LogInfoExtended($"Saved item data. (VariantIndex: {VariantIndex}, VariantType: {VariantDataList.GetByIndex(VariantIndex).VariantType}, JetpackFly: {JetpackFly})"); Variant?.SaveData(); return base.GetItemDataToSave(); } public override void LoadItemSaveData(int saveData) { base.LoadItemSaveData(saveData); if (NetworkUtils.IsServer) { _loadVariantData = true; VariantIndex = GameSaveFileHelper.Load(base.SaveKey + "_VariantIndex", VariantDataList.GetRandomIndex()); JetpackFly = GameSaveFileHelper.Load(base.SaveKey + "_JetpackFly", defaultValue: false); LogInfoExtended($"Loaded item data. (VariantIndex: {VariantIndex}, VariantType: {VariantDataList.GetByIndex(VariantIndex).VariantType}, JetpackFly: {JetpackFly})"); } } public override void InteractItem() { if (((GrabbableObject)this).grabbable) { if (IsFlying) { StopFlyingServerRpc(); } } else if (JetpackFly && !IsFlying) { StartFlyingServerRpc(); ShowJetpackFlyWarning(); } Variant?.InteractItem(); } public override void GrabItem() { Variant?.GrabItem(); } public override void SetControlTipsForItem() { if ((Object)(object)Variant == (Object)null) { ((GrabbableObject)this).SetControlTipsForItem(); } else { Variant.SetControlTipsForItem(); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); PreviousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy; PreviousPlayerHeldBy.equippedUsableItemQE = true; Variant?.EquipItem(); } public override void ItemActivate(bool used, bool buttonDown = true) { if ((Object)(object)Variant == (Object)null) { base.ItemActivate(used, buttonDown); } else if (Variant.ItemActivate(used, buttonDown) && !Variant.InSpecialAnimation) { base.ItemActivate(used, buttonDown); } } public override void ItemInteractLeftRight(bool right) { Variant?.ItemInteractLeftRight(right); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); Variant?.PocketItem(); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); if ((Object)(object)PreviousPlayerHeldBy != (Object)null) { PreviousPlayerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).isBeingUsed = false; if (((NetworkBehaviour)this).IsOwner) { RollJetpackFlyServerRpc(); } Variant?.DiscardItem(); } public override void OnHitGround() { Variant?.OnHitGround(); } public override void OnBroughtToShip() { ((GrabbableObject)this).OnBroughtToShip(); VariantDataList.OnBroughtToShip(VariantType); Variant?.OnBroughtToShip(); } private void SpawnVariant() { if ((Object)(object)Variant != (Object)null) { LogError($"Failed to spawn variant #{VariantIndex}. TakeyVariant already exists. (VariantIndex: {VariantIndex}, VariantType: {VariantType})"); return; } TakeyVariantData byIndex = VariantDataList.GetByIndex(VariantIndex); if (byIndex == null) { LogError($"Failed to spawn variant #{VariantIndex}. TakeyVariantData could not be found."); return; } if ((Object)(object)byIndex.Prefab == (Object)null) { LogError($"Failed to spawn variant #{VariantIndex}. TakeyVariantData Prefab could not be found."); return; } GameObject val = Object.Instantiate(byIndex.Prefab); val.GetComponent().Spawn(false); val.transform.SetParent(((Component)this).transform); Variant = val.GetComponent(); Variant.Takey = this; if (_loadVariantData) { Variant?.LoadData(); } LogInfoExtended("Spawned variant prefab."); } private void DespawnVariant() { if ((Object)(object)Variant == (Object)null) { LogError("Failed to despawn variant. TakeyVariant could not be found."); return; } NetworkObject component = ((Component)Variant).GetComponent(); if ((Object)(object)component != (Object)null && component.IsSpawned) { component.Despawn(true); } LogInfoExtended("Despawned variant."); } [ServerRpc(RequireOwnership = false)] private void ChangeOwnershipOfVariantServerRpc(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_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_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_00c7: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(630446264u, serverRpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 630446264u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId) && !((Object)(object)Variant == (Object)null)) { ((Component)Variant).GetComponent().ChangeOwnership(senderClientId); LogInfoExtended($"Changed variant ownership to client: {senderClientId}"); } } } private bool GetJetpackFlyRoll() { VehicleController val = default(VehicleController); if ((Object)(object)((Component)this).transform.parent != (Object)null && ((Component)((Component)this).transform.parent).TryGetComponent(ref val)) { return false; } return Utils.RollPercentChance(ConfigManager.SmolTakey_JetpackChance.Value); } [ServerRpc(RequireOwnership = false)] public void RollJetpackFlyServerRpc() { //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_00c1: 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(1213506770u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1213506770u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetJetpackFlyServerRpc(GetJetpackFlyRoll()); } } } [ServerRpc(RequireOwnership = false)] private void SetJetpackFlyServerRpc(bool value) { //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) //IL_00dc: 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(2763764846u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2763764846u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetJetpackFlyClientRpc(value); } } } [ClientRpc] private void SetJetpackFlyClientRpc(bool value) { //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) //IL_00dc: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3282957009u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3282957009u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; JetpackFly = value; } } } [ServerRpc(RequireOwnership = false)] public void StartFlyingServerRpc() { //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_00c1: 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(492595741u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 492595741u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; StartFlyingClientRpc(5f); } } } [ClientRpc] private void StartFlyingClientRpc(float flyDuration) { //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) //IL_00dc: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2016010317u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flyDuration, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2016010317u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; StartFlyingOnLocalClient(flyDuration); } } } private void StartFlyingOnLocalClient(float flyDuration) { JetpackFly = false; if (_startFlyingAnimationOnLocalClient != null) { ((MonoBehaviour)this).StopCoroutine(_startFlyingAnimationOnLocalClient); } _startFlyingAnimationOnLocalClient = ((MonoBehaviour)this).StartCoroutine(StartFlyingAnimationOnLocalClient(flyDuration)); Variant?.OnStartFlying(); } [IteratorStateMachine(typeof(d__71))] private IEnumerator StartFlyingAnimationOnLocalClient(float flyDuration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__71(0) { <>4__this = this, flyDuration = flyDuration }; } [ServerRpc(RequireOwnership = false)] private void StopFlyingServerRpc() { //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_00c1: 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(3000815762u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3000815762u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; StopFlyingClientRpc(); } } } [ClientRpc] private void StopFlyingClientRpc() { //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_00c1: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3937760835u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3937760835u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (_startFlyingAnimationOnLocalClient != null) { ((MonoBehaviour)this).StopCoroutine(_startFlyingAnimationOnLocalClient); } TakeyJetpack.HideJetpack(); TakeyJetpack.StopEffects(); IsFlying = false; IsHovering = false; ((GrabbableObject)this).grabbable = true; ((GrabbableObject)this).currentUseCooldown = 0f; if (!Variant.InSpecialAnimation) { NoiseAudio.Stop(); } } } private void ShowJetpackFlyWarning() { HUDManager.Instance.DisplayTip("TakeyPlush", "Quick! Catch him before it's too late!", true, true, "TakeyPlush_JetpackFlyWarning"); } protected override void OnPlaySoundFromIndex(int index) { Variant?.OnPlaySqueezeVoiceLine(index); } public void LogError(object data) { string text = ((base.UniqueId != 0) ? $" : {base.UniqueId}" : string.Empty); string text2 = ((VariantType != 0) ? $" : {VariantType}" : string.Empty); Logger.LogError("[" + ((GrabbableObject)this).itemProperties.itemName + text + text2 + "] " + data); } public void LogInfoExtended(object data) { string text = ((base.UniqueId != 0) ? $" : {base.UniqueId}" : string.Empty); string text2 = ((VariantType != 0) ? $" : {VariantType}" : string.Empty); Logger.LogInfo("[" + ((GrabbableObject)this).itemProperties.itemName + text + text2 + "] " + data, extended: true); } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1278842631u, new RpcReceiveHandler(__rpc_handler_1278842631), "SetDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(630446264u, new RpcReceiveHandler(__rpc_handler_630446264), "ChangeOwnershipOfVariantServerRpc"); ((NetworkBehaviour)this).__registerRpc(1213506770u, new RpcReceiveHandler(__rpc_handler_1213506770), "RollJetpackFlyServerRpc"); ((NetworkBehaviour)this).__registerRpc(2763764846u, new RpcReceiveHandler(__rpc_handler_2763764846), "SetJetpackFlyServerRpc"); ((NetworkBehaviour)this).__registerRpc(3282957009u, new RpcReceiveHandler(__rpc_handler_3282957009), "SetJetpackFlyClientRpc"); ((NetworkBehaviour)this).__registerRpc(492595741u, new RpcReceiveHandler(__rpc_handler_492595741), "StartFlyingServerRpc"); ((NetworkBehaviour)this).__registerRpc(2016010317u, new RpcReceiveHandler(__rpc_handler_2016010317), "StartFlyingClientRpc"); ((NetworkBehaviour)this).__registerRpc(3000815762u, new RpcReceiveHandler(__rpc_handler_3000815762), "StopFlyingServerRpc"); ((NetworkBehaviour)this).__registerRpc(3937760835u, new RpcReceiveHandler(__rpc_handler_3937760835), "StopFlyingClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_1278842631(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool jetpackFly = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref jetpackFly, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((Takey)(object)target).SetDataClientRpc(jetpackFly, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_630446264(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_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((Takey)(object)target).ChangeOwnershipOfVariantServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1213506770(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; ((Takey)(object)target).RollJetpackFlyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2763764846(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 jetpackFlyServerRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref jetpackFlyServerRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Takey)(object)target).SetJetpackFlyServerRpc(jetpackFlyServerRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3282957009(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 jetpackFlyClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref jetpackFlyClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Takey)(object)target).SetJetpackFlyClientRpc(jetpackFlyClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_492595741(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; ((Takey)(object)target).StartFlyingServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2016010317(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 flyDuration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flyDuration, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Takey)(object)target).StartFlyingClientRpc(flyDuration); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3000815762(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; ((Takey)(object)target).StopFlyingServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3937760835(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; ((Takey)(object)target).StopFlyingClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Takey"; } } public class TakeyALOOEventReceiver : MonoBehaviour { public static List Instances = new List(); public AudioSource AudioSource; public float NoiseRange; private GrabbableObject _grabbableObject; private void OnEnable() { if (!Instances.Contains(this)) { Instances.Add(this); } } private void OnDisable() { Instances.Remove(this); } private void Start() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)this).transform.parent == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); } if (!((Component)((Component)this).transform.parent).TryGetComponent(ref _grabbableObject)) { Object.Destroy((Object)(object)((Component)this).gameObject); } ((Component)this).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); } private void Update() { AudioSource.mute = GetMuteAudioSourceStatus(); } private bool GetMuteAudioSourceStatus() { GrabbableObject grabbableObject = _grabbableObject; WalkieTalkie val = (WalkieTalkie)(object)((grabbableObject is WalkieTalkie) ? grabbableObject : null); if ((Object)(object)val != (Object)null) { return !((GrabbableObject)val).isBeingUsed; } if (!_grabbableObject.isHeld) { return true; } return false; } public float PlaySound(AudioClip audioClip, bool audibleNoise = true) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AudioSource == (Object)null || (Object)(object)audioClip == (Object)null) { return 0f; } AudioSource.Stop(); AudioSource.PlayOneShot(audioClip); if (audibleNoise && !AudioSource.mute) { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, NoiseRange, AudioSource.volume, 0, _grabbableObject.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); if (AudioSource.volume >= 0.6f && (Object)(object)_grabbableObject.playerHeldBy != (Object)null) { _grabbableObject.playerHeldBy.timeSinceMakingLoudNoise = 0f; } } return audioClip.length; } } public enum TakeyALOOEventType { ThreeBeehivesOnShip, ThreeForestGiantsOutside, EightPM, ForestGiantAroundMain, LastSurvivor, MaskedInShip, SafeToGetApparatus, SmolTakeyInInterior, SomeoneDiedToFalling, SomeoneDrownedInQuicksand, SomeoneSteppedOnLandmine, RandomMessage } public class TakeyALOOVariant : TakeyVariant { [CompilerGenerated] private sealed class d__45 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeyALOOEventType eventType; public TakeyALOOVariant <>4__this; public int randomEventIndex; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__45(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown int num = <>1__state; TakeyALOOVariant takeyALOOVariant = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; TakeyALOOEventData takeyALOOEventData = ((eventType != TakeyALOOEventType.RandomMessage) ? takeyALOOVariant.GetEventData(eventType) : takeyALOOVariant.GetRandomEventData(randomEventIndex)); if (takeyALOOEventData == null) { takeyALOOVariant.LogError($"Failed to play {eventType} event on local client. TakeyALOOEventData is null."); return false; } takeyALOOVariant.LogInfoExtended($"Started event: {eventType}"); takeyALOOVariant._playingEvent = true; takeyALOOEventData.Played = true; foreach (TakeyALOOEventReceiver instance in TakeyALOOEventReceiver.Instances) { instance.PlaySound(takeyALOOEventData.AudioClip); } <>2__current = (object)new WaitForSeconds(takeyALOOEventData.AudioClip.length + 1f); <>1__state = 1; return true; } case 1: <>1__state = -1; takeyALOOVariant._playingEvent = false; if (NetworkUtils.IsServer) { takeyALOOVariant.PlayNextEventFromQueue_Server(); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__59 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeyALOOVariant <>4__this; private AudioClip 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__59(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown int num = <>1__state; TakeyALOOVariant takeyALOOVariant = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; takeyALOOVariant.LogInfoExtended("Starting TTS event on local client."); takeyALOOVariant._startingTTSEvent = false; if ((Object)(object)takeyALOOVariant.Takey == (Object)null) { Logger.LogError("Failed to start TTS event on local client. This scrap item did not initialize properly! This is most likely caused by another mod you have installed."); return false; } float value = ConfigManager.ALOOVariantTTS_VoiceVolumeAmplificationDB.Value; 5__2 = Utils.AmplifyClipByDecibels(takeyALOOVariant._TTSStreamedAudioClip.AudioClip, value); takeyALOOVariant._playingTTSEvent = true; takeyALOOVariant.InSpecialAnimation = true; takeyALOOVariant.Takey.NoiseAudio.Stop(); <>2__current = (object)new WaitForSeconds(takeyALOOVariant.PlaySound(takeyALOOVariant.PhoneAudio, takeyALOOVariant.PhoneRingSFX, audibleNoise: false)); <>1__state = 1; return true; } case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = (object)new WaitForSeconds(takeyALOOVariant.PlaySound(takeyALOOVariant.VoiceAudio, 5__2, audibleNoise: false)); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = (object)new WaitForSeconds(takeyALOOVariant.PlaySound(takeyALOOVariant.PhoneAudio, takeyALOOVariant.PhoneEndCallSFX, audibleNoise: false)); <>1__state = 5; return true; case 5: <>1__state = -1; takeyALOOVariant.SetTTSIsOnCooldown_Server(value: true); takeyALOOVariant._playingTTSEvent = false; takeyALOOVariant.InSpecialAnimation = false; takeyALOOVariant.LogInfoExtended($"TTS event is now on cooldown for {takeyALOOVariant._TTSEventCooldown} seconds"); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__53 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public AudioClip clip; public TakeyALOOVariant <>4__this; private int 5__2; private float[] 5__3; private int 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__53(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__3 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; TakeyALOOVariant takeyALOOVariant = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if ((Object)(object)clip == (Object)null) { return false; } takeyALOOVariant._clientsReceivedTTSAudioClip.Clear(); takeyALOOVariant.StreamAudioStart_ClientRpc(clip.channels, clip.frequency); 5__2 = 480; 5__3 = new float[clip.samples * clip.channels]; clip.GetData(5__3, 0); 5__4 = 0; break; case 1: <>1__state = -1; break; } if (5__4 < 5__3.Length) { int num2 = Mathf.Min(5__2, 5__3.Length - 5__4); float[] array = new float[num2]; Array.Copy(5__3, 5__4, array, 0, num2); takeyALOOVariant.StreamAudioChunk_ClientRpc(array); 5__4 += num2; <>2__current = null; <>1__state = 1; return true; } takeyALOOVariant.StreamAudioComplete_ClientRpc(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static TakeyALOOVariant MasterInstance; [Space(20f)] [Header("ALOO")] [Space(5f)] public Animator PhoneAnimator; public AudioSource PhoneAudio; public AudioSource VoiceAudio; public AudioClip PhoneRingSFX; public AudioClip PhoneEndCallSFX; public TakeyALOOEventData[] PhoneEvents = Array.Empty(); public TakeyALOOEventData[] RandomPhoneEvents = Array.Empty(); private bool _playingEvent; private Coroutine _eventCoroutine; private List _eventQueue = new List(); private LCTime _randomPhoneEventTime; private bool _timePassedTwelvePM; private bool _timePassedEightPM; private bool _TTSIsOnCooldown; private bool _startingTTSEvent; private bool _playingTTSEvent; private StreamedAudioClip _TTSStreamedAudioClip; private List _clientsReceivedTTSAudioClip = new List(); private Coroutine _startTTSEventAnimation; private float _TTSCooldownTimer; private ProfanityFilter _profanityFilter; public bool IsMasterInstance => (Object)(object)MasterInstance == (Object)(object)this; private float _TTSEventCooldown => ConfigManager.ALOOVariantTTS_Cooldown.Value; public override void Start() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown base.Start(); if ((Object)(object)MasterInstance == (Object)null) { MasterInstance = this; LogInfoExtended("Set master instance to this."); } UpdateSettings(); if (NetworkUtils.IsServer) { _randomPhoneEventTime = new LCTime(); _timePassedTwelvePM = false; _timePassedEightPM = false; _profanityFilter = new ProfanityFilter(); SetTTSIsOnCooldown_Server(_TTSIsOnCooldown); } } public override void OnNetworkSpawn() { base.OnNetworkSpawn(); if (NetworkUtils.IsServer) { Events.OnALOOTTSMessage += OnTTSMessageReceived; Events.OnGrabItem += OnGrabItem; Events.OnDiscardItem += OnDiscardItem; Events.OnShipArrived += OnShipArrive; Events.OnTimeChanged += OnTimeChanged; Events.OnPlayerDied += OnPlayerDied; Events.OnMaskedEnteredShip += OnMaskedEnteredShip; Events.OnForestGiantSpawned += OnForestGiantSpawned; Events.OnForestGiantNearMain += OnForestGiantNearMain; } } public override void OnNetworkDespawn() { base.OnNetworkDespawn(); if (IsMasterInstance) { SetNewMasterInstance(); } if (NetworkUtils.IsServer) { Events.OnALOOTTSMessage -= OnTTSMessageReceived; Events.OnGrabItem -= OnGrabItem; Events.OnDiscardItem -= OnDiscardItem; Events.OnShipArrived -= OnShipArrive; Events.OnTimeChanged -= OnTimeChanged; Events.OnPlayerDied -= OnPlayerDied; Events.OnMaskedEnteredShip -= OnMaskedEnteredShip; Events.OnForestGiantSpawned -= OnForestGiantSpawned; Events.OnForestGiantNearMain -= OnForestGiantNearMain; } } public override void OnClientConnected(ulong clientId) { //IL_0012: 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_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) //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_003e: Unknown result type (might be due to invalid IL or missing references) base.OnClientConnected(clientId); if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SetData_ClientRpc(_TTSIsOnCooldown, clientRpcParams); } } [ClientRpc] private void SetData_ClientRpc(bool TTSIsOnCooldown, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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) //IL_00dc: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2450126798u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref TTSIsOnCooldown, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2450126798u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetTTSIsOnCooldown_Local(TTSIsOnCooldown); } } } public override bool ItemActivate(bool used, bool buttonDown = true) { if (_playingTTSEvent) { return false; } return base.ItemActivate(used, buttonDown); } public override void Update() { base.Update(); TTSEvent_Tick(); } private void OnShipArrive() { ResetEvents(); } private void OnGrabItem(GrabbableObject grabbableObject) { if (!IsMasterInstance || !StartOfRound.Instance.shipHasLanded || !StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { return; } int num = 0; bool flag = false; foreach (GrabbableObject instance in GrabbableObjectPatch.Instances) { if (instance.itemProperties.isScrap && instance.isInFactory) { if (grabbableObject.itemProperties.itemName.Equals("Apparatus", StringComparison.OrdinalIgnoreCase)) { flag = true; } num++; } } if (num <= 3 && flag) { PlayEvent_Server(TakeyALOOEventType.SafeToGetApparatus); } } private void OnDiscardItem(GrabbableObject grabbableObject) { if (IsMasterInstance && StartOfRound.Instance.shipHasLanded && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap && Utils.GetBeehivesOnShipCount() == 3) { PlayEvent_Server(TakeyALOOEventType.ThreeBeehivesOnShip); } } private void OnTimeChanged(int hours, int minutes) { if (!IsMasterInstance) { return; } if (_randomPhoneEventTime.HasMinutesPassed(30)) { _randomPhoneEventTime.UpdateTime(); if (((GrabbableObject)base.Takey).isInShipRoom && Utils.RollPercentChance(5f)) { PlayEvent_Server(TakeyALOOEventType.RandomMessage); } } if (!_timePassedTwelvePM && hours >= 12) { _timePassedTwelvePM = true; Takey[] array = Takey.Instances.Where(delegate(Takey x) { if (!((GrabbableObject)x).isInFactory) { return false; } if (((GrabbableObject)x).isInShipRoom) { return false; } return (!((GrabbableObject)x).isHeld) ? true : false; }).ToArray(); if (array.Length != 0) { PlayEvent_Server(TakeyALOOEventType.SmolTakeyInInterior); } } if (!_timePassedEightPM && hours >= 20) { _timePassedEightPM = true; PlayEvent_Server(TakeyALOOEventType.EightPM); } } private void OnPlayerDied(PlayerControllerB playerScript, PlayerDeathReason playerDeathReason) { if (IsMasterInstance) { switch (playerDeathReason) { case PlayerDeathReason.Falling: PlayEvent_Server(TakeyALOOEventType.SomeoneDiedToFalling); break; case PlayerDeathReason.Quicksand: PlayEvent_Server(TakeyALOOEventType.SomeoneDrownedInQuicksand); break; case PlayerDeathReason.Landmine: PlayEvent_Server(TakeyALOOEventType.SomeoneSteppedOnLandmine); break; } if (GameNetworkManager.Instance.connectedPlayers > 1 && PlayerUtils.AlivePlayerScripts.Length == 1) { PlayEvent_Server(TakeyALOOEventType.LastSurvivor); } } } private void OnMaskedEnteredShip(MaskedPlayerEnemy maskedPlayerEnemy) { if (IsMasterInstance) { PlayEvent_Server(TakeyALOOEventType.MaskedInShip); } } private void OnForestGiantSpawned(ForestGiantAI forestGiantAI) { if (IsMasterInstance && Utils.GetForestGiantSpawnCount() == 3) { PlayEvent_Server(TakeyALOOEventType.ThreeForestGiantsOutside); } } private void OnForestGiantNearMain(ForestGiantAI forestGiantAI) { if (IsMasterInstance) { PlayEvent_Server(TakeyALOOEventType.ForestGiantAroundMain); } } private void PlayEvent_Server(TakeyALOOEventType eventType) { if (!NetworkUtils.IsServer || !IsMasterInstance) { return; } int num = -1; if (eventType != TakeyALOOEventType.RandomMessage) { TakeyALOOEventData eventData = GetEventData(eventType); if (eventData == null) { LogError("Failed to play event on server. TakeyALOOEventData is null."); return; } if (!eventData.CanPlay) { LogInfoExtended("Could not play event on server. This event has already been played."); return; } } else { num = GetRandomEventIndex(); if (num == -1) { LogInfoExtended("Could not play random event on server. All random events have already been played."); return; } } if (_playingEvent) { _eventQueue.Add(eventType); LogInfoExtended($"Added {eventType} event to the queue."); } else { PlayEvent_ClientRpc(eventType, num); PlayEvent_Local(eventType, num); } } private void PlayNextEventFromQueue_Server() { if (!_playingEvent && _eventQueue.Count != 0) { TakeyALOOEventType eventType = _eventQueue[0]; _eventQueue.RemoveAt(0); PlayEvent_Server(eventType); } } [ClientRpc] private void PlayEvent_ClientRpc(TakeyALOOEventType eventType, int randomEventIndex) { //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_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_008c: 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_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2522538118u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref eventType, default(ForEnums)); BytePacker.WriteValueBitPacked(val2, randomEventIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2522538118u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { PlayEvent_Local(eventType, randomEventIndex); } } } private void PlayEvent_Local(TakeyALOOEventType eventType, int randomEventIndex) { if (_eventCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_eventCoroutine); } _eventCoroutine = ((MonoBehaviour)this).StartCoroutine(PlayEvent_LocalCoroutine(eventType, randomEventIndex)); } [IteratorStateMachine(typeof(d__45))] private IEnumerator PlayEvent_LocalCoroutine(TakeyALOOEventType eventType, int randomEventIndex) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__45(0) { <>4__this = this, eventType = eventType, randomEventIndex = randomEventIndex }; } private TakeyALOOEventData GetEventData(TakeyALOOEventType eventType) { TakeyALOOEventData[] phoneEvents = PhoneEvents; foreach (TakeyALOOEventData takeyALOOEventData in phoneEvents) { if (takeyALOOEventData.EventType == eventType) { return takeyALOOEventData; } } return null; } private TakeyALOOEventData GetRandomEventData(int randomEventIndex) { if (randomEventIndex < 0 || randomEventIndex > RandomPhoneEvents.Length - 1) { return null; } return RandomPhoneEvents[randomEventIndex]; } private int GetRandomEventIndex() { List list = new List(); for (int i = 0; i < RandomPhoneEvents.Length; i++) { if (RandomPhoneEvents[i].CanPlay) { list.Add(i); } } if (list.Count == 0) { return -1; } return list[Random.Range(0, list.Count)]; } private void ResetEvents() { _randomPhoneEventTime.UpdateTime(); _timePassedTwelvePM = false; _timePassedEightPM = false; TakeyALOOEventData[] phoneEvents = PhoneEvents; foreach (TakeyALOOEventData takeyALOOEventData in phoneEvents) { takeyALOOEventData.Played = false; } TakeyALOOEventData[] randomPhoneEvents = RandomPhoneEvents; foreach (TakeyALOOEventData takeyALOOEventData2 in randomPhoneEvents) { takeyALOOEventData2.Played = false; } } private void TTSEvent_Tick() { if (NetworkUtils.IsServer && IsMasterInstance && _TTSIsOnCooldown && !_playingTTSEvent) { if (_TTSCooldownTimer >= _TTSEventCooldown) { _TTSCooldownTimer = 0f; SetTTSIsOnCooldown_Server(value: false); LogInfoExtended("TTS event is now ready!"); } else { _TTSCooldownTimer += Time.deltaTime; } } } public void OnTTSMessageReceived(string text) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer && IsMasterInstance) { LogInfoExtended("Received TTS message: " + text); if (ConfigManager.ALOOVariantTTS_ProfanityFilterEnabled.Value) { text = _profanityFilter.CensorString(text); } if (!PlayerUtils.IsPlayerNearby(((Component)this).transform.position, VoiceAudio.maxDistance, ((GrabbableObject)base.Takey).isInShipRoom)) { LogInfoExtended("No players found within the max sound distance. Skipping TTS event."); } else { GetTTSAudioClip_Server(text); } } } private void GetTTSAudioClip_Server(string text) { if (!NetworkUtils.IsServer) { return; } if (!ConfigManager.ALOOVariantTTS_Enabled.Value) { LogInfoExtended("TTS event is disabled in the config settings."); return; } if (_TTSIsOnCooldown) { LogInfoExtended("TTS event is still on cooldown."); return; } if (_startingTTSEvent || _playingTTSEvent) { LogInfoExtended("TTS event is already playing or starting."); return; } _startingTTSEvent = true; string text2 = text; string name = TextToSpeech.GetRandomVoiceName(); int num = text.IndexOf(':'); if (num > 0) { string text3 = text.Substring(0, num).Trim(); string text4 = text.Substring(num + 1).Trim(); if (text3.StartsWith("ALOO", StringComparison.OrdinalIgnoreCase)) { string b = text3.Substring("ALOO".Length).Trim(); string[] voiceNames = TextToSpeech.VoiceNames; foreach (string text5 in voiceNames) { if (string.Equals(text5, b, StringComparison.OrdinalIgnoreCase)) { name = text5; text2 = "ALOO " + text4; break; } } } } TextToSpeech.RequestAudio(name, text2, delegate(AudioClip clip) { if ((Object)(object)clip == (Object)null) { _startingTTSEvent = false; } else { ((MonoBehaviour)this).StartCoroutine(StreamAudio_Server(clip)); } }); } [IteratorStateMachine(typeof(d__53))] private IEnumerator StreamAudio_Server(AudioClip clip) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__53(0) { <>4__this = this, clip = clip }; } [ClientRpc] private void StreamAudioStart_ClientRpc(int channels, int sampleRate) { //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) //IL_00db: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3688163357u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, channels); BytePacker.WriteValueBitPacked(val2, sampleRate); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3688163357u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; _TTSStreamedAudioClip = new StreamedAudioClip(); _TTSStreamedAudioClip.Channels = channels; _TTSStreamedAudioClip.SampleRate = sampleRate; } } } [ClientRpc] private void StreamAudioChunk_ClientRpc(float[] chunk) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_010c: 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_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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1687798349u, val, (RpcDelivery)0); bool flag = chunk != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(chunk, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1687798349u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; _TTSStreamedAudioClip.AddChunk(chunk); } } [ClientRpc] private void StreamAudioComplete_ClientRpc() { //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_00c1: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3704789395u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3704789395u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; _TTSStreamedAudioClip.BuildClipIfNeeded(); ReceivedAudioClip_ServerRpc(); } } } [ServerRpc(RequireOwnership = false)] private void ReceivedAudioClip_ServerRpc(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_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_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_00c7: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(313973520u, serverRpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 313973520u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId) && !_clientsReceivedTTSAudioClip.Contains(senderClientId)) { _clientsReceivedTTSAudioClip.Add(senderClientId); if (_clientsReceivedTTSAudioClip.Contains(NetworkUtils.LocalClientId) && _clientsReceivedTTSAudioClip.Count >= NetworkUtils.ConnectedPlayerCount) { StartTTSEvent_ClientRpc(); } } } [ClientRpc] private void StartTTSEvent_ClientRpc() { //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_00c1: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3367635484u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3367635484u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (_startTTSEventAnimation != null) { ((MonoBehaviour)this).StopCoroutine(_startTTSEventAnimation); } _startTTSEventAnimation = ((MonoBehaviour)this).StartCoroutine(StartTTSEventAnimation()); } } [IteratorStateMachine(typeof(d__59))] private IEnumerator StartTTSEventAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__59(0) { <>4__this = this }; } private void SetTTSIsOnCooldown_Server(bool value) { if (NetworkUtils.IsServer) { SetTTSIsOnCooldown_ClientRpc(value); SetTTSIsOnCooldown_Local(value); } } [ClientRpc] private void SetTTSIsOnCooldown_ClientRpc(bool value) { //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) //IL_00dc: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3872420183u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3872420183u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { SetTTSIsOnCooldown_Local(value); } } } private void SetTTSIsOnCooldown_Local(bool value) { _TTSIsOnCooldown = value; PhoneAnimator.SetBool("IsFlashing", _TTSIsOnCooldown); } private static void SetNewMasterInstance() { foreach (TakeyALOOVariant item in TakeyVariant.GetInstancesOfType()) { if (!((Object)(object)item == (Object)(object)MasterInstance)) { MasterInstance = item; MasterInstance.LogInfoExtended("Set new master instance."); break; } } } private void UpdateSettings() { float value = ConfigManager.ALOOVariantTTS_MinSoundDistance.Value; float value2 = ConfigManager.ALOOVariantTTS_MaxSoundDistance.Value; PhoneAudio.minDistance = value; PhoneAudio.maxDistance = value2; VoiceAudio.minDistance = value; VoiceAudio.maxDistance = value2; } public static void OnConfigSettingsChanged() { foreach (TakeyALOOVariant item in TakeyVariant.GetInstancesOfType()) { item.UpdateSettings(); } } private void ResetTTSCooldown() { _TTSCooldownTimer = _TTSEventCooldown; } public static void ResetTTSCooldown_OnButtonClicked() { foreach (TakeyALOOVariant item in TakeyVariant.GetInstancesOfType()) { item.ResetTTSCooldown(); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2450126798u, new RpcReceiveHandler(__rpc_handler_2450126798), "SetData_ClientRpc"); ((NetworkBehaviour)this).__registerRpc(2522538118u, new RpcReceiveHandler(__rpc_handler_2522538118), "PlayEvent_ClientRpc"); ((NetworkBehaviour)this).__registerRpc(3688163357u, new RpcReceiveHandler(__rpc_handler_3688163357), "StreamAudioStart_ClientRpc"); ((NetworkBehaviour)this).__registerRpc(1687798349u, new RpcReceiveHandler(__rpc_handler_1687798349), "StreamAudioChunk_ClientRpc"); ((NetworkBehaviour)this).__registerRpc(3704789395u, new RpcReceiveHandler(__rpc_handler_3704789395), "StreamAudioComplete_ClientRpc"); ((NetworkBehaviour)this).__registerRpc(313973520u, new RpcReceiveHandler(__rpc_handler_313973520), "ReceivedAudioClip_ServerRpc"); ((NetworkBehaviour)this).__registerRpc(3367635484u, new RpcReceiveHandler(__rpc_handler_3367635484), "StartTTSEvent_ClientRpc"); ((NetworkBehaviour)this).__registerRpc(3872420183u, new RpcReceiveHandler(__rpc_handler_3872420183), "SetTTSIsOnCooldown_ClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_2450126798(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool tTSIsOnCooldown = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref tTSIsOnCooldown, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyALOOVariant)(object)target).SetData_ClientRpc(tTSIsOnCooldown, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2522538118(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_003e: 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) { TakeyALOOEventType eventType = default(TakeyALOOEventType); ((FastBufferReader)(ref reader)).ReadValueSafe(ref eventType, default(ForEnums)); int randomEventIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref randomEventIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyALOOVariant)(object)target).PlayEvent_ClientRpc(eventType, randomEventIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3688163357(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 channels = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref channels); int sampleRate = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref sampleRate); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyALOOVariant)(object)target).StreamAudioStart_ClientRpc(channels, sampleRate); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1687798349(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_006e: 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_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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); float[] chunk = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref chunk, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyALOOVariant)(object)target).StreamAudioChunk_ClientRpc(chunk); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3704789395(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; ((TakeyALOOVariant)(object)target).StreamAudioComplete_ClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_313973520(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_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyALOOVariant)(object)target).ReceivedAudioClip_ServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3367635484(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; ((TakeyALOOVariant)(object)target).StartTTSEvent_ClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3872420183(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 tTSIsOnCooldown_ClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref tTSIsOnCooldown_ClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyALOOVariant)(object)target).SetTTSIsOnCooldown_ClientRpc(tTSIsOnCooldown_ClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyALOOVariant"; } } [Serializable] public class TakeyALOOEventData { public TakeyALOOEventType EventType; public AudioClip AudioClip; public bool PlayOnce; [HideInInspector] public bool Played; public bool CanPlay { get { if (!PlayOnce) { return true; } return !Played; } } } public class StreamedAudioClip { private AudioClip _audioClip; public int Channels = 1; public int SampleRate = 48000; public AudioClip AudioClip { get { BuildClipIfNeeded(); return _audioClip; } } public List BufferedSamples { get; private set; } = new List(); public bool IsClipBuilt { get; private set; } public StreamedAudioClip() { } public StreamedAudioClip(float[] chunk, int channels, int sampleRate) { AddChunk(chunk, channels, sampleRate); } public void AddChunk(float[] chunk) { BufferedSamples.AddRange(chunk); } public void AddChunk(float[] chunk, int channels, int sampleRate) { BufferedSamples.AddRange(chunk); Channels = channels; SampleRate = sampleRate; } public void BuildClipIfNeeded() { if (!IsClipBuilt && BufferedSamples.Count != 0) { _audioClip = AudioClip.Create($"{Guid.NewGuid()}", BufferedSamples.Count / Channels, Channels, SampleRate, false); _audioClip.SetData(BufferedSamples.ToArray(), 0); IsClipBuilt = true; } } } public class TakeyBox : GrabbableObject { [CompilerGenerated] private sealed class d__16 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeyBox <>4__this; private PlayerControllerB 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_01ac: 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_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_01c5: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0232: 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) int num = <>1__state; TakeyBox takeyBox = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; if (!NetworkUtils.IsServer) { return false; } 5__2 = takeyBox.PreviousPlayerHeldBy; if ((Object)(object)5__2 == (Object)null) { return false; } string[] array = new string[21] { "Oh no!", ":)", "This will be fun", "This will be fun :3", "I wonder what will happen now...", "That should not have happened...", "Hehhehehe", "Hehhehehe :3", "peepoGiggles", "peepoBye", "BLUBBERS", "BLUBBERSWTF", "uwu", "RUN!", "Spawning Toil-Slayers!", "Spawning Spike Traps!", "Spawning Landmines!", "Spawning Turrets!", "You should not have opened the box...", "It is not safe here", "#BlameRoe" }; takeyBox.DisplayTipClientRpc("Takey Box", array[Random.Range(0, array.Length)], isWarning: false, 5__2.actualClientId); <>2__current = (object)new WaitForSeconds(Random.Range(1f, 5f)); <>1__state = 1; return true; } case 1: { <>1__state = -1; float percent = 50f; float percent2 = 50f; if (5__2.isInHangarShipRoom) { percent = 40f; percent2 = 60f; } if (Utils.RollPercentChance(percent)) { EnemyHelper.SpawnRandomEnemyOnServer(5__2, 1, 10f, 25f); } else if (Utils.RollPercentChance(percent2)) { Vector3 position = ((Component)5__2).transform.position + Random.insideUnitSphere * 5f; position.y = ((Component)5__2).transform.position.y; HazardHelper.SpawnRandomHazardOnServer(5__2, position); } else if (Utils.RollPercentChance(50f)) { CoroutineRunner.Start(takeyBox.SpawnLightningStormOnServerCoroutine(((Component)5__2).transform.position, 5f, 15f)); } else { takeyBox.SpawnLightningStrikeOnServer(((Component)5__2).transform.position, Random.Range(3f, 15f)); } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GrabbableObject grabbableObject; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; grabbableObject.reachedFloorTarget = false; grabbableObject.hasHitGround = false; grabbableObject.fallTime = 0f; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__17 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeyBox <>4__this; public Vector3 origin; public float minRadius; public float maxRadius; private int 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0040: 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_0075: Expected O, but got Unknown int num = <>1__state; TakeyBox takeyBox = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (!NetworkUtils.IsServer) { return false; } 5__2 = Random.Range(5, 25); 5__3 = 0; break; case 1: <>1__state = -1; 5__3++; break; } if (5__3 < 5__2) { takeyBox.SpawnLightningStrikeOnServer(origin, Random.Range(minRadius, maxRadius)); <>2__current = (object)new WaitForSeconds(Random.Range(0.1f, 1f)); <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__15 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NetworkObjectReference networkObjectReference; public int presentValue; public Vector3 startFallingPos; public TakeyBox <>4__this; private NetworkObject 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown int num = <>1__state; TakeyBox takeyBox = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = null; 5__3 = Time.realtimeSinceStartup; goto IL_005d; case 1: <>1__state = -1; goto IL_005d; case 2: { <>1__state = -1; GrabbableObject component = ((Component)5__2).GetComponent(); RoundManager instance = RoundManager.Instance; instance.totalScrapValueInLevel += (float)component.scrapValue; component.SetScrapValue(presentValue); component.startFallingPosition = startFallingPos; component.fallTime = 0f; component.hasHitGround = false; component.reachedFloorTarget = false; if ((Object)(object)((GrabbableObject)takeyBox).playerHeldBy != (Object)null && ((GrabbableObject)takeyBox).playerHeldBy.isInHangarShipRoom) { ((GrabbableObject)takeyBox).playerHeldBy.SetItemInElevator(true, true, component); } return false; } IL_005d: if (Time.realtimeSinceStartup - 5__3 < 8f && !((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref 5__2, (NetworkManager)null)) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 1; return true; } if ((Object)(object)5__2 == (Object)null) { Logger.LogInfo("No network object found."); return false; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Space(20f)] [Header("Takey Box")] [Space(5f)] public ParticleSystem PoofParticleSystem; public AudioSource GiftAudio; public AudioClip OpenGiftSFX; private bool _openedGift; public PlayerControllerB PreviousPlayerHeldBy { get; private set; } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); PreviousPlayerHeldBy = base.playerHeldBy; } public override void ItemActivate(bool used, bool buttonDown = true) { if (_openedGift) { return; } if (ConfigManager.TakeyBox_NegativeEffectsEnabled.Value) { if (StartOfRound.Instance.inShipPhase) { HUDManager.Instance.DisplayTip("Takey Box", "You cannot open this in space", false, false, "LC_Tip1"); return; } if (!StartOfRound.Instance.shipHasLanded) { if (StartOfRound.Instance.shipIsLeaving) { HUDManager.Instance.DisplayTip("Takey Box", "You cannot open this while leaving", false, false, "LC_Tip1"); } else { HUDManager.Instance.DisplayTip("Takey Box", "You cannot open this while landing", false, false, "LC_Tip1"); } return; } if (!StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { HUDManager.Instance.DisplayTip("Takey Box", "You cannot open this here", false, false, "LC_Tip1"); return; } } _openedGift = true; base.playerHeldBy.activatingItem = true; OpenGiftServerRpc(); } [ServerRpc(RequireOwnership = false)] private void OpenGiftServerRpc() { //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_00c1: 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(324682860u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 324682860u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)base.playerHeldBy == (Object)null)) { if (ConfigManager.TakeyBox_NegativeEffectsEnabled.Value && Utils.RollPercentChance(ConfigManager.TakeyBox_NegativeEffectsChance.Value)) { CoroutineRunner.Start(OpenGiftWithoutPresentOnServerCoroutine()); OpenGiftWithPresentOnServer(Assets.TakeyBox); } else { OpenGiftWithPresentOnServer(); } } } [ClientRpc] private void DisplayTipClientRpc(string headerText, string bodyText, bool isWarning, ulong targetClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0165: 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_00cc: 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_00ff: 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_0120: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2807722435u, val, (RpcDelivery)0); bool flag = headerText != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(headerText, false); } bool flag2 = bodyText != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(bodyText, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref isWarning, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, targetClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2807722435u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (NetworkUtils.IsLocalClientId(targetClientId)) { HUDManager.Instance.DisplayTip(headerText, bodyText, isWarning, false, "LC_Tip1"); } } } private void OpenGiftWithPresentOnServer(Item item = null) { //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_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) //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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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) if (NetworkUtils.IsServer) { Transform val = ((!base.playerHeldBy.isInHangarShipRoom && !StartOfRound.Instance.inShipPhase && !((Object)(object)RoundManager.Instance.spawnedScrapContainer == (Object)null)) ? RoundManager.Instance.spawnedScrapContainer : StartOfRound.Instance.elevatorTransform); if ((Object)(object)item == (Object)null) { item = ItemHelper.GetRandomTakeyBoxItem(); } int scrapValue = (int)((float)Random.Range(item.minValue, item.maxValue) * RoundManager.Instance.scrapValueMultiplier); GameObject val2 = Object.Instantiate(item.spawnPrefab, ((Component)this).transform.position, Quaternion.identity, val); GrabbableObject component = val2.GetComponent(); component.startFallingPosition = ((Component)this).transform.position; ((MonoBehaviour)this).StartCoroutine(SetObjectToHitGroundSFX(component)); component.targetFloorPosition = component.GetItemFloorPosition(((Component)this).transform.position); if ((Object)(object)base.playerHeldBy != (Object)null && base.playerHeldBy.isInHangarShipRoom) { base.playerHeldBy.SetItemInElevator(true, true, component); } component.SetScrapValue(scrapValue); NetworkObject component2 = ((Component)component).GetComponent(); component2.Spawn(false); OpenGiftWithPresentClientRpc(NetworkObjectReference.op_Implicit(component2), scrapValue, ((Component)this).transform.position); } } [IteratorStateMachine(typeof(d__13))] private IEnumerator SetObjectToHitGroundSFX(GrabbableObject grabbableObject) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { grabbableObject = grabbableObject }; } [ClientRpc] private void OpenGiftWithPresentClientRpc(NetworkObjectReference networkObjectReference, int scrapValue, Vector3 startFallingPos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_008c: 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_00f6: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1337732907u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, scrapValue); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref startFallingPos); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1337732907u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PoofParticleSystem.Play(); GiftAudio.PlayOneShot(OpenGiftSFX); WalkieTalkie.TransmitOneShotAudio(GiftAudio, OpenGiftSFX, 1f); RoundManager.Instance.PlayAudibleNoise(((Component)GiftAudio).transform.position, 8f, 0.5f, 0, base.isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0); if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.activatingItem = false; ((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy); } if (!NetworkUtils.IsServer) { ((MonoBehaviour)this).StartCoroutine(WaitForScrapToSpawnOnLocalClient(networkObjectReference, scrapValue, startFallingPos)); } } } [IteratorStateMachine(typeof(d__15))] private IEnumerator WaitForScrapToSpawnOnLocalClient(NetworkObjectReference networkObjectReference, int presentValue, Vector3 startFallingPos) { //IL_000e: 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_001c: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__15(0) { <>4__this = this, networkObjectReference = networkObjectReference, presentValue = presentValue, startFallingPos = startFallingPos }; } [IteratorStateMachine(typeof(d__16))] private IEnumerator OpenGiftWithoutPresentOnServerCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__17))] private IEnumerator SpawnLightningStormOnServerCoroutine(Vector3 origin, float minRadius, float maxRadius) { //IL_000e: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this, origin = origin, minRadius = minRadius, maxRadius = maxRadius }; } private void SpawnLightningStrikeOnServer(Vector3 origin, float radius) { //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_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_0019: 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_0027: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer) { Vector3 strikePosition = origin + Random.insideUnitSphere * radius; strikePosition.y = origin.y; StormyWeatherHelper.LightningStrikeOnServer(strikePosition, useTargetedObject: false); } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(324682860u, new RpcReceiveHandler(__rpc_handler_324682860), "OpenGiftServerRpc"); ((NetworkBehaviour)this).__registerRpc(2807722435u, new RpcReceiveHandler(__rpc_handler_2807722435), "DisplayTipClientRpc"); ((NetworkBehaviour)this).__registerRpc(1337732907u, new RpcReceiveHandler(__rpc_handler_1337732907), "OpenGiftWithPresentClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_324682860(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; ((TakeyBox)(object)target).OpenGiftServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2807722435(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_0067: 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_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_00ae: 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_00e7: 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(ref flag, default(ForPrimitives)); string headerText = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref headerText, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag2, default(ForPrimitives)); string bodyText = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref bodyText, false); } bool isWarning = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isWarning, default(ForPrimitives)); ulong targetClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref targetClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyBox)(object)target).DisplayTipClientRpc(headerText, bodyText, isWarning, targetClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1337732907(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_003e: 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_0069: 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_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); Vector3 startFallingPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref startFallingPos); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyBox)(object)target).OpenGiftWithPresentClientRpc(networkObjectReference, scrapValue, startFallingPos); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyBox"; } } public class TakeyButlerController : NetworkBehaviour { public Material ButlerMaterial; public GameObject TakeyHeadPrefab; public AudioClip AttackSFX; public AudioClip[] CreepyLaughSFX = Array.Empty(); private ButlerEnemyAI _butlerEnemyAI; private Transform _faceTransform; private GameObject _takeyHeadObject; private int _previousBehaviourStateIndex = -1; private bool _isChasingPlayer; private float _sfxInterval; private float _sfxTimer; private float _sfxCooldown = 5f; private float _timeSincePlayingSFX; private void Start() { //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) ((Component)this).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); if ((Object)(object)((Component)this).transform.parent != (Object)null) { _butlerEnemyAI = ((Component)((Component)this).transform.parent).GetComponent(); } if ((Object)(object)_butlerEnemyAI == (Object)null) { Logger.LogError("Failed to initialize Takey Butler. ButlerEnemyAI is null."); if (NetworkUtils.IsServer) { ((Component)this).GetComponent().Despawn(true); } return; } if (NetworkUtils.IsServer) { SetRandomSFXInterval(); } SetFaceTransform(); SetMaterial(); SetTakeyHeadModel(); SetScanNode(); Logger.LogInfo("Initialized Takey Butler on local client.", extended: true); } private void SetFaceTransform() { _faceTransform = _butlerEnemyAI.animationContainer.Find("metarig").Find("spine").Find("spine.001") .Find("NeckContainer") .Find("spine.004") .Find("face"); } private void SetMaterial() { SkinnedMeshRenderer[] componentsInChildren = ((Component)_butlerEnemyAI.animationContainer).GetComponentsInChildren(); foreach (SkinnedMeshRenderer val in componentsInChildren) { Material[] sharedMaterials = ((Renderer)val).sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { sharedMaterials[j] = ButlerMaterial; } ((Renderer)val).sharedMaterials = sharedMaterials; } } private void SetTakeyHeadModel() { //IL_0084: 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_0095: 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) if (!((Object)(object)_takeyHeadObject != (Object)null)) { Transform val = _butlerEnemyAI.animationContainer.Find("metarig").Find("spine").Find("spine.001") .Find("NeckContainer") .Find("spine.004"); _takeyHeadObject = Object.Instantiate(TakeyHeadPrefab, val); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(0.003f, 0.242f, 0.032f); Quaternion val3 = Quaternion.Euler(-52.494f, 1.297f, -1.083f); _takeyHeadObject.transform.SetLocalPositionAndRotation(val2, val3); } } private void SetScanNode() { ScanNodeProperties componentInChildren = ((Component)_butlerEnemyAI).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { Logger.LogError("Failed to set scan node properties on Takey Butler. ScanNodeProperties is null."); } else { componentInChildren.headerText = "Takey Butler"; } } private void Update() { if ((Object)(object)_butlerEnemyAI == (Object)null || (Object)(object)_faceTransform == (Object)null) { if (NetworkUtils.IsServer) { if ((Object)(object)_takeyHeadObject != (Object)null) { Object.Destroy((Object)(object)_takeyHeadObject); } ((Component)this).GetComponent().Despawn(true); } return; } SetTakeyHeadRotationAndScale(); if (((EnemyAI)_butlerEnemyAI).isEnemyDead || !NetworkUtils.IsServer) { return; } if (_previousBehaviourStateIndex != ((EnemyAI)_butlerEnemyAI).currentBehaviourStateIndex) { _previousBehaviourStateIndex = ((EnemyAI)_butlerEnemyAI).currentBehaviourStateIndex; OnBehaviourStateChanged(((EnemyAI)_butlerEnemyAI).currentBehaviourStateIndex); } if (_sfxTimer >= _sfxInterval && Time.realtimeSinceStartup - _timeSincePlayingSFX > _sfxCooldown) { _sfxTimer = 0f; SetRandomSFXInterval(); if (((EnemyAI)_butlerEnemyAI).currentBehaviourStateIndex == 2 && Utils.RollPercentChance(35f)) { PlayAttackSFXClientRpc(); } else { PlayRandomLaughSFXOnServer(); } } else { _sfxTimer += Time.deltaTime; } } private void LateUpdate() { if (!((Object)(object)_butlerEnemyAI == (Object)null) && !((Object)(object)_faceTransform == (Object)null)) { SetTakeyHeadRotationAndScale(); } } private void SetRandomSFXInterval() { if (_isChasingPlayer) { _sfxInterval = Random.Range(5f, 15f); } else { _sfxInterval = Random.Range(15f, 45f); } } private void SetTakeyHeadRotationAndScale() { //IL_0015: 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_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_004b: Unknown result type (might be due to invalid IL or missing references) _faceTransform.localScale = new Vector3(0.01f, 0.01f, 0.01f); Quaternion val = Quaternion.Euler(-7.258f, 0.796f, -0.155f); _takeyHeadObject.transform.localRotation = _faceTransform.localRotation * val; } private void OnBehaviourStateChanged(int index) { Logger.LogInfo($"Takey Butler OnBehaviourStateChanged index: {index}", extended: true); if (index == 2) { PlayAttackSFXClientRpc(); SetRandomSFXInterval(); _isChasingPlayer = true; } else { _isChasingPlayer = false; } } private void PlayRandomLaughSFXOnServer() { if (NetworkUtils.IsServer) { PlayLaughSFXClientRpc(Random.Range(0, CreepyLaughSFX.Length)); } } [ClientRpc] private void PlayAttackSFXClientRpc() { //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_00c1: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(592097451u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 592097451u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ((EnemyAI)_butlerEnemyAI).creatureVoice.PlayOneShot(AttackSFX); _timeSincePlayingSFX = Time.realtimeSinceStartup; } } } [ClientRpc] private void PlayLaughSFXClientRpc(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) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1887174359u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1887174359u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ((EnemyAI)_butlerEnemyAI).creatureVoice.PlayOneShot(CreepyLaughSFX[index]); _timeSincePlayingSFX = Time.realtimeSinceStartup; } } } public void OnStabPlayerOnServer(PlayerControllerB playerScript) { if (NetworkUtils.IsServer && Time.realtimeSinceStartup - _timeSincePlayingSFX > _sfxCooldown) { PlayRandomLaughSFXOnServer(); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(592097451u, new RpcReceiveHandler(__rpc_handler_592097451), "PlayAttackSFXClientRpc"); ((NetworkBehaviour)this).__registerRpc(1887174359u, new RpcReceiveHandler(__rpc_handler_1887174359), "PlayLaughSFXClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_592097451(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; ((TakeyButlerController)(object)target).PlayAttackSFXClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1887174359(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 index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyButlerController)(object)target).PlayLaughSFXClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyButlerController"; } } public class TakeyCakeVariant : TakeyPartyHatVariant { [Space(20f)] [Header("Cake")] [Space(5f)] public MeshRenderer CakeMeshRenderer; public Material[] CakeMaterials = Array.Empty(); private int _cakeMaterialIndex; public override void Awake() { base.Awake(); if (NetworkUtils.IsServer) { _cakeMaterialIndex = GetRandomCakeMaterialIndex(); } } public override void Start() { base.Start(); SetCakeMaterialIndexOnServer(_cakeMaterialIndex); } public override void OnClientConnected(ulong clientId) { //IL_0012: 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_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) //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_003e: Unknown result type (might be due to invalid IL or missing references) base.OnClientConnected(clientId); if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(_cakeMaterialIndex, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(int cakeMaterialIndex, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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_00ce: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2801502625u, clientRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, cakeMaterialIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2801502625u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetCakeMaterialIndexOnLocalClient(cakeMaterialIndex); } } } public override void SaveData() { base.SaveData(); GameSaveFileHelper.Save(base.SaveKey + "__cakeMaterialIndex", _cakeMaterialIndex); LogInfoExtended($"Saved item data. (CakeMaterialIndex: {_cakeMaterialIndex})"); } public override void LoadData() { base.LoadData(); _cakeMaterialIndex = GameSaveFileHelper.Load(base.SaveKey + "__cakeMaterialIndex", GetRandomCakeMaterialIndex()); LogInfoExtended($"Loaded item data. (CakeMaterialIndex: {_cakeMaterialIndex})"); } private int GetRandomCakeMaterialIndex() { return Random.Range(0, CakeMaterials.Length); } private void SetCakeMaterialIndexOnServer(int index) { if (NetworkUtils.IsServer) { SetCakeMaterialIndexClientRpc(index); SetCakeMaterialIndexOnLocalClient(index); } } [ClientRpc] private void SetCakeMaterialIndexClientRpc(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) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(782695861u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 782695861u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { SetCakeMaterialIndexOnLocalClient(index); } } } private void SetCakeMaterialIndexOnLocalClient(int index) { _cakeMaterialIndex = index; ((Renderer)CakeMeshRenderer).sharedMaterial = CakeMaterials[_cakeMaterialIndex]; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2801502625u, new RpcReceiveHandler(__rpc_handler_2801502625), "SetDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(782695861u, new RpcReceiveHandler(__rpc_handler_782695861), "SetCakeMaterialIndexClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_2801502625(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_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_0040: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int cakeMaterialIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref cakeMaterialIndex); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyCakeVariant)(object)target).SetDataClientRpc(cakeMaterialIndex, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_782695861(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 cakeMaterialIndexClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref cakeMaterialIndexClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyCakeVariant)(object)target).SetCakeMaterialIndexClientRpc(cakeMaterialIndexClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyCakeVariant"; } } public class TakeyChickenDanceVariant : TakeyVariant { [Space(20f)] [Header("Chicken Dance")] [Space(5f)] public Animator ChickenAnimator; public AudioSource MusicAudio; private bool _playMusic; public override void Start() { base.Start(); MusicAudio.clip.LoadAudioData(); if (NetworkUtils.IsServer) { SetPlayingMusic(_playMusic); } } public override void OnClientConnected(ulong clientId) { //IL_0012: 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_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) //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_005e: Unknown result type (might be due to invalid IL or missing references) base.OnClientConnected(clientId); if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(ChickenAnimator.GetBool("Animate"), MusicAudio.isPlaying, MusicAudio.time, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(bool animate, bool playMusic, float musicTime, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_0098: 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_00b3: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3739193447u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref animate, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref playMusic, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref musicTime, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3739193447u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetAnimateOnLocalClient(animate); SetPlayingMusicOnLocalClient(playMusic, musicTime); } } } public override void SaveData() { base.SaveData(); GameSaveFileHelper.Save(base.SaveKey + "__playMusic", MusicAudio.isPlaying); LogInfoExtended($"Saved item data. (PlayMusic: {MusicAudio.isPlaying})"); } public override void LoadData() { base.LoadData(); _playMusic = GameSaveFileHelper.Load(base.SaveKey + "__playMusic", defaultValue: false); LogInfoExtended($"Loaded item data. (PlayMusic: {_playMusic})"); } public override void EquipItem() { if (NetworkUtils.IsServer) { SetAnimate(value: false); } } public override void SetControlTipsForItem() { List list = ((GrabbableObject)base.Takey).itemProperties.toolTips.ToList(); list.Add(MusicAudio.isPlaying ? "Pause Music : [Q]" : "Play Music : [Q]"); HUDManager.Instance.ChangeControlTipMultiple(list.ToArray(), true, ((GrabbableObject)base.Takey).itemProperties); } public override void ItemInteractLeftRight(bool right) { if (!right) { SetPlayingMusic(!MusicAudio.isPlaying); SetControlTipsForItem(); } } public override void DiscardItem() { if (NetworkUtils.IsServer) { SetAnimate(value: true); } } public override void OnStartFlying() { if (NetworkUtils.IsServer) { SetAnimate(value: false); SetPlayingMusic(value: false); } } private void SetAnimate(bool value) { //IL_0004: 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) SetAnimateServerRpc(value); SetAnimateOnLocalClient(value); } [ServerRpc(RequireOwnership = false)] private void SetAnimateServerRpc(bool value, 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_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) //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_00e2: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1987887818u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1987887818u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { SetAnimateClientRpc(value, senderClientId); } } } [ClientRpc] private void SetAnimateClientRpc(bool value, ulong senderClientId) { //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_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_008c: 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_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4245180028u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4245180028u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsLocalClientId(senderClientId)) { SetAnimateOnLocalClient(value); } } } private void SetAnimateOnLocalClient(bool value) { ChickenAnimator.SetBool("Animate", value); } private void SetPlayingMusic(bool value) { //IL_0004: 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) SetPlayingMusicServerRpc(value); SetPlayingMusicOnLocalClient(value); } [ServerRpc(RequireOwnership = false)] private void SetPlayingMusicServerRpc(bool value, 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_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) //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_00e2: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3934112273u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3934112273u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { SetPlayingMusicClientRpc(value, senderClientId); } } } [ClientRpc] private void SetPlayingMusicClientRpc(bool value, ulong senderClientId) { //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_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_008c: 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_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(623369381u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 623369381u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsLocalClientId(senderClientId)) { SetPlayingMusicOnLocalClient(value); } } } private void SetPlayingMusicOnLocalClient(bool value, float musicTime = -1f) { if (musicTime >= 0f) { MusicAudio.time = musicTime; } if (value) { MusicAudio.Play(); } else { MusicAudio.Pause(); } LogInfoExtended($"Set playing music on local client: {value} (MusicTime: {musicTime})"); } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3739193447u, new RpcReceiveHandler(__rpc_handler_3739193447), "SetDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(1987887818u, new RpcReceiveHandler(__rpc_handler_1987887818), "SetAnimateServerRpc"); ((NetworkBehaviour)this).__registerRpc(4245180028u, new RpcReceiveHandler(__rpc_handler_4245180028), "SetAnimateClientRpc"); ((NetworkBehaviour)this).__registerRpc(3934112273u, new RpcReceiveHandler(__rpc_handler_3934112273), "SetPlayingMusicServerRpc"); ((NetworkBehaviour)this).__registerRpc(623369381u, new RpcReceiveHandler(__rpc_handler_623369381), "SetPlayingMusicClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_3739193447(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_004a: 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_0065: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00aa: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool animate = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref animate, default(ForPrimitives)); bool playMusic = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref playMusic, default(ForPrimitives)); float musicTime = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref musicTime, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyChickenDanceVariant)(object)target).SetDataClientRpc(animate, playMusic, musicTime, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1987887818(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyChickenDanceVariant)(object)target).SetAnimateServerRpc(value, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4245180028(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_003e: 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) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyChickenDanceVariant)(object)target).SetAnimateClientRpc(value, senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3934112273(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyChickenDanceVariant)(object)target).SetPlayingMusicServerRpc(value, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_623369381(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_003e: 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) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyChickenDanceVariant)(object)target).SetPlayingMusicClientRpc(value, senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyChickenDanceVariant"; } } public enum TakeyDinkDonkEventType { InteriorCollectedByWolfy, InteriorCollectedByZombies, InteriorCollectedByHiccubz, InteriorLootIsNear, InteriorLeaveZombiesBehind, ShipCollectedByZombies, ShipCollectedByZombiesConsequences, ProfitQuotaFulfilled, PlayerDied, ClearWeather, EclipsedWeather, FloodedWeather, FoggyWeather, RainyWeather, StormyWeather, JetpackWasOrdered, LeavingPlanet, LeavingPlanetBeehives, ScrapEaterSpawned, ShipValue5000, ShipValue10000, CollectedAllScrap, InteriorCollectedByLustings } public class TakeyDinkDonkVariant : TakeyVariant { [CompilerGenerated] private sealed class d__45 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeyDinkDonkVariant <>4__this; public TakeyDinkDonkEventType eventType; private AudioClipGroup 5__2; private bool 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__45(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown int num = <>1__state; TakeyDinkDonkVariant takeyDinkDonkVariant = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = takeyDinkDonkVariant.GetEventAudioClipGroup(eventType); if (5__2 == null || (Object)(object)5__2.AudioClip == (Object)null) { takeyDinkDonkVariant.LogError($"AudioClip(s) are missing for {eventType} event. Skipping event."); if (takeyDinkDonkVariant._eventQueue.Count > 0) { takeyDinkDonkVariant.PlayNextEventFromQueueOnServer(); } return false; } takeyDinkDonkVariant.LogInfoExtended($"Started event: {eventType}"); takeyDinkDonkVariant._currentEvent = eventType; takeyDinkDonkVariant._playingEvent = true; takeyDinkDonkVariant.InSpecialAnimation = true; 5__3 = takeyDinkDonkVariant.BellRingAudio.IsPlaying; if (NetworkUtils.IsServer) { takeyDinkDonkVariant.SetAnimate(value: true); } takeyDinkDonkVariant.Takey.NoiseAudio.Stop(); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: { <>1__state = -1; if (eventType == TakeyDinkDonkEventType.ShipCollectedByZombiesConsequences) { ((MonoBehaviour)takeyDinkDonkVariant).StartCoroutine(takeyDinkDonkVariant.SpawnDogsAtShipAfterTime(4.5f)); } bool audibleNoise = false; if (eventType == TakeyDinkDonkEventType.ShipCollectedByZombiesConsequences) { audibleNoise = true; } <>2__current = (object)new WaitForSeconds(takeyDinkDonkVariant.PlaySound(takeyDinkDonkVariant.EventAudio, 5__2, audibleNoise)); <>1__state = 2; return true; } case 2: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 3; return true; case 3: <>1__state = -1; if (NetworkUtils.IsServer) { if (!((GrabbableObject)takeyDinkDonkVariant.Takey).isHeld) { 5__3 = false; } takeyDinkDonkVariant.SetAnimate(5__3); if (takeyDinkDonkVariant._eventQueue.Count > 0) { <>2__current = (object)new WaitForSeconds(1f); <>1__state = 4; return true; } } break; case 4: <>1__state = -1; takeyDinkDonkVariant.PlayNextEventFromQueueOnServer(); break; } takeyDinkDonkVariant._playingEvent = false; takeyDinkDonkVariant.InSpecialAnimation = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__47 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float time; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__47(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(time); <>1__state = 1; return true; case 1: <>1__state = -1; EnemyHelper.SpawnEnemyOnServer(Utils.GetHangarShipCenter(), insideFactory: false, "MouthDog", 10, 15f, 30f); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Space(20f)] [Header("Dink Donk")] [Space(5f)] public Animator Animator; public AudioSource BellAudio; public AudioSourceGroup BellRingAudio; public AudioSourceGroup EventAudio; public AudioClip BellDropSFX; public AudioClipGroupWithData[] EventSFX = Array.Empty>(); public float LootCheckRadius = 25f; public float LootCheckInterval = 25f; private float _bellTimer; private bool _playingEvent; private TakeyDinkDonkEventType _currentEvent; private Coroutine _eventCoroutine; private List _eventQueue = new List(); private float _lootCheckTimer; private int _previousShipScrapValue; private int _timesCollectedByZombiesInShip; public override void Start() { base.Start(); if (NetworkUtils.IsServer) { _previousShipScrapValue = ItemHelper.GetLootTotal(); } UpdateSettings(); } public override void OnNetworkSpawn() { base.OnNetworkSpawn(); if (NetworkUtils.IsServer) { Events.OnProfitQuotaFulfilled += OnProfitQuotaFulfilled; Events.OnPlayerDied += OnPlayerDied; Events.OnShipArrived += OnShipArrive; Events.OnShipLeave += OnShipLeave; Events.OnItemsOrdered += OnItemsOrdered; Events.OnDinkDonkScrapEaterSpawned += OnScrapEaterSpawned; Events.OnNewScrapCollected += OnNewScrapCollected; } } public override void OnNetworkDespawn() { base.OnNetworkDespawn(); if (NetworkUtils.IsServer) { Events.OnProfitQuotaFulfilled -= OnProfitQuotaFulfilled; Events.OnPlayerDied -= OnPlayerDied; Events.OnShipArrived -= OnShipArrive; Events.OnShipLeave -= OnShipLeave; Events.OnItemsOrdered -= OnItemsOrdered; Events.OnDinkDonkScrapEaterSpawned -= OnScrapEaterSpawned; Events.OnNewScrapCollected -= OnNewScrapCollected; } } public override void OnClientConnected(ulong clientId) { //IL_0012: 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_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) //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_0043: Unknown result type (might be due to invalid IL or missing references) base.OnClientConnected(clientId); if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(BellRingAudio.IsPlaying, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(bool animate, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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) //IL_00dc: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2378092490u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref animate, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2378092490u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetAnimateOnLocalClient(animate); } } } public override void Update() { base.Update(); LootCheckTick(); BellTick(); } private void LootCheckTick() { if (!NetworkUtils.IsServer || !BellRingAudio.IsPlaying || !((GrabbableObject)base.Takey).isHeld || !((GrabbableObject)base.Takey).playerHeldBy.isInsideFactory) { return; } if (_lootCheckTimer >= LootCheckInterval) { _lootCheckTimer = 0f; if (PlayerUtils.IsPlayer(((GrabbableObject)base.Takey).playerHeldBy, PlayerName.ZombiesAteMyChannel)) { return; } if (PlayerUtils.IsLootNearPlayer(((GrabbableObject)base.Takey).playerHeldBy, LootCheckRadius)) { PlayEventOnServer(TakeyDinkDonkEventType.InteriorLootIsNear); } } _lootCheckTimer += Time.deltaTime; } private void BellTick() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!BellRingAudio.IsPlaying) { return; } bool flag = true; if (_playingEvent) { flag = false; if (_currentEvent == TakeyDinkDonkEventType.ShipCollectedByZombiesConsequences) { flag = true; } } if (!flag) { return; } if (_bellTimer >= 0.75f) { _bellTimer = 0f; if (((GrabbableObject)base.Takey).isPocketed) { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 7.5f, 0.275f, 0, ((GrabbableObject)base.Takey).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } else { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 0.55f, 0, ((GrabbableObject)base.Takey).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } } else { _bellTimer += Time.deltaTime; } } public override void GrabItem() { if (((NetworkBehaviour)base.Takey).IsOwner && !_playingEvent) { if (Utils.RollPercentChance(15f)) { SetAnimate(value: false); } else { SetAnimate(value: true); } } } public override void EquipItem() { UpdateBellVolume(); } public override void PocketItem() { UpdateBellVolume(); } public override void DiscardItem() { if (((NetworkBehaviour)base.Takey).IsOwner && !_playingEvent) { SetAnimate(value: false); } } public override void OnHitGround() { base.OnHitGround(); BellAudio.PlayOneShot(BellDropSFX); } private void SetAnimate(bool value) { //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) LogInfoExtended($"Set animate: {value}"); SetAnimateServerRpc(value); SetAnimateOnLocalClient(value); } [ServerRpc(RequireOwnership = false)] private void SetAnimateServerRpc(bool value, 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_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) //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_00e2: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4228735874u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4228735874u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { SetAnimateClientRpc(value, senderClientId); if (value) { TryPlayCollectedEventOnServer(); } } } [ClientRpc] private void SetAnimateClientRpc(bool value, ulong senderClientId) { //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_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_008c: 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_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(489345996u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 489345996u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsLocalClientId(senderClientId)) { SetAnimateOnLocalClient(value); } } } private void SetAnimateOnLocalClient(bool value) { Animator.SetBool("Animate", value); if (value) { if (!BellRingAudio.IsPlaying) { BellRingAudio.Play(); } } else { BellRingAudio.Stop(); } LogInfoExtended($"Set animate on local client: {value}"); } private void OnProfitQuotaFulfilled() { PlayEventOnServer(TakeyDinkDonkEventType.ProfitQuotaFulfilled); } private void OnPlayerDied(PlayerControllerB playerScript, PlayerDeathReason playerDeathReason) { PlayEventOnServer(TakeyDinkDonkEventType.PlayerDied); } private void OnShipArrive() { //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected I4, but got Unknown SelectableLevel currentLevel = StartOfRound.Instance.currentLevel; if (currentLevel.planetHasTime) { TakeyDinkDonkEventType eventType = TakeyDinkDonkEventType.ClearWeather; LevelWeatherType currentWeather = currentLevel.currentWeather; switch (currentWeather - 1) { case 0: eventType = TakeyDinkDonkEventType.RainyWeather; break; case 1: eventType = TakeyDinkDonkEventType.StormyWeather; break; case 2: eventType = TakeyDinkDonkEventType.FoggyWeather; break; case 3: eventType = TakeyDinkDonkEventType.FloodedWeather; break; case 4: eventType = TakeyDinkDonkEventType.EclipsedWeather; break; } PlayEventOnServer(eventType); } } private void OnShipLeave() { if (Utils.HasBeehivesOnShip()) { PlayEventOnServer(TakeyDinkDonkEventType.LeavingPlanetBeehives); } else { PlayEventOnServer(TakeyDinkDonkEventType.LeavingPlanet); } } private void OnItemsOrdered(List items) { LogInfoExtended("OnItemsOrdered(); [" + string.Join(", ", items.Select((Item x) => x.itemName)) + "]"); bool flag = false; foreach (Item item in items) { if (item.itemName.Equals("Jetpack", StringComparison.OrdinalIgnoreCase)) { flag = true; break; } if (item.itemName.Equals("Takeypack", StringComparison.OrdinalIgnoreCase)) { flag = true; break; } } if (flag) { PlayEventOnServer(TakeyDinkDonkEventType.JetpackWasOrdered); } } private void OnScrapEaterSpawned() { PlayEventOnServer(TakeyDinkDonkEventType.ScrapEaterSpawned); } private void OnNewScrapCollected(GrabbableObject grabbableObject) { int previousShipScrapValue = _previousShipScrapValue; int lootTotal = ItemHelper.GetLootTotal(); lootTotal = (_previousShipScrapValue = lootTotal + grabbableObject.scrapValue); LogInfoExtended($"OnNewScrapCollected(); PreviousShipScrapValue: {previousShipScrapValue}, NewShipScrapValue: {lootTotal}"); if (lootTotal >= 10000 && previousShipScrapValue < 10000) { PlayEventOnServer(TakeyDinkDonkEventType.ShipValue10000); } else if (lootTotal >= 5000 && previousShipScrapValue < 5000) { PlayEventOnServer(TakeyDinkDonkEventType.ShipValue5000); } bool inShipPhase = StartOfRound.Instance.inShipPhase; bool spawnEnemiesAndScrap = StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap; if (!inShipPhase && spawnEnemiesAndScrap && Utils.CollectedAllScrap()) { PlayEventOnServer(TakeyDinkDonkEventType.CollectedAllScrap); } } private void TryPlayCollectedEventOnServer() { if (StartOfRound.Instance.inShipPhase || _playingEvent || !((GrabbableObject)base.Takey).isHeld) { return; } if (PlayerUtils.IsPlayer(((GrabbableObject)base.Takey).playerHeldBy, PlayerName.WolfsMyChocolate) && ((GrabbableObject)base.Takey).playerHeldBy.isInsideFactory) { PlayEventOnServer(TakeyDinkDonkEventType.InteriorCollectedByWolfy); } if (PlayerUtils.IsPlayer(((GrabbableObject)base.Takey).playerHeldBy, PlayerName.Hiccubz) && ((GrabbableObject)base.Takey).playerHeldBy.isInsideFactory) { PlayEventOnServer(TakeyDinkDonkEventType.InteriorCollectedByHiccubz); } if (PlayerUtils.IsPlayer(((GrabbableObject)base.Takey).playerHeldBy, PlayerName.LustStings) && ((GrabbableObject)base.Takey).playerHeldBy.isInsideFactory) { PlayEventOnServer(TakeyDinkDonkEventType.InteriorCollectedByLustings); } if (PlayerUtils.IsPlayer(((GrabbableObject)base.Takey).playerHeldBy, PlayerName.ZombiesAteMyChannel)) { if (((GrabbableObject)base.Takey).playerHeldBy.isInsideFactory) { PlayEventOnServer(TakeyDinkDonkEventType.InteriorCollectedByZombies); } else if (((GrabbableObject)base.Takey).playerHeldBy.isInHangarShipRoom && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { if (_timesCollectedByZombiesInShip == 0) { PlayEventOnServer(TakeyDinkDonkEventType.ShipCollectedByZombies); _timesCollectedByZombiesInShip++; } else if (_timesCollectedByZombiesInShip == 1) { PlayEventOnServer(TakeyDinkDonkEventType.ShipCollectedByZombiesConsequences); _timesCollectedByZombiesInShip = 0; } } } else if (PlayerUtils.HasPlayer(PlayerName.ZombiesAteMyChannel) && ((GrabbableObject)base.Takey).playerHeldBy.isInsideFactory && Utils.RollPercentChance(10f)) { PlayEventOnServer(TakeyDinkDonkEventType.InteriorLeaveZombiesBehind); } } private void PlayEventOnServer(TakeyDinkDonkEventType eventType) { if (NetworkUtils.IsServer) { if (_playingEvent) { _eventQueue.Add(eventType); LogInfoExtended($"Added {eventType} event to the queue."); } else { PlayEventClientRpc(eventType); PlayEventOnLocalClient(eventType); } } } private void PlayNextEventFromQueueOnServer() { if (_eventQueue.Count != 0) { TakeyDinkDonkEventType eventType = _eventQueue[0]; _eventQueue.RemoveAt(0); PlayEventClientRpc(eventType); PlayEventOnLocalClient(eventType); } } [ClientRpc] private void PlayEventClientRpc(TakeyDinkDonkEventType eventType) { //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) //IL_00dc: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1354076938u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref eventType, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1354076938u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { PlayEventOnLocalClient(eventType); } } } private void PlayEventOnLocalClient(TakeyDinkDonkEventType eventType) { if (_eventCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_eventCoroutine); } _eventCoroutine = ((MonoBehaviour)this).StartCoroutine(PlayEventOnLocalClientCoroutine(eventType)); } [IteratorStateMachine(typeof(d__45))] private IEnumerator PlayEventOnLocalClientCoroutine(TakeyDinkDonkEventType eventType) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__45(0) { <>4__this = this, eventType = eventType }; } private AudioClipGroup GetEventAudioClipGroup(TakeyDinkDonkEventType eventType) { AudioClipGroupWithData[] eventSFX = EventSFX; foreach (AudioClipGroupWithData audioClipGroupWithData in eventSFX) { if (audioClipGroupWithData.Data == eventType) { return audioClipGroupWithData; } } return null; } [IteratorStateMachine(typeof(d__47))] private IEnumerator SpawnDogsAtShipAfterTime(float time) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__47(0) { time = time }; } private void UpdateBellVolume() { BellAudio.volume = ConfigManager.DinkDonkVariant_BellVolume.Value * 0.01f; if ((Object)(object)base.Takey == (Object)null || !((GrabbableObject)base.Takey).isPocketed) { SetBellRingVolume(1f); } else { SetBellRingVolume(0.5f); } } private void SetBellRingVolume(float value) { float num = ConfigManager.DinkDonkVariant_BellVolume.Value * Mathf.Clamp(value, 0f, 1f); BellRingAudio.Volume = num * 0.01f; } private void UpdateSettings() { UpdateBellVolume(); } public static void OnConfigSettingsChanged() { foreach (TakeyDinkDonkVariant item in TakeyVariant.GetInstancesOfType()) { item.UpdateSettings(); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2378092490u, new RpcReceiveHandler(__rpc_handler_2378092490), "SetDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(4228735874u, new RpcReceiveHandler(__rpc_handler_4228735874), "SetAnimateServerRpc"); ((NetworkBehaviour)this).__registerRpc(489345996u, new RpcReceiveHandler(__rpc_handler_489345996), "SetAnimateClientRpc"); ((NetworkBehaviour)this).__registerRpc(1354076938u, new RpcReceiveHandler(__rpc_handler_1354076938), "PlayEventClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_2378092490(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool animate = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref animate, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyDinkDonkVariant)(object)target).SetDataClientRpc(animate, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4228735874(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyDinkDonkVariant)(object)target).SetAnimateServerRpc(value, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_489345996(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_003e: 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) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyDinkDonkVariant)(object)target).SetAnimateClientRpc(value, senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1354076938(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) { TakeyDinkDonkEventType eventType = default(TakeyDinkDonkEventType); ((FastBufferReader)(ref reader)).ReadValueSafe(ref eventType, default(ForEnums)); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyDinkDonkVariant)(object)target).PlayEventClientRpc(eventType); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyDinkDonkVariant"; } } public class TakeyFightClubVariant : TakeyVariant { [Space(20f)] [Header("Fight Club")] [Space(5f)] public float PlushieInteractionRadius = 1.5f; public AudioClipGroup[] SpecialSFX = Array.Empty(); public override void OnHitGround() { base.OnHitGround(); TryPlaySmolZombiesInteractionOnServer(); } private void TryPlaySmolZombiesInteractionOnServer() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer && ZombiesPlushProxy.Enabled && ZombiesPlushProxy.HasSmolZombiesNearby(((Component)this).transform.position, PlushieInteractionRadius)) { PlaySpecialSFXClientRpc(Random.Range(0, SpecialSFX.Length)); } } [ClientRpc] private void PlaySpecialSFXClientRpc(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) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2985897691u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2985897691u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.Takey.NoiseAudio.Stop(); base.Takey.PlaySoundOnLocalClient(SpecialSFX[index]); } } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2985897691u, new RpcReceiveHandler(__rpc_handler_2985897691), "PlaySpecialSFXClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_2985897691(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 index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyFightClubVariant)(object)target).PlaySpecialSFXClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyFightClubVariant"; } } public class TakeyGambleVariant : TakeyVariant { [Space(20f)] [Header("Gamble")] [Space(5f)] public MeshFilter CardMeshFilter; public Mesh[] CardMeshes = Array.Empty(); private int _cardMeshIndex; public override void Awake() { base.Awake(); if (NetworkUtils.IsServer) { _cardMeshIndex = GetRandomCardMeshIndex(); } } public override void Start() { base.Start(); SetCardMeshIndexOnServer(_cardMeshIndex); } public override void OnClientConnected(ulong clientId) { //IL_0012: 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_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) //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_003e: Unknown result type (might be due to invalid IL or missing references) base.OnClientConnected(clientId); if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(_cardMeshIndex, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(int cardMeshIndex, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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_00ce: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1497986646u, clientRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, cardMeshIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1497986646u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetCardMeshIndexOnLocalClient(cardMeshIndex); } } } public override void SaveData() { base.SaveData(); GameSaveFileHelper.Save(base.SaveKey + "__cardMeshIndex", _cardMeshIndex); LogInfoExtended($"Saved item data. (CardMeshIndex: {_cardMeshIndex})"); } public override void LoadData() { base.LoadData(); _cardMeshIndex = GameSaveFileHelper.Load(base.SaveKey + "__cardMeshIndex", GetRandomCardMeshIndex()); LogInfoExtended($"Loaded item data. (CardMeshIndex: {_cardMeshIndex})"); } private int GetRandomCardMeshIndex() { return Random.Range(0, CardMeshes.Length); } private void SetCardMeshIndexOnServer(int index) { if (NetworkUtils.IsServer) { SetCardMeshIndexClientRpc(index); SetCardMeshIndexOnLocalClient(index); } } [ClientRpc] private void SetCardMeshIndexClientRpc(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) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1189744956u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1189744956u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { SetCardMeshIndexOnLocalClient(index); } } } private void SetCardMeshIndexOnLocalClient(int index) { _cardMeshIndex = index; CardMeshFilter.mesh = CardMeshes[_cardMeshIndex]; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1497986646u, new RpcReceiveHandler(__rpc_handler_1497986646), "SetDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(1189744956u, new RpcReceiveHandler(__rpc_handler_1189744956), "SetCardMeshIndexClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_1497986646(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_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_0040: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int cardMeshIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref cardMeshIndex); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyGambleVariant)(object)target).SetDataClientRpc(cardMeshIndex, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1189744956(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 cardMeshIndexClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref cardMeshIndexClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyGambleVariant)(object)target).SetCardMeshIndexClientRpc(cardMeshIndexClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyGambleVariant"; } } public class TakeyGiftVariant : TakeyPartyHatVariant { [CompilerGenerated] private sealed class d__22 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GrabbableObject grabbableObject; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; grabbableObject.reachedFloorTarget = false; grabbableObject.hasHitGround = false; grabbableObject.fallTime = 0f; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__24 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NetworkObjectReference networkObjectReference; public int presentValue; public Vector3 startFallingPos; public TakeyGiftVariant <>4__this; private NetworkObject 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown int num = <>1__state; TakeyGiftVariant takeyGiftVariant = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; 5__2 = null; 5__3 = Time.realtimeSinceStartup; goto IL_005d; case 1: <>1__state = -1; goto IL_005d; case 2: { <>1__state = -1; GrabbableObject component = ((Component)5__2).GetComponent(); RoundManager instance = RoundManager.Instance; instance.totalScrapValueInLevel += (float)component.scrapValue; component.SetScrapValue(presentValue); component.startFallingPosition = startFallingPos; component.fallTime = 0f; component.hasHitGround = false; component.reachedFloorTarget = false; if ((Object)(object)((GrabbableObject)takeyGiftVariant.Takey).playerHeldBy != (Object)null && ((GrabbableObject)takeyGiftVariant.Takey).playerHeldBy.isInHangarShipRoom) { ((GrabbableObject)takeyGiftVariant.Takey).playerHeldBy.SetItemInElevator(true, true, component); } return false; } IL_005d: if (Time.realtimeSinceStartup - 5__3 < 8f && !((NetworkObjectReference)(ref networkObjectReference)).TryGet(ref 5__2, (NetworkManager)null)) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 1; return true; } if ((Object)(object)5__2 == (Object)null) { Logger.LogInfo("No network object found."); return false; } <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Space(20f)] [Header("Gift")] [Space(5f)] public GameObject GiftObject; public GameObject GiftOpenedObject; public ParticleSystem PoofParticleSystem; public AudioSource GiftAudio; public AudioClip OpenGiftSFX; public Transform ScrapSpawnTransform; private bool _openedGift; public override void Start() { base.Start(); SetOpenedGiftOnServer(_openedGift); } public override void OnClientConnected(ulong clientId) { //IL_0012: 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_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) //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_003e: Unknown result type (might be due to invalid IL or missing references) base.OnClientConnected(clientId); if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(_openedGift, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(bool openedGift, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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) //IL_00dc: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2717582961u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref openedGift, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2717582961u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetOpenedGiftOnLocalClient(openedGift); } } } public override void SaveData() { base.SaveData(); GameSaveFileHelper.Save(base.SaveKey + "__openedGift", _openedGift); LogInfoExtended($"Saved item data. (OpenedGift: {_openedGift})"); } public override void LoadData() { base.LoadData(); _openedGift = GameSaveFileHelper.Load(base.SaveKey + "__openedGift", defaultValue: false); LogInfoExtended($"Loaded item data. (OpenedGift: {_openedGift})"); } public override void SetControlTipsForItem() { string[] array = (_openedGift ? new string[1] { string.Empty } : new string[1] { "Open Gift : [LMB]" }); HUDManager.Instance.ChangeControlTipMultiple(array, true, ((GrabbableObject)base.Takey).itemProperties); } public override void EquipItem() { base.EquipItem(); UpdateModel(); } public override void PocketItem() { base.PocketItem(); UpdateModel(); } public override void DiscardItem() { base.DiscardItem(); UpdateModel(); } public override bool ItemActivate(bool used, bool buttonDown = true) { if (!_openedGift) { _openedGift = true; OpenGiftServerRpc(); } return false; } private void SetOpenedGiftOnServer(bool value) { if (NetworkUtils.IsServer) { SetOpenedGiftClientRpc(value); SetOpenedGiftOnLocalClient(value); } } [ClientRpc] private void SetOpenedGiftClientRpc(bool value) { //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) //IL_00dc: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2092359002u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2092359002u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { SetOpenedGiftOnLocalClient(value); } } } private void SetOpenedGiftOnLocalClient(bool value) { _openedGift = value; if (PlayerUtils.IsLocalPlayer(((GrabbableObject)(base.Takey?)).playerHeldBy)) { SetControlTipsForItem(); } UpdateModel(); } private void UpdateModel() { GiftObject.SetActive(!_openedGift); GiftOpenedObject.SetActive(_openedGift); Utils.SetMeshRenderersEnabled(GiftObject, !((GrabbableObject)base.Takey).isPocketed); Utils.SetMeshRenderersEnabled(GiftOpenedObject, !((GrabbableObject)base.Takey).isPocketed); } [ServerRpc(RequireOwnership = false)] private void OpenGiftServerRpc() { //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_00c1: 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_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_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_0210: 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_0236: 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(2435218592u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2435218592u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)((GrabbableObject)base.Takey).playerHeldBy == (Object)null)) { Transform val3 = ((!((GrabbableObject)base.Takey).playerHeldBy.isInHangarShipRoom && !StartOfRound.Instance.inShipPhase && !((Object)(object)RoundManager.Instance.spawnedScrapContainer == (Object)null)) ? RoundManager.Instance.spawnedScrapContainer : StartOfRound.Instance.elevatorTransform); Item randomTakeyBoxItem = ItemHelper.GetRandomTakeyBoxItem(); int scrapValue = (int)Mathf.Floor((float)((GrabbableObject)base.Takey).scrapValue / 2f); int scrapValue2 = (int)Mathf.Ceil((float)((GrabbableObject)base.Takey).scrapValue / 2f); GameObject val4 = Object.Instantiate(randomTakeyBoxItem.spawnPrefab, ScrapSpawnTransform.position, Quaternion.identity, val3); GrabbableObject component = val4.GetComponent(); component.startFallingPosition = ScrapSpawnTransform.position; ((MonoBehaviour)this).StartCoroutine(SetObjectToHitGroundSFX(component)); component.targetFloorPosition = component.GetItemFloorPosition(ScrapSpawnTransform.position); if ((Object)(object)((GrabbableObject)base.Takey).playerHeldBy != (Object)null && ((GrabbableObject)base.Takey).playerHeldBy.isInHangarShipRoom) { ((GrabbableObject)base.Takey).playerHeldBy.SetItemInElevator(true, true, component); } component.SetScrapValue(scrapValue); NetworkObject component2 = ((Component)component).GetComponent(); component2.Spawn(false); OpenGiftClientRpc(NetworkObjectReference.op_Implicit(component2), scrapValue, ScrapSpawnTransform.position); PluginNetworkBehaviour.Instance.SetGrabbableObjectScrapValueClientRpc(NetworkObjectReference.op_Implicit(((Component)base.Takey).GetComponent()), scrapValue2); } } [IteratorStateMachine(typeof(d__22))] private IEnumerator SetObjectToHitGroundSFX(GrabbableObject grabbableObject) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__22(0) { grabbableObject = grabbableObject }; } [ClientRpc] private void OpenGiftClientRpc(NetworkObjectReference networkObjectReference, int scrapValue, Vector3 startFallingPos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_008c: 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_00f6: 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_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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(346892062u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, scrapValue); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref startFallingPos); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 346892062u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PoofParticleSystem.Play(); GiftAudio.PlayOneShot(OpenGiftSFX); WalkieTalkie.TransmitOneShotAudio(GiftAudio, OpenGiftSFX, 1f); RoundManager.Instance.PlayAudibleNoise(((Component)GiftAudio).transform.position, 8f, 0.5f, 0, ((GrabbableObject)base.Takey).isInShipRoom && StartOfRound.Instance.hangarDoorsClosed, 0); if (!NetworkUtils.IsServer) { ((MonoBehaviour)this).StartCoroutine(WaitForScrapToSpawnOnLocalClient(networkObjectReference, scrapValue, startFallingPos)); } SetOpenedGiftOnLocalClient(value: true); } } [IteratorStateMachine(typeof(d__24))] private IEnumerator WaitForScrapToSpawnOnLocalClient(NetworkObjectReference networkObjectReference, int presentValue, Vector3 startFallingPos) { //IL_000e: 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_001c: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__24(0) { <>4__this = this, networkObjectReference = networkObjectReference, presentValue = presentValue, startFallingPos = startFallingPos }; } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2717582961u, new RpcReceiveHandler(__rpc_handler_2717582961), "SetDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(2092359002u, new RpcReceiveHandler(__rpc_handler_2092359002), "SetOpenedGiftClientRpc"); ((NetworkBehaviour)this).__registerRpc(2435218592u, new RpcReceiveHandler(__rpc_handler_2435218592), "OpenGiftServerRpc"); ((NetworkBehaviour)this).__registerRpc(346892062u, new RpcReceiveHandler(__rpc_handler_346892062), "OpenGiftClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_2717582961(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool openedGift = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref openedGift, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyGiftVariant)(object)target).SetDataClientRpc(openedGift, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2092359002(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 openedGiftClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref openedGiftClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyGiftVariant)(object)target).SetOpenedGiftClientRpc(openedGiftClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2435218592(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; ((TakeyGiftVariant)(object)target).OpenGiftServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_346892062(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_003e: 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_0069: 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_0080: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference networkObjectReference = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref networkObjectReference, default(ForNetworkSerializable)); int scrapValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue); Vector3 startFallingPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref startFallingPos); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyGiftVariant)(object)target).OpenGiftClientRpc(networkObjectReference, scrapValue, startFallingPos); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyGiftVariant"; } } public class TakeyIgnoreVariant : TakeyVariant { [Space(20f)] [Header("Ignore")] [Space(5f)] public Transform HeadTransform; public Vector3 HeadRotationOffset; private bool IsHeldByLocalPlayer { get { if ((Object)(object)base.Takey == (Object)null) { return false; } return PlayerUtils.IsLocalPlayer(((GrabbableObject)base.Takey).playerHeldBy); } } private void LateUpdate() { //IL_0046: 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_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_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_0063: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_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_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_00c9: 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) if ((Object)(object)HeadTransform == (Object)null) { return; } PlayerControllerB localPlayerScript = PlayerUtils.LocalPlayerScript; if (!((Object)(object)localPlayerScript == (Object)null)) { Transform val = ((!localPlayerScript.isPlayerDead) ? ((Component)localPlayerScript.gameplayCamera).transform : ((Component)StartOfRound.Instance.spectateCamera).transform); Vector3 val2 = val.position - HeadTransform.position; Quaternion val3 = Quaternion.LookRotation(val2); val3 *= Quaternion.Euler(HeadRotationOffset); HeadTransform.rotation = val3; Quaternion localRotation = HeadTransform.localRotation; Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles; if (IsHeldByLocalPlayer) { eulerAngles.x = HeadRotationOffset.x; } eulerAngles.z = HeadRotationOffset.z; HeadTransform.localRotation = Quaternion.Euler(eulerAngles); } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "TakeyIgnoreVariant"; } } public class TakeyJetpack : MonoBehaviour { [Header("Properties")] [Space(5f)] public bool HideOnStart; [Header("Visuals")] [Space(5f)] public GameObject ModelObject; public ParticleSystem[] RocketParticles = Array.Empty(); public Light[] ThrusterLights = Array.Empty(); public ParticleSystem[] SmokeTrailParticles = Array.Empty(); [Header("Audio")] [Space(5f)] public AudioSource MainAudio; public AudioSource ThrustAudio; public AudioSource BeepAudio; public AudioSource WarningBeepAudio; public AudioClip ThrustStartSFX; private void Start() { if (HideOnStart) { HideJetpack(); StopEffects(); } } public void ShowJetpack() { ModelObject.SetActive(true); } public void HideJetpack() { ModelObject.SetActive(false); } public void PlayThrustStartSFX() { MainAudio.PlayOneShot(ThrustStartSFX); } public void PlayWarningBeepSFX() { WarningBeepAudio.Play(); } public void PlayEffects(bool playThrustStartSFX = true) { if (playThrustStartSFX) { PlayThrustStartSFX(); } ThrustAudio.Play(); BeepAudio.Play(); SetThrusterLightsEnabled(value: true); ParticleSystem[] rocketParticles = RocketParticles; foreach (ParticleSystem val in rocketParticles) { val.Play(); } ParticleSystem[] smokeTrailParticles = SmokeTrailParticles; foreach (ParticleSystem val2 in smokeTrailParticles) { val2.Play(); } } public void StopEffects() { MainAudio.Stop(); ThrustAudio.Stop(); BeepAudio.Stop(); WarningBeepAudio.Stop(); SetThrusterLightsEnabled(value: false); ParticleSystem[] rocketParticles = RocketParticles; foreach (ParticleSystem val in rocketParticles) { val.Stop(true, (ParticleSystemStopBehavior)1); } ParticleSystem[] smokeTrailParticles = SmokeTrailParticles; foreach (ParticleSystem val2 in smokeTrailParticles) { val2.Stop(true, (ParticleSystemStopBehavior)1); } } private void SetThrusterLightsEnabled(bool value) { Light[] thrusterLights = ThrusterLights; foreach (Light val in thrusterLights) { ((Component)val).gameObject.SetActive(value); } } } public class TakeyMug : AdvancedGrabbableObject { public static List Instances = new List(); [Space(20f)] [Header("Takey Mug")] [Space(5f)] public MeshRenderer MeshRenderer; public Animator Animator; public List Variants = new List(); public int VariantIndex { get; private set; } public override void Awake() { base.Awake(); if (NetworkUtils.IsServer) { VariantIndex = GetRandomVariantIndex(); } } private void OnEnable() { if (!Instances.Contains(this)) { Instances.Add(this); } } private void OnDisable() { Instances.Remove(this); } public override void OnNetworkSpawn() { base.OnNetworkSpawn(); SetVariantIndexOnServer(VariantIndex); } protected override void OnClientConnected(ulong clientId) { //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_0028: 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_0037: Unknown result type (might be due to invalid IL or missing references) if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(VariantIndex, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(int variantIndex, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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_00ce: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3116593714u, clientRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, variantIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3116593714u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetVariantIndexOnLocalClient(variantIndex); } } } public override int GetItemDataToSave() { GameSaveFileHelper.Save(base.SaveKey + "_VariantIndex", VariantIndex); LogInfoExtended($"Saved item data. (VariantIndex: {VariantIndex})"); return base.GetItemDataToSave(); } public override void LoadItemSaveData(int saveData) { base.LoadItemSaveData(saveData); VariantIndex = GameSaveFileHelper.Load(base.SaveKey + "_VariantIndex", GetRandomVariantIndex()); LogInfoExtended($"Loaded item data. (VariantIndex: {VariantIndex})"); } private int GetRandomVariantIndex() { return Utils.GetRandomIndexFromWeightList(GetVariantWeightList()); } private List GetVariantWeightList() { List list = new List(); for (int i = 0; i < Variants.Count; i++) { list.Add(GetVariantWeight(i)); } return list; } private int GetVariantWeight(int index) { TakeyMugVariantData variantData = GetVariantData(index); if (variantData == null) { return 0; } if (Utils.IsAprilFools() && index == 2) { return 9999; } int weight = variantData.Weight; if (variantData.MaxInstanceCount <= -1) { return weight; } TakeyMug[] array = Instances.Where((TakeyMug x) => x.VariantIndex == index).ToArray(); if (array.Length >= variantData.MaxInstanceCount) { return 0; } return weight; } private TakeyMugVariantData GetVariantData(int index) { if (index < 0 || index > Variants.Count - 1) { return null; } return Variants[index]; } private void SetVariantIndexOnServer(int index) { if (NetworkUtils.IsServer) { SetVariantIndexClientRpc(index); SetVariantIndexOnLocalClient(index); } } [ClientRpc] private void SetVariantIndexClientRpc(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) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3889126209u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3889126209u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { SetVariantIndexOnLocalClient(index); } } } private void SetVariantIndexOnLocalClient(int index) { TakeyMugVariantData variantData = GetVariantData(index); if (variantData == null) { return; } VariantIndex = index; if ((Object)(object)MeshRenderer != (Object)null && (Object)(object)variantData.Material != (Object)null) { ((Renderer)MeshRenderer).sharedMaterial = variantData.Material; } if ((Object)(object)Animator != (Object)null) { if (variantData.IsAnimated && !string.IsNullOrWhiteSpace(variantData.AnimationName)) { ((Behaviour)Animator).enabled = true; Animator.Play(variantData.AnimationName); } else { ((Behaviour)Animator).enabled = false; } } } public void LogInfoExtended(object data) { string text = ((base.UniqueId != 0) ? $" : {base.UniqueId}" : string.Empty); Logger.LogInfo("[" + ((GrabbableObject)this).itemProperties.itemName + text + "] " + data, extended: true); } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3116593714u, new RpcReceiveHandler(__rpc_handler_3116593714), "SetDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(3889126209u, new RpcReceiveHandler(__rpc_handler_3889126209), "SetVariantIndexClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_3116593714(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_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_0040: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int variantIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIndex); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyMug)(object)target).SetDataClientRpc(variantIndex, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3889126209(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 variantIndexClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIndexClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyMug)(object)target).SetVariantIndexClientRpc(variantIndexClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyMug"; } } [Serializable] public class TakeyMugVariantData { [Range(0f, 500f)] public int Weight = 25; public int MaxInstanceCount = 1; public Material Material; public bool IsAnimated; public string AnimationName; } public class TakeyMugShelf : NetworkBehaviour { [CompilerGenerated] private sealed class d__18 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GrabbableObject grabbableObject; public Vector3 localRotation; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__18(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)grabbableObject == (Object)null) { return false; } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; ((Component)grabbableObject).transform.localRotation = Quaternion.Euler(localRotation); Logger.LogInfo($"[TakeyMugShelf] Set local rotation of GrabbableObject \"{grabbableObject.itemProperties.itemName}\" to ({localRotation.x}, {localRotation.y}, {localRotation.z})", extended: true); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public List ItemDataList = new List(); public Transform BoundsTransform; public static TakeyMugShelf Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } private void Start() { ParentGrabbableObjectsNextFrame(); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { if (((NetworkBehaviour)this).IsServer) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } } else { Instance = this; } } public TakeyMugShelfItemData GetItemData(GrabbableObject grabbableObject) { if ((Object)(object)grabbableObject == (Object)null || (Object)(object)grabbableObject.itemProperties == (Object)null) { return null; } string itemName = grabbableObject.itemProperties.itemName; foreach (TakeyMugShelfItemData itemData in ItemDataList) { if (itemData.ItemName.Equals(itemName, StringComparison.OrdinalIgnoreCase)) { return itemData; } } return null; } public bool TryGetItemData(GrabbableObject grabbableObject, out TakeyMugShelfItemData itemData) { itemData = GetItemData(grabbableObject); return itemData != null; } private List GetGrabbableObjectsInBounds() { //IL_001a: 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_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_003c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)BoundsTransform == (Object)null) { return new List(); } Vector3 val = BoundsTransform.lossyScale / 2f; Collider[] array = Physics.OverlapBox(BoundsTransform.position, val, BoundsTransform.rotation, LayerMask.GetMask(new string[1] { "Props" })); List list = new List(); Collider[] array2 = array; GrabbableObject item = default(GrabbableObject); foreach (Collider val2 in array2) { if (((Component)val2).TryGetComponent(ref item)) { list.Add(item); } } return list; } public void ParentGrabbableObjects() { //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_006f: 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_008b: Unknown result type (might be due to invalid IL or missing references) List grabbableObjectsInBounds = GetGrabbableObjectsInBounds(); Logger.LogInfo($"[TakeyMugShelf] Found {grabbableObjectsInBounds.Count} GrabbableObject(s).", extended: true); if (grabbableObjectsInBounds.Count == 0) { return; } foreach (GrabbableObject item in grabbableObjectsInBounds) { Utils.SetGrabbableObjectParent(item, ((Component)this).transform); Vector3 position = ((Component)item).transform.position; Logger.LogInfo($"[TakeyMugShelf] Parented GrabbableObject \"{item.itemProperties.itemName}\" position: {position.x}, {position.y}, {position.z}", extended: true); } Logger.LogInfo("[TakeyMugShelf] Finished parenting GrabbableObject(s).", extended: true); } public void ParentGrabbableObjectsNextFrame() { Utils.ExecuteNextFrame(ParentGrabbableObjects); } public void UnparentGrabbableObjectsOnServer() { if (NetworkUtils.IsServer) { UnparentGrabbableObjectsClientRpc(); UnparentGrabbableObjectsOnLocalClient(); } } [ClientRpc] private void UnparentGrabbableObjectsClientRpc() { //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_00c1: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1216475981u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1216475981u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { UnparentGrabbableObjectsOnLocalClient(); } } } private void UnparentGrabbableObjectsOnLocalClient() { Transform hangarShipTransform = Utils.GetHangarShipTransform(); if (!((Object)(object)hangarShipTransform == (Object)null)) { GrabbableObject[] componentsInChildren = ((Component)this).GetComponentsInChildren(); GrabbableObject[] array = componentsInChildren; foreach (GrabbableObject grabbableObject in array) { Utils.SetGrabbableObjectParent(grabbableObject, hangarShipTransform); } } } public void SetGrabbableObjectLocalRotation(GrabbableObject grabbableObject) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (TryGetItemData(grabbableObject, out var itemData) && itemData.LocalRotation.Enabled) { ((MonoBehaviour)this).StartCoroutine(SetGrabbableObjectLocalRotationCoroutine(grabbableObject, itemData.LocalRotation.Value)); } } [IteratorStateMachine(typeof(d__18))] private IEnumerator SetGrabbableObjectLocalRotationCoroutine(GrabbableObject grabbableObject, Vector3 localRotation) { //IL_000e: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__18(0) { grabbableObject = grabbableObject, localRotation = localRotation }; } [ServerRpc(RequireOwnership = false)] public void RequestSyncGrabbableObjectsServerRpc(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_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_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_00c7: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2689165081u, serverRpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2689165081u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { Logger.LogInfo($"[TakeyMugShelf] Client #{senderClientId} requested to sync GrabbableObject(s)", extended: true); SyncGrabbableObjectsToClient(senderClientId); } } } private void SyncGrabbableObjectsToClient(ulong clientId) { //IL_0013: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_003f: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer && !NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SyncGrabbableObjectsClientRpc(GetGrabbableObjectDataArray(), clientRpcParams); } } [ClientRpc] private void SyncGrabbableObjectsClientRpc(GrabbableObjectData[] grabbableObjectDataArray, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_010c: 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_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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3496601058u, clientRpcParams, (RpcDelivery)0); bool flag = grabbableObjectDataArray != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(grabbableObjectDataArray, default(ForNetworkSerializable)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3496601058u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; GrabbableObjectData[] grabbableObjectDataArray2 = grabbableObjectDataArray; Utils.ExecuteAfterDelay(delegate { LoadGrabbableObjectDataArray(grabbableObjectDataArray2); }, 1f); } } private GrabbableObjectData[] GetGrabbableObjectDataArray() { return (from x in GetGrabbableObjectsInBounds() select new GrabbableObjectData(x)).ToArray(); } private void LoadGrabbableObjectDataArray(GrabbableObjectData[] grabbableObjectDataArray) { //IL_0040: 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_0061: 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_00cd: 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_00e5: Unknown result type (might be due to invalid IL or missing references) Logger.LogInfo($"[TakeyMugShelf] Loading {grabbableObjectDataArray.Length} GrabbableObjectData.", extended: true); foreach (GrabbableObjectData grabbableObjectData in grabbableObjectDataArray) { if (grabbableObjectData.TryGetGrabbableObject(out var grabbableObject)) { Utils.SetGrabbableObjectParent(grabbableObject, ((Component)this).transform); Utils.SetGrabbableObjectPosition(grabbableObject, grabbableObjectData.Position); ((Component)grabbableObject).transform.rotation = grabbableObjectData.Rotation; Vector3 eulerAngles = ((Quaternion)(ref grabbableObjectData.Rotation)).eulerAngles; Logger.LogInfo("[TakeyMugShelf] Loaded GrabbableObjectData for \"" + grabbableObject.itemProperties.itemName + "\".", extended: true); Logger.LogInfo($"[TakeyMugShelf] Position: {grabbableObjectData.Position.x}, {grabbableObjectData.Position.y}, {grabbableObjectData.Position.z}", extended: true); Logger.LogInfo($"[TakeyMugShelf] Rotation: {eulerAngles.x}, {eulerAngles.y}, {eulerAngles.z}", extended: true); } } } private void OnDrawGizmos() { //IL_000f: 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_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_0035: 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_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_005f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)BoundsTransform == (Object)null)) { Gizmos.color = Color.red; Vector3 val = BoundsTransform.lossyScale / 2f; Gizmos.matrix = Matrix4x4.TRS(BoundsTransform.position, BoundsTransform.rotation, Vector3.one); Gizmos.DrawWireCube(Vector3.zero, val * 2f); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1216475981u, new RpcReceiveHandler(__rpc_handler_1216475981), "UnparentGrabbableObjectsClientRpc"); ((NetworkBehaviour)this).__registerRpc(2689165081u, new RpcReceiveHandler(__rpc_handler_2689165081), "RequestSyncGrabbableObjectsServerRpc"); ((NetworkBehaviour)this).__registerRpc(3496601058u, new RpcReceiveHandler(__rpc_handler_3496601058), "SyncGrabbableObjectsClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1216475981(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; ((TakeyMugShelf)(object)target).UnparentGrabbableObjectsClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2689165081(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_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyMugShelf)(object)target).RequestSyncGrabbableObjectsServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3496601058(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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0087: 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_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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); GrabbableObjectData[] grabbableObjectDataArray = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref grabbableObjectDataArray, default(ForNetworkSerializable)); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyMugShelf)(object)target).SyncGrabbableObjectsClientRpc(grabbableObjectDataArray, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyMugShelf"; } } [Serializable] public class TakeyMugShelfItemData { public string ItemName; public EnableField LocalRotation; public EnableField VerticalOffset; } [Serializable] public class GrabbableObjectData : INetworkSerializable { public NetworkObjectReference NetworkObjectReference; public Vector3 Position; public Quaternion Rotation; public GrabbableObjectData() { } public GrabbableObjectData(GrabbableObject grabbableObject) { //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_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_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) NetworkObject val = default(NetworkObject); if (!((Object)(object)grabbableObject == (Object)null) && ((Component)grabbableObject).TryGetComponent(ref val)) { NetworkObjectReference = NetworkObjectReference.op_Implicit(val); Position = ((Component)grabbableObject).transform.position; Rotation = ((Component)grabbableObject).transform.rotation; } } public unsafe void NetworkSerialize(BufferSerializer serializer) where T : IReaderWriter { //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) ((BufferSerializer*)(&serializer))->SerializeValue(ref NetworkObjectReference, default(ForNetworkSerializable)); serializer.SerializeValue(ref Position); serializer.SerializeValue(ref Rotation); } public GrabbableObject GetGrabbableObject() { NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref NetworkObjectReference)).TryGet(ref val, (NetworkManager)null)) { return null; } return ((Component)val).GetComponent(); } public bool TryGetGrabbableObject(out GrabbableObject grabbableObject) { grabbableObject = GetGrabbableObject(); return (Object)(object)grabbableObject != (Object)null; } } public class TakeyMugShelfPlaceableObjectsSurface : MonoBehaviour { public InteractTrigger InteractTrigger; public Transform PlacementTransform; private void Update() { if (!((Object)(object)InteractTrigger == (Object)null)) { InteractTrigger.interactable = CanSetInteractable(); } } private bool CanSetInteractable() { if ((Object)(object)TakeyMugShelf.Instance == (Object)null) { return false; } if ((Object)(object)PlacementTransform == (Object)null) { return false; } PlayerControllerB localPlayerScript = PlayerUtils.LocalPlayerScript; if ((Object)(object)localPlayerScript == (Object)null) { return false; } return localPlayerScript.isHoldingObject; } public void PlaceObject(PlayerControllerB playerScript) { //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_003f: 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_004c: 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_0062: 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) NetworkObject val = default(NetworkObject); if (CanPlaceObject(playerScript) && ((Component)TakeyMugShelf.Instance).TryGetComponent(ref val)) { GrabbableObject currentlyHeldObjectServer = playerScript.currentlyHeldObjectServer; TakeyMugShelfItemData itemData = TakeyMugShelf.Instance.GetItemData(currentlyHeldObjectServer); Vector3 itemPlacementPosition = GetItemPlacementPosition(currentlyHeldObjectServer, itemData); Vector3 val2 = ((Component)TakeyMugShelf.Instance).transform.InverseTransformPoint(itemPlacementPosition); Logger.LogInfo($"[TakeyMugShelf] Item placement position: {itemPlacementPosition.x}, {itemPlacementPosition.y}, {itemPlacementPosition.z}", extended: true); bool flag = false; if (itemData != null && itemData.LocalRotation.Enabled) { flag = true; } playerScript.DiscardHeldObject(true, val, val2, flag); } } private bool CanPlaceObject(PlayerControllerB playerScript) { if ((Object)(object)TakeyMugShelf.Instance == (Object)null) { return false; } if ((Object)(object)PlacementTransform == (Object)null) { return false; } if ((Object)(object)playerScript == (Object)null) { return false; } if (!playerScript.isHoldingObject) { return false; } if (playerScript.isGrabbingObjectAnimation) { return false; } if ((Object)(object)playerScript.currentlyHeldObjectServer == (Object)null) { return false; } return true; } private Vector3 GetItemPlacementPosition(GrabbableObject grabbableObject, TakeyMugShelfItemData itemData = null) { //IL_000e: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0097: 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_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) if ((Object)(object)PlacementTransform == (Object)null) { return Vector3.zero; } if ((Object)(object)grabbableObject == (Object)null || (Object)(object)grabbableObject.itemProperties == (Object)null) { return PlacementTransform.position; } float num = ((itemData == null || !itemData.VerticalOffset.Enabled) ? grabbableObject.itemProperties.verticalOffset : itemData.VerticalOffset.Value); RaycastHit val = default(RaycastHit); if (Physics.Raycast(PlacementTransform.position, PlacementTransform.up * -1f, ref val, 0.5f, 1073744640, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point + PlacementTransform.up * num; } return PlacementTransform.position; } } public class TakeypackItem : JetpackItem { public static List Instances = new List(); [Space(20f)] [Header("Takeypack")] [Space(5f)] public AudioSource MusicAudio; public float GroundCheckInterval = 0.25f; public ParticleSystem[] RocketParticles; public GameObject[] ThrusterLights; public ParticleSystem[] SmokeTrailParticles; private float _groundCheckTimer; public bool IsPlayerHeldByGrounded { get { if (!((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)) { return false; } return ((GrabbableObject)this).playerHeldBy.thisController.isGrounded; } } public override void Start() { ((GrabbableObject)this).Start(); UpdateSettings(); } private void OnEnable() { if (!Instances.Contains(this)) { Instances.Add(this); } } private void OnDisable() { Instances.Remove(this); } public override void Update() { ((JetpackItem)this).Update(); if (!((NetworkBehaviour)this).IsOwner || base.jetpackActivated || !IsPlayerHeldByGrounded) { return; } if (_groundCheckTimer >= GroundCheckInterval) { _groundCheckTimer = 0f; if (MusicAudio.isPlaying) { SetPlayingMusic(value: false); } } else { _groundCheckTimer += Time.deltaTime; } } public override void DiscardItem() { ((JetpackItem)this).DiscardItem(); if (((NetworkBehaviour)this).IsOwner) { SetPlayingMusic(value: false); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((JetpackItem)this).ItemActivate(used, buttonDown); if (((NetworkBehaviour)this).IsOwner && !base.jetpackBroken) { if (!MusicAudio.isPlaying) { SetPlayingMusic(value: true); } _groundCheckTimer = 0f; } } public override void UseUpBatteries() { ((JetpackItem)this).UseUpBatteries(); if (((NetworkBehaviour)this).IsOwner) { SetPlayingMusic(value: false); } } public void UpdateSettings() { MusicAudio.volume = ConfigManager.Takeypack_MusicVolume.Value * 0.01f; } public static void OnConfigSettingsChanged() { foreach (TakeypackItem instance in Instances) { instance.UpdateSettings(); } } public void SetJetpackEffects(bool value) { GameObject[] thrusterLights = ThrusterLights; foreach (GameObject val in thrusterLights) { val.SetActive(value); } ParticleSystem[] rocketParticles = RocketParticles; foreach (ParticleSystem val2 in rocketParticles) { if (value) { val2.Play(); } else { val2.Stop(true, (ParticleSystemStopBehavior)1); } } ParticleSystem[] smokeTrailParticles = SmokeTrailParticles; foreach (ParticleSystem val3 in smokeTrailParticles) { if (value) { val3.Play(); } else { val3.Stop(true, (ParticleSystemStopBehavior)1); } } } public void SetPlayingMusic(bool value) { //IL_0004: 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) SetPlayingMusicServerRpc(value); SetPlayingMusicOnLocalClient(value); } [ServerRpc(RequireOwnership = false)] private void SetPlayingMusicServerRpc(bool value, 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_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) //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_00e2: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3289368235u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3289368235u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { SetPlayingMusicClientRpc(value, senderClientId); } } } [ClientRpc] private void SetPlayingMusicClientRpc(bool value, ulong senderClientId) { //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_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_008c: 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_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(22156199u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 22156199u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsLocalClientId(senderClientId)) { SetPlayingMusicOnLocalClient(value); } } } private void SetPlayingMusicOnLocalClient(bool value) { if (value) { MusicAudio.Play(); } else { MusicAudio.Pause(); } } protected override void __initializeVariables() { ((JetpackItem)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3289368235u, new RpcReceiveHandler(__rpc_handler_3289368235), "SetPlayingMusicServerRpc"); ((NetworkBehaviour)this).__registerRpc(22156199u, new RpcReceiveHandler(__rpc_handler_22156199), "SetPlayingMusicClientRpc"); ((JetpackItem)this).__initializeRpcs(); } private static void __rpc_handler_3289368235(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeypackItem)(object)target).SetPlayingMusicServerRpc(value, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_22156199(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_003e: 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) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeypackItem)(object)target).SetPlayingMusicClientRpc(value, senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeypackItem"; } } public class TakeyPartyHatVariant : TakeyVariant { [Space(20f)] [Header("Party Hat")] [Space(5f)] public GameObject PartyHatObject; public Material[] PartyHatMaterials = Array.Empty(); private int _partyHatMaterialIndex; public override void Awake() { base.Awake(); if (NetworkUtils.IsServer) { _partyHatMaterialIndex = Random.Range(0, PartyHatMaterials.Length); } } public override void Start() { base.Start(); SetPartyHatMaterialIndexOnServer(_partyHatMaterialIndex); } public override void OnClientConnected(ulong clientId) { //IL_0012: 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_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) //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_003e: Unknown result type (might be due to invalid IL or missing references) base.OnClientConnected(clientId); if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(_partyHatMaterialIndex, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(int partyHatMaterialIndex, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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_00ce: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3781487039u, clientRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, partyHatMaterialIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3781487039u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetPartyHatMaterialIndexOnLocalClient(partyHatMaterialIndex); } } } public override void SaveData() { base.SaveData(); GameSaveFileHelper.Save(base.SaveKey + "__partyHatMaterialIndex", _partyHatMaterialIndex); LogInfoExtended($"Saved item data. (PartyHatMaterialIndex: {_partyHatMaterialIndex})"); } public override void LoadData() { base.LoadData(); _partyHatMaterialIndex = GameSaveFileHelper.Load(base.SaveKey + "__partyHatMaterialIndex", Random.Range(0, PartyHatMaterials.Length)); LogInfoExtended($"Loaded item data. (PartyHatMaterialIndex: {_partyHatMaterialIndex})"); } public override void SetControlTipsForItem() { HUDManager.Instance.ChangeControlTipMultiple(new string[1] { "Party : [LMB]" }, true, ((GrabbableObject)base.Takey).itemProperties); } public override bool ItemActivate(bool used, bool buttonDown = true) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) PluginNetworkBehaviour.Instance.SpawnPartyExplosionServerRpc(((Component)this).transform.position); return false; } public override void OnHitGround() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) base.OnHitGround(); if (((NetworkBehaviour)base.Takey).IsOwner && Utils.RollPercentChance(20f)) { PluginNetworkBehaviour.Instance.SpawnPartyExplosionServerRpc(((Component)this).transform.position); } } private void SetPartyHatMaterialIndexOnServer(int index) { if (NetworkUtils.IsServer) { SetPartyHatMaterialIndexClientRpc(index); SetPartyHatMaterialIndexOnLocalClient(index); } } [ClientRpc] private void SetPartyHatMaterialIndexClientRpc(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) //IL_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1812800066u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1812800066u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { SetPartyHatMaterialIndexOnLocalClient(index); } } } private void SetPartyHatMaterialIndexOnLocalClient(int index) { _partyHatMaterialIndex = index; if ((Object)(object)PartyHatObject == (Object)null || _partyHatMaterialIndex < 0 || _partyHatMaterialIndex > PartyHatMaterials.Length - 1) { return; } Material val = PartyHatMaterials[_partyHatMaterialIndex]; Renderer[] componentsInChildren = PartyHatObject.GetComponentsInChildren(true); foreach (Renderer val2 in componentsInChildren) { Material[] sharedMaterials = val2.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { sharedMaterials[j] = val; } val2.sharedMaterials = sharedMaterials; } } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3781487039u, new RpcReceiveHandler(__rpc_handler_3781487039), "SetDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(1812800066u, new RpcReceiveHandler(__rpc_handler_1812800066), "SetPartyHatMaterialIndexClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_3781487039(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_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_0040: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int partyHatMaterialIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref partyHatMaterialIndex); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyPartyHatVariant)(object)target).SetDataClientRpc(partyHatMaterialIndex, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1812800066(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 partyHatMaterialIndexClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref partyHatMaterialIndexClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyPartyHatVariant)(object)target).SetPartyHatMaterialIndexClientRpc(partyHatMaterialIndexClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyPartyHatVariant"; } } public class TakeyStabbyVariant : TakeyVariant { [CompilerGenerated] private sealed class d__32 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Transform targetTransform; public Vector3 targetEulerAngles; public float duration; private float 5__2; private Quaternion 5__3; private Quaternion 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //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_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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0083: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = Time.time; 5__3 = targetTransform.localRotation; 5__4 = Quaternion.Euler(targetEulerAngles); if (5__3 == 5__4) { return false; } break; case 1: <>1__state = -1; break; } if (Time.time < 5__2 + duration) { float num = (Time.time - 5__2) / duration; targetTransform.localRotation = Quaternion.Slerp(5__3, 5__4, num); <>2__current = null; <>1__state = 1; return true; } targetTransform.localRotation = 5__4; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Space(20f)] [Header("Stabby")] [Space(5f)] public Vector3 IdleRotation; public Vector3 StabbyRotation; public int KnifeHitForce = 1; public Animator Animator; public GameObject KnifeObject; public Vector3 KnifeIdleRotation; public Vector3 KnifeStabbyRotation; public AudioSource KnifeAudio; public AudioClip[] HitSFX = Array.Empty(); public AudioClip[] SwingSFX = Array.Empty(); public ParticleSystem BloodParticleSystem; private bool _attackMode; private int _knifeMask = 1084754248; private float _timeAtLastDamageDealt; private RaycastHit[] _objectsHitByKnife = Array.Empty(); private List _objectsHitByKnifeList = new List(); private Coroutine _variantRotateToEulerAngles; public override void Start() { base.Start(); if (NetworkUtils.IsServer) { SetAttackMode(_attackMode); } } public override void OnClientConnected(ulong clientId) { //IL_0012: 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_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) //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_003e: Unknown result type (might be due to invalid IL or missing references) base.OnClientConnected(clientId); if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(_attackMode, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(bool attackMode, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //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) //IL_00dc: 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.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3469652461u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref attackMode, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3469652461u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SetAttackModeOnLocalClient(attackMode); } } } public override void SaveData() { base.SaveData(); GameSaveFileHelper.Save(base.SaveKey + "__attackMode", _attackMode); LogInfoExtended($"Saved item data. (AttackMode: {_attackMode})"); } public override void LoadData() { base.LoadData(); _attackMode = GameSaveFileHelper.Load(base.SaveKey + "__attackMode", defaultValue: false); LogInfoExtended($"Loaded item data. (AttackMode: {_attackMode})"); } public override void GrabItem() { base.GrabItem(); UpdateVariantRotation(animate: false); } public override void SetControlTipsForItem() { if (_attackMode) { HUDManager.Instance.ChangeControlTipMultiple(new string[2] { "Stab : [LMB]", "Switch Mode : [Q]" }, true, ((GrabbableObject)base.Takey).itemProperties); } else { HUDManager.Instance.ChangeControlTipMultiple(new string[2] { "Squeeze : [LMB]", "Switch Mode : [Q]" }, true, ((GrabbableObject)base.Takey).itemProperties); } } public override bool ItemActivate(bool used, bool buttonDown = true) { if (_attackMode) { ((GrabbableObject)base.Takey).useCooldown = 0f; Stab(); return false; } return base.ItemActivate(used, buttonDown); } public override void ItemInteractLeftRight(bool right) { if (!right) { SetAttackMode(!_attackMode); } } public override void DiscardItem() { base.DiscardItem(); UpdateVariantRotation(animate: false); } private void SetAttackMode(bool value) { //IL_0004: 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) SetAttackModeServerRpc(value); SetAttackModeOnLocalClient(value); } [ServerRpc(RequireOwnership = false)] private void SetAttackModeServerRpc(bool value, 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_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) //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_00e2: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3406110425u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3406110425u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { SetAttackModeClientRpc(value, senderClientId); } } } [ClientRpc] private void SetAttackModeClientRpc(bool value, ulong senderClientId) { //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_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_008c: 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_00e9: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2133985427u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref value, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2133985427u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsLocalClientId(senderClientId)) { SetAttackModeOnLocalClient(value); } } } private void SetAttackModeOnLocalClient(bool value) { //IL_003e: 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_0043: 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_0050: Unknown result type (might be due to invalid IL or missing references) _attackMode = value; ((GrabbableObject)base.Takey).useCooldown = 0.3f; Animator.SetBool("AttackMode", _attackMode); Vector3 val = (_attackMode ? KnifeStabbyRotation : KnifeIdleRotation); KnifeObject.transform.localRotation = Quaternion.Euler(val); UpdateVariantRotation(); if (PlayerUtils.IsLocalPlayer(((GrabbableObject)base.Takey).playerHeldBy)) { SetControlTipsForItem(); } } private void UpdateVariantRotation(bool animate = true) { //IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((_attackMode && ((GrabbableObject)base.Takey).isHeld) ? StabbyRotation : IdleRotation); if (_variantRotateToEulerAngles != null) { ((MonoBehaviour)this).StopCoroutine(_variantRotateToEulerAngles); } if (animate && ((GrabbableObject)base.Takey).isHeld) { _variantRotateToEulerAngles = ((MonoBehaviour)this).StartCoroutine(RotateToEulerAngles(((Component)this).transform, val, 0.3f)); } else { ((Component)this).transform.localRotation = Quaternion.Euler(val); } } [IteratorStateMachine(typeof(d__32))] private IEnumerator RotateToEulerAngles(Transform targetTransform, Vector3 targetEulerAngles, float duration) { //IL_000e: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__32(0) { targetTransform = targetTransform, targetEulerAngles = targetEulerAngles, duration = duration }; } private void Stab() { //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) if (_attackMode) { StabServerRpc(); StabOnLocalClient(); } } [ServerRpc(RequireOwnership = false)] private void StabServerRpc(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_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_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_00c7: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(591760016u, serverRpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 591760016u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { StabClientRpc(senderClientId); } } } [ClientRpc] private void StabClientRpc(ulong senderClientId) { //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_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2281358813u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2281358813u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsLocalClientId(senderClientId)) { StabOnLocalClient(); } } } private void StabOnLocalClient() { if (_attackMode) { RoundManager.PlayRandomClip(KnifeAudio, SwingSFX, true, 1f, 0, 1000); Animator.SetTrigger("Attack"); if (((NetworkBehaviour)base.Takey).IsOwner) { KnifeHit(); } } } private void KnifeHit(bool cancel = false) { //IL_03c4: 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_0086: 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_00a1: 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_010d: 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_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_01b6: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0237: 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_0249: 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_028f: 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_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_0302: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.Takey.PreviousPlayerHeldBy == (Object)null) { LogInfoExtended("PreviousPlayerHeldBy is null on this client when KnifeHit is called."); return; } base.Takey.PreviousPlayerHeldBy.activatingItem = false; bool flag = false; bool flag2 = false; int num = -1; bool flag3 = false; if (!cancel && Time.realtimeSinceStartup - _timeAtLastDamageDealt > 0.43f) { base.Takey.PreviousPlayerHeldBy.twoHanded = false; Transform transform = ((Component)base.Takey.PreviousPlayerHeldBy.gameplayCamera).transform; _objectsHitByKnife = Physics.SphereCastAll(transform.position + transform.right * 0.1f, 0.3f, transform.forward, 1.5f, _knifeMask, (QueryTriggerInteraction)2); _objectsHitByKnifeList = _objectsHitByKnife.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList(); List list = new List(); IHittable val2 = default(IHittable); for (int i = 0; i < _objectsHitByKnifeList.Count; i++) { RaycastHit val = _objectsHitByKnifeList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8) { val = _objectsHitByKnifeList[i]; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11) { val = _objectsHitByKnifeList[i]; if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent(ref val2)) { continue; } val = _objectsHitByKnifeList[i]; if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)base.Takey.PreviousPlayerHeldBy).transform) { continue; } val = _objectsHitByKnifeList[i]; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position = ((Component)base.Takey.PreviousPlayerHeldBy.gameplayCamera).transform.position; RaycastHit val3 = _objectsHitByKnifeList[i]; if (Physics.Linecast(position, ((RaycastHit)(ref val3)).point, ref val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { continue; } } flag = true; Vector3 forward = ((Component)base.Takey.PreviousPlayerHeldBy.gameplayCamera).transform.forward; try { val = _objectsHitByKnifeList[i]; EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val)).transform).GetComponent(); if ((Object)(object)component != (Object)null) { if (!((Object)(object)component.mainScript == (Object)null) && !list.Contains(component.mainScript)) { goto IL_02fa; } continue; } val = _objectsHitByKnifeList[i]; if (!((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent() != (Object)null)) { goto IL_02fa; } if (!flag3) { flag3 = true; goto IL_02fa; } goto end_IL_0287; IL_02fa: bool flag4 = val2.Hit(KnifeHitForce, forward, base.Takey.PreviousPlayerHeldBy, true, 5); if (flag4 && (Object)(object)component != (Object)null) { list.Add(component.mainScript); } if (!flag2 && flag4) { flag2 = true; _timeAtLastDamageDealt = Time.realtimeSinceStartup; PlayBloodParticles(); } end_IL_0287:; } catch (Exception arg) { LogError($"Exception caught when hitting object with shovel from player #{base.Takey.PreviousPlayerHeldBy.playerClientId}: {arg}"); } continue; } } flag = true; val = _objectsHitByKnifeList[i]; string tag = ((Component)((RaycastHit)(ref val)).collider).gameObject.tag; for (int j = 0; j < StartOfRound.Instance.footstepSurfaces.Length; j++) { if (StartOfRound.Instance.footstepSurfaces[j].surfaceTag == tag) { num = j; break; } } } } if (flag) { RoundManager.PlayRandomClip(KnifeAudio, HitSFX, true, 1f, 0, 1000); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 17f, 0.8f, 0, false, 0); if (!flag2 && num != -1) { KnifeAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(KnifeAudio, StartOfRound.Instance.footstepSurfaces[num].hitSurfaceSFX, 1f); } HitShovelServerRpc(num); } } private void PlayBloodParticles() { //IL_0003: 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) PlayBloodParticlesServerRpc(); PlayBloodParticlesOnLocalClient(); } [ServerRpc(RequireOwnership = false)] private void PlayBloodParticlesServerRpc(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_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_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_00c7: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4054753107u, serverRpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4054753107u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { PlayBloodParticlesClientRpc(senderClientId); } } } [ClientRpc] private void PlayBloodParticlesClientRpc(ulong senderClientId) { //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_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1966824597u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1966824597u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsLocalClientId(senderClientId)) { PlayBloodParticlesOnLocalClient(); } } } private void PlayBloodParticlesOnLocalClient() { BloodParticleSystem.Play(true); } [ServerRpc(RequireOwnership = false)] public void HitShovelServerRpc(int hitSurfaceID) { //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_00ce: 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(1552587199u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, hitSurfaceID); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1552587199u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; HitShovelClientRpc(hitSurfaceID); } } } [ClientRpc] public void HitShovelClientRpc(int hitSurfaceID) { //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_00ce: 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.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2255171945u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, hitSurfaceID); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2255171945u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)base.Takey == (Object)null) && !((NetworkBehaviour)base.Takey).IsOwner) { RoundManager.PlayRandomClip(KnifeAudio, HitSFX, true, 1f, 0, 1000); if (hitSurfaceID != -1) { HitSurfaceWithKnife(hitSurfaceID); } } } private void HitSurfaceWithKnife(int hitSurfaceID) { KnifeAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX); WalkieTalkie.TransmitOneShotAudio(KnifeAudio, StartOfRound.Instance.footstepSurfaces[hitSurfaceID].hitSurfaceSFX, 1f); } protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3469652461u, new RpcReceiveHandler(__rpc_handler_3469652461), "SetDataClientRpc"); ((NetworkBehaviour)this).__registerRpc(3406110425u, new RpcReceiveHandler(__rpc_handler_3406110425), "SetAttackModeServerRpc"); ((NetworkBehaviour)this).__registerRpc(2133985427u, new RpcReceiveHandler(__rpc_handler_2133985427), "SetAttackModeClientRpc"); ((NetworkBehaviour)this).__registerRpc(591760016u, new RpcReceiveHandler(__rpc_handler_591760016), "StabServerRpc"); ((NetworkBehaviour)this).__registerRpc(2281358813u, new RpcReceiveHandler(__rpc_handler_2281358813), "StabClientRpc"); ((NetworkBehaviour)this).__registerRpc(4054753107u, new RpcReceiveHandler(__rpc_handler_4054753107), "PlayBloodParticlesServerRpc"); ((NetworkBehaviour)this).__registerRpc(1966824597u, new RpcReceiveHandler(__rpc_handler_1966824597), "PlayBloodParticlesClientRpc"); ((NetworkBehaviour)this).__registerRpc(1552587199u, new RpcReceiveHandler(__rpc_handler_1552587199), "HitShovelServerRpc"); ((NetworkBehaviour)this).__registerRpc(2255171945u, new RpcReceiveHandler(__rpc_handler_2255171945), "HitShovelClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_3469652461(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool attackMode = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref attackMode, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyStabbyVariant)(object)target).SetDataClientRpc(attackMode, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3406110425(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_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) //IL_0044: 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_005d: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyStabbyVariant)(object)target).SetAttackModeServerRpc(value, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2133985427(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_003e: 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) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref value, default(ForPrimitives)); ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyStabbyVariant)(object)target).SetAttackModeClientRpc(value, senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_591760016(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_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyStabbyVariant)(object)target).StabServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2281358813(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) { ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyStabbyVariant)(object)target).StabClientRpc(senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4054753107(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_0033: 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_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyStabbyVariant)(object)target).PlayBloodParticlesServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1966824597(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) { ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyStabbyVariant)(object)target).PlayBloodParticlesClientRpc(senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1552587199(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 hitSurfaceID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyStabbyVariant)(object)target).HitShovelServerRpc(hitSurfaceID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2255171945(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 hitSurfaceID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref hitSurfaceID); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyStabbyVariant)(object)target).HitShovelClientRpc(hitSurfaceID); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyStabbyVariant"; } } public class TakeyVariant : NetworkBehaviour { public static List Instances = new List(); [Header("Takey Variant")] [Space(5f)] public TakeyVariantType VariantType = TakeyVariantType.Default; public AudioClipGroupWithWeight[] SqueezeVoiceLines = Array.Empty(); public Takey Takey { get; set; } public string SaveKey => Takey.SaveKey; public bool InSpecialAnimation { get; protected set; } public virtual void Awake() { } public virtual void Start() { //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) ((Component)this).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); } private void OnEnable() { if (!Instances.Contains(this)) { Instances.Add(this); } } private void OnDisable() { Instances.Remove(this); } public override void OnNetworkSpawn() { if (NetworkUtils.IsServer) { NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected; } } public override void OnNetworkDespawn() { if (NetworkUtils.IsServer) { NetworkManager.Singleton.OnClientConnectedCallback -= OnClientConnected; } } public virtual void OnClientConnected(ulong clientId) { } public virtual void Update() { } public virtual void SaveData() { } public virtual void LoadData() { } public virtual void InteractItem() { } public virtual void GrabItem() { } public virtual void SetControlTipsForItem() { if (SqueezeVoiceLines.Length == 0) { HUDManager.Instance.ChangeControlTipMultiple(Array.Empty(), true, ((GrabbableObject)Takey).itemProperties); } else { HUDManager.Instance.ChangeControlTipMultiple(((GrabbableObject)Takey).itemProperties.toolTips, true, ((GrabbableObject)Takey).itemProperties); } } public virtual void EquipItem() { } public virtual bool ItemActivate(bool used, bool buttonDown = true) { return true; } public virtual void ItemInteractLeftRight(bool right) { } public virtual void PocketItem() { } public virtual void DiscardItem() { } public virtual void OnHitGround() { } public virtual void OnBroughtToShip() { } public virtual void OnStartFlying() { } public virtual void OnPlaySqueezeVoiceLine(int index) { } protected float PlaySound(AudioSource audioSource, AudioClip audioClip, bool audibleNoise = true) { return PlaySound(new AudioSourceGroup(audioSource, null), new AudioClipGroup(audioClip, null), audibleNoise); } protected float PlaySound(AudioSourceGroup audioSourceGroup, AudioClipGroup audioClipGroup, bool audibleNoise = true) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (audioSourceGroup == null || (Object)(object)audioSourceGroup.AudioSource == (Object)null) { return 0f; } if (audioClipGroup == null || (Object)(object)audioClipGroup.AudioClip == (Object)null) { return 0f; } audioSourceGroup.PlayOneShot(audioClipGroup); WalkieTalkie.TransmitOneShotAudio(audioSourceGroup.AudioSource, audioClipGroup.AudioClip, 1f); if (audibleNoise) { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, Takey.NoiseRange, audioSourceGroup.Volume, 0, ((GrabbableObject)Takey).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); if (audioSourceGroup.Volume >= 0.6f && (Object)(object)((GrabbableObject)Takey).playerHeldBy != (Object)null) { ((GrabbableObject)Takey).playerHeldBy.timeSinceMakingLoudNoise = 0f; } } return audioClipGroup.AudioClip.length; } protected void LogError(object data) { if ((Object)(object)Takey == (Object)null) { Logger.LogError($"[{VariantType}] " + data); } else { Takey.LogError(data); } } protected void LogInfoExtended(object data) { if ((Object)(object)Takey == (Object)null) { Logger.LogInfo($"[{VariantType}] " + data, extended: true); } else { Takey.LogInfoExtended(data); } } public static List GetInstancesOfType() where T : TakeyVariant { List list = new List(); foreach (TakeyVariant instance in Instances) { if (instance is T item) { list.Add(item); } } return list; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "TakeyVariant"; } } } namespace com.github.zehsteam.TakeyPlush.Managers { internal static class ConfigManager { public static ConfigFile ConfigFile { get; private set; } public static ConfigEntry ExtendedLogging { get; private set; } public static ConfigEntry ExtraFeatures_Enabled { get; private set; } public static ConfigEntry ExtraFeatures_SpecialSporeLizardSoundsChance { get; private set; } public static ConfigEntry ExtraFeatures_EnableSpecialKidnapperFoxSounds { get; private set; } public static ConfigEntry ExtraFeatures_BunkerSpiderReskinChance { get; private set; } public static ConfigEntry ExtraFeatures_ButlerReskinChance { get; private set; } public static ItemConfigData SmolTakey { get; private set; } public static ConfigEntry SmolTakey_JetpackChance { get; private set; } public static ItemConfigData TakeyBox { get; private set; } public static SyncedConfigEntry TakeyBox_NegativeEffectsEnabled { get; private set; } public static SyncedConfigEntry TakeyBox_NegativeEffectsChance { get; private set; } public static ItemConfigData TakeyMug { get; private set; } public static UnlockableItemConfigData TakeyMugShelf { get; private set; } public static ConfigEntry Takeypack_MusicVolume { get; private set; } public static ConfigEntry Takeypack_JetpackReplaceChance { get; private set; } public static ConfigEntry DinkDonkVariant_BellVolume { get; private set; } public static ConfigEntry ALOOVariantTTS_Enabled { get; private set; } public static ConfigEntry ALOOVariantTTS_Cooldown { get; private set; } public static ConfigEntry ALOOVariantTTS_VoiceVolumeAmplificationDB { get; private set; } public static ConfigEntry ALOOVariantTTS_MinSoundDistance { get; private set; } public static ConfigEntry ALOOVariantTTS_MaxSoundDistance { get; private set; } public static ConfigEntry ALOOVariantTTS_ProfanityFilterEnabled { get; private set; } public static void Initialize(ConfigFile configFile) { ConfigFile = configFile; BindConfigs(); SetupChangedEvents(); } private static void BindConfigs() { ConfigHelper.SkipAutoGen(); ExtendedLogging = ConfigHelper.Bind("General", "ExtendedLogging", defaultValue: false, "Enable extended logging."); ExtraFeatures_Enabled = ConfigHelper.Bind("Extra Features", "Enabled", defaultValue: false, "Enabled all the extra features."); ExtraFeatures_SpecialSporeLizardSoundsChance = ConfigHelper.Bind("Extra Features", "SpecialSporeLizardSoundsChance", 5f, "The percent chance the Spore Lizard spawns with special sounds. (Requires Extra Features to be enabled)", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); ExtraFeatures_EnableSpecialKidnapperFoxSounds = ConfigHelper.Bind("Extra Features", "EnableSpecialKidnapperFoxSounds", defaultValue: true, "If enabled, the Kidnapper Fox will have some special sounds. (Requires Extra Features to be enabled)"); ExtraFeatures_BunkerSpiderReskinChance = ConfigHelper.Bind("Extra Features", "BunkerSpiderReskinChance", 50f, "The percent chance the Bunker Spider gets a special reskin. (Requires Extra Features to be enabled)", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); ExtraFeatures_ButlerReskinChance = ConfigHelper.Bind("Extra Features", "ButlerReskinChance", 50f, "The percent chance the Butler gets a special reskin. (Requires Extra Features to be enabled)", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); SmolTakey = new ItemConfigData(Assets.SmolTakey, "Smol Takey", 20, twoHanded: false, 6, 80, 250); SmolTakey_JetpackChance = ConfigHelper.Bind("Smol Takey", "JetpackChance", 10f, "The percent chance Smol Takey will start flying with his jetpack after you try picking him up.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); TakeyBox = new ItemConfigData(Assets.TakeyBox, "Takey Box", 10, twoHanded: false, 19, 30, 70); TakeyBox_NegativeEffectsEnabled = ConfigHelper.BindSynced("Takey Box", "NegativeEffectsEnabled", defaultValue: false, "If enabled, the Takey Box will have a chance of giving a negative effect after opening."); TakeyBox_NegativeEffectsChance = ConfigHelper.BindSynced("Takey Box", "NegativeEffectsChance", 25f, "The percent chance to give a negative effect after opening the Takey Box.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); TakeyMug = new ItemConfigData(Assets.TakeyMug, "Takey Mug", 10, twoHanded: false, 5, 60, 170); TakeyMugShelf = new UnlockableItemConfigData(Assets.TakeyMugShelf, "Takey Mug Shelf", 0, unlockAtStart: false); Takeypack_MusicVolume = ConfigHelper.Bind("Takeypack", "MusicVolume", 75f, "The music volume of the Takeypack.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); Takeypack_JetpackReplaceChance = ConfigHelper.Bind("Takeypack", "JetpackReplaceChance", 25f, "The percent chance a bought Jetpack from the store becomes a Takeypack.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); DinkDonkVariant_BellVolume = ConfigHelper.Bind("DinkDonk Variant", "BellVolume", 100f, "The volume of the DinkDonk Smol Takey variant's bell.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f)); ALOOVariantTTS_Enabled = ConfigHelper.Bind("ALOO Variant TTS", "Enabled", defaultValue: true, "If enabled, will allow chat from Twitch to send TTS messages through the ALOO Takey's phone. (Requires the TwitchChatAPI mod)"); ALOOVariantTTS_Cooldown = ConfigHelper.Bind("ALOO Variant TTS", "Cooldown", 60f, "The cooldown between TTS messages in seconds."); ConfigHelper.AddButton("ALOO Variant TTS", "Reset TTS Cooldown", "Reset Cooldown", "Click to reset the cooldown.", TakeyALOOVariant.ResetTTSCooldown_OnButtonClicked); ALOOVariantTTS_VoiceVolumeAmplificationDB = ConfigHelper.Bind("ALOO Variant TTS", "VoiceVolumeAmplificationDB", 10f, "Boost the TTS voice volume in decibels (dB). Increase for louder sound, with 10 dB roughly doubling the perceived loudness.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange(-10f, 20f)); ALOOVariantTTS_MinSoundDistance = ConfigHelper.Bind("ALOO Variant TTS", "MinSoundDistance", 4f, "The min sound distance of the TTS voice and phone sfx.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange(0f, 50f)); ALOOVariantTTS_MaxSoundDistance = ConfigHelper.Bind("ALOO Variant TTS", "MaxSoundDistance", 16f, "The max sound distance of the TTS voice and phone sfx.", requiresRestart: false, (AcceptableValueBase)(object)new AcceptableValueRange(0f, 50f)); ALOOVariantTTS_ProfanityFilterEnabled = ConfigHelper.Bind("ALOO Variant TTS", "ProfanityFilterEnabled", defaultValue: true, "If enabled, TTS messages will filter out profanity."); } private static void SetupChangedEvents() { Takeypack_MusicVolume.SettingChanged += delegate { TakeypackItem.OnConfigSettingsChanged(); }; DinkDonkVariant_BellVolume.SettingChanged += delegate { TakeyDinkDonkVariant.OnConfigSettingsChanged(); }; ALOOVariantTTS_MinSoundDistance.SettingChanged += delegate { TakeyALOOVariant.OnConfigSettingsChanged(); }; ALOOVariantTTS_MaxSoundDistance.SettingChanged += delegate { TakeyALOOVariant.OnConfigSettingsChanged(); }; } public static void TrySetCustomSettings() { TrySetCustomSettingsForSpecialUsers(); TrySetCustomSettingsForTakerst(); } public static void TrySetCustomSettingsForSpecialUsers() { PlayerData localClientPlayerData = SteamUtils.GetLocalClientPlayerData(); if (localClientPlayerData != null && !Plugin.ModpackSave.Load("EnabledExtraFeatures", defaultValue: false)) { Plugin.ModpackSave.Save("EnabledExtraFeatures", value: true); ExtraFeatures_Enabled.Value = true; } } public static void TrySetCustomSettingsForTakerst() { if (PlayerUtils.IsLocalPlayer(PlayerName.Takerst) && !Plugin.ModpackSave.Load("SetUnlockAtStart", defaultValue: false)) { Plugin.ModpackSave.Save("SetUnlockAtStart", value: true); TakeyMugShelf.UnlockAtStart.Value = true; } } } public static class Events { public static event Action OnProfitQuotaFulfilled; public static event Action OnPlayerDied; public static event Action OnShipArrived; public static event Action OnShipLeave; public static event Action> OnItemsOrdered; public static event Action OnNewScrapCollected; public static event Action OnTimeChanged; public static event Action OnALOOTTSMessage; public static event Action OnGrabItem; public static event Action OnDiscardItem; public static event Action OnMaskedEnteredShip; public static event Action OnForestGiantSpawned; public static event Action OnForestGiantNearMain; public static event Action OnDinkDonkScrapEaterSpawned; static Events() { TwitchChatAPIProxy.OnMessage += HandleTwitchMessage; Application.quitting += delegate { TwitchChatAPIProxy.OnMessage -= HandleTwitchMessage; }; } private static void HandleTwitchMessage(string message) { if (message.StartsWith("ALOO") && message.Length > 4) { Events.OnALOOTTSMessage?.Invoke(message); } } internal static void InvokeOnProfitQuotaFulfilled() { Events.OnProfitQuotaFulfilled?.Invoke(); } internal static void InvokeOnPlayerDied(PlayerControllerB playerScript, PlayerDeathReason playerDeathReason) { Events.OnPlayerDied?.Invoke(playerScript, playerDeathReason); } internal static void InvokeOnShipArrived() { Events.OnShipArrived?.Invoke(); } internal static void InvokeOnShipLeave() { Events.OnShipLeave?.Invoke(); } internal static void InvokeOnItemsOrdered(List items) { Events.OnItemsOrdered?.Invoke(items); } internal static void InvokeOnNewScrapCollected(GrabbableObject grabbableObject) { Events.OnNewScrapCollected?.Invoke(grabbableObject); } internal static void InvokeOnTimeChanged(int hours, int minutes) { Events.OnTimeChanged?.Invoke(hours, minutes); } internal static void InvokeOnALOOTTSMessage(string message) { Events.OnALOOTTSMessage?.Invoke(message); } internal static void InvokeOnGrabItem(GrabbableObject grabbableObject) { Events.OnGrabItem?.Invoke(grabbableObject); } internal static void InvokeOnDiscardItem(GrabbableObject grabbableObject) { Events.OnDiscardItem?.Invoke(grabbableObject); } internal static void InvokeOnMaskedEnteredShip(MaskedPlayerEnemy maskedPlayerEnemy) { Events.OnMaskedEnteredShip?.Invoke(maskedPlayerEnemy); } internal static void InvokeOnForestGiantSpawned(ForestGiantAI forestGiantAI) { Events.OnForestGiantSpawned?.Invoke(forestGiantAI); } internal static void InvokeOnForestGiantNearMain(ForestGiantAI forestGiantAI) { Events.OnForestGiantNearMain?.Invoke(forestGiantAI); } public static void InvokeOnDinkDonkScrapEaterSpawned() { Events.OnDinkDonkScrapEaterSpawned?.Invoke(); } } } namespace com.github.zehsteam.TakeyPlush.Helpers { internal static class ConfigHelper { public static void SkipAutoGen() { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SkipAutoGen(); } } public static void AddButton(string section, string name, string buttonText, string description, Action callback) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddButton(section, name, buttonText, description, callback); } } public static ConfigEntry Bind(string section, string key, T defaultValue, string description, bool requiresRestart = false, AcceptableValueBase acceptableValues = null, Action settingChanged = null, ConfigFile configFile = null) { if (configFile == null) { configFile = ((BaseUnityPlugin)Plugin.Instance).Config; } ConfigEntry configEntry = configFile.Bind(section, key, defaultValue, description, acceptableValues); if (settingChanged != null) { configEntry.SettingChanged += delegate { settingChanged?.Invoke(configEntry.Value); }; } if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddConfig(configEntry, requiresRestart); } return configEntry; } public static SyncedConfigEntry BindSynced(string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues = null, Action settingChanged = null, ConfigFile configFile = null) { SyncedConfigEntry syncedConfigEntry = new SyncedConfigEntry(section, key, defaultValue, description, acceptableValues, configFile); if (settingChanged != null) { syncedConfigEntry.SettingChanged += settingChanged; } return syncedConfigEntry; } } internal static class EnemyHelper { public static List BlockedEnemyNames = new List(7) { "Butler Bees", "Docile Locust Bees", "Lasso", "Red Locust Bees", "Red pill", "Manticoil", "Tulip Snake" }; public static void SpawnRandomEnemyOnServer(PlayerControllerB playerScript, int spawnCount, float minRadius, float maxRadius) { List list = new List(); list = ((!StarlancerAIFixProxy.Enabled) ? GetEnemyTypes(playerScript.isInsideFactory) : GetEnemyTypes()); EnemyType val = list[Random.Range(0, list.Count)]; SpawnEnemyOnServer(playerScript, val.enemyName, spawnCount, minRadius, maxRadius); } public static void SpawnEnemyOnServer(PlayerControllerB playerScript, string enemyName, int spawnCount, float minRadius, float maxRadius) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) SpawnEnemyOnServer(((Component)playerScript).transform.position, playerScript.isInsideFactory, enemyName, spawnCount, minRadius, maxRadius); } public static void SpawnEnemyOnServer(Vector3 position, bool insideFactory, string enemyName, int spawnCount, float minRadius, float maxRadius) { //IL_0049: 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_005a: 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_0079: 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_0095: Unknown result type (might be due to invalid IL or missing references) if (!NetworkUtils.IsServer) { Logger.LogError("Failed to spawn enemy. Only the host can spawn enemies."); return; } EnemyType enemyType = GetEnemyType(enemyName); if ((Object)(object)enemyType == (Object)null) { Logger.LogError("Failed to spawn enemy. Could not find EnemyType."); return; } Logger.LogInfo("Spawn \"" + enemyName + "\" enemy.", extended: true); for (int i = 0; i < spawnCount; i++) { Vector3 spawnPositionNearPoint = GetSpawnPositionNearPoint(position, insideFactory, minRadius, maxRadius); RoundManager.Instance.SpawnEnemyGameObject(spawnPositionNearPoint, 0f, -1, enemyType); Logger.LogInfo($"Spawned {enemyName} at position: (x: {spawnPositionNearPoint.x}, y: {spawnPositionNearPoint.y}, z: {spawnPositionNearPoint.z})", extended: true); } } private static Vector3 GetRandomSpawnPosition(bool insideFactory) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (insideFactory) { return RoundManager.Instance.insideAINodes[Random.Range(0, RoundManager.Instance.insideAINodes.Length)].transform.position; } return RoundManager.Instance.outsideAINodes[Random.Range(0, RoundManager.Instance.outsideAINodes.Length)].transform.position; } private static Vector3 GetSpawnPositionNearPoint(Vector3 sourcePosition, bool insideFactory, float minRadius, float maxRadius) { //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_002c: 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_000c: Unknown result type (might be due to invalid IL or missing references) bool flag = false; Vector3 position = Vector3.zero; for (int i = 0; i < 50; i++) { if (flag) { break; } if (TryGetRandomPositionInNavMesh(sourcePosition, minRadius, maxRadius, out position)) { flag = true; } } if (flag) { return position; } return GetRandomSpawnPosition(insideFactory); } private static bool TryGetRandomPositionInNavMesh(Vector3 sourcePosition, float minRadius, float maxRadius, out 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_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_0016: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0038: 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) position = Vector3.zero; Vector3 val = Random.insideUnitSphere * maxRadius; val += sourcePosition; NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(val, ref val2, maxRadius, 1)) { position = ((NavMeshHit)(ref val2)).position; if (Vector3.Distance(sourcePosition, position) <= minRadius) { return false; } return true; } return false; } public static EnemyType GetEnemyType(string enemyName) { foreach (EnemyType enemyType in GetEnemyTypes()) { if (enemyType.enemyName == enemyName) { return enemyType; } } try { EnemyType val = Resources.FindObjectsOfTypeAll().Single((EnemyType x) => x.enemyName == enemyName); if (IsValidEnemyType(val) && NetworkUtils.IsNetworkPrefab(val.enemyPrefab)) { Logger.LogInfo("Found EnemyType \"" + val.enemyName + "\" from Resources.", extended: true); return val; } } catch { } return null; } public static List GetEnemyTypes(bool forInterior) { HashSet hashSet = new HashSet(new EnemyTypeComparer()); SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { IEnumerable enumerable = Array.Empty(); enumerable = ((!forInterior) ? (from e in val.DaytimeEnemies.Concat(val.OutsideEnemies) select e.enemyType).Where(IsValidEnemyType) : val.Enemies.Select((SpawnableEnemyWithRarity e) => e.enemyType).Where(IsValidEnemyType)); foreach (EnemyType item in enumerable) { hashSet.Add(item); } } return hashSet.ToList(); } public static List GetEnemyTypes() { HashSet hashSet = new HashSet(new EnemyTypeComparer()); SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { IEnumerable enumerable = (from e in val.Enemies.Concat(val.DaytimeEnemies).Concat(val.OutsideEnemies) select e.enemyType).Where(IsValidEnemyType); foreach (EnemyType item in enumerable) { hashSet.Add(item); } } return hashSet.ToList(); } public static bool IsValidEnemyType(EnemyType enemyType) { if ((Object)(object)enemyType == (Object)null) { return false; } if (string.IsNullOrWhiteSpace(enemyType.enemyName)) { return false; } if ((Object)(object)enemyType.enemyPrefab == (Object)null) { return false; } if (BlockedEnemyNames.Contains(enemyType.enemyName)) { return false; } return true; } } public class EnemyTypeComparer : IEqualityComparer { public bool Equals(EnemyType x, EnemyType y) { if ((Object)(object)x == (Object)null || (Object)(object)y == (Object)null) { return false; } return x.enemyName == y.enemyName; } public int GetHashCode(EnemyType obj) { return obj.enemyName?.GetHashCode() ?? 0; } } internal static class GameSaveFileHelper { private static string GetCurrentSaveFilePath() { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { Logger.LogWarning("GameSaveFileHelper: GetCurrentSaveFilePath() GameNetworkManager instance is null. Returning an empty string."); return string.Empty; } return GameNetworkManager.Instance.currentSaveFileName; } public static bool KeyExists(string key) { if (!NetworkUtils.IsServer) { return false; } return ES3.KeyExists(key, GetCurrentSaveFilePath()); } public static T Load(string key, T defaultValue = default(T)) { if (!NetworkUtils.IsServer) { return defaultValue; } if (TryLoad(key, out var value)) { return value; } return defaultValue; } public static bool TryLoad(string key, out T value) { if (!NetworkUtils.IsServer) { value = default(T); return false; } value = ES3.Load(key, GetCurrentSaveFilePath()); return value != null; } public static bool Save(string key, T value) { if (!NetworkUtils.IsServer) { return false; } ES3.Save(key, value, GetCurrentSaveFilePath()); return true; } } internal static class HazardHelper { public static void SpawnRandomHazardOnServer(PlayerControllerB playerScript, Vector3 position) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer) { List spawnableMapObjects = GetSpawnableMapObjects(); if (spawnableMapObjects.Count == 0) { Logger.LogError("Failed to spawn random hazard on server. SpawnableMapObject list is empty."); return; } SpawnableMapObject spawnableMapObject = spawnableMapObjects[Random.Range(0, spawnableMapObjects.Count)]; SpawnHazardOnServer(spawnableMapObject, playerScript, position); } } public static void SpawnHazardOnServer(SpawnableMapObject spawnableMapObject, PlayerControllerB playerScript, Vector3 position) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_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) //IL_008c: 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) //IL_010f: 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_00b3: 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_00be: 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_00d8: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0184: 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_01ae: Unknown result type (might be due to invalid IL or missing references) if (!NetworkUtils.IsServer) { return; } if (spawnableMapObject == null) { Logger.LogError("Failed to spawn hazard on server. SpawnableMapObject is null."); return; } GameObject val = GameObject.FindGameObjectWithTag("MapPropsContainer"); if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to spawn hazard on server. MapPropsContainer is null."); return; } GameObject val2 = Object.Instantiate(spawnableMapObject.prefabToSpawn, position, Quaternion.identity, val.transform); if (spawnableMapObject.spawnFacingAwayFromWall) { val2.transform.eulerAngles = new Vector3(0f, RoundManager.Instance.YRotationThatFacesTheFarthestFromPosition(position + Vector3.up * 0.2f, 25f, 6), 0f); } else if (spawnableMapObject.spawnFacingWall) { val2.transform.eulerAngles = new Vector3(0f, RoundManager.Instance.YRotationThatFacesTheNearestFromPosition(position + Vector3.up * 0.2f, 25f, 6), 0f); } else { val2.transform.eulerAngles = new Vector3(val2.transform.eulerAngles.x, Random.Range(0f, 360f), val2.transform.eulerAngles.z); } RaycastHit val3 = default(RaycastHit); if (spawnableMapObject.spawnWithBackToWall && Physics.Raycast(val2.transform.position, -val2.transform.forward, ref val3, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { val2.transform.position = ((RaycastHit)(ref val3)).point; if (spawnableMapObject.spawnWithBackFlushAgainstWall) { val2.transform.forward = ((RaycastHit)(ref val3)).normal; val2.transform.eulerAngles = new Vector3(0f, val2.transform.eulerAngles.y, 0f); } } val2.GetComponent().Spawn(true); } public static List GetSpawnableMapObjects() { HashSet hashSet = new HashSet(new SpawnableMapObjectComparer()); SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { IEnumerable enumerable = val.spawnableMapObjects.Where(IsValidSpawnableMapObject); foreach (SpawnableMapObject item in enumerable) { hashSet.Add(item); } } return hashSet.ToList(); } public static bool IsValidSpawnableMapObject(SpawnableMapObject spawnableMapObject) { if (spawnableMapObject == null) { return false; } if ((Object)(object)spawnableMapObject.prefabToSpawn == (Object)null) { return false; } return true; } } public class SpawnableMapObjectComparer : IEqualityComparer { public bool Equals(SpawnableMapObject x, SpawnableMapObject y) { if (x == null || y == null) { return false; } return (Object)(object)x.prefabToSpawn == (Object)(object)y.prefabToSpawn; } public int GetHashCode(SpawnableMapObject obj) { return ((object)obj.prefabToSpawn)?.GetHashCode() ?? 0; } } internal static class ItemHelper { public static void RegisterScrap(Item item, int rarity, bool twoHanded, int carryWeight, int minValue, int maxValue) { if ((Object)(object)item == (Object)null) { Logger.LogError("Failed to register scrap item. Item is null."); return; } item.twoHanded = twoHanded; item.weight = (float)carryWeight / 105f + 1f; item.minValue = minValue; item.maxValue = maxValue; Utilities.FixMixerGroups(item.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab); Items.RegisterScrap(item, rarity, (LevelTypes)(-1)); Logger.LogInfo($"Registered \"{item.itemName}\" scrap item. (Rarity: {rarity}, TwoHanded: {twoHanded}, CarryWeight: {carryWeight}, MinValue: {minValue}, MaxValue: {maxValue})"); } public static void RegisterScrap(ItemConfigData itemConfigData) { RegisterScrap(itemConfigData.Item, itemConfigData.SpawnWeight.Value, itemConfigData.TwoHanded.Value, itemConfigData.CarryWeight.Value, itemConfigData.MinValue.Value, itemConfigData.MaxValue.Value); } public static void UpdateScrapRarity(Item item, int rarity) { if ((Object)(object)item == (Object)null) { Logger.LogError("Failed to update scrap item rarity. Item is null."); return; } if ((Object)(object)StartOfRound.Instance == (Object)null) { Logger.LogError("Failed to update scrap item rarity. StartOfRound instance is null."); return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { foreach (SpawnableItemWithRarity item2 in val.spawnableScrap) { if (!((Object)(object)item2.spawnableItem != (Object)(object)item)) { item2.rarity = rarity; Logger.LogInfo($"Updated \"{item.itemName}\" scrap item rarity to {rarity} on \"{val.PlanetName}\"."); } } } } public static void UpdateScrapRarity(ItemConfigData itemConfigData) { UpdateScrapRarity(itemConfigData.Item, itemConfigData.SpawnWeight.Value); } public static void UpdateItemProperties(Item item, bool twoHanded, int carryWeight, int minValue, int maxValue) { if ((Object)(object)item == (Object)null) { Logger.LogError("Failed to update item properties. Item is null."); return; } item.twoHanded = twoHanded; item.weight = (float)carryWeight / 105f + 1f; item.minValue = minValue; item.maxValue = maxValue; Logger.LogInfo($"Updated \"{item.itemName}\" item properties. (TwoHanded: {twoHanded}, CarryWeight: {carryWeight}, MinValue: {minValue}, MaxValue: {maxValue})"); } public static void UpdateItemProperties(string itemName, bool twoHanded, int carryWeight, int minValue, int maxValue) { if (!TryGetItem(itemName, out var item, matchCase: false)) { Logger.LogError("Failed to update item properties. Item is null. (ItemName: " + itemName + ")"); } else { UpdateItemProperties(item, twoHanded, carryWeight, minValue, maxValue); } } public static void UpdateItemProperties(ItemConfigData itemConfigData) { UpdateItemProperties(itemConfigData.Item, itemConfigData.TwoHanded.Value, itemConfigData.CarryWeight.Value, itemConfigData.MinValue.Value, itemConfigData.MaxValue.Value); } public static Item GetItem(string itemName, bool matchCase = true) { if ((Object)(object)StartOfRound.Instance == (Object)null) { Logger.LogError("Failed to get item by name. StartOfRound instance is null."); return null; } StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (items.itemName.Equals(itemName, comparisonType)) { return items; } } return null; } public static bool TryGetItem(string itemName, out Item item, bool matchCase = true) { item = GetItem(itemName, matchCase); return (Object)(object)item != (Object)null; } public static List GetItems(string[] itemNames, bool matchCase = true) { if ((Object)(object)StartOfRound.Instance == (Object)null) { Logger.LogError("Failed to get items by names. StartOfRound instance is null."); return new List(); } List list = new List(); foreach (string itemName in itemNames) { if (TryGetItem(itemName, out var item, matchCase)) { list.Add(item); } } return list; } public static int GetLootTotal() { return GetShipLootTotal() + GetVehicleLootTotal(); } public static int GetShipLootTotal() { Transform hangarShipTransform = Utils.GetHangarShipTransform(); if ((Object)(object)hangarShipTransform == (Object)null) { return 0; } GrabbableObject[] componentsInChildren = ((Component)hangarShipTransform).GetComponentsInChildren(); return componentsInChildren.Where(IsValidScrap).Sum((GrabbableObject x) => x.scrapValue); } public static int GetVehicleLootTotal() { VehicleController vehicleController = VehicleHelper.VehicleController; if ((Object)(object)vehicleController == (Object)null) { return 0; } if (!vehicleController.magnetedToShip) { return 0; } GrabbableObject[] componentsInChildren = ((Component)vehicleController).GetComponentsInChildren(); return componentsInChildren.Where(IsValidScrap).Sum((GrabbableObject x) => x.scrapValue); } public static bool IsValidScrap(GrabbableObject grabbableObject) { if ((Object)(object)grabbableObject == (Object)null || (Object)(object)grabbableObject.itemProperties == (Object)null) { return false; } if (grabbableObject.deactivated) { return false; } return grabbableObject.itemProperties.isScrap; } public static Item GetRandomTakeyBoxItem() { if (Utils.RollPercentChance(45f)) { return Assets.SmolTakey; } List items = GetItems(new string[4] { "Smol Takey Goku", "Wooden Clogs", "Wood Nut", "Wood Nut In Cider" }, matchCase: false); if (Utils.RollPercentChance(75f) || items.Count == 0) { return Assets.TakeyMug; } return items[Random.Range(0, items.Count)]; } } internal static class NetworkUtils { private static readonly FieldInfo _rpcExecStageField = AccessTools.Field(typeof(NetworkBehaviour), "__rpc_exec_stage"); public static bool IsConnected { get { NetworkManager singleton = NetworkManager.Singleton; if (singleton == null) { return false; } return singleton.IsConnectedClient; } } public static bool IsServer { get { NetworkManager singleton = NetworkManager.Singleton; if (singleton == null) { return false; } return singleton.IsServer; } } public static ulong LocalClientId { get { NetworkManager singleton = NetworkManager.Singleton; if (singleton == null) { return 0uL; } return singleton.LocalClientId; } } public static int ConnectedPlayerCount => GameNetworkManager.Instance?.connectedPlayers ?? 0; public static bool IsLocalClientId(ulong clientId) { return clientId == LocalClientId; } public static bool HasClient(ulong clientId) { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.ConnectedClients.ContainsKey(clientId); } public static bool IsNetworkPrefab(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { return false; } if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } IReadOnlyList prefabs = NetworkManager.Singleton.NetworkConfig.Prefabs.Prefabs; return prefabs.Any((NetworkPrefab x) => (Object)(object)x.Prefab == (Object)(object)prefab); } public static bool AddNetworkPrefab(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { Logger.LogError("Failed to register network prefab. GameObject is null."); return false; } if ((Object)(object)NetworkManager.Singleton == (Object)null) { Logger.LogError("Failed to register network prefab. NetworkManager Singleton is null."); return false; } NetworkManager.Singleton.AddNetworkPrefab(prefab); Logger.LogInfo("Registered \"" + ((Object)prefab).name + "\" network prefab."); return true; } public static void NetcodePatcherAwake() { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); IEnumerable loadableTypes = executingAssembly.GetLoadableTypes(); foreach (Type item in loadableTypes) { MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { try { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { try { methodInfo.Invoke(null, null); } catch (TargetInvocationException ex) { Logger.LogWarning("[NetworkUtils] Failed to invoke method " + methodInfo.Name + ": " + ex.Message); } } } catch (Exception ex2) { Logger.LogWarning("[NetworkUtils] Error processing method " + methodInfo.Name + " in type " + item.Name + ": " + ex2.Message); } } } } catch (Exception ex3) { Logger.LogError("[NetworkUtils] Failed to run NetcodePatcherAwake: " + ex3.Message); } } public static bool IsExecutingRPCMethod(NetworkBehaviour networkBehaviour) { if ((Object)(object)networkBehaviour == (Object)null) { return false; } NetworkManager networkManager = networkBehaviour.NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening) { return false; } if (_rpcExecStageField == null) { Logger.LogError("[NetworkUtils] IsExecutingRPCMethod: Failed to find \"__rpc_exec_stage\" field."); return false; } object value = _rpcExecStageField.GetValue(networkBehaviour); int num = (int)value; if (num != 0) { return num == 1; } return true; } } internal static class PlayerUtils { public static PlayerControllerB LocalPlayerScript => GameNetworkManager.Instance?.localPlayerController ?? null; public static PlayerControllerB[] AllPlayerScripts => StartOfRound.Instance?.allPlayerScripts ?? Array.Empty(); public static PlayerControllerB[] ConnectedPlayerScripts => AllPlayerScripts.Where(IsConnected).ToArray(); public static PlayerControllerB[] AlivePlayerScripts => ConnectedPlayerScripts.Where((PlayerControllerB x) => !x.isPlayerDead).ToArray(); public static PlayerControllerB[] DeadPlayerScripts => ConnectedPlayerScripts.Where((PlayerControllerB x) => x.isPlayerDead).ToArray(); public static bool TryGetLocalPlayerScript(out PlayerControllerB playerScript) { playerScript = LocalPlayerScript; return (Object)(object)playerScript != (Object)null; } public static bool IsLocalPlayer(PlayerControllerB playerScript) { if ((Object)(object)playerScript == (Object)null) { return false; } return (Object)(object)playerScript == (Object)(object)LocalPlayerScript; } public static bool IsConnected(PlayerControllerB playerScript) { if ((Object)(object)playerScript == (Object)null) { return false; } if (!playerScript.isPlayerControlled) { return playerScript.isPlayerDead; } return true; } public static PlayerControllerB GetPlayerScriptByClientId(ulong clientId) { return ((IEnumerable)ConnectedPlayerScripts).FirstOrDefault((Func)((PlayerControllerB playerScript) => playerScript.actualClientId == clientId)); } public static bool TryGetPlayerScriptByClientId(ulong clientId, out PlayerControllerB playerScript) { playerScript = GetPlayerScriptByClientId(clientId); return (Object)(object)playerScript != (Object)null; } public static PlayerControllerB GetPlayerScriptByPlayerId(int playerId) { if (playerId < 0 || playerId > ConnectedPlayerScripts.Length - 1) { return null; } return ConnectedPlayerScripts[playerId]; } public static bool TryGetPlayerScriptByPlayerId(int playerId, out PlayerControllerB playerScript) { playerScript = GetPlayerScriptByPlayerId(playerId); return (Object)(object)playerScript != (Object)null; } public static PlayerControllerB GetPlayerScriptByUsername(string username) { PlayerControllerB[] source = ConnectedPlayerScripts.OrderBy((PlayerControllerB x) => x.playerUsername.Length).ToArray(); PlayerControllerB val = ((IEnumerable)source).FirstOrDefault((Func)((PlayerControllerB x) => x.playerUsername.Equals(username, StringComparison.OrdinalIgnoreCase))); if (val == null) { val = ((IEnumerable)source).FirstOrDefault((Func)((PlayerControllerB x) => x.playerUsername.StartsWith(username, StringComparison.OrdinalIgnoreCase))); } if (val == null) { val = ((IEnumerable)source).FirstOrDefault((Func)((PlayerControllerB x) => x.playerUsername.Contains(username, StringComparison.OrdinalIgnoreCase))); } return val; } public static bool TryGetPlayerScriptByUsername(string username, out PlayerControllerB playerScript) { playerScript = GetPlayerScriptByUsername(username); return (Object)(object)playerScript != (Object)null; } public static PlayerControllerB GetRandomPlayerScript(PlayerControllerB[] playerScripts, bool excludeLocal = false) { if (playerScripts == null || playerScripts.Length == 0) { return null; } PlayerControllerB[] array = playerScripts.Where((PlayerControllerB playerScript) => !excludeLocal || !IsLocalPlayer(playerScript)).ToArray(); if (array.Length == 0) { return null; } return array[Random.Range(0, array.Length)]; } public static bool TryGetRandomPlayerScript(PlayerControllerB[] playerScripts, out PlayerControllerB playerScript, bool excludeLocal = false) { playerScript = GetRandomPlayerScript(playerScripts, excludeLocal); return (Object)(object)playerScript != (Object)null; } public static bool IsLocalPlayer(PlayerName playerName) { return SteamUtils.IsLocalClient(playerName); } public static bool IsLocalPlayer(PlayerName[] playerNames) { foreach (PlayerName playerName in playerNames) { if (SteamUtils.IsLocalClient(playerName)) { return true; } } return false; } public static bool IsPlayer(PlayerControllerB playerScript, PlayerName playerName) { if ((Object)(object)playerScript == (Object)null) { return false; } return SteamUtils.IsPlayer(playerName, playerScript.playerUsername, playerScript.playerSteamId); } public static bool HasPlayer(PlayerName playerName) { PlayerControllerB[] connectedPlayerScripts = ConnectedPlayerScripts; foreach (PlayerControllerB playerScript in connectedPlayerScripts) { if (IsPlayer(playerScript, playerName)) { return true; } } return false; } public static PlayerControllerB GetPlayerScript(PlayerName playerName) { PlayerControllerB[] connectedPlayerScripts = ConnectedPlayerScripts; foreach (PlayerControllerB val in connectedPlayerScripts) { if (IsPlayer(val, playerName)) { return val; } } return null; } public static bool IsPlayerNearby(Vector3 position, float range, bool inShip = false) { //IL_000e: 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) return AlivePlayerScripts.Any(delegate(PlayerControllerB playerScript) { //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) if (inShip && !playerScript.isInHangarShipRoom) { return false; } float num = Vector3.Distance(((Component)playerScript).transform.position, position); return num <= range; }); } public static bool IsLootNearPlayer(PlayerControllerB playerScript, float radius) { //IL_0043: 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 ((Object)(object)playerScript == (Object)null) { return false; } foreach (GrabbableObject instance in GrabbableObjectPatch.Instances) { if (instance.isInFactory && !instance.isHeld && instance.itemProperties.isScrap) { float num = Vector3.Distance(((Component)playerScript).transform.position, ((Component)instance).transform.position); if (num <= radius) { return true; } } } return false; } } public enum SeasonalEvent { None, Birthday, Halloween, Christmas, NewYears, AprilFools } internal static class SeasonalHandler { public static Action OnEventChanged; public static SeasonalEvent CurrentEvent { get; private set; } public static bool IsCurrentEvent(SeasonalEvent seasonalEvent) { return CurrentEvent == seasonalEvent; } public static void Update() { DateTime now = DateTime.Now; if ((now.Month == 8 && now.Day == 31) || (now.Month == 9 && now.Day == 1)) { SetEvent(SeasonalEvent.Birthday); } else if (now.Month == 10 && now.Day == 31) { SetEvent(SeasonalEvent.Halloween); } else if (now.Month == 12 && now.Day == 24) { SetEvent(SeasonalEvent.Christmas); } else if ((now.Month == 12 && now.Day == 31) || (now.Month == 1 && now.Day == 1)) { SetEvent(SeasonalEvent.NewYears); } else if (now.Month == 4 && now.Day == 1) { SetEvent(SeasonalEvent.AprilFools); } } private static void SetEvent(SeasonalEvent seasonalEvent) { bool flag = CurrentEvent != seasonalEvent; CurrentEvent = seasonalEvent; if (flag) { OnEventChanged?.Invoke(seasonalEvent); } Logger.LogInfo($"SeasonalHandler: Set event to {CurrentEvent}"); } } internal static class ShopHelper { public static void RegisterShopItem(Item item, int price, TerminalNode terminalNode) { Utilities.FixMixerGroups(item.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab); Items.RegisterShopItem(item, (TerminalNode)null, (TerminalNode)null, terminalNode, price); Logger.LogInfo($"Registered \"{item.itemName}\" shop item with {price} price."); } public static bool IsBuyItemIndex(int index, string itemName, bool matchCase = false) { if ((Object)(object)TerminalPatch.Instance == (Object)null) { return false; } Item[] buyableItemsList = TerminalPatch.Instance.buyableItemsList; if (index < 0 || index > buyableItemsList.Length - 1) { return false; } StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); return buyableItemsList[index].itemName.Equals(itemName, comparisonType); } public static bool TryGetBuyItemIndex(string itemName, out int buyItemIndex, bool matchCase = false) { buyItemIndex = -1; if ((Object)(object)TerminalPatch.Instance == (Object)null) { return false; } StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); Item[] buyableItemsList = TerminalPatch.Instance.buyableItemsList; for (int i = 0; i < buyableItemsList.Length; i++) { if (buyableItemsList[i].itemName.Equals(itemName, comparisonType)) { buyItemIndex = i; return true; } } return false; } } internal enum PlayerName { Takerst, ZombiesAteMyChannel, WolfsMyChocolate, Hiccubz, Lunxara, PANDAM0NIEM, Jxshkins, SpookyTug, Raqaizal, MaestroSpooks, VanoraDarkWolf, TetraFlash, XSuperBeefyx, Ariesgoddess168, LustStings, TIMETELL, IElucian, Irishdev13, CritHaxXoG, Oopsmyleg, Reapermitsuki, Yinisin, AGlitchedNpc, Scraner } internal static class SteamUtils { public static List PlayersData { get; private set; } static SteamUtils() { PlayersData = new List(); PlayersData = new List(24) { new PlayerData(PlayerName.Takerst, "Takerst", 76561197980238122uL), new PlayerData(PlayerName.ZombiesAteMyChannel, "ZombieAteMyChannel", 76561197990822861uL), new PlayerData(PlayerName.WolfsMyChocolate, new string[2] { "WolfsMyChocolate", "wolfyfook" }, new ulong[2] { 76561199112488706uL, 76561199589529626uL }), new PlayerData(PlayerName.Hiccubz, "Hiccubz", 76561199090697084uL), new PlayerData(PlayerName.Lunxara, "Lunxara", 76561198086325047uL), new PlayerData(PlayerName.PANDAM0NIEM, "PANDAM0NIEM", 76561199169070660uL), new PlayerData(PlayerName.Jxshkins, "jxshkins", 76561199004549621uL), new PlayerData(PlayerName.SpookyTug, "SpookyTug", 76561198053549767uL), new PlayerData(PlayerName.Raqaizal, "Raqaizal", 76561198047992629uL), new PlayerData(PlayerName.MaestroSpooks, "MaestroSpooks", 76561198150757587uL), new PlayerData(PlayerName.VanoraDarkWolf, "Vanora", 76561198064529684uL), new PlayerData(PlayerName.TetraFlash, "TetraFlash", 76561197993458924uL), new PlayerData(PlayerName.XSuperBeefyx, "xSuperBeefyx", 76561197964982016uL), new PlayerData(PlayerName.Ariesgoddess168, "NewAgeAries", 76561198174632877uL), new PlayerData(PlayerName.LustStings, "lustings", 76561198053068793uL), new PlayerData(PlayerName.TIMETELL, "TIMETELL", 76561197967817500uL), new PlayerData(PlayerName.IElucian, "iElucian", 76561197962979730uL), new PlayerData(PlayerName.Irishdev13, "TTV_Irishdev13", 76561198123000350uL), new PlayerData(PlayerName.CritHaxXoG, "CritHaxXoG", 76561198993712632uL), new PlayerData(PlayerName.Oopsmyleg, "Oopsmyleg", 76561198113371889uL), new PlayerData(PlayerName.Reapermitsuki, "reaper-mitsuki", 76561198281494776uL), new PlayerData(PlayerName.Yinisin, "Yinisin", 76561199582073183uL), new PlayerData(PlayerName.AGlitchedNpc, "a glitched npc", 76561198984467725uL), new PlayerData(PlayerName.Scraner, "Scraner", 76561198030372045uL) }; } public static bool IsPlayer(PlayerName playerName, string username, ulong steamId) { return GetPlayerData(playerName)?.IsPlayer(username, steamId) ?? false; } public static PlayerData GetLocalClientPlayerData() { foreach (PlayerData playersDatum in PlayersData) { if (playersDatum.IsLocalClient()) { return playersDatum; } } return null; } public static PlayerData GetPlayerData(PlayerName playerName) { foreach (PlayerData playersDatum in PlayersData) { if (playersDatum.PlayerName == playerName) { return playersDatum; } } return null; } public static bool IsLocalClient(PlayerName playerName) { return GetPlayerData(playerName)?.IsLocalClient() ?? false; } public static bool IsLocalClient(string username, ulong steamId) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!SteamClient.IsValid) { return false; } if (!SteamClient.IsLoggedOn) { return false; } if (SteamClient.Name.Equals(username, StringComparison.OrdinalIgnoreCase)) { return true; } if (SteamId.op_Implicit(SteamClient.SteamId) == steamId) { return true; } return false; } } internal class PlayerData { public PlayerName PlayerName { get; private set; } public string[] Username { get; private set; } public ulong[] SteamId { get; private set; } public PlayerData(PlayerName playerName, string username, ulong steamId) { PlayerName = playerName; Username = new string[1] { username }; SteamId = new ulong[1] { steamId }; } public PlayerData(PlayerName playerName, string[] username, ulong[] steamId) { PlayerName = playerName; Username = username; SteamId = steamId; } public bool IsLocalClient() { for (int i = 0; i < Username.Length; i++) { if (SteamUtils.IsLocalClient(Username[i], SteamId[i])) { return true; } } return false; } public bool IsPlayer(string username, ulong steamId) { for (int i = 0; i < Username.Length; i++) { if (Username[i].Equals(username, StringComparison.OrdinalIgnoreCase)) { return true; } if (SteamId[i] == steamId) { return true; } } return false; } } internal class StormyWeatherHelper { [CompilerGenerated] private sealed class d__4 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float duration; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)StormyWeather != (Object)null) { ((Component)StormyWeather).gameObject.SetActive(false); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static StormyWeather _stormyWeather; private static Coroutine _disableStormyWeatherAfterTimeCoroutine; public static StormyWeather StormyWeather { get { if (_stormyWeather == null) { _stormyWeather = Object.FindObjectOfType(true); } return _stormyWeather; } } [IteratorStateMachine(typeof(d__4))] public static IEnumerator DisableStormyWeatherAfterTimeCoroutine(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0) { duration = duration }; } public static void LightningStrikeOnServer(Vector3 strikePosition, bool useTargetedObject) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer) { PluginNetworkBehaviour.Instance.LightningStrikeClientRpc(strikePosition, useTargetedObject); } } public static void LightningStrike(Vector3 strikePosition, bool useTargetedObject) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Invalid comparison between Unknown and I4 //IL_00fa: 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_0147: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_016f: 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_010e: 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_011d: 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_01fd: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0226: 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_0235: 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_0240: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: 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_02a5: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_0171: 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_017c: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StormyWeather == (Object)null) { Logger.LogError("Failed to play thunder effects. StormyWeather is null."); return; } if (_disableStormyWeatherAfterTimeCoroutine != null) { ((MonoBehaviour)StartOfRound.Instance).StopCoroutine(_disableStormyWeatherAfterTimeCoroutine); } ((Component)StormyWeather).gameObject.SetActive(true); if ((int)StartOfRound.Instance.currentLevel.currentWeather != 2) { _disableStormyWeatherAfterTimeCoroutine = ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(DisableStormyWeatherAfterTimeCoroutine(10f)); } AudioSource val; LightningBoltPrefabScript val2; if (useTargetedObject) { StormyWeather.staticElectricityParticle.Stop(); ((Component)StormyWeather.staticElectricityParticle).GetComponent().Stop(); StormyWeather.setStaticToObject = null; val = StormyWeather.targetedStrikeAudio; val2 = StormyWeather.targetedThunder; } else { val = (StormyWeather.lastStrikeAudioUsed ? StormyWeather.randomStrikeAudioB : StormyWeather.randomStrikeAudio); StormyWeather.lastStrikeAudioUsed = !StormyWeather.lastStrikeAudioUsed; val2 = StormyWeather.randomThunder; } bool flag = false; Vector3 val3 = Vector3.zero; for (int i = 0; i < 7; i++) { if (i == 6) { val3 = strikePosition + Vector3.up * 80f; } else { float num = Random.Range(-32f, 32f); float num2 = Random.Range(-32f, 32f); val3 = strikePosition + Vector3.up * 80f + new Vector3(num, 0f, num2); } if (!Physics.Linecast(val3, strikePosition + Vector3.up * 0.5f, ref StormyWeather.rayHit, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { flag = true; break; } } if (!flag) { if (!Physics.Raycast(val3, strikePosition - val3, ref StormyWeather.rayHit, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return; } strikePosition = ((RaycastHit)(ref StormyWeather.rayHit)).point; } val2.Source.transform.position = val3; val2.Destination.transform.position = strikePosition; ((LightningBoltPrefabScriptBase)val2).AutomaticModeSeconds = 0.2f; ((Component)val).transform.position = strikePosition + Vector3.up * 0.5f; Landmine.SpawnExplosion(strikePosition + Vector3.up * 0.25f, false, 0f, 5f, 50, 0f, (GameObject)null, false); ((Component)StormyWeather.explosionEffectParticle).transform.position = strikePosition + Vector3.up * 0.25f; StormyWeather.explosionEffectParticle.Play(); PlayThunderEffects(strikePosition, val); } private static void PlayThunderEffects(Vector3 strikePosition, AudioSource audio) { //IL_005c: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StormyWeather == (Object)null) { Logger.LogError("Failed to play thunder effects. StormyWeather is null."); return; } PlayerControllerB val = PlayerUtils.LocalPlayerScript; if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to play thunder effects. PlayerControllerB is null."); return; } if (val.isPlayerDead && (Object)(object)val.spectatedPlayerScript != (Object)null) { val = val.spectatedPlayerScript; } float num = Vector3.Distance(((Component)val.gameplayCamera).transform.position, strikePosition); bool flag = false; if (num < 40f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 110f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } else { flag = true; } AudioClip[] array = (flag ? StormyWeather.distantThunderSFX : StormyWeather.strikeSFX); if (!val.isInsideFactory) { RoundManager.PlayRandomClip(audio, array, true, 1f, 0, 1000); } WalkieTalkie.TransmitOneShotAudio(audio, array[Random.Range(0, array.Length)], 1f); Bounds bounds = StartOfRound.Instance.shipBounds.bounds; if (((Bounds)(ref bounds)).Contains(strikePosition)) { ((Component)StartOfRound.Instance.shipAnimatorObject).GetComponent().SetTrigger("shipShake"); RoundManager.PlayRandomClip(StartOfRound.Instance.ship3DAudio, StartOfRound.Instance.shipCreakSFX, false, 1f, 0, 1000); StartOfRound.Instance.PowerSurgeShip(); } } } internal static class UnlockableItemHelper { public static void RegisterUnlockable(UnlockableItemDef unlockableItemDef, int price, TerminalNode terminalNode) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)unlockableItemDef == (Object)null) { Logger.LogError("Failed to register unlockable item. UnlockableItemDef is null."); return; } UnlockableItem unlockable = unlockableItemDef.unlockable; if (unlockable == null) { Logger.LogError("Failed to register unlockable item. UnlockableItem is null."); return; } if ((Object)(object)terminalNode == (Object)null) { Logger.LogError("Failed to register unlockable item. TerminalNode is null."); return; } try { unlockable.shopSelectionNode.itemCost = price; unlockable.shopSelectionNode.terminalOptions[0].result.itemCost = price; } catch { } Utilities.FixMixerGroups(unlockable.prefabObject); NetworkPrefabs.RegisterNetworkPrefab(unlockable.prefabObject); Unlockables.RegisterUnlockable(unlockableItemDef, unlockableItemDef.storeType, (TerminalNode)null, (TerminalNode)null, terminalNode, price); Logger.LogInfo($"Registered \"{unlockable.unlockableName}\" unlockable item with a price of ${price}."); } public static void RegisterUnlockable(UnlockableItemConfigData unlockableItemConfigData, TerminalNode terminalNode) { RegisterUnlockable(unlockableItemConfigData.UnlockableItemDef, unlockableItemConfigData.Price.Value, terminalNode); } public static void UpdateUnlockablePrice(UnlockableItem unlockableItem, int price) { if (unlockableItem == null) { Logger.LogError("Failed to update unlockable item price. UnlockableItem is null."); return; } try { unlockableItem.shopSelectionNode.itemCost = price; unlockableItem.shopSelectionNode.terminalOptions[0].result.itemCost = price; } catch { } Unlockables.UpdateUnlockablePrice(unlockableItem, price); Logger.LogInfo($"Updated \"{unlockableItem.unlockableName}\" unlockable item price to ${price}."); } public static void UpdateUnlockablePrice(int unlockableId, int price) { if (!TryGetUnlockableItem(unlockableId, out var unlockableItem)) { Logger.LogError($"Failed to update unlockable item price. UnlockableItem is null. (UnlockableId: {unlockableId})"); } else { UpdateUnlockablePrice(unlockableItem, price); } } public static void UpdateUnlockablePrice(UnlockableItemConfigData unlockableItemConfigData) { UpdateUnlockablePrice(unlockableItemConfigData.UnlockableItem, unlockableItemConfigData.Price.Value); } public static UnlockableItem GetUnlockableItem(int unlockableId) { if ((Object)(object)StartOfRound.Instance == (Object)null) { Logger.LogError($"Failed to get unlockable item. StartOfRound instance is null. (UnlockableId: {unlockableId})"); return null; } List unlockables = StartOfRound.Instance.unlockablesList.unlockables; if (unlockableId < 0 || unlockableId > unlockables.Count - 1) { Logger.LogError($"Failed to get unlockable item. Unlockable id is invalid. (UnlockableId: {unlockableId})"); return null; } return unlockables[unlockableId]; } public static bool TryGetUnlockableItem(int unlockableId, out UnlockableItem unlockableItem) { unlockableItem = GetUnlockableItem(unlockableId); return unlockableItem != null; } public static int GetUnlockableId(UnlockableItem unlockableItem) { if ((Object)(object)StartOfRound.Instance == (Object)null) { Logger.LogError("Failed to get unlockable id. StartOfRound instance is null."); return -1; } if (unlockableItem == null) { Logger.LogError("Failed to get unlockable id. UnlockableItem is null."); return -1; } List unlockables = StartOfRound.Instance.unlockablesList.unlockables; for (int i = 0; i < unlockables.Count; i++) { if (unlockables[i] == unlockableItem) { return i; } } return -1; } } internal static class Utils { [CompilerGenerated] private sealed class d__29 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float seconds; public Action action; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__29(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(seconds); <>1__state = 1; return true; case 1: <>1__state = -1; action?.Invoke(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__27 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Action action; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__27(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; action?.Invoke(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__31 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Task task; public Action result; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } if (!task.IsCompleted) { <>2__current = null; <>1__state = 1; return true; } if (task.IsFaulted) { throw task.Exception; } result?.Invoke(task.Result); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static string GetPluginDirectoryPath() { return Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location); } public static string GetConfigDirectoryPath() { return Paths.ConfigPath; } public static string GetGlobalConfigDirectoryPath() { return Path.Combine(Application.persistentDataPath, "TakeyPlush"); } public static string GetPluginPersistentDataPath() { return Path.Combine(Application.persistentDataPath, "TakeyPlush"); } public static ConfigFile CreateConfigFile(BaseUnityPlugin plugin, string path, string name = null, bool saveOnInit = false) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown BepInPlugin metadata = MetadataHelper.GetMetadata((object)plugin); if (name == null) { name = metadata.GUID; } name += ".cfg"; return new ConfigFile(Path.Combine(path, name), saveOnInit, metadata); } public static ConfigFile CreateLocalConfigFile(BaseUnityPlugin plugin, string name = null, bool saveOnInit = false) { return CreateConfigFile(plugin, Paths.ConfigPath, name, saveOnInit); } public static ConfigFile CreateGlobalConfigFile(BaseUnityPlugin plugin, string name = null, bool saveOnInit = false) { string pluginPersistentDataPath = GetPluginPersistentDataPath(); if (name == null) { name = "global"; } return CreateConfigFile(plugin, pluginPersistentDataPath, name, saveOnInit); } public static bool RollPercentChance(float percent) { if (percent <= 0f) { return false; } if (percent >= 100f) { return true; } return Random.value * 100f <= percent; } public static void CreateExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, int damage = 20, float minDamageRange = 0f, float maxDamageRange = 6.4f, int enemyHitForce = 6, CauseOfDeath causeOfDeath = 3, PlayerControllerB attacker = null) { //IL_0005: 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_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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: 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_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_0120: 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_02db: 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_0196: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) Logger.LogInfo($"Spawning explosion at pos: {explosionPosition}"); Transform val = null; if ((Object)(object)RoundManager.Instance != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null && (Object)(object)RoundManager.Instance.mapPropsContainer.transform != (Object)null) { val = RoundManager.Instance.mapPropsContainer.transform; } if (spawnExplosionEffect) { Object.Instantiate(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), val).SetActive(true); } float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition); if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 25f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } Collider[] array = Physics.OverlapSphere(explosionPosition, maxDamageRange, 2621448, (QueryTriggerInteraction)2); PlayerControllerB val2 = null; for (int i = 0; i < array.Length; i++) { float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position); if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) { continue; } if (((Component)array[i]).gameObject.layer == 3) { val2 = ((Component)array[i]).gameObject.GetComponent(); if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).IsOwner) { float num3 = 1f - Mathf.Clamp01((num2 - minDamageRange) / (maxDamageRange - minDamageRange)); val2.DamagePlayer((int)((float)damage * num3), true, true, causeOfDeath, 0, false, default(Vector3)); } } else if (((Component)array[i]).gameObject.layer == 21) { Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f) { Logger.LogInfo("Setting off other mine"); ((MonoBehaviour)componentInChildren).StartCoroutine(componentInChildren.TriggerOtherMineDelayed(componentInChildren)); } } else if (((Component)array[i]).gameObject.layer == 19) { EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f) { componentInChildren2.mainScript.HitEnemyOnLocalClient(enemyHitForce, default(Vector3), attacker, false, -1); } } } int num4 = ~LayerMask.GetMask(new string[1] { "Room" }); num4 = ~LayerMask.GetMask(new string[1] { "Colliders" }); array = Physics.OverlapSphere(explosionPosition, 10f, num4); for (int j = 0; j < array.Length; j++) { Rigidbody component = ((Component)array[j]).GetComponent(); if ((Object)(object)component != (Object)null) { component.AddExplosionForce(70f, explosionPosition, 10f); } } } public static int GetRandomIndexFromWeightList(List weightList) { List<(int, int)> list = new List<(int, int)>(); for (int i = 0; i < weightList.Count; i++) { int num = weightList[i]; if (num > 0) { list.Add((i, num)); } } int num2 = 0; foreach (var item4 in list) { int item = item4.Item2; num2 += item; } if (num2 == 0) { return -1; } int num3 = Random.Range(0, num2); int num4 = 0; foreach (var item5 in list) { int item2 = item5.Item1; int item3 = item5.Item2; num4 += item3; if (num3 < num4) { return item2; } } throw new InvalidOperationException("Weights are not properly specified."); } public static Transform GetHangarShipTransform() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return null; } return StartOfRound.Instance.elevatorTransform; } public static Vector3 GetHangarShipCenter() { //IL_0016: 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_000f: Unknown result type (might be due to invalid IL or missing references) Transform hangarShipTransform = GetHangarShipTransform(); if ((Object)(object)hangarShipTransform == (Object)null) { return Vector3.zero; } return hangarShipTransform.position + new Vector3(1.47f, 0f, -6.68f); } public static bool HasBeehivesOnShip(bool inShipRoom = false) { return GetBeehivesOnShipCount(inShipRoom) > 0; } public static int GetBeehivesOnShipCount(bool inShipRoom = 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_0023: 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_0056: 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) int num = 0; Vector3 hangarShipCenter = GetHangarShipCenter(); foreach (GrabbableObject instance in GrabbableObjectPatch.Instances) { if (!(((Component)instance).transform.position.y < hangarShipCenter.y) && instance.itemProperties.itemName.Equals("Hive", StringComparison.OrdinalIgnoreCase) && inShipRoom == instance.isInShipRoom && Vector3.Distance(hangarShipCenter, ((Component)instance).transform.position) <= 25f) { num++; } } return num; } public static bool CollectedAllScrap() { foreach (GrabbableObject instance in GrabbableObjectPatch.Instances) { if (instance.itemProperties.isScrap && !instance.isInShipRoom) { return false; } } return true; } public static void SpawnExplosionForce(Vector3 position, float physicsForce, bool fallDamage = false) { //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_002c: 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_0038: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_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_0089: 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_008f: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_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_014b: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_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) PlayerControllerB localPlayerScript = PlayerUtils.LocalPlayerScript; if (physicsForce > 0f && Vector3.Distance(((Component)localPlayerScript).transform.position, position) < 35f && !Physics.Linecast(position, ((Component)localPlayerScript).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) { float num = Vector3.Distance(((Component)localPlayerScript).transform.position, position); Vector3 val = Vector3.Normalize(((Component)localPlayerScript).transform.position + Vector3.up * num - position) / (num * 0.35f) * physicsForce; if (((Vector3)(ref val)).magnitude > 2f) { if (((Vector3)(ref val)).magnitude > 10f) { localPlayerScript.CancelSpecialTriggerAnimations(); } if (localPlayerScript.inVehicleAnimation) { Vector3 val2 = localPlayerScript.externalForceAutoFade + val; if (!(((Vector3)(ref val2)).magnitude > 50f)) { goto IL_0107; } } localPlayerScript.externalForceAutoFade += val; if (!fallDamage) { PlayerControllerBPatch.IgnoreNextFallDamage(); } } } goto IL_0107; IL_0107: VehicleController vehicleController = VehicleHelper.VehicleController; if ((Object)(object)vehicleController != (Object)null && !vehicleController.magnetedToShip && physicsForce > 0f && Vector3.Distance(((Component)vehicleController).transform.position, position) < 35f) { vehicleController.mainRigidbody.AddExplosionForce(physicsForce * 50f, position, 12f, 3f, (ForceMode)1); } } public static void SetMeshRenderersEnabled(GameObject gameObject, bool value, bool includeInactive = false) { if ((Object)(object)gameObject == (Object)null) { return; } MeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren(includeInactive); foreach (MeshRenderer val in componentsInChildren) { if (!((Component)val).gameObject.CompareTag("DoNotSet") && !((Component)val).gameObject.CompareTag("InteractTrigger")) { ((Renderer)val).enabled = value; } } SkinnedMeshRenderer[] componentsInChildren2 = gameObject.GetComponentsInChildren(includeInactive); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { ((Renderer)val2).enabled = value; } } public static int GetForestGiantSpawnCount() { int num = 0; foreach (ForestGiantAI item in EnemyAIPatch.GetInstancesOfType()) { if (!((EnemyAI)item).isEnemyDead) { num++; } } return num; } public static Vector3 GetMainEntrancePosition() { //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_0044: 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) foreach (EntranceTeleport instance in EntranceTeleportPatch.Instances) { if (instance.entranceId == 0) { return ((Component)instance).transform.position; } } return Vector3.zero; } public static AudioClip AmplifyClipByDecibels(AudioClip originalClip, float decibelChange) { if ((Object)(object)originalClip == (Object)null) { return null; } float num = Mathf.Pow(10f, decibelChange / 20f); float[] array = new float[originalClip.samples * originalClip.channels]; originalClip.GetData(array, 0); for (int i = 0; i < array.Length; i++) { array[i] *= num; array[i] = Mathf.Clamp(array[i], -1f, 1f); } AudioClip val = AudioClip.Create("AmplifiedClip", originalClip.samples, originalClip.channels, originalClip.frequency, false); val.SetData(array, 0); return val; } public static string GetModpackName() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location); string text = "\\profiles"; int num = directoryName.IndexOf(text, StringComparison.OrdinalIgnoreCase); if (num == -1) { return string.Empty; } int num2 = num + text.Length + 1; if (num2 >= directoryName.Length) { return string.Empty; } string text2 = directoryName.Substring(num2); int num3 = text2.IndexOf('\\'); if (num3 != -1) { return text2.Substring(0, num3); } return string.Empty; } public static bool StringEquals(string input, string[] values, bool matchCase = true) { StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); foreach (string value in values) { if (input.Equals(value, comparisonType)) { return true; } } return false; } public static bool StringContains(string input, string[] values, bool matchCase = true) { StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture); foreach (string value in values) { if (input.Contains(value, comparisonType)) { return true; } } return false; } public static Vector3 GetLocalPosition(Transform transform, Vector3 position) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)transform == (Object)null || (Object)(object)transform.parent == (Object)null) { return position; } return transform.parent.InverseTransformPoint(position); } public static void SetGrabbableObjectPosition(GrabbableObject grabbableObject, Vector3 position) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)grabbableObject == (Object)null)) { grabbableObject.targetFloorPosition = GetLocalPosition(((Component)grabbableObject).transform, position); } } public static void SetGrabbableObjectParent(GrabbableObject grabbableObject, Transform transform) { //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_0023: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)grabbableObject == (Object)null)) { Vector3 position = ((Component)grabbableObject).transform.position; ((Component)grabbableObject).transform.SetParent(transform); SetGrabbableObjectPosition(grabbableObject, position); } } public static void ExecuteNextFrame(Action action) { CoroutineRunner.Start(ExecuteNextFrameCoroutine(action)); } [IteratorStateMachine(typeof(d__27))] private static IEnumerator ExecuteNextFrameCoroutine(Action action) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__27(0) { action = action }; } public static void ExecuteAfterDelay(Action action, float seconds) { CoroutineRunner.Start(ExecuteAfterDelayCoroutine(action, seconds)); } [IteratorStateMachine(typeof(d__29))] private static IEnumerator ExecuteAfterDelayCoroutine(Action action, float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__29(0) { action = action, seconds = seconds }; } public static bool TryParseValue(string value, out T result) { try { if (typeof(T) == typeof(int) && int.TryParse(value, out var result2)) { result = (T)(object)result2; return true; } if (typeof(T) == typeof(float) && float.TryParse(value, out var result3)) { result = (T)(object)result3; return true; } if (typeof(T) == typeof(double) && double.TryParse(value, out var result4)) { result = (T)(object)result4; return true; } if (typeof(T) == typeof(bool) && bool.TryParse(value, out var result5)) { result = (T)(object)result5; return true; } if (typeof(T) == typeof(string)) { result = (T)(object)value; return true; } } catch { } result = default(T); return false; } [IteratorStateMachine(typeof(d__31<>))] public static IEnumerator WaitForTask(Task task, Action result) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__31(0) { task = task, result = result }; } public static void DisplayMessage(string text, bool isError = false) { string text2 = "TakeyPlush"; if (isError) { text2 += " - ERROR"; } HUDManager instance = HUDManager.Instance; if (instance != null) { instance.DisplayTip(text2, text, isError, false, "LC_Tip1"); } } public static void LogStackTraceSignatures() { StackTrace stackTrace = new StackTrace(1, fNeedFileInfo: false); StringBuilder stringBuilder = new StringBuilder(); int num = 1; StackFrame[] array = stackTrace.GetFrames() ?? Array.Empty(); foreach (StackFrame stackFrame in array) { MethodBase method = stackFrame.GetMethod(); if (!(method == null)) { string text = method.DeclaringType?.FullName ?? ""; string text2 = string.Join(", ", Array.ConvertAll(method.GetParameters(), (ParameterInfo p) => p.ParameterType.Name + " " + p.Name)); stringBuilder.AppendLine($"{num,2}. {text}.{method.Name}({text2})"); num++; } } Logger.LogInfo("LogStackTraceSignatures:\n" + stringBuilder.ToString(), extended: true); } public static bool IsAprilFools() { DateTime now = DateTime.Now; if (now.Month == 4) { return now.Day == 1; } return false; } } internal static class VehicleHelper { private static VehicleController _vehicleController; public static VehicleController VehicleController { get { if (_vehicleController == null) { _vehicleController = Object.FindFirstObjectByType(); } return _vehicleController; } } } } namespace com.github.zehsteam.TakeyPlush.Extensions { internal static class AssemblyExtensions { public static IEnumerable GetLoadableTypes(this Assembly assembly) { if (assembly == null) { return Array.Empty(); } try { return assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type type) => type != null); } } } internal static class ConfigEntryExtensions { public static bool SetValue(this ConfigEntry configEntry, string value) { if (configEntry == null) { return false; } try { configEntry.Value = value.ConvertTo(); return true; } catch (Exception ex) { Logger.LogError("SetValue failed for key '" + ((ConfigEntryBase)configEntry).Definition.Key + "': " + ex.Message); return false; } } public static bool SetValue(this SyncedConfigEntry configEntry, string value) { if (configEntry == null) { return false; } try { configEntry.Value = value.ConvertTo(); return true; } catch (Exception ex) { Logger.LogError($"SetValue failed for key '{configEntry.Definition}': {ex.Message}"); return false; } } } internal static class ConfigFileExtensions { private static readonly PropertyInfo EntriesProperty = AccessTools.Property(typeof(ConfigFile), "Entries"); private static readonly PropertyInfo OrphanedEntriesProperty = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); public static ConfigEntry Bind(this ConfigFile configFile, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if (acceptableValues == null) { return configFile.Bind(section, key, defaultValue, description); } return configFile.Bind(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty())); } public static Dictionary GetConfigEntries_Ext(this ConfigFile configFile) { if (configFile == null) { return new Dictionary(); } if (EntriesProperty == null) { Logger.LogError("ConfigFileExtensions: GetConfigEntries_Ext(); EntriesProperty is null."); return new Dictionary(); } return EntriesProperty?.GetValue(configFile) as Dictionary; } public static Dictionary GetOrphanedConfigEntries(this ConfigFile configFile) { if (configFile == null) { return new Dictionary(); } if (OrphanedEntriesProperty == null) { Logger.LogError("ConfigFileExtensions: GetOrphanedConfigEntries(); OrphanedEntriesProperty is null."); return new Dictionary(); } return (OrphanedEntriesProperty?.GetValue(configFile, null) as Dictionary) ?? new Dictionary(); } public static bool RemoveOrphaned(this ConfigFile configFile, ConfigDefinition configDefinition) { if (configFile == null || configDefinition == (ConfigDefinition)null) { return false; } if (typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(configFile) is IDictionary dictionary) { return dictionary.Remove(configDefinition); } return false; } public static bool MigrateConfigEntry(this ConfigFile configFile, ConfigDefinition oldConfigDefinition, string value, ConfigEntry newConfigEntry) { if (configFile == null || oldConfigDefinition == (ConfigDefinition)null || newConfigEntry == null) { return false; } configFile.RemoveOrphaned(oldConfigDefinition); return newConfigEntry.SetValue(value); } public static bool MigrateConfigEntry(this ConfigFile configFile, ConfigDefinition oldConfigDefinition, string value, SyncedConfigEntry newConfigEntry) { if (configFile == null || oldConfigDefinition == (ConfigDefinition)null || newConfigEntry == null) { return false; } configFile.RemoveOrphaned(oldConfigDefinition); return newConfigEntry.SetValue(value); } public static bool MigrateConfigEntry(this ConfigFile configFile, ConfigDefinition oldConfigDefinition, string value, ConfigEntryBase configEntryBase) { if (configFile == null || oldConfigDefinition == (ConfigDefinition)null || configEntryBase == null) { return false; } Type type = ((object)configEntryBase).GetType(); if (!type.IsGenericType || type.GetGenericTypeDefinition() != typeof(ConfigEntry<>)) { return false; } Type type2 = type.GenericTypeArguments[0]; MethodInfo methodInfo = typeof(ConfigFileExtensions).GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault((MethodInfo m) => m.Name == "MigrateConfigEntry" && m.IsGenericMethodDefinition && m.GetParameters().Length == 4 && m.GetGenericArguments().Length == 1); if (methodInfo == null) { throw new InvalidOperationException("Cannot find MigrateConfigEntry method."); } MethodInfo methodInfo2 = methodInfo.MakeGenericMethod(type2); object obj = methodInfo2.Invoke(null, new object[4] { configFile, oldConfigDefinition, value, configEntryBase }); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } public static void MigrateConfigEntries(this ConfigFile configFile, ConfigSectionMigration[] migrations) { Dictionary configEntries_Ext = configFile.GetConfigEntries_Ext(); Dictionary dictionary = new Dictionary(configFile.GetOrphanedConfigEntries()); Logger.LogInfo($"ConfigFileExtensions: MigrateConfigEntries(); entries: {configEntries_Ext.Count}, orphanedEntries: {dictionary.Count}", extended: true); foreach (ConfigSectionMigration migration in migrations) { configFile.MigrateConfigEntries(migration, configEntries_Ext, dictionary); } } public static void MigrateConfigEntries(this ConfigFile configFile, ConfigSectionMigration migration, Dictionary entries = null, Dictionary orphanedEntries = null) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown if (entries == null) { entries = configFile.GetConfigEntries_Ext(); } if (orphanedEntries == null) { orphanedEntries = new Dictionary(configFile.GetOrphanedConfigEntries()); } foreach (KeyValuePair orphanedEntry in orphanedEntries) { ConfigDefinition orphanedDefinition = orphanedEntry.Key; if (migration.OldSections.Any((string oldSection) => oldSection.Equals(orphanedDefinition.Section, StringComparison.OrdinalIgnoreCase))) { string value = orphanedEntry.Value; ConfigDefinition val = new ConfigDefinition(migration.NewSection, orphanedDefinition.Key); if (entries.TryGetValue(val, out var value2) && configFile.MigrateConfigEntry(orphanedDefinition, value, value2)) { Logger.LogInfo("Migrated orphaned config entry (section: \"" + orphanedDefinition.Section + "\", key: \"" + orphanedDefinition.Key + "\", value: \"" + value + "\") to (section: \"" + val.Section + "\", key: \"" + val.Key + "\")"); } } } } } public readonly struct ConfigSectionMigration { public string[] OldSections { get; } public string NewSection { get; } public ConfigSectionMigration(string[] oldSections, string newSection) { OldSections = oldSections; NewSection = newSection; } public ConfigSectionMigration(string oldSection, string newSection) : this(new string[1] { oldSection }, newSection) { } } public static class StringExtensions { public static T ConvertTo(this string s) { Type typeFromHandle = typeof(T); if ((object)typeFromHandle != null) { Type type = typeFromHandle; object obj; if (type == typeof(int) && int.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out var result)) { obj = result; } else { Type type2 = typeFromHandle; if (type2 == typeof(float) && float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2)) { obj = result2; } else { Type type3 = typeFromHandle; if (type3 == typeof(double) && double.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result3)) { obj = result3; } else { Type type4 = typeFromHandle; if (type4 == typeof(bool) && bool.TryParse(s, out var result4)) { obj = result4; } else { Type type5 = typeFromHandle; if (type5 == typeof(string)) { obj = s; } else { Type type6 = typeFromHandle; if (!type6.IsEnum || !Enum.TryParse(type6, s, ignoreCase: true, out object result5)) { goto IL_0121; } obj = result5; } } } } } object obj2 = obj; return (T)obj2; } goto IL_0121; IL_0121: throw new NotSupportedException($"Unsupported value type: {typeof(T)}"); } public static bool TryConvertTo(this string s, out T result) { try { result = s.ConvertTo(); return true; } catch { result = default(T); return false; } } } } namespace com.github.zehsteam.TakeyPlush.Enums { public enum PlayerDeathReason { Unknown, Falling, Quicksand, Landmine } internal enum SaveLocation { CurrentSave, GeneralSave, Modpack, Global } public enum TakeyVariantType { None, Default, Gazmi, Shady, Captain, Gamble, ChickenDance, DinkDonk, FightClub, Cute, Feels, Stabby, LUBBERS, ALOO, Gift, Cake, Dracula, Pumpkin, Ignore, Pilgrim, CookedChickenSuit, Santa, Nutcracker } } namespace com.github.zehsteam.TakeyPlush.Dependencies { internal static class LethalConfigProxy { public const string PLUGIN_GUID = "ainavt.lc.lethalconfig"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SkipAutoGen() { LethalConfigManager.SkipAutoGen(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig(ConfigEntry configEntry, bool requiresRestart = false) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues; if (acceptableValues != null) { if (acceptableValues is AcceptableValueRange || acceptableValues is AcceptableValueRange) { AddConfigSlider(configEntry, requiresRestart); return; } if (acceptableValues is AcceptableValueList) { AddConfigDropdown(configEntry, requiresRestart); return; } } if (!(configEntry is ConfigEntry val)) { if (!(configEntry is ConfigEntry val2)) { if (!(configEntry is ConfigEntry val3)) { if (!(configEntry is ConfigEntry val4)) { throw new NotSupportedException($"Unsupported type: {typeof(T)}"); } LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(val4, requiresRestart)); } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(val3, requiresRestart)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(val2, requiresRestart)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(val, requiresRestart)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfigSlider(ConfigEntry configEntry, bool requiresRestart = false) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if (!(configEntry is ConfigEntry val)) { if (!(configEntry is ConfigEntry val2)) { throw new NotSupportedException($"Slider not supported for type: {typeof(T)}"); } LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(val2, requiresRestart)); } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(val, requiresRestart)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfigDropdown(ConfigEntry configEntry, bool requiresRestart = false) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown if (configEntry is ConfigEntry val) { LethalConfigManager.AddConfigItem((BaseConfigItem)new TextDropDownConfigItem(val, requiresRestart)); return; } throw new NotSupportedException($"Dropdown not supported for type: {typeof(T)}"); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddButton(string section, string name, string buttonText, string description, Action callback) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate { callback?.Invoke(); })); } } internal static class StarlancerAIFixProxy { public const string PLUGIN_GUID = "AudioKnight.StarlancerAIFix"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("AudioKnight.StarlancerAIFix"); _enabled = valueOrDefault; } return _enabled.Value; } } } internal static class TwitchChatAPIProxy { public const string PLUGIN_GUID = "TwitchChatAPI"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("TwitchChatAPI"); _enabled = valueOrDefault; } return _enabled.Value; } } public static event Action OnMessage; [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void Initialize() { try { API.OnMessage += HandleMessage; Application.quitting += delegate { API.OnMessage -= HandleMessage; }; } catch (Exception arg) { Logger.LogError($"Failed to initialize TwitchChatAPIProxy. {arg}"); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void HandleMessage(TwitchMessage twitchMessage) { TwitchChatAPIProxy.OnMessage?.Invoke(((TwitchMessage)(ref twitchMessage)).Message); } } internal static class ZombiesPlushProxy { public const string PLUGIN_GUID = "com.github.zehsteam.ZombiesPlush"; private static bool? _enabled; public static bool Enabled { get { bool valueOrDefault = _enabled.GetValueOrDefault(); if (!_enabled.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.github.zehsteam.ZombiesPlush"); _enabled = valueOrDefault; } return _enabled.Value; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool HasSmolZombiesNearby(Vector3 position, float radius) { //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) try { foreach (ZombiesBehaviour item in GrabbableObjectPatch.GetInstancesOfType()) { if (Vector3.Distance(position, ((Component)item).transform.position) <= radius) { return true; } } } catch (Exception arg) { Logger.LogError($"Failed to check if a Smol Zombies plushie is nearby. {arg}"); } return false; } } } namespace com.github.zehsteam.TakeyPlush.Data { [Serializable] public class AudioClipGroup { public AudioClip AudioClip; public AudioClip AudioClipFar; public float Length => AudioClip.length; public AudioClipGroup(AudioClip audioClip, AudioClip audioClipFar) { AudioClip = audioClip; AudioClipFar = audioClipFar; } } [Serializable] public class AudioClipGroupWithWeight : AudioClipGroup { [Range(0f, 100f)] public int Weight = 10; public AudioClipGroupWithWeight(AudioClip audioClip, AudioClip audioClipFar, int weight = 10) : base(audioClip, audioClipFar) { Weight = weight; } } [Serializable] public class AudioClipGroupWithData : AudioClipGroup { public T Data; public AudioClipGroupWithData(AudioClip audioClip, AudioClip audioClipFar, T data) : base(audioClip, audioClipFar) { Data = data; } } [Serializable] public class AudioSourceGroup { public AudioSource AudioSource; public AudioSource AudioSourceFar; public bool IsPlaying => AudioSource.isPlaying; public float Volume { get { return AudioSource.volume; } set { AudioSource.volume = value; AudioSourceFar.volume = value; } } public float Pitch { get { return AudioSource.pitch; } set { AudioSource.pitch = value; AudioSourceFar.pitch = value; } } public AudioSourceGroup(AudioSource audioSource, AudioSource audioSourceFar) { AudioSource = audioSource; AudioSourceFar = audioSourceFar; } public void Play() { AudioSource.Play(); AudioSourceFar.Play(); } public float PlayOneShot(AudioClipGroup audioClipGroup, float volumeScale = 1f) { if (audioClipGroup == null) { return 0f; } float result = 0f; if ((Object)(object)audioClipGroup.AudioClip != (Object)null) { result = audioClipGroup.AudioClip.length; AudioSource.PlayOneShot(audioClipGroup.AudioClip, volumeScale); } if ((Object)(object)audioClipGroup.AudioClipFar != (Object)null) { AudioSourceFar.PlayOneShot(audioClipGroup.AudioClipFar, volumeScale); } return result; } public void Pause() { AudioSource.Pause(); AudioSourceFar.Pause(); } public void Stop() { AudioSource.Stop(); AudioSourceFar.Stop(); } } [Serializable] public struct EnableField { public bool Enabled; public T Value; } [Serializable] public class TakeyVariantData { public TakeyVariantType VariantType; [Range(0f, 500f)] public int Weight = 25; public int MaxInstanceCount = 1; public GameObject Prefab; } [CreateAssetMenu(fileName = "TakeyVariantDataList", menuName = "TakeyPlush/TakeyVariantDataList")] public class TakeyVariantDataList : ScriptableObject { public List Variants = new List(); public int GetIndex(TakeyVariantType variantType) { for (int i = 0; i < Variants.Count; i++) { if (Variants[i].VariantType == variantType) { return i; } } return 0; } public TakeyVariantData GetByIndex(int index) { try { return Variants[index]; } catch (Exception data) { Logger.LogError(data); } if (Variants.Count > 0) { return Variants[0]; } return null; } public TakeyVariantData GetByType(TakeyVariantType variantType) { foreach (TakeyVariantData variant in Variants) { if (variant.VariantType == variantType) { return variant; } } return null; } public int GetRandomIndex() { return Utils.GetRandomIndexFromWeightList(GetWeightList()); } private List GetWeightList() { List list = new List(); foreach (TakeyVariantData variant in Variants) { list.Add(GetWeight(variant)); } return list; } private int GetWeight(TakeyVariantData variant) { if (Utils.IsAprilFools() && variant.VariantType == TakeyVariantType.Gazmi) { return 9999; } int weight = variant.Weight; if (variant.MaxInstanceCount <= -1) { return weight; } Takey[] array = Takey.Instances.Where((Takey x) => x.VariantType == variant.VariantType).ToArray(); if (array.Length >= variant.MaxInstanceCount) { return 0; } if (array.Length == 0 && TryGetSpecialWeight(variant.VariantType, out var specialWeight)) { return specialWeight; } if (variant.VariantType == TakeyVariantType.Gazmi && PlayerUtils.IsLocalPlayer(new PlayerName[2] { PlayerName.Ariesgoddess168, PlayerName.LustStings })) { return weight * 3; } return weight; } private bool TryGetSpecialWeight(TakeyVariantType variantType, out int specialWeight) { specialWeight = 10000; TakeyVariantType[] variantTypesToShowInOrder = GetVariantTypesToShowInOrder(); foreach (TakeyVariantType takeyVariantType in variantTypesToShowInOrder) { if (takeyVariantType == variantType) { return true; } if (!SpawnedVariant(takeyVariantType)) { break; } } return false; } public void OnBroughtToShip(TakeyVariantType variantType) { if (!NetworkUtils.IsServer) { return; } TakeyVariantType[] variantTypesToShowInOrder = GetVariantTypesToShowInOrder(); foreach (TakeyVariantType takeyVariantType in variantTypesToShowInOrder) { if (takeyVariantType == variantType && !ShowedVariant(variantType)) { Plugin.ModpackSave.Save(GetShowVariantKey(variantType), value: true); } } } private TakeyVariantType[] GetVariantTypesToShowInOrder() { if (PlayerUtils.IsLocalPlayer(new PlayerName[5] { PlayerName.Takerst, PlayerName.Ariesgoddess168, PlayerName.WolfsMyChocolate, PlayerName.Hiccubz, PlayerName.ZombiesAteMyChannel })) { return new TakeyVariantType[1] { TakeyVariantType.ALOO }; } return Array.Empty(); } private bool ShowedVariant(TakeyVariantType variantType) { return Plugin.ModpackSave.Load(GetShowVariantKey(variantType), defaultValue: false); } private bool SpawnedVariant(TakeyVariantType variantType) { foreach (Takey instance in Takey.Instances) { if (instance.VariantType == variantType) { return true; } } return false; } private string GetShowVariantKey(TakeyVariantType variantType) { return $"ForceShowed{variantType}SmolTakeyVariant_10"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace com.github.zehsteam.TakeyPlush.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }