using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using GokuBracken.Core; using GokuBracken.Scripts; using Hallucinoceps; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Steamworks; using Unity.Netcode; using UnityEngine; using com.github.zehsteam.TakeyGokuBracken.Data; using com.github.zehsteam.TakeyGokuBracken.Dependencies; using com.github.zehsteam.TakeyGokuBracken.Dependencies.GokuBrackenProxy; using com.github.zehsteam.TakeyGokuBracken.Dependencies.GokuBrackenProxy.Patches; using com.github.zehsteam.TakeyGokuBracken.MonoBehaviours; using com.github.zehsteam.TakeyGokuBracken.NetcodePatcher; using com.github.zehsteam.TakeyGokuBracken.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("GokuBracken")] [assembly: IgnoresAccessChecksTo("Hallucinoceps")] [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 2 scrap and 1 enemy reskin. Requires the GokuBracken mod to be installed for most features. (This mod is included with the TakeyPlush mod)")] [assembly: AssemblyFileVersion("1.5.0.0")] [assembly: AssemblyInformationalVersion("1.5.0+9b5f4827fcf68d284898650603dd54656d33a9b7")] [assembly: AssemblyProduct("TakeyGokuBracken")] [assembly: AssemblyTitle("com.github.zehsteam.TakeyGokuBracken")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.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.TakeyGokuBracken { public static class Api { public static Dictionary EnemyControllerPairs => FlowermanAIPatch.EnemyControllerPairs; public static int TakeyGokuBrackenMaxSpawnCount => Plugin.ConfigManager.TakeyGokuBracken_MaxSpawnCount.Value; public static int TakeyGokuBrackenSpawnChance => Plugin.ConfigManager.TakeyGokuBracken_SpawnChance.Value; public static int TakeyGokuBrackenSpawnCount => FlowermanAIPatch.TakeyGokuBrackenSpawnCount; public static bool ForceTakeyGokuBrackenSpawns { get { return FlowermanAIPatch.ForceTakeyGokuBrackenSpawns; } set { FlowermanAIPatch.ForceTakeyGokuBrackenSpawns = value; } } public static int ForceTakeyGokuBrackenMaxSpawnCount { get { return FlowermanAIPatch.ForceTakeyGokuBrackenMaxSpawnCount; } set { FlowermanAIPatch.ForceTakeyGokuBrackenMaxSpawnCount = value; } } public static bool SetTakeyGokuBrackenOnServer(FlowermanAI flowermanAI) { return Plugin.Instance.SetTakeyGokuBrackenOnServer(flowermanAI); } } internal static class ConfigHelper { public static void SetModIcon(Sprite sprite) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SetModIcon(sprite); } } public static void SetModDescription(string description) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SetModDescription(description); } } public static void SkipAutoGen() { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SkipAutoGen(); } } public static void AddButton(string section, string name, string description, string buttonText, Action callback) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddButton(section, name, description, buttonText, callback); } } public static ConfigEntry Bind(string section, string key, T defaultValue, bool requiresRestart, string description, AcceptableValueBase acceptableValues = null, Action settingChanged = null, ConfigFile configFile = null) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown if (configFile == null) { configFile = ((BaseUnityPlugin)Plugin.Instance).Config; } ConfigEntry configEntry = ((acceptableValues == null) ? configFile.Bind(section, key, defaultValue, description) : configFile.Bind(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty()))); if (settingChanged != null) { configEntry.SettingChanged += delegate { settingChanged?.Invoke(configEntry.Value); }; } if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddConfig(configEntry, requiresRestart); } return configEntry; } public static Dictionary GetOrphanedConfigEntries(ConfigFile configFile = null) { if (configFile == null) { configFile = ((BaseUnityPlugin)Plugin.Instance).Config; } PropertyInfo property = ((object)configFile).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); return (Dictionary)property.GetValue(configFile, null); } public static void SetConfigEntryValue(ConfigEntry configEntry, string value) { if (typeof(T) == typeof(int) && int.TryParse(value, out var result)) { configEntry.Value = (T)(object)result; return; } if (typeof(T) == typeof(float) && float.TryParse(value, out var result2)) { configEntry.Value = (T)(object)result2; return; } if (typeof(T) == typeof(double) && double.TryParse(value, out var result3)) { configEntry.Value = (T)(object)result3; return; } if (typeof(T) == typeof(bool) && bool.TryParse(value, out var result4)) { configEntry.Value = (T)(object)result4; return; } if (typeof(T) == typeof(string)) { configEntry.Value = (T)(object)value; return; } throw new InvalidOperationException($"Unsupported type: {typeof(T)}"); } public static void ClearUnusedEntries(ConfigFile configFile = null) { if (configFile == null) { configFile = ((BaseUnityPlugin)Plugin.Instance).Config; } Dictionary orphanedConfigEntries = GetOrphanedConfigEntries(configFile); if (orphanedConfigEntries != null) { orphanedConfigEntries.Clear(); configFile.Save(); } } } internal class ConfigManager { public ConfigEntry ExtendedLogging { get; private set; } public ConfigEntry EnablePlushies { get; private set; } public ConfigEntry TakeyGokuBracken_MaxSpawnCount { get; private set; } public ConfigEntry TakeyGokuBracken_SpawnChance { get; private set; } public ItemConfigData SmolTakeyGokuPlushie { get; private set; } public ItemConfigData TakeyGokuPlushie { get; private set; } public ConfigManager() { BindConfigs(); MigrateOldConfigSettings(); ConfigHelper.ClearUnusedEntries(); } private void BindConfigs() { ConfigHelper.SkipAutoGen(); ExtendedLogging = ConfigHelper.Bind("General", "ExtendedLogging", defaultValue: false, requiresRestart: false, "Enable extended logging."); EnablePlushies = ConfigHelper.Bind("General", "EnablePlushies", defaultValue: false, requiresRestart: false, "Enable plushies without needing the GokuBracken mod installed."); EnablePlushies.SettingChanged += EnablePlushies_SettingChanged; TakeyGokuBracken_MaxSpawnCount = ConfigHelper.Bind("Takey Goku Bracken", "MaxSpawnCount", 999, requiresRestart: false, "Takey Goku Bracken max spawn count."); TakeyGokuBracken_SpawnChance = ConfigHelper.Bind("Takey Goku Bracken", "SpawnChance", 25, requiresRestart: false, "The percent chance a Goku Bracken turns into a Takey Goku Bracken."); SmolTakeyGokuPlushie = new ItemConfigData(Content.SmolTakeyGokuPlushie, "Smol Takey Goku Plushie", 10, twoHanded: false, 6, 80, 250); TakeyGokuPlushie = new ItemConfigData(Content.TakeyGokuPlushie, "Takey Goku Plushie", 10, twoHanded: true, 69, 255, 525); } private void EnablePlushies_SettingChanged(object sender, EventArgs e) { foreach (ItemConfigData instance in ItemConfigData.Instances) { instance.RefreshConfigData(); } } private void MigrateOldConfigSettings() { foreach (KeyValuePair orphanedConfigEntry in ConfigHelper.GetOrphanedConfigEntries()) { MigrateOldConfigSetting(orphanedConfigEntry.Key.Section, orphanedConfigEntry.Key.Key, orphanedConfigEntry.Value); } } private void MigrateOldConfigSetting(string section, string key, string value) { if (section == "General Settings") { if (!(key == "ExtendedLogging")) { if (key == "EnablePlushies") { ConfigHelper.SetConfigEntryValue(EnablePlushies, value); } } else { ConfigHelper.SetConfigEntryValue(ExtendedLogging, value); } } if (!(section == "Takey Goku Bracken Settings")) { return; } if (!(key == "MaxSpawnCount")) { if (key == "SpawnChance") { ConfigHelper.SetConfigEntryValue(TakeyGokuBracken_SpawnChance, value); } } else { ConfigHelper.SetConfigEntryValue(TakeyGokuBracken_MaxSpawnCount, value); } } } internal static class Content { public static GameObject NetworkHandlerPrefab { get; private set; } public static GameObject TakeyGokuBrackenControllerPrefab { get; private set; } public static Item SmolTakeyGokuPlushie { get; private set; } public static Item TakeyGokuPlushie { get; private set; } public static HallucinocepsAssets HallucinocepsAssets { get; private set; } public static Sprite ModIcon { get; private set; } public static void Load() { LoadAssetsFromAssetBundle(); } private static void LoadAssetsFromAssetBundle() { AssetBundle val = LoadAssetBundle("takeygokubracken_assets"); if (!((Object)(object)val == (Object)null)) { NetworkHandlerPrefab = LoadAssetFromAssetBundle("NetworkHandler", val); NetworkHandlerPrefab.AddComponent(); TakeyGokuBrackenControllerPrefab = LoadAssetFromAssetBundle("TakeyGokuBrackenController", val); SmolTakeyGokuPlushie = LoadAssetFromAssetBundle("SmolTakeyGokuPlushie", val); TakeyGokuPlushie = LoadAssetFromAssetBundle("TakeyGokuPlushie", val); HallucinocepsAssets = LoadAssetFromAssetBundle("HallucinocepsAssets", val); ModIcon = LoadAssetFromAssetBundle("ModIcon", val); Plugin.Logger.LogInfo((object)"Successfully loaded assets from AssetBundle!"); } } private static AssetBundle LoadAssetBundle(string fileName) { try { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location); string text = Path.Combine(directoryName, fileName); return AssetBundle.LoadFromFile(text); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Failed to load AssetBundle \"{fileName}\". {arg}"); } return null; } private static T LoadAssetFromAssetBundle(string name, AssetBundle assetBundle) where T : Object { if (string.IsNullOrWhiteSpace(name)) { Plugin.Logger.LogError((object)("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) { Plugin.Logger.LogError((object)("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) { Plugin.Logger.LogError((object)("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; } } 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) { Plugin.Logger.LogError((object)"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)); Plugin.Logger.LogInfo((object)$"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.SpawnWeightValue, 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) { Plugin.Logger.LogError((object)"Failed to update scrap item rarity. Item is null."); return; } if ((Object)(object)StartOfRound.Instance == (Object)null) { Plugin.Logger.LogError((object)"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; Plugin.Logger.LogInfo((object)$"Updated \"{item.itemName}\" scrap item rarity to {rarity} on \"{val.PlanetName}\"."); } } } } public static void UpdateScrapRarity(ItemConfigData itemConfigData) { UpdateScrapRarity(itemConfigData.Item, itemConfigData.SpawnWeightValue); } public static void UpdateItemProperties(Item item, bool twoHanded, int carryWeight, int minValue, int maxValue) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null) { Plugin.Logger.LogError((object)"Failed to update item properties. Item is null."); return; } item.twoHanded = twoHanded; item.weight = (float)carryWeight / 105f + 1f; item.minValue = minValue; item.maxValue = maxValue; Plugin.Logger.LogInfo((object)$"Updated \"{item.itemName}\" item properties. (TwoHanded: {twoHanded}, CarryWeight: {carryWeight}, MinValue: {minValue}, MaxValue: {maxValue})"); if (NetworkUtils.IsServer) { PluginNetworkBehaviour.Instance.UpdateItemPropertiesClientRpc(item.itemName, twoHanded, carryWeight, minValue, maxValue); } } public static void UpdateItemProperties(string itemName, bool twoHanded, int carryWeight, int minValue, int maxValue) { if (!TryGetItem(itemName, out var item, matchCase: false)) { Plugin.Logger.LogError((object)("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) { Plugin.Logger.LogError((object)"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) { Plugin.Logger.LogError((object)"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; } } internal static class ModpackSaveSystem { public const string FileName = "TakeyGokuBracken_SaveData.json"; private static JObject _saveFileObject; public static string FilePath { get { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Config.ConfigFilePath); return Path.Combine(directoryName, "TakeyGokuBracken_SaveData.json"); } } public static bool FileExists => File.Exists(FilePath); public static void Initialize() { if (!FileExists) { WriteFile(JObject.Parse("{}")); } _saveFileObject = ReadFile(); } public static bool ContainsKey(string key) { return _saveFileObject.ContainsKey(key); } public static T ReadValue(string key, T defaultValue = default(T)) { //IL_0019: Expected O, but got Unknown JToken val = default(JToken); if (_saveFileObject.TryGetValue(key, ref val)) { try { return val.ToObject(); } catch (JsonException val2) { JsonException val3 = val2; Plugin.Logger.LogError((object)("JSON Conversion Error: " + ((Exception)(object)val3).Message)); } catch (ArgumentNullException ex) { Plugin.Logger.LogError((object)("Argument Null Error: " + ex.Message)); } catch (Exception ex2) { Plugin.Logger.LogError((object)("Unexpected Error: " + ex2.Message)); } return defaultValue; } return defaultValue; } public static void WriteValue(string key, T value) { JToken val = JToken.FromObject((object)value); if (_saveFileObject.ContainsKey(key)) { _saveFileObject[key] = val; } else { _saveFileObject.Add(key, val); } WriteFile(_saveFileObject); } private static JObject ReadFile() { try { using FileStream stream = new FileStream(FilePath, FileMode.Open, FileAccess.ReadWrite); using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8); return JObject.Parse(streamReader.ReadToEnd()); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Failed to read save file. {arg}"); } return null; } private static bool WriteFile(JObject jObject) { try { using FileStream stream = new FileStream(FilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite); using StreamWriter streamWriter = new StreamWriter(stream, Encoding.UTF8); streamWriter.WriteLine(((object)jObject).ToString()); return true; } catch (Exception arg) { Plugin.Logger.LogError((object)$"Failed to write save file. {arg}"); } return false; } } internal static class NetworkUtils { public static bool IsServer { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsServer; } } public static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsHost; } } public static ulong GetLocalClientId() { return NetworkManager.Singleton.LocalClientId; } public static bool IsLocalClientId(ulong clientId) { return clientId == GetLocalClientId(); } } internal static class PlayerUtils { public static ulong GetLocalClientId() { return NetworkManager.Singleton.LocalClientId; } public static ulong GetLocalPlayerId() { return GetLocalPlayerScript().playerClientId; } public static bool IsLocalPlayerId(ulong playerId) { return playerId == GetLocalPlayerId(); } public static PlayerControllerB GetLocalPlayerScript() { return GameNetworkManager.Instance.localPlayerController; } } [BepInPlugin("com.github.zehsteam.TakeyGokuBracken", "TakeyGokuBracken", "1.5.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.TakeyGokuBracken"); internal static Plugin Instance; internal static ManualLogSource Logger; internal static ConfigManager ConfigManager; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = Logger.CreateLogSource("com.github.zehsteam.TakeyGokuBracken"); Logger.LogInfo((object)"TakeyGokuBracken has awoken!"); _harmony.PatchAll(typeof(GameNetworkManagerPatch)); _harmony.PatchAll(typeof(StartOfRoundPatch)); _harmony.PatchAll(typeof(FlowermanAIPatch)); _harmony.PatchAll(typeof(PlayerControllerBPatch)); if (GokuBrackenProxy.Enabled) { GokuBrackenProxy.PatchAll(_harmony); } Content.Load(); ConfigManager = new ConfigManager(); ModpackSaveSystem.Initialize(); FlowermanAIPatch.Reset(); ConfigHelper.SetModIcon(Content.ModIcon); ConfigHelper.SetModDescription("Adds 2 scrap and 1 enemy reskin. Requires the GokuBracken mod to be installed for most features. (This mod is included with the TakeyPlush mod)"); RegisterScrapItems(); NetcodePatcherAwake(); } private void NetcodePatcherAwake() { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); Type[] types = executingAssembly.GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { try { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { try { methodInfo.Invoke(null, null); } catch (TargetInvocationException ex) { Logger.LogWarning((object)("Failed to invoke method " + methodInfo.Name + ": " + ex.Message)); } } } catch (Exception ex2) { Logger.LogWarning((object)("Error processing method " + methodInfo.Name + " in type " + type.Name + ": " + ex2.Message)); } } } } catch (Exception ex3) { Logger.LogError((object)("An error occurred in NetcodePatcherAwake: " + ex3.Message)); } } public void OnLocalDisconnect() { FlowermanAIPatch.Reset(); } public void OnShipHasLeft() { FlowermanAIPatch.DespawnAllControllers(); FlowermanAIPatch.Reset(); ForceDespawnAllTakeyGokuBrackenControllersOnServer(); } private void RegisterScrapItems() { ItemHelper.RegisterScrap(ConfigManager.SmolTakeyGokuPlushie); ItemHelper.RegisterScrap(ConfigManager.TakeyGokuPlushie); } public bool SetTakeyGokuBrackenOnServer(FlowermanAI flowermanAI) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (!NetworkUtils.IsServer) { return false; } if ((Object)(object)flowermanAI == (Object)null) { Logger.LogError((object)"Failed to set Takey Goku Bracken on server. FlowermanAI is null."); return false; } NetworkObject component = ((Component)flowermanAI).GetComponent(); if (GokuBrackenProxy.Enabled && !GokuBrackenProxy.IsGokuBracken(flowermanAI)) { Logger.LogError((object)$"Failed to set Takey Goku Bracken on server. Enemy is not a Goku Bracken. (NetworkObject: {component.NetworkObjectId})"); return false; } if (Utils.IsTakeyGokuBracken(flowermanAI)) { Logger.LogWarning((object)$"Warning: Failed to set Takey Goku Bracken on server. Enemy is already a Takey Goku Bracken. (NetworkObject: {component.NetworkObjectId})"); return false; } SpawnTakeyGokuControllerOnServer(((Component)component).transform); PluginNetworkBehaviour.Instance.SetTakeyGokuClientRpc(NetworkObjectReference.op_Implicit(component)); SetTakeyGokuBrackenOnLocalClient(component); LogInfoExtended($"Spawned Takey Goku Bracken. (NetworkObject: {component.NetworkObjectId})"); return true; } public void SetTakeyGokuBrackenOnLocalClient(NetworkObject enemyNetworkObject) { //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) if (!GokuBrackenProxy.Enabled) { return; } FlowermanAI val = default(FlowermanAI); if ((Object)(object)enemyNetworkObject == (Object)null) { Logger.LogError((object)"Failed to set Takey Goku Bracken on local client. Enemy NetworkObject is null."); } else if (((Component)enemyNetworkObject).TryGetComponent(ref val)) { if (GokuBrackenProxy.Enabled && !GokuBrackenProxy.IsGokuBracken(val)) { Logger.LogError((object)$"Failed to set Takey Goku Bracken on local client. Enemy \"{((Object)((Component)enemyNetworkObject).gameObject).name}\" is not a Goku Bracken. (NetworkObject: {enemyNetworkObject.NetworkObjectId})"); return; } if (!FlowermanAIPatch.EnemyControllerPairs.ContainsKey(val)) { try { Transform val2 = ((Component)enemyNetworkObject).transform.Find("TakeyGokuBrackenController(Clone)"); val2.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); FlowermanAIPatch.AddEnemyControllerPair(val, ((Component)val2).GetComponent()); LogInfoExtended($"Initialized Takey Goku Bracken on local client. (NetworkObject: {enemyNetworkObject.NetworkObjectId})"); return; } catch (Exception arg) { Logger.LogError((object)$"Failed to set Takey Goku Bracken on local client. (NetworkObject: {enemyNetworkObject.NetworkObjectId})\n\n{arg}"); return; } } Logger.LogWarning((object)$"Failed to set Takey Goku Bracken on local client. Enemy is already a Takey Goku Bracken. (NetworkObject: {enemyNetworkObject.NetworkObjectId})"); } else { Logger.LogError((object)$"Failed to set Takey Goku Bracken on local client. Could not find FlowermanAI. (NetworkObject: {enemyNetworkObject.NetworkObjectId})"); } } private NetworkObject SpawnTakeyGokuControllerOnServer(Transform parentTransform) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!NetworkUtils.IsServer) { return null; } GameObject val = Object.Instantiate(Content.TakeyGokuBrackenControllerPrefab, Vector3.zero, Quaternion.identity, parentTransform); NetworkObject component = val.GetComponent(); component.Spawn(true); val.transform.SetParent(parentTransform); return component; } private void ForceDespawnAllTakeyGokuBrackenControllersOnServer() { if (!NetworkUtils.IsServer) { return; } TakeyGokuBrackenBehaviour[] array = Object.FindObjectsByType((FindObjectsSortMode)0); if (array.Length == 0) { return; } Transform[] array2 = (from x in array select ((Component)x).transform.parent into x where (Object)(object)x != (Object)null select x).ToArray(); Transform[] array3 = array2; NetworkObject val2 = default(NetworkObject); foreach (Transform val in array3) { if (((Component)val).TryGetComponent(ref val2)) { if (!val2.IsSpawned) { Logger.LogError((object)"Failed to force despawn Takey Goku Bracken controller. NetworkObject is not spawned."); break; } val2.Despawn(true); LogInfoExtended("Force despawned Takey Goku Bracken controller."); } else { Logger.LogError((object)"Failed to force despawn Takey Goku Bracken controller. NetworkObject is null."); } } } public void LogInfoExtended(object data) { LogExtended((LogLevel)16, data); } public void LogExtended(LogLevel level, object data) { //IL_0018: 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) if (ConfigManager == null || ConfigManager.ExtendedLogging == null) { Logger.Log(level, data); } else if (ConfigManager.ExtendedLogging.Value) { Logger.Log(level, data); } } } internal static class SteamUtils { public static bool IsLocalPlayerTakerst() { return IsLocalPlayer("Takerst", 76561197980238122uL); } public static bool IsLocalPlayer(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; } } public static class Utils { public static bool RandomPercent(float percent) { if (percent <= 0f) { return false; } if (percent >= 100f) { return true; } return Random.value * 100f <= percent; } public static bool IsTakeyGokuBracken(FlowermanAI flowermanAI) { return (Object)(object)((Component)flowermanAI).GetComponentInChildren() != (Object)null; } public static bool IsTakeyGokuBracken(FlowermanAI flowermanAI, out TakeyGokuBrackenBehaviour behaviour) { behaviour = ((Component)flowermanAI).GetComponentInChildren(); return (Object)(object)behaviour != (Object)null; } 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 class MyPluginInfo { public const string PLUGIN_GUID = "com.github.zehsteam.TakeyGokuBracken"; public const string PLUGIN_NAME = "TakeyGokuBracken"; public const string PLUGIN_VERSION = "1.5.0"; } } namespace com.github.zehsteam.TakeyGokuBracken.Patches { [HarmonyPatch(typeof(FlowermanAI))] internal static class FlowermanAIPatch { [CompilerGenerated] private sealed class d__13 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FlowermanAI flowermanAI; 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() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; TrySpawnTakeyGokuBracken(flowermanAI); 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 int TakeyGokuBrackenSpawnCount = 0; public static bool ForceTakeyGokuBrackenSpawns = false; public static int ForceTakeyGokuBrackenMaxSpawnCount = -1; public static Dictionary EnemyControllerPairs { get; private set; } = new Dictionary(); public static void Reset() { EnemyControllerPairs = new Dictionary(); TakeyGokuBrackenSpawnCount = 0; ForceTakeyGokuBrackenSpawns = false; ForceTakeyGokuBrackenMaxSpawnCount = -1; } public static void AddEnemyControllerPair(FlowermanAI flowermanAI, TakeyGokuBrackenBehaviour controllerScript) { EnemyControllerPairs.Add(flowermanAI, controllerScript); } public static void DespawnAllControllers() { if (!NetworkUtils.IsServer) { return; } foreach (TakeyGokuBrackenBehaviour value in EnemyControllerPairs.Values) { DespawnController(value); } EnemyControllerPairs.Clear(); Plugin.Instance.LogInfoExtended("Finished despawning all Takey Goku Bracken controllers."); } public static void DespawnController(FlowermanAI flowermanAI) { if (!NetworkUtils.IsServer) { return; } NetworkObject component = ((Component)flowermanAI).GetComponent(); TakeyGokuBrackenBehaviour value; if ((Object)(object)component == (Object)null) { Plugin.Logger.LogError((object)"Failed to despawn Takey Goku Bracken controller. Enemy NetworkObject is null."); } else if (EnemyControllerPairs.TryGetValue(flowermanAI, out value)) { try { DespawnController(value); EnemyControllerPairs.Remove(flowermanAI); Plugin.Instance.LogInfoExtended($"Despawned Takey Goku Bracken controller (NetworkObjectId: {component.NetworkObjectId})."); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Failed to despawn Takey Goku Bracken controller. (NetworkObjectId: {component.NetworkObjectId}).\n\n{arg}"); } } } public static void DespawnController(TakeyGokuBrackenBehaviour controllerScript) { if (NetworkUtils.IsServer) { NetworkObject component = ((Component)controllerScript).GetComponent(); if ((Object)(object)component == (Object)null) { Plugin.Logger.LogError((object)"Failed to despawn Takey Goku Bracken controller. NetworkObject is null."); } else if (!component.IsSpawned) { Plugin.Logger.LogError((object)"Failed to despawn Takey Goku Bracken controller. NetworkObject is not spawned."); } else { component.Despawn(true); } } } [HarmonyPatch("Start")] [HarmonyPostfix] [HarmonyPriority(0)] private static void StartPatch(ref FlowermanAI __instance) { if (NetworkUtils.IsServer) { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(LateStartCO(__instance)); } } [IteratorStateMachine(typeof(d__13))] private static IEnumerator LateStartCO(FlowermanAI flowermanAI) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { flowermanAI = flowermanAI }; } private static bool TrySpawnTakeyGokuBracken(FlowermanAI flowermanAI) { int num = Plugin.ConfigManager.TakeyGokuBracken_MaxSpawnCount.Value; int value = Plugin.ConfigManager.TakeyGokuBracken_SpawnChance.Value; if (ForceTakeyGokuBrackenMaxSpawnCount > -1) { num = ForceTakeyGokuBrackenMaxSpawnCount; } if (!ForceTakeyGokuBrackenSpawns) { if (TakeyGokuBrackenSpawnCount >= num) { return false; } if (!Utils.RandomPercent(value)) { return false; } } return Plugin.Instance.SetTakeyGokuBrackenOnServer(flowermanAI); } [HarmonyPatch("KillEnemy")] [HarmonyPrefix] private static void KillEnemyPatch(ref FlowermanAI __instance, bool destroy) { if (NetworkUtils.IsServer && Utils.IsTakeyGokuBracken(__instance) && destroy) { DespawnController(__instance); } } [HarmonyPatch("KillPlayerAnimationServerRpc")] [HarmonyPrefix] private static void KillPlayerAnimationServerRpcPatch(ref FlowermanAI __instance) { if (Utils.IsTakeyGokuBracken(__instance, out var behaviour)) { behaviour.SetRandomCrackNeckSFXOnServer(); } } } [HarmonyPatch(typeof(GameNetworkManager))] internal static class GameNetworkManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { AddNetworkPrefabs(); } private static void AddNetworkPrefabs() { AddNetworkPrefab(Content.NetworkHandlerPrefab); AddNetworkPrefab(Content.TakeyGokuBrackenControllerPrefab); } private static void AddNetworkPrefab(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { Plugin.Logger.LogError((object)"Failed to register network prefab. GameObject is null."); return; } NetworkManager.Singleton.AddNetworkPrefab(prefab); Plugin.Logger.LogInfo((object)("Registered \"" + ((Object)prefab).name + "\" network prefab.")); } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class PlayerControllerBPatch { [CompilerGenerated] private sealed class d__4 : 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__4(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.GetLocalPlayerScript(); 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; Plugin.Instance.LogInfoExtended("Cancelled local player ignored fall damage."); _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 _ignoreNextFallDamage; private static Coroutine _ignoreNextFallCancelCheck; [HarmonyPatch("PlayerHitGroundEffects")] [HarmonyPrefix] private static void PlayerHitGroundEffectsPatch(ref PlayerControllerB __instance) { if (!((Object)(object)__instance != (Object)(object)PlayerUtils.GetLocalPlayerScript()) && _ignoreNextFallDamage) { _ignoreNextFallDamage = false; if (__instance.fallValueUncapped < -39f) { __instance.fallValueUncapped = -39f; } if (__instance.fallValue < -38f) { __instance.fallValue = -38f; } Plugin.Instance.LogInfoExtended("Local player ignored fall damage."); } } public static void IgnoreNextFallDamage() { _ignoreNextFallDamage = true; if (_ignoreNextFallCancelCheck != null) { ((MonoBehaviour)StartOfRound.Instance).StopCoroutine(_ignoreNextFallCancelCheck); } _ignoreNextFallCancelCheck = ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(IgnoreNextFallCancelCheck()); } [IteratorStateMachine(typeof(d__4))] private static IEnumerator IgnoreNextFallCancelCheck() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0); } } [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(Content.NetworkHandlerPrefab, Vector3.zero, Quaternion.identity); val.GetComponent().Spawn(false); } } [HarmonyPatch("Start")] [HarmonyPostfix] [HarmonyPriority(300)] private static void StartPatch() { foreach (ItemConfigData instance in ItemConfigData.Instances) { instance.RefreshConfigData(); } if (GokuBrackenProxy.Enabled && HallucinocepsProxy.Enabled) { HallucinocepsProxy.AddHallucinationSounds(); } } [HarmonyPatch("OnClientConnect")] [HarmonyPrefix] private static void OnClientConnectPatch(ref ulong clientId) { SendConfigsToNewConnectedPlayer(clientId); } private static void SendConfigsToNewConnectedPlayer(ulong clientId) { if (!NetworkUtils.IsServer) { return; } Plugin.Logger.LogInfo((object)$"Sending item config data to client: {clientId}"); foreach (ItemConfigData instance in ItemConfigData.Instances) { instance.SendConfigDataToClient(clientId); } } [HarmonyPatch("ShipHasLeft")] [HarmonyPostfix] private static void ShipHasLeftPatch() { Plugin.Instance.OnShipHasLeft(); } [HarmonyPatch("OnLocalDisconnect")] [HarmonyPrefix] private static void OnLocalDisconnectPatch() { Plugin.Instance.OnLocalDisconnect(); } } } namespace com.github.zehsteam.TakeyGokuBracken.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(1516145776u, serverRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1516145776u, 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(3699628756u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3699628756u, 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(1516145776u, new RpcReceiveHandler(__rpc_handler_1516145776), "PlaySoundServerRpc"); ((NetworkBehaviour)this).__registerRpc(3699628756u, new RpcReceiveHandler(__rpc_handler_3699628756), "PlaySoundClientRpc"); base.__initializeRpcs(); } private static void __rpc_handler_1516145776(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_3699628756(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"; } } public class AdvancedRandomPeriodicAudioPlayer : NetworkBehaviour { public AudioSourceGroup NoiseAudio; public AudioClipGroup[] NoiseSFX = Array.Empty(); public float MinInterval; public float MaxInterval; public float PercentChance; private float _timer; private float _interval; private void Start() { SetRandomInterval(); } private void Update() { if (!NetworkUtils.IsServer) { return; } if (_timer >= _interval) { _timer = 0f; SetRandomInterval(); if (Utils.RandomPercent(PercentChance)) { PlaySoundServerRpc(Random.Range(0, NoiseSFX.Length)); } } else { _timer += Time.deltaTime; } } private void SetRandomInterval() { _interval = Random.Range(MinInterval, MaxInterval); } [ServerRpc(RequireOwnership = false)] private void PlaySoundServerRpc(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.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4251847043u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4251847043u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; PlaySoundClientRpc(index); } } } [ClientRpc] private void PlaySoundClientRpc(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(1611995967u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1611995967u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; NoiseAudio.PlayOneShot(NoiseSFX[index]); } } } 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(4251847043u, new RpcReceiveHandler(__rpc_handler_4251847043), "PlaySoundServerRpc"); ((NetworkBehaviour)this).__registerRpc(1611995967u, new RpcReceiveHandler(__rpc_handler_1611995967), "PlaySoundClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_4251847043(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; ((AdvancedRandomPeriodicAudioPlayer)(object)target).PlaySoundServerRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1611995967(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; ((AdvancedRandomPeriodicAudioPlayer)(object)target).PlaySoundClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "AdvancedRandomPeriodicAudioPlayer"; } } 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 UpdateItemPropertiesClientRpc(string itemName, bool twoHanded, int carryWeight, int minValue, int maxValue, 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00ca: 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_00e4: 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) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2102329058u, clientRpcParams, (RpcDelivery)0); bool flag = itemName != null; ((FastBufferWriter)(ref val)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(itemName, false); } ((FastBufferWriter)(ref val)).WriteValueSafe(ref twoHanded, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, carryWeight); BytePacker.WriteValueBitPacked(val, minValue); BytePacker.WriteValueBitPacked(val, maxValue); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2102329058u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { ItemHelper.UpdateItemProperties(itemName, twoHanded, carryWeight, minValue, maxValue); } } } [ClientRpc] public void SetTakeyGokuClientRpc(NetworkObjectReference enemyReference) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3517081936u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref enemyReference, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3517081936u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!NetworkUtils.IsServer) { NetworkObject takeyGokuBrackenOnLocalClient = default(NetworkObject); if (((NetworkObjectReference)(ref enemyReference)).TryGet(ref takeyGokuBrackenOnLocalClient, (NetworkManager)null)) { Plugin.Instance.SetTakeyGokuBrackenOnLocalClient(takeyGokuBrackenOnLocalClient); } else { Plugin.Instance.SetTakeyGokuBrackenOnLocalClient(null); } } } 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(2102329058u, new RpcReceiveHandler(__rpc_handler_2102329058), "UpdateItemPropertiesClientRpc"); ((NetworkBehaviour)this).__registerRpc(3517081936u, new RpcReceiveHandler(__rpc_handler_3517081936), "SetTakeyGokuClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2102329058(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_0076: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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 = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string itemName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemName, false); } bool twoHanded = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref twoHanded, default(ForPrimitives)); int carryWeight = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref carryWeight); int minValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref minValue); int maxValue = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref maxValue); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).UpdateItemPropertiesClientRpc(itemName, twoHanded, carryWeight, minValue, maxValue, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3517081936(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 takeyGokuClientRpc = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe(ref takeyGokuClientRpc, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PluginNetworkBehaviour)(object)target).SetTakeyGokuClientRpc(takeyGokuClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PluginNetworkBehaviour"; } } public class TakeyGokuBrackenBehaviour : NetworkBehaviour { [CompilerGenerated] private sealed class d__17 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TakeyGokuBrackenBehaviour <>4__this; private int 5__2; 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown int num = <>1__state; TakeyGokuBrackenBehaviour takeyGokuBrackenBehaviour = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; takeyGokuBrackenBehaviour.SetMaterials(); 5__2 = 0; break; case 2: <>1__state = -1; takeyGokuBrackenBehaviour.SetMaterials(); 5__2++; break; } if (5__2 < 10) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; 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(); } } public Material clothesMaterial; public Material headMaterial; public AudioClip[] takeyFoundSFX = Array.Empty(); public AudioClip[] takeyCrackNeckSFX = Array.Empty(); public AudioClip ChaseSFX; public AudioSource DeathAudio; private FlowermanAI _flowermanAI; private ScanNodeProperties _scanNodeProperties; private PlayAudioAnimationEvent _playAudioAnimationEvent; private float _timer; public FlowermanAI FlowermanAI { get { if ((Object)(object)_flowermanAI == (Object)null) { _flowermanAI = ((Component)((Component)this).transform.parent).GetComponent(); } return _flowermanAI; } } public ScanNodeProperties ScanNodeProperties { get { if ((Object)(object)_scanNodeProperties == (Object)null) { _scanNodeProperties = ((Component)FlowermanAI).GetComponentInChildren(); } return _scanNodeProperties; } } public PlayAudioAnimationEvent PlayAudioAnimationEvent { get { if ((Object)(object)_playAudioAnimationEvent == (Object)null) { _playAudioAnimationEvent = ((Component)FlowermanAI).GetComponentInChildren(); } return _playAudioAnimationEvent; } } 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)FlowermanAI == (Object)null) && GokuBrackenProxy.Enabled) { SetMaterials(); SetScanNodeProperties("Takey Goku"); FlowermanAI.creatureAngerVoice.clip = ChaseSFX; if (NetworkUtils.IsServer) { SetSFXOnServer(); } ((MonoBehaviour)this).StartCoroutine(ForceSetMaterials()); } } [IteratorStateMachine(typeof(d__17))] private IEnumerator ForceSetMaterials() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { <>4__this = this }; } private void Update() { if (NetworkUtils.IsServer && GokuBrackenProxy.Enabled) { if (_timer >= 20f) { _timer = 0f; SetRandomFoundSFXOnServer(); } _timer += Time.deltaTime; } } private void SetMaterials() { for (int i = 0; i < ((Component)FlowermanAI).transform.childCount; i++) { Transform child = ((Component)FlowermanAI).transform.GetChild(i); string[] array = new string[4] { "Base Goku", "God Goku", "SSJ Goku", "SSB Goku" }; string[] array2 = array; foreach (string value in array2) { if (((Object)child).name.Equals(value, StringComparison.OrdinalIgnoreCase)) { SetMaterialsOnBaseGoku(child); } } } } private void SetMaterialsOnBaseGoku(Transform baseGokuTransform) { SkinnedMeshRenderer componentInChildren = ((Component)baseGokuTransform.GetChild(0)).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { SetSkinnedMeshRendererMaterials(componentInChildren, clothesMaterial, headMaterial); } } private void SetSkinnedMeshRendererMaterials(SkinnedMeshRenderer skinnedMeshRenderer, Material material1, Material material2) { Material[] sharedMaterials = ((Renderer)skinnedMeshRenderer).sharedMaterials; sharedMaterials[0] = material1; sharedMaterials[1] = material2; ((Renderer)skinnedMeshRenderer).sharedMaterials = sharedMaterials; } private void SetSFXOnServer() { SetRandomCrackNeckSFXOnServer(); SetRandomFoundSFXOnServer(); } public void SetRandomCrackNeckSFXOnServer() { if (NetworkUtils.IsServer) { int crackNeckSFXClientRpc = Random.Range(0, takeyCrackNeckSFX.Length); SetCrackNeckSFXClientRpc(crackNeckSFXClientRpc); } } [ClientRpc] private void SetCrackNeckSFXClientRpc(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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2929643050u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2929643050u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (GokuBrackenProxy.Enabled) { AudioClip val3 = takeyCrackNeckSFX[index]; FlowermanAI.crackNeckSFX = val3; FlowermanAI.crackNeckAudio.clip = val3; } } } public void SetRandomFoundSFXOnServer() { if (NetworkUtils.IsServer) { int foundSFXClientRpc = Random.Range(0, takeyFoundSFX.Length); SetFoundSFXClientRpc(foundSFXClientRpc); } } [ClientRpc] private void SetFoundSFXClientRpc(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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3425590996u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3425590996u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (GokuBrackenProxy.Enabled) { PlayAudioAnimationEvent.audioClip = takeyFoundSFX[index]; } } } private void SetScanNodeProperties(string headerText) { ScanNodeProperties.headerText = headerText; } public void OnDeath() { if (GokuBrackenProxy.Enabled && GokuBrackenProxy.UseDeathSound()) { DeathAudio.Play(); } } 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(2929643050u, new RpcReceiveHandler(__rpc_handler_2929643050), "SetCrackNeckSFXClientRpc"); ((NetworkBehaviour)this).__registerRpc(3425590996u, new RpcReceiveHandler(__rpc_handler_3425590996), "SetFoundSFXClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2929643050(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 crackNeckSFXClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref crackNeckSFXClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyGokuBrackenBehaviour)(object)target).SetCrackNeckSFXClientRpc(crackNeckSFXClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3425590996(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 foundSFXClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref foundSFXClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((TakeyGokuBrackenBehaviour)(object)target).SetFoundSFXClientRpc(foundSFXClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TakeyGokuBrackenBehaviour"; } } public class TakeyGokuPlushBehaviour : AdvancedNoisemakerProp { protected override void __initializeVariables() { base.__initializeVariables(); } protected override void __initializeRpcs() { base.__initializeRpcs(); } protected internal override string __getTypeName() { return "TakeyGokuPlushBehaviour"; } } } namespace com.github.zehsteam.TakeyGokuBracken.Dependencies { internal static class HallucinocepsProxy { public const string PLUGIN_GUID = "PloufJPEG.Hallucinoceps"; public static bool Enabled => Chainloader.PluginInfos.ContainsKey("PloufJPEG.Hallucinoceps"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddHallucinationSounds() { try { List list = CompanyCreaturesNetworker.instance.hallucinationSounds.ToList(); AudioClip[] hallucinationSounds = Content.HallucinocepsAssets.HallucinationSounds; foreach (AudioClip item in hallucinationSounds) { if (!list.Contains(item)) { list.Add(item); } } CompanyCreaturesNetworker.instance.hallucinationSounds = list.ToArray(); Plugin.Logger.LogInfo((object)"Added hallucination sounds to the Hallucinoceps mod."); } catch (Exception arg) { Plugin.Logger.LogError((object)$"Failed to add hallucination sounds to the Hallucinoceps mod. {arg}"); } } } internal static class LethalConfigProxy { public const string PLUGIN_GUID = "ainavt.lc.lethalconfig"; public static bool Enabled => Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SetModIcon(Sprite sprite) { LethalConfigManager.SetModIcon(sprite); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SetModDescription(string description) { LethalConfigManager.SetModDescription(description); } [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 description, string buttonText, 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(); })); } } } namespace com.github.zehsteam.TakeyGokuBracken.Dependencies.GokuBrackenProxy { internal static class GokuBrackenProxy { public const string PLUGIN_GUID = "Vulf.GokuBracken"; public static bool Enabled => Chainloader.PluginInfos.ContainsKey("Vulf.GokuBracken"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void PatchAll(Harmony harmony) { harmony.PatchAll(typeof(GokuControllerPatch)); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool IsGokuBracken(FlowermanAI flowermanAI) { if ((Object)(object)flowermanAI == (Object)null) { return false; } return (Object)(object)((Component)flowermanAI).GetComponentInChildren() != (Object)null; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static bool UseDeathSound() { try { return ConfigManager.UseDeathSound.Value; } catch { Plugin.Logger.LogError((object)"Failed to check if GokuBracken has UseDeathSound enabled."); } return true; } } } namespace com.github.zehsteam.TakeyGokuBracken.Dependencies.GokuBrackenProxy.Patches { [HarmonyPatch(typeof(GokuController))] internal static class GokuControllerPatch { [HarmonyPatch("KillGoku")] [HarmonyPostfix] private static void KillGokuPatch(ref GokuController __instance) { if (FlowermanAIPatch.EnemyControllerPairs.TryGetValue(__instance.FlowermanAI, out var value)) { AudioSource componentInChildren = __instance.BaseGokuObject.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); } value.OnDeath(); } } } } namespace com.github.zehsteam.TakeyGokuBracken.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(); } } [CreateAssetMenu(fileName = "HallucinocepsAssets", menuName = "TakeyGokuBracken/HallucinocepsAssets")] public class HallucinocepsAssets : ScriptableObject { public AudioClip[] HallucinationSounds = Array.Empty(); } public class ItemConfigData { public static List Instances { get; private set; } = new List(); public ConfigEntry SpawnWeight { get; private set; } public ConfigEntry TwoHanded { get; private set; } public ConfigEntry CarryWeight { get; private set; } public ConfigEntry MinValue { get; private set; } public ConfigEntry MaxValue { get; private set; } public int SpawnWeightValue { get { if (!GokuBrackenProxy.Enabled && !Plugin.ConfigManager.EnablePlushies.Value) { return 0; } return SpawnWeight.Value; } } 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); MigrateOldConfigSettings(); } 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, requiresRestart: false, Item.itemName + " spawn chance weight."); TwoHanded = ConfigHelper.Bind(section, "TwoHanded", twoHanded, requiresRestart: false, "If enabled, " + Item.itemName + " will be two-handed."); CarryWeight = ConfigHelper.Bind(section, "CarryWeight", carryWeight, requiresRestart: false, Item.itemName + " carry weight in pounds."); MinValue = ConfigHelper.Bind(section, "MinValue", minValue, requiresRestart: false, Item.itemName + " min scrap value."); MaxValue = ConfigHelper.Bind(section, "MaxValue", maxValue, requiresRestart: false, Item.itemName + " max scrap value."); SpawnWeight.SettingChanged += SpawnWeight_SettingsChanged; TwoHanded.SettingChanged += Properties_SettingsChanged; CarryWeight.SettingChanged += Properties_SettingsChanged; MinValue.SettingChanged += Properties_SettingsChanged; MaxValue.SettingChanged += Properties_SettingsChanged; } } private void MigrateOldConfigSettings() { foreach (KeyValuePair orphanedConfigEntry in ConfigHelper.GetOrphanedConfigEntries()) { MigrateOldConfigSetting(orphanedConfigEntry.Key.Section, orphanedConfigEntry.Key.Key, orphanedConfigEntry.Value); } } private void MigrateOldConfigSetting(string section, string key, string value) { if (section == ((ConfigEntryBase)SpawnWeight).Definition.Section + " Settings") { switch (key) { case "SpawnWeight": ConfigHelper.SetConfigEntryValue(SpawnWeight, value); break; case "TwoHanded": ConfigHelper.SetConfigEntryValue(TwoHanded, value); break; case "CarryWeight": ConfigHelper.SetConfigEntryValue(CarryWeight, value); break; case "MinValue": ConfigHelper.SetConfigEntryValue(MinValue, value); break; case "MaxValue": ConfigHelper.SetConfigEntryValue(MaxValue, value); break; } } } public void RefreshConfigData() { if (NetworkUtils.IsServer) { Plugin.Instance.LogInfoExtended("Refreshing \"" + Item.itemName + "\" config data."); ItemHelper.UpdateScrapRarity(this); ItemHelper.UpdateItemProperties(this); } } public void SendConfigDataToClient(ulong clientId) { //IL_000a: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (NetworkUtils.IsServer) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList(clientId) }; ClientRpcParams clientRpcParams = val; Plugin.Instance.LogInfoExtended($"Sending \"{Item.itemName}\" config data to client: {clientId}"); PluginNetworkBehaviour.Instance.UpdateItemPropertiesClientRpc(Item.itemName, TwoHanded.Value, CarryWeight.Value, MinValue.Value, MaxValue.Value, clientRpcParams); } } private void SpawnWeight_SettingsChanged(object sender, EventArgs e) { if (NetworkUtils.IsServer) { ItemHelper.UpdateScrapRarity(this); } } private void Properties_SettingsChanged(object sender, EventArgs e) { if (NetworkUtils.IsServer) { ItemHelper.UpdateItemProperties(this); } } } } 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.TakeyGokuBracken.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }