Decompiled source of MyLegModPack v1.1.1
plugins/BetterTruckHeals.dll
Decompiled 3 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BetterTruckHeals")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BetterTruckHeals")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("819aea69-b910-4066-83d4-ca334402331c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace BetterTruckHeals; [BepInPlugin("Lazarus.BetterTruckHeals", "Better Truck Heals", "1.0.0")] public class BetterTruckHeals : BaseUnityPlugin { [HarmonyPatch(typeof(PlayerAvatar), "FinalHealRPC")] public class PlayerAvatarPatch { private static readonly FieldInfo FinalHealField = typeof(PlayerAvatar).GetField("finalHeal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo IsLocalField = typeof(PlayerAvatar).GetField("isLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo PlayerNameField = typeof(PlayerAvatar).GetField("playerName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); [HarmonyPrefix] private static bool Prefix(PlayerAvatar __instance) { if (FinalHealField == null || IsLocalField == null || PlayerNameField == null) { ModLogger.LogError((object)"Failed to reflect fields in PlayerAvatar. Check assembly reference."); return true; } if ((bool)FinalHealField.GetValue(__instance)) { return true; } if ((bool)IsLocalField.GetValue(__instance)) { int value = HealAmountConfig.Value; string text = (string)PlayerNameField.GetValue(__instance); ModLogger.LogInfo((object)$"Applying custom heal amount: {value} for player: {text}"); __instance.playerHealth.EyeMaterialOverride((EyeOverrideState)2, 2f, 1); TruckScreenText.instance.MessageSendCustom("", text + " {arrowright}{truck}{check}\n {point}{shades}{pointright}<b><color=#00FF00>+" + value + "</color></b>{heart}", 0); __instance.playerHealth.Heal(value, true); FinalHealField.SetValue(__instance, true); } return false; } [HarmonyPostfix] private static void Postfix(PlayerAvatar __instance) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) TruckHealer.instance.Heal(__instance); __instance.truckReturn.Play(__instance.PlayerVisionTarget.VisionTransform.position, 1f, 1f, 1f, 1f); __instance.truckReturnGlobal.Play(__instance.PlayerVisionTarget.VisionTransform.position, 1f, 1f, 1f, 1f); ((Component)__instance.playerAvatarVisuals.effectGetIntoTruck).gameObject.SetActive(true); } } private const string PluginGUID = "Lazarus.BetterTruckHeals"; private const string PluginName = "Better Truck Heals"; private const string PluginVersion = "1.0.0"; public static ConfigEntry<int> HealAmountConfig; internal static ManualLogSource ModLogger; private void Awake() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"John 11:11!"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"WAKEY WAKEY!"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"BetterTruckHeals has risen!"); HealAmountConfig = ((BaseUnityPlugin)this).Config.Bind<int>("General", "HealAmount", 50, new ConfigDescription("The amount of health the truck healer restores to the player.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 200), Array.Empty<object>())); ModLogger = ((BaseUnityPlugin)this).Logger; ModLogger.LogInfo((object)string.Format("{0} v{1} is loading with heal amount: {2}", "Better Truck Heals", "1.0.0", HealAmountConfig.Value)); Harmony val = new Harmony("Lazarus.BetterTruckHeals"); val.PatchAll(); ModLogger.LogInfo((object)"Harmony patches applied successfully!"); } }
plugins/BetterUpgrades.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BetterUpgrades; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("Zonk")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.4.4.0")] [assembly: AssemblyInformationalVersion("1.4.4")] [assembly: AssemblyProduct("BetterUpgrades")] [assembly: AssemblyTitle("BetterUpgrades")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class ItemUpgradePlayerEnergyThree : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamEnergyUpgradeThree.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerExtraJumpThree : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamExtraJumpUpgradeThree.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerGrabRangeThree : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamRangeUpgradeThree.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerGrabStrengthThree : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamStrengthUpgradeThree.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerHealthThree : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamHealthUpgradeThree.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerSprintSpeedThree : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamSpeedUpgradeThree.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerTumbleLaunchThree : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamTumbleLaunchUpgradeThree.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerEnergyTwo : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamEnergyUpgradeTwo.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerExtraJumpTwo : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamExtraJumpUpgradeTwo.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerGrabRangeTwo : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamRangeUpgradeTwo.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerGrabStrengthTwo : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamStrengthUpgradeTwo.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerHealthTwo : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamHealthUpgradeTwo.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerSprintSpeedTwo : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamSpeedUpgradeTwo.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } public class ItemUpgradePlayerTumbleLaunchTwo : MonoBehaviour { private ItemToggle itemToggle; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if (global::BetterUpgrades.BetterUpgrades.Configuration.EnableTeamTumbleLaunchUpgradeTwo.Value && SemiFunc.IsMultiplayer()) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item)); PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item)); } return; } PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(itemToggle.playerTogglePhotonID))); } } namespace BetterUpgrades { [BepInPlugin("Zonk.BetterUpgrades", "BetterUpgrades", "1.4.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BetterUpgrades : BaseUnityPlugin { internal class Configuration { public static ConfigEntry<bool> EnableCommands; public static ConfigEntry<bool> EnableTeamEnergyUpgradeTwo; public static ConfigEntry<bool> EnableTeamEnergyUpgradeThree; public static ConfigEntry<bool> EnableTeamExtraJumpUpgradeTwo; public static ConfigEntry<bool> EnableTeamExtraJumpUpgradeThree; public static ConfigEntry<bool> EnableTeamRangeUpgradeTwo; public static ConfigEntry<bool> EnableTeamRangeUpgradeThree; public static ConfigEntry<bool> EnableTeamStrengthUpgradeTwo; public static ConfigEntry<bool> EnableTeamStrengthUpgradeThree; public static ConfigEntry<bool> EnableTeamHealthUpgradeTwo; public static ConfigEntry<bool> EnableTeamHealthUpgradeThree; public static ConfigEntry<bool> EnableTeamSpeedUpgradeTwo; public static ConfigEntry<bool> EnableTeamSpeedUpgradeThree; public static ConfigEntry<bool> EnableTeamTumbleLaunchUpgradeTwo; public static ConfigEntry<bool> EnableTeamTumbleLaunchUpgradeThree; public static ConfigEntry<int> MaxInShopEnergyOne; public static ConfigEntry<int> MaxInShopEnergyTwo; public static ConfigEntry<int> MaxInShopEnergyThree; public static ConfigEntry<int> MaxInShopExtraJumpOne; public static ConfigEntry<int> MaxInShopExtraJumpTwo; public static ConfigEntry<int> MaxInShopExtraJumpThree; public static ConfigEntry<int> MaxInShopRangeOne; public static ConfigEntry<int> MaxInShopRangeTwo; public static ConfigEntry<int> MaxInShopRangeThree; public static ConfigEntry<int> MaxInShopStrengthOne; public static ConfigEntry<int> MaxInShopStrengthTwo; public static ConfigEntry<int> MaxInShopStrengthThree; public static ConfigEntry<int> MaxInShopHealthOne; public static ConfigEntry<int> MaxInShopHealthTwo; public static ConfigEntry<int> MaxInShopHealthThree; public static ConfigEntry<int> MaxInShopSpeedOne; public static ConfigEntry<int> MaxInShopSpeedTwo; public static ConfigEntry<int> MaxInShopSpeedThree; public static ConfigEntry<int> MaxInShopTumbleLaunchOne; public static ConfigEntry<int> MaxInShopTumbleLaunchTwo; public static ConfigEntry<int> MaxInShopTumbleLaunchThree; public static ConfigEntry<int> MaxInShopPlayerCount; public static ConfigEntry<float> UpgradePriceScalingIncrease; public static ConfigEntry<float> UpgradePlayerPriceScaling; public static ConfigEntry<float> UpgradeBasePriceMultiplier; public static ConfigEntry<int> EnergyOnePriceMin; public static ConfigEntry<int> EnergyOnePriceMax; public static ConfigEntry<int> EnergyTwoPriceMin; public static ConfigEntry<int> EnergyTwoPriceMax; public static ConfigEntry<int> EnergyThreePriceMin; public static ConfigEntry<int> EnergyThreePriceMax; public static ConfigEntry<int> ExtraJumpOnePriceMin; public static ConfigEntry<int> ExtraJumpOnePriceMax; public static ConfigEntry<int> ExtraJumpTwoPriceMin; public static ConfigEntry<int> ExtraJumpTwoPriceMax; public static ConfigEntry<int> ExtraJumpThreePriceMin; public static ConfigEntry<int> ExtraJumpThreePriceMax; public static ConfigEntry<int> RangeOnePriceMin; public static ConfigEntry<int> RangeOnePriceMax; public static ConfigEntry<int> RangeTwoPriceMin; public static ConfigEntry<int> RangeTwoPriceMax; public static ConfigEntry<int> RangeThreePriceMin; public static ConfigEntry<int> RangeThreePriceMax; public static ConfigEntry<int> StrengthOnePriceMin; public static ConfigEntry<int> StrengthOnePriceMax; public static ConfigEntry<int> StrengthTwoPriceMin; public static ConfigEntry<int> StrengthTwoPriceMax; public static ConfigEntry<int> StrengthThreePriceMin; public static ConfigEntry<int> StrengthThreePriceMax; public static ConfigEntry<int> HealthOnePriceMin; public static ConfigEntry<int> HealthOnePriceMax; public static ConfigEntry<int> HealthTwoPriceMin; public static ConfigEntry<int> HealthTwoPriceMax; public static ConfigEntry<int> HealthThreePriceMin; public static ConfigEntry<int> HealthThreePriceMax; public static ConfigEntry<int> SpeedOnePriceMin; public static ConfigEntry<int> SpeedOnePriceMax; public static ConfigEntry<int> SpeedTwoPriceMin; public static ConfigEntry<int> SpeedTwoPriceMax; public static ConfigEntry<int> SpeedThreePriceMin; public static ConfigEntry<int> SpeedThreePriceMax; public static ConfigEntry<int> TumbleLaunchOnePriceMin; public static ConfigEntry<int> TumbleLaunchOnePriceMax; public static ConfigEntry<int> TumbleLaunchTwoPriceMin; public static ConfigEntry<int> TumbleLaunchTwoPriceMax; public static ConfigEntry<int> TumbleLaunchThreePriceMin; public static ConfigEntry<int> TumbleLaunchThreePriceMax; public static ConfigEntry<int> PlayerCountPriceMin; public static ConfigEntry<int> PlayerCountPriceMax; public static void Init(ConfigFile config) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Expected O, but got Unknown //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Expected O, but got Unknown //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Expected O, but got Unknown //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Expected O, but got Unknown //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Expected O, but got Unknown //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Expected O, but got Unknown //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Expected O, but got Unknown //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Expected O, but got Unknown //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Expected O, but got Unknown //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Expected O, but got Unknown //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Expected O, but got Unknown //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Expected O, but got Unknown //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Expected O, but got Unknown //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Expected O, but got Unknown //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Expected O, but got Unknown //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Expected O, but got Unknown //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Expected O, but got Unknown //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Expected O, but got Unknown //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Expected O, but got Unknown //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Expected O, but got Unknown //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Expected O, but got Unknown //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Expected O, but got Unknown //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Expected O, but got Unknown //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Expected O, but got Unknown //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Expected O, but got Unknown //IL_075a: Unknown result type (might be due to invalid IL or missing references) //IL_0764: Expected O, but got Unknown //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Expected O, but got Unknown //IL_07ca: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: Expected O, but got Unknown //IL_0802: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Expected O, but got Unknown //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_0844: Expected O, but got Unknown //IL_0872: Unknown result type (might be due to invalid IL or missing references) //IL_087c: Expected O, but got Unknown //IL_08aa: Unknown result type (might be due to invalid IL or missing references) //IL_08b4: Expected O, but got Unknown //IL_08e2: Unknown result type (might be due to invalid IL or missing references) //IL_08ec: Expected O, but got Unknown //IL_091a: Unknown result type (might be due to invalid IL or missing references) //IL_0924: Expected O, but got Unknown //IL_0952: Unknown result type (might be due to invalid IL or missing references) //IL_095c: Expected O, but got Unknown //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_0994: Expected O, but got Unknown //IL_09c2: Unknown result type (might be due to invalid IL or missing references) //IL_09cc: Expected O, but got Unknown //IL_09fa: Unknown result type (might be due to invalid IL or missing references) //IL_0a04: Expected O, but got Unknown //IL_0a32: Unknown result type (might be due to invalid IL or missing references) //IL_0a3c: Expected O, but got Unknown //IL_0a6a: Unknown result type (might be due to invalid IL or missing references) //IL_0a74: Expected O, but got Unknown //IL_0aa2: Unknown result type (might be due to invalid IL or missing references) //IL_0aac: Expected O, but got Unknown //IL_0ada: Unknown result type (might be due to invalid IL or missing references) //IL_0ae4: Expected O, but got Unknown //IL_0b12: Unknown result type (might be due to invalid IL or missing references) //IL_0b1c: Expected O, but got Unknown //IL_0b4a: Unknown result type (might be due to invalid IL or missing references) //IL_0b54: Expected O, but got Unknown //IL_0b82: Unknown result type (might be due to invalid IL or missing references) //IL_0b8c: Expected O, but got Unknown //IL_0bba: Unknown result type (might be due to invalid IL or missing references) //IL_0bc4: Expected O, but got Unknown //IL_0bf2: Unknown result type (might be due to invalid IL or missing references) //IL_0bfc: Expected O, but got Unknown //IL_0c2a: Unknown result type (might be due to invalid IL or missing references) //IL_0c34: Expected O, but got Unknown //IL_0c62: Unknown result type (might be due to invalid IL or missing references) //IL_0c6c: Expected O, but got Unknown //IL_0c9a: Unknown result type (might be due to invalid IL or missing references) //IL_0ca4: Expected O, but got Unknown //IL_0cd2: Unknown result type (might be due to invalid IL or missing references) //IL_0cdc: Expected O, but got Unknown //IL_0d0a: Unknown result type (might be due to invalid IL or missing references) //IL_0d14: Expected O, but got Unknown //IL_0d42: Unknown result type (might be due to invalid IL or missing references) //IL_0d4c: Expected O, but got Unknown //IL_0d7a: Unknown result type (might be due to invalid IL or missing references) //IL_0d84: Expected O, but got Unknown //IL_0db2: Unknown result type (might be due to invalid IL or missing references) //IL_0dbc: Expected O, but got Unknown //IL_0dea: Unknown result type (might be due to invalid IL or missing references) //IL_0df4: Expected O, but got Unknown //IL_0e22: Unknown result type (might be due to invalid IL or missing references) //IL_0e2c: Expected O, but got Unknown //IL_0e5a: Unknown result type (might be due to invalid IL or missing references) //IL_0e64: Expected O, but got Unknown //IL_0e92: Unknown result type (might be due to invalid IL or missing references) //IL_0e9c: Expected O, but got Unknown //IL_0eca: Unknown result type (might be due to invalid IL or missing references) //IL_0ed4: Expected O, but got Unknown //IL_0f02: Unknown result type (might be due to invalid IL or missing references) //IL_0f0c: Expected O, but got Unknown //IL_0f3a: Unknown result type (might be due to invalid IL or missing references) //IL_0f44: Expected O, but got Unknown //IL_0f72: Unknown result type (might be due to invalid IL or missing references) //IL_0f7c: Expected O, but got Unknown //IL_0faa: Unknown result type (might be due to invalid IL or missing references) //IL_0fb4: Expected O, but got Unknown //IL_0fe2: Unknown result type (might be due to invalid IL or missing references) //IL_0fec: Expected O, but got Unknown //IL_101a: Unknown result type (might be due to invalid IL or missing references) //IL_1024: Expected O, but got Unknown //IL_1052: Unknown result type (might be due to invalid IL or missing references) //IL_105c: Expected O, but got Unknown EnableCommands = config.Bind<bool>("General", "EnableCommands", true, new ConfigDescription("Enable if you and your team can use developer commands /be spawn (item) and /be money (number)", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamEnergyUpgradeTwo = config.Bind<bool>("EnergyTwo", "EnableTeamEnergyUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamEnergyUpgradeThree = config.Bind<bool>("EnergyThree", "EnableTeamEnergyUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamExtraJumpUpgradeTwo = config.Bind<bool>("ExtraJumpTwo", "EnableTeamExtraJumpUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamExtraJumpUpgradeThree = config.Bind<bool>("ExtraJumpThree", "EnableTeamExtraJumpUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamRangeUpgradeTwo = config.Bind<bool>("RangeTwo", "EnableTeamRangeUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamRangeUpgradeThree = config.Bind<bool>("RangeThree", "EnableTeamRangeUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamStrengthUpgradeTwo = config.Bind<bool>("StrengthTwo", "EnableTeamStrengthUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamStrengthUpgradeThree = config.Bind<bool>("StrengthThree", "EnableTeamStrengthUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamHealthUpgradeTwo = config.Bind<bool>("HealthTwo", "EnableTeamHealthUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamHealthUpgradeThree = config.Bind<bool>("HealthThree", "EnableTeamHealthUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamSpeedUpgradeTwo = config.Bind<bool>("SpeedTwo", "EnableTeamSpeedUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamSpeedUpgradeThree = config.Bind<bool>("SpeedThree", "EnableTeamSpeedUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamTumbleLaunchUpgradeTwo = config.Bind<bool>("TumbleLaunchTwo", "EnableTeamTumbleLaunchUpgradeTwo", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); EnableTeamTumbleLaunchUpgradeThree = config.Bind<bool>("TumbleLaunchThree", "EnableTeamTumbleLaunchUpgradeThree", true, new ConfigDescription("Enable the teamwide use of this upgrade", (AcceptableValueBase)null, Array.Empty<object>())); UpgradePriceScalingIncrease = config.Bind<float>("General", "UpgradePriceScalingIncrease", 50f, new ConfigDescription("Vanilla: 50%, UpgradePrice + (pruchasedUpgradeCount * 0.5), Change the percent increase for every purchased upgrade", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f), Array.Empty<object>())); UpgradePlayerPriceScaling = config.Bind<float>("General", "UpgradePlayerPriceScaling", 0f, new ConfigDescription("BaseUpgradePrice + (x% * playerCount), Change the percent increase for every player", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 200f), Array.Empty<object>())); UpgradeBasePriceMultiplier = config.Bind<float>("General", "UpgradeBasePriceMultiplier", 1f, new ConfigDescription("UpgradePrice * x, Multiplier to the price of an item at the start of a game", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100.5f), Array.Empty<object>())); MaxInShopEnergyOne = config.Bind<int>("EnergyOne", "MaxInShopEnergyOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopEnergyTwo = config.Bind<int>("EnergyTwo", "MaxInShopEnergyTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopEnergyThree = config.Bind<int>("EnergyThree", "MaxInShopEnergyThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopExtraJumpOne = config.Bind<int>("ExtraJumpOne", "MaxInShopExtraJumpOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopExtraJumpTwo = config.Bind<int>("ExtraJumpTwo", "MaxInShopExtraJumpTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopExtraJumpThree = config.Bind<int>("ExtraJumpThree", "MaxInShopExtraJumpThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopRangeOne = config.Bind<int>("RangeOne", "MaxInShopRangeOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopRangeTwo = config.Bind<int>("RangeTwo", "MaxInShopRangeTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopRangeThree = config.Bind<int>("RangeThree", "MaxInShopRangeThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopStrengthOne = config.Bind<int>("StrengthOne", "MaxInShopStrengthOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopStrengthTwo = config.Bind<int>("StrengthTwo", "MaxInShopStrengthTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopStrengthThree = config.Bind<int>("StrengthThree", "MaxInShopStrengthThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopHealthOne = config.Bind<int>("HealthOne", "MaxInShopHealthOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopHealthTwo = config.Bind<int>("HealthTwo", "MaxInShopHealthTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopHealthThree = config.Bind<int>("HealthThree", "MaxInShopHealthThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopSpeedOne = config.Bind<int>("SpeedOne", "MaxInShopSpeedOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopSpeedTwo = config.Bind<int>("SpeedTwo", "MaxInShopSpeedTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopSpeedThree = config.Bind<int>("SpeedThree", "MaxInShopSpeedThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopTumbleLaunchOne = config.Bind<int>("TumbleLaunchOne", "MaxInShopTumbleLaunchOne", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopTumbleLaunchTwo = config.Bind<int>("TumbleLaunchTwo", "MaxInShopTumbleLaunchTwo", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopTumbleLaunchThree = config.Bind<int>("TumbleLaunchThree", "MaxInShopTumbleLaunchThree", 1, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); MaxInShopPlayerCount = config.Bind<int>("PlayerCount", "MaxInShopPlayerCount", 2, new ConfigDescription("Set the max amount of instances of the respective upgrade in the shop at a time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); EnergyOnePriceMin = config.Bind<int>("EnergyOne", "EnergyOnePriceMin", 1900, new ConfigDescription("Change the min price of energyupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); EnergyOnePriceMax = config.Bind<int>("EnergyOne", "EnergyOnePriceMax", 1900, new ConfigDescription("Change the max price of energyupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); EnergyTwoPriceMin = config.Bind<int>("EnergyTwo", "EnergyTwoPriceMin", 2900, new ConfigDescription("Change the min price of energytwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); EnergyTwoPriceMax = config.Bind<int>("EnergyTwo", "EnergyTwoPriceMax", 2900, new ConfigDescription("Change the max price of energytwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); EnergyThreePriceMin = config.Bind<int>("EnergyThree", "EnergyThreePriceMin", 4900, new ConfigDescription("Change the min price of energythreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); EnergyThreePriceMax = config.Bind<int>("EnergyThree", "EnergyThreePriceMax", 4900, new ConfigDescription("Change the max price of energythreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); ExtraJumpOnePriceMin = config.Bind<int>("ExtraJumpOne", "ExtraJumpOnePriceMin", 7900, new ConfigDescription("Change the min price of extrajumpupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); ExtraJumpOnePriceMax = config.Bind<int>("ExtraJumpOne", "ExtraJumpOnePriceMax", 7900, new ConfigDescription("Change the max price of extrajumpupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); ExtraJumpTwoPriceMin = config.Bind<int>("ExtraJumpTwo", "ExtraJumpTwoPriceMin", 13900, new ConfigDescription("Change the min price of extrajumptwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); ExtraJumpTwoPriceMax = config.Bind<int>("ExtraJumpTwo", "ExtraJumpTwoPriceMax", 13900, new ConfigDescription("Change the max price of extrajumptwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); ExtraJumpThreePriceMin = config.Bind<int>("ExtraJumpThree", "ExtraJumpThreePriceMin", 20900, new ConfigDescription("Change the min price of extrajumpthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); ExtraJumpThreePriceMax = config.Bind<int>("ExtraJumpThree", "ExtraJumpThreePriceMax", 20900, new ConfigDescription("Change the max price of extrajumpthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); RangeOnePriceMin = config.Bind<int>("RangeOne", "RangeOnePriceMin", 6900, new ConfigDescription("Change the min price of rangeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); RangeOnePriceMax = config.Bind<int>("RangeOne", "RangeOnePriceMax", 6900, new ConfigDescription("Change the max price of rangeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); RangeTwoPriceMin = config.Bind<int>("RangeTwo", "RangeTwoPriceMin", 11900, new ConfigDescription("Change the min price of rangetwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); RangeTwoPriceMax = config.Bind<int>("RangeTwo", "RangeTwoPriceMax", 11900, new ConfigDescription("Change the max price of rangetwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); RangeThreePriceMin = config.Bind<int>("RangeThree", "RangeThreePriceMin", 17900, new ConfigDescription("Change the min price of rangethreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); RangeThreePriceMax = config.Bind<int>("RangeThree", "RangeThreePriceMax", 17900, new ConfigDescription("Change the max price of rangethreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); StrengthOnePriceMin = config.Bind<int>("StrengthOne", "StrengthOnePriceMin", 6900, new ConfigDescription("Change the min price of strengthupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); StrengthOnePriceMax = config.Bind<int>("StrengthOne", "StrengthOnePriceMax", 6900, new ConfigDescription("Change the max price of strengthupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); StrengthTwoPriceMin = config.Bind<int>("StrengthTwo", "StrengthTwoPriceMin", 11900, new ConfigDescription("Change the min price of strengthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); StrengthTwoPriceMax = config.Bind<int>("StrengthTwo", "StrengthTwoPriceMax", 11900, new ConfigDescription("Change the max price of strengthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); StrengthThreePriceMin = config.Bind<int>("StrengthThree", "StrengthThreePriceMin", 17900, new ConfigDescription("Change the min price of strengththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); StrengthThreePriceMax = config.Bind<int>("StrengthThree", "StrengthThreePriceMax", 17900, new ConfigDescription("Change the max price of strengththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); HealthOnePriceMin = config.Bind<int>("HealthOne", "HealthOnePriceMin", 3900, new ConfigDescription("Change the min price of healthupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); HealthOnePriceMax = config.Bind<int>("HealthOne", "HealthOnePriceMax", 3900, new ConfigDescription("Change the max price of healthupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); HealthTwoPriceMin = config.Bind<int>("HealthTwo", "HealthTwoPriceMin", 5900, new ConfigDescription("Change the min price of healthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); HealthTwoPriceMax = config.Bind<int>("HealthTwo", "HealthTwoPriceMax", 5900, new ConfigDescription("Change the max price of healthtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); HealthThreePriceMin = config.Bind<int>("HealthThree", "HealthThreePriceMin", 8900, new ConfigDescription("Change the min price of healththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); HealthThreePriceMax = config.Bind<int>("HealthThree", "HealthThreePriceMax", 8900, new ConfigDescription("Change the max price of healththreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); SpeedOnePriceMin = config.Bind<int>("SpeedOne", "SpeedOnePriceMin", 6900, new ConfigDescription("Change the min price of speedupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); SpeedOnePriceMax = config.Bind<int>("SpeedOne", "SpeedOnePriceMax", 6900, new ConfigDescription("Change the max price of speedupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); SpeedTwoPriceMin = config.Bind<int>("SpeedTwo", "SpeedTwoPriceMin", 11900, new ConfigDescription("Change the min price of speedtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); SpeedTwoPriceMax = config.Bind<int>("SpeedTwo", "SpeedTwoPriceMax", 11900, new ConfigDescription("Change the max price of speedtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); SpeedThreePriceMin = config.Bind<int>("SpeedThree", "SpeedThreePriceMin", 17900, new ConfigDescription("Change the min price of speedthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); SpeedThreePriceMax = config.Bind<int>("SpeedThree", "SpeedThreePriceMax", 17900, new ConfigDescription("Change the max price of speedthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); TumbleLaunchOnePriceMin = config.Bind<int>("TumbleLaunchOne", "TumbleLaunchOnePriceMin", 3900, new ConfigDescription("Change the min price of tumblelaunchupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); TumbleLaunchOnePriceMax = config.Bind<int>("TumbleLaunchOne", "TumbleLaunchOnePriceMax", 3900, new ConfigDescription("Change the max price of tumblelaunchupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); TumbleLaunchTwoPriceMin = config.Bind<int>("TumbleLaunchTwo", "TumbleLaunchTwoPriceMin", 5900, new ConfigDescription("Change the min price of tumblelaunchtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); TumbleLaunchTwoPriceMax = config.Bind<int>("TumbleLaunchTwo", "TumbleLaunchTwoPriceMax", 5900, new ConfigDescription("Change the max price of tumblelaunchtwoupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); TumbleLaunchThreePriceMin = config.Bind<int>("TumbleLaunchThree", "TumbleLaunchThreePriceMin", 8900, new ConfigDescription("Change the min price of tumblelaunchthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); TumbleLaunchThreePriceMax = config.Bind<int>("TumbleLaunchThree", "TumbleLaunchThreePriceMax", 8900, new ConfigDescription("Change the max price of tumblelaunchthreeupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); PlayerCountPriceMin = config.Bind<int>("PlayerCount", "PlayerCountPriceMin", 7900, new ConfigDescription("Change the min price of playercountupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); PlayerCountPriceMax = config.Bind<int>("PlayerCount", "PlayerCountPriceMax", 7900, new ConfigDescription("Change the max price of playercountupgrade in the shop", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1000, 100000), Array.Empty<object>())); } } [HarmonyPatch(typeof(ShopManager))] internal static class ShopManagerPatch { [HarmonyPatch("ShopInitialize")] [HarmonyPostfix] private static void StartConfigPatch() { Dictionary<string, List<int>> dictionary = new Dictionary<string, List<int>> { { "Strength Upgrade", new List<int>(3) { Configuration.StrengthOnePriceMin.Value, Configuration.StrengthOnePriceMax.Value, Configuration.MaxInShopStrengthOne.Value } }, { "Strength Upgrade Two", new List<int>(3) { Configuration.StrengthTwoPriceMin.Value, Configuration.StrengthTwoPriceMax.Value, Configuration.MaxInShopStrengthTwo.Value } }, { "Strength Upgrade Three", new List<int>(3) { Configuration.StrengthThreePriceMin.Value, Configuration.StrengthThreePriceMax.Value, Configuration.MaxInShopStrengthThree.Value } }, { "Stamina Upgrade", new List<int>(3) { Configuration.EnergyOnePriceMin.Value, Configuration.EnergyOnePriceMax.Value, Configuration.MaxInShopEnergyOne.Value } }, { "Stamina Upgrade Two", new List<int>(3) { Configuration.EnergyTwoPriceMin.Value, Configuration.EnergyTwoPriceMax.Value, Configuration.MaxInShopEnergyTwo.Value } }, { "Stamina Upgrade Three", new List<int>(3) { Configuration.EnergyThreePriceMin.Value, Configuration.EnergyThreePriceMax.Value, Configuration.MaxInShopEnergyThree.Value } }, { "Extra Jump Upgrade", new List<int>(3) { Configuration.ExtraJumpOnePriceMin.Value, Configuration.ExtraJumpOnePriceMax.Value, Configuration.MaxInShopExtraJumpOne.Value } }, { "Extra Jump Upgrade Two", new List<int>(3) { Configuration.ExtraJumpTwoPriceMin.Value, Configuration.ExtraJumpTwoPriceMax.Value, Configuration.MaxInShopExtraJumpTwo.Value } }, { "Extra Jump Upgrade Three", new List<int>(3) { Configuration.ExtraJumpThreePriceMin.Value, Configuration.ExtraJumpThreePriceMax.Value, Configuration.MaxInShopExtraJumpThree.Value } }, { "Health Upgrade", new List<int>(3) { Configuration.HealthOnePriceMin.Value, Configuration.HealthOnePriceMax.Value, Configuration.MaxInShopHealthOne.Value } }, { "Health Upgrade Two", new List<int>(3) { Configuration.HealthTwoPriceMin.Value, Configuration.HealthTwoPriceMax.Value, Configuration.MaxInShopHealthTwo.Value } }, { "Health Upgrade Three", new List<int>(3) { Configuration.HealthThreePriceMin.Value, Configuration.HealthThreePriceMax.Value, Configuration.MaxInShopHealthThree.Value } }, { "Range Upgrade", new List<int>(3) { Configuration.RangeOnePriceMin.Value, Configuration.RangeOnePriceMax.Value, Configuration.MaxInShopRangeOne.Value } }, { "Range Upgrade Two", new List<int>(3) { Configuration.RangeTwoPriceMin.Value, Configuration.RangeTwoPriceMax.Value, Configuration.MaxInShopRangeTwo.Value } }, { "Range Upgrade Three", new List<int>(3) { Configuration.RangeThreePriceMin.Value, Configuration.RangeThreePriceMax.Value, Configuration.MaxInShopRangeThree.Value } }, { "Sprint Speed Upgrade", new List<int>(3) { Configuration.SpeedOnePriceMin.Value, Configuration.SpeedOnePriceMax.Value, Configuration.MaxInShopSpeedOne.Value } }, { "Sprint Speed Upgrade Two", new List<int>(3) { Configuration.SpeedTwoPriceMin.Value, Configuration.SpeedTwoPriceMax.Value, Configuration.MaxInShopSpeedTwo.Value } }, { "Sprint Speed Upgrade Three", new List<int>(3) { Configuration.SpeedThreePriceMin.Value, Configuration.SpeedThreePriceMax.Value, Configuration.MaxInShopSpeedThree.Value } }, { "Tumble Launch Upgrade", new List<int>(3) { Configuration.TumbleLaunchOnePriceMin.Value, Configuration.TumbleLaunchOnePriceMax.Value, Configuration.MaxInShopTumbleLaunchOne.Value } }, { "Tumble Launch Upgrade Two", new List<int>(3) { Configuration.TumbleLaunchTwoPriceMin.Value, Configuration.TumbleLaunchTwoPriceMax.Value, Configuration.MaxInShopTumbleLaunchTwo.Value } }, { "Tumble Launch Upgrade Three", new List<int>(3) { Configuration.TumbleLaunchThreePriceMin.Value, Configuration.TumbleLaunchThreePriceMax.Value, Configuration.MaxInShopTumbleLaunchThree.Value } }, { "Map Player Count Upgrade", new List<int>(3) { Configuration.PlayerCountPriceMin.Value, Configuration.PlayerCountPriceMax.Value, Configuration.MaxInShopPlayerCount.Value } } }; foreach (KeyValuePair<string, List<int>> item in dictionary) { string key = item.Key; List<int> value = item.Value; SetItemValueMinMax(Items.GetItemByName(key), value[0], value[1], key, Configuration.UpgradeBasePriceMultiplier.Value, value[2]); } UpdateUpgradePriceScales(Configuration.UpgradePriceScalingIncrease.Value); Debug.Log((object)"All items patched for BetterUpgrades"); } private static void SetItemValueMinMax(Item item, int minValue, int maxValue, string name, float basePriceMult, int maxInShop) { if ((Object)(object)item == (Object)null) { Debug.LogError((object)("StatsManagerPatch: Failed to set item min max value. " + name + " is null.")); return; } float num = GameDirector.instance.PlayerList.Count - 1; float value = Configuration.UpgradePlayerPriceScaling.Value; Value val = ScriptableObject.CreateInstance<Value>(); val.valueMin = ((float)((int)Math.Round((double)minValue / 1000.0) * 1000 / 4) + value / 100f * num * (float)minValue) * basePriceMult; val.valueMax = ((float)((int)Math.Round((double)maxValue / 1000.0) * 1000 / 4) + value / 100f * num * (float)maxValue) * basePriceMult; item.value = val; item.maxAmountInShop = maxInShop; } private static void UpdateUpgradePriceScales(float percent) { float upgradeValueIncrease = percent / 100f; ShopManager.instance.upgradeValueIncrease = upgradeValueIncrease; } } [HarmonyPatch(typeof(ChatManager))] internal static class ChatManagerPatch { [HarmonyPatch("MessageSend")] [HarmonyPostfix] private static void CommandsPatch() { //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) string text = ChatManager.instance.chatHistory[ChatManager.instance.chatHistory.Count - 1]; if (!text.StartsWith("/") || !Configuration.EnableCommands.Value) { return; } string[] array = text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (!(array[0] == "/be")) { return; } if (SemiFunc.RunIsShop() && array[1] == "money") { if (int.TryParse(array[2], out var result) && result >= 1000) { StatsManager.instance.runStats["currency"] = StatsManager.instance.runStats["currency"] + result / 1000; Debug.Log((object)$"Gave you {result} currency"); } } else { if (!(array[1] == "spawn")) { return; } string itemName = ""; for (int i = 2; i <= array.Length - 1; i++) { itemName = itemName + " " + array[i]; } itemName = itemName.Trim(); Transform transform = ((Component)Camera.main).transform; Vector3 val = transform.position + transform.forward * 2f; Quaternion identity = Quaternion.identity; IReadOnlyList<Item> registeredItems = Items.RegisteredItems; Item val2 = ((IEnumerable<Item>)registeredItems).FirstOrDefault((Func<Item, bool>)((Item go) => string.Equals(((Object)go).name, itemName, StringComparison.OrdinalIgnoreCase))); if (Object.op_Implicit((Object)(object)val2)) { if (SemiFunc.IsMultiplayer()) { PhotonNetwork.InstantiateRoomObject("Items/" + ((Object)val2).name, val, identity, (byte)0, (object[])null); Debug.Log((object)(((Object)val2).name + " has been spawned")); } else { Object.Instantiate<GameObject>(val2.prefab, val, identity); Debug.Log((object)(((Object)val2).name + " has been spawned")); } } } } } internal AssetBundle assetBundle; internal static BetterUpgrades Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal static Harmony? Harmony { get; set; } private void Awake() { Instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "betterupgrades"); AssetBundle val = (assetBundle = AssetBundle.LoadFromFile(text)); List<string> list = new List<string>(14) { "Item Upgrade Player Grab Strength Two", "Item Upgrade Player Grab Strength Three", "Item Upgrade Player Energy Two", "Item Upgrade Player Energy Three", "Item Upgrade Player Extra Jump Two", "Item Upgrade Player Extra Jump Three", "Item Upgrade Player Grab Range Two", "Item Upgrade Player Grab Range Three", "Item Upgrade Player Health Two", "Item Upgrade Player Health Three", "Item Upgrade Player Sprint Speed Two", "Item Upgrade Player Sprint Speed Three", "Item Upgrade Player Tumble Launch Two", "Item Upgrade Player Tumble Launch Three" }; foreach (string item in list) { Item val2 = val.LoadAsset<Item>("Assets/Upgrades/" + item + ".asset"); Items.RegisterItem(val2); } Configuration.Init(((BaseUnityPlugin)this).Config); Patch(); } internal void Patch() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } }
plugins/CartSpeedSync.dll
Decompiled 3 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("discjenny")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+fe60aa4cb3849f4fd32ddf9f39906111b9b25b68")] [assembly: AssemblyProduct("CartSpeedSync")] [assembly: AssemblyTitle("CartSpeedSync")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CartSpeedSync { [BepInPlugin("discjenny.CartSpeedSync", "CartSpeedSync", "2.0.0")] public class CartSpeedSync : BaseUnityPlugin { internal static CartSpeedSync Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } [HarmonyPatch] public static class PhysGrabCartPatches { [HarmonyPatch(typeof(PhysGrabCart), "CartSteer")] [HarmonyPostfix] public static void CartSteerPostfix(PhysGrabCart __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) if ((int)__instance.currentState != 2 || (Object)(object)__instance.physGrabObjectGrabArea == (Object)null || __instance.physGrabObjectGrabArea.listOfAllGrabbers.Count == 0) { return; } PhysGrabber val = __instance.physGrabObjectGrabArea.listOfAllGrabbers[0]; if ((Object)(object)val == (Object)null || (Object)(object)val.playerAvatar == (Object)null) { return; } PlayerAvatar playerAvatar = val.playerAvatar; Rigidbody rb = __instance.rb; if ((Object)(object)rb == (Object)null || !playerAvatar.isSprinting) { return; } Rigidbody val2 = rb; Vector3 rbVelocityRaw = playerAvatar.rbVelocityRaw; bool flag = Vector3.Dot(rbVelocityRaw, ((Component)__instance).transform.forward) > 0f; float num = 3f; float num2 = 4f; float num3 = 7f; float num4 = Mathf.Clamp(Vector3.Dot(val2.velocity, ((Component)val).transform.forward) / num3, 0f, 1f); float num5 = Mathf.Lerp(num, num2, num4); Vector3 val3 = ((Component)val).transform.rotation * Vector3.back; Vector3 val4 = ((Component)val.playerAvatar).transform.position - val3 * num5; float num6 = Mathf.Clamp(Vector3.Distance(((Component)__instance).transform.position, val4 / 1f), 0f, 1f); Vector3 val5 = val4 - ((Component)__instance).transform.position; Vector3 val6 = ((Vector3)(ref val5)).normalized * 5f * num6; val6 = Vector3.ClampMagnitude(val6, 5f); float num7 = num6 * 3f; val2.velocity = Vector3.MoveTowards(val2.velocity, val6, num7); val2.velocity = Vector3.ClampMagnitude(val2.velocity, 5f); Vector3 val7 = Vector3.ProjectOnPlane(playerAvatar.rbVelocityRaw, Vector3.up); float magnitude = ((Vector3)(ref val7)).magnitude; Vector3 val8 = Vector3.ProjectOnPlane(val2.velocity, Vector3.up); float y = val2.velocity.y; if (((Vector3)(ref val8)).magnitude < magnitude && magnitude > 0.5f) { val8 = ((Vector3)(ref val8)).normalized * magnitude; if (((Vector3)(ref val8)).magnitude < 0.1f) { val8 = val7; } val2.velocity = new Vector3(val8.x, y, val8.z); } Quaternion val9 = Quaternion.LookRotation(((Component)val).transform.position - ((Component)__instance).transform.position, Vector3.up); Quaternion val10 = Quaternion.Euler(0f, ((Quaternion)(ref val9)).eulerAngles.y + 180f, 0f); val9 = val2.rotation; Quaternion val11 = Quaternion.Euler(0f, ((Quaternion)(ref val9)).eulerAngles.y, 0f); val9 = val10 * Quaternion.Inverse(val11); float num8 = default(float); Vector3 val12 = default(Vector3); ((Quaternion)(ref val9)).ToAngleAxis(ref num8, ref val12); if (num8 > 180f) { num8 -= 360f; } float num9 = Mathf.Clamp(Mathf.Abs(num8) / 180f, 0.2f, 1f) * 20f; num9 = Mathf.Clamp(num9, 0f, 8f); Vector3 val13 = MathF.PI / 180f * num8 * ((Vector3)(ref val12)).normalized * num9; val13 = Vector3.ClampMagnitude(val13, 8f); val2.angularVelocity = Vector3.MoveTowards(val2.angularVelocity, val13, num9); val2.angularVelocity = Vector3.ClampMagnitude(val2.angularVelocity, 8f); } } }
plugins/DeadMapAccess.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("SaturnKai")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.4.0")] [assembly: AssemblyInformationalVersion("1.0.4+a79dee4aa0fca7a6cd5ff757e184d547a209136b")] [assembly: AssemblyProduct("DeadMapAccess")] [assembly: AssemblyTitle("DeadMapAccess")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DeadMapAccess { internal static class Configuration { internal static Color borderColor = Color32.op_Implicit(new Color32((byte)19, (byte)19, (byte)19, byte.MaxValue)); internal static ConfigEntry<float> width = null; internal static ConfigEntry<float> height = null; internal static ConfigEntry<int> borderSize = null; internal static ConfigEntry<bool> toggle = null; internal static ConfigEntry<bool> showUpgrades = null; internal static ConfigEntry<bool> hideValuables = null; internal static void Init(ConfigFile config) { width = config.Bind<float>("General", "Width", 600f, "The width of the map."); height = config.Bind<float>("General", "Height", 600f, "The height of the map."); borderSize = config.Bind<int>("General", "Border", 6, "The size of the map border."); toggle = config.Bind<bool>("General", "Toggle", false, "Set the map to toggle instead of hold."); showUpgrades = config.Bind<bool>("General", "ShowUpgrades", true, "Show upgrades while the map is shown."); hideValuables = config.Bind<bool>("Host", "HideValuables", false, "Force hide valuables on the map for all spectating players (only works when you are host)."); } } [BepInPlugin("dev.saturnkai.deadmapaccess", "DeadMapAccess", "1.0.4")] public class DeadMap : BaseUnityPlugin { internal static RenderTexture? renderTexture = null; internal static Camera? camera = null; internal static float cameraOrthographicDefault = 2.5f; internal static bool spectating = false; internal static bool hideValuables = false; private bool active; private bool activePrev; private readonly float scaleSpeed = 5f; private float scale = 0.5f; private float targetScale = 1f; private readonly float zoomSpeed = 0.2f; private readonly float zoomMin = 1f; private readonly float zoomMax = 20f; internal static DeadMap Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; internal Harmony? Harmony { get; set; } private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0054: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Configuration.Init(((BaseUnityPlugin)this).Config); if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Invalid comparison between Unknown and I4 //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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) if (Configuration.toggle.Value && spectating) { if (SemiFunc.InputDown((InputKey)8)) { active = !active; } } else if (spectating) { active = SemiFunc.InputHold((InputKey)8); } targetScale = (active ? 1f : 0.5f); scale = Mathf.Lerp(scale, targetScale, Time.deltaTime * scaleSpeed); if (!spectating || !((Object)(object)SpectateCamera.instance != (Object)null) || (int)SpectateCamera.instance.currentState != 1) { return; } Transform transform = ((Component)SpectateCamera.instance).transform; if ((Object)(object)DirtFinderMapPlayer.Instance.PlayerTransform == (Object)null) { Logger.LogWarning((object)"DirtFinderMapPlayer transform null."); DirtFinderMapPlayer.Instance.PlayerTransform = new GameObject().transform; } DirtFinderMapPlayer.Instance.PlayerTransform.position = transform.position; Transform playerTransform = DirtFinderMapPlayer.Instance.PlayerTransform; Quaternion rotation = transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; rotation = transform.rotation; playerTransform.rotation = Quaternion.Euler(0f, y, ((Quaternion)(ref rotation)).eulerAngles.z); PlayerController.instance.playerAvatarScript.LastNavmeshPosition = SpectateCamera.instance.player.LastNavmeshPosition; if (active && Configuration.showUpgrades.Value) { ((SemiUI)StatsUI.instance).Show(); } if (active) { float num = SemiFunc.InputScrollY() * 0.01f; if (num != 0f && (Object)(object)camera != (Object)null) { Camera? obj = camera; obj.orthographicSize -= num * zoomSpeed; camera.orthographicSize = Mathf.Clamp(camera.orthographicSize, zoomMin, zoomMax); } } } private void OnGUI() { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (!spectating) { return; } if (active != activePrev) { activePrev = active; Sound val = (activePrev ? PlayerAvatar.instance.mapToolController.SoundStart : PlayerAvatar.instance.mapToolController.SoundStop); if ((Object)(object)SpectateCamera.instance != (Object)null) { val.Play(((Component)SpectateCamera.instance).transform.position, 1f, 1f, 1f, 1f); } } Map.Instance.Active = active; if (!active) { targetScale = 0.5f; return; } CameraTopFade.Instance.Set(0.5f, 0.1f); float num = Configuration.width.Value * scale; float num2 = Configuration.height.Value * scale; float num3 = ((float)Screen.width - num) / 2f; float num4 = ((float)Screen.height - num2) / 2f; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num3 - (float)Configuration.borderSize.Value, num4 - (float)Configuration.borderSize.Value, num + (float)(Configuration.borderSize.Value * 2), num2 + (float)(Configuration.borderSize.Value * 2)); GUI.color = Configuration.borderColor; GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)renderTexture, (ScaleMode)0, false); } internal static void SetSpectating(bool isSpectating) { spectating = isSpectating; if ((Object)(object)camera != (Object)null) { camera.orthographicSize = cameraOrthographicDefault; } if (hideValuables) { MapValuable[] componentsInChildren = ((Component)Map.Instance.OverLayerParent).GetComponentsInChildren<MapValuable>(true); MapValuable[] array = componentsInChildren; foreach (MapValuable val in array) { ((Component)val).gameObject.SetActive(!spectating); } } } } internal class NetworkController : MonoBehaviourPun { [PunRPC] internal void HideValuables() { if (!DeadMap.hideValuables) { DeadMap.hideValuables = true; DeadMap.Logger.LogInfo((object)"Valuables set to hidden."); } } } } namespace DeadMapAccess.patches { [HarmonyPatch(typeof(DirtFinderMapPlayer))] internal static class DirtFinderMapPlayerPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(DirtFinderMapPlayer __instance) { Camera componentInChildren = ((Component)__instance).GetComponentInChildren<Camera>(); if (((Object)componentInChildren).name != "Dirt Finder Map Camera") { DeadMap.Logger.LogWarning((object)"Dirt Finder Map Camera not found in map children."); } else if ((Object)(object)DeadMap.camera == (Object)null) { DeadMap.camera = componentInChildren; DeadMap.cameraOrthographicDefault = componentInChildren.orthographicSize; } } } [HarmonyPatch(typeof(GameDirector))] internal static class GameDirectorPatch { [HarmonyPrefix] [HarmonyPatch("Revive")] private static void Revive_Prefix() { if (DeadMap.spectating) { DeadMap.SetSpectating(isSpectating: false); } } [HarmonyPrefix] [HarmonyPatch("gameStateStart")] private static void GameStateStart_Prefix() { if (SemiFunc.IsMasterClient() && Configuration.hideValuables.Value) { NetworkController component = ((Component)Map.Instance).gameObject.GetComponent<NetworkController>(); if ((Object)(object)component == (Object)null) { DeadMap.Logger.LogWarning((object)"Failed to send hide valuables event: Network controller is null."); return; } ((MonoBehaviourPun)component).photonView.RPC("HideValuables", (RpcTarget)0, new object[0]); } if (DeadMap.spectating) { DeadMap.SetSpectating(isSpectating: false); } } } [HarmonyPatch(typeof(Map))] internal static class MapPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(Map __instance) { if ((Object)(object)((Component)__instance).gameObject.GetComponent<NetworkController>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<NetworkController>(); } } [HarmonyPostfix] [HarmonyPatch("AddValuable")] private static void AddValuable_Postfix(Map __instance) { if (DeadMap.spectating && DeadMap.hideValuables) { MapValuable[] componentsInChildren = ((Component)__instance.OverLayerParent).GetComponentsInChildren<MapValuable>(); MapValuable[] array = componentsInChildren; foreach (MapValuable val in array) { ((Component)val).gameObject.SetActive(false); } } } } [HarmonyPatch(typeof(PlayerAvatar))] internal static class PlayerAvatarPatch { [HarmonyPrefix] [HarmonyPatch("SetSpectate")] private static void SetSpectate_Prefix() { Map.Instance.ActiveParent.SetActive(true); if ((Object)(object)DeadMap.camera != (Object)null) { ((MonoBehaviour)Map.Instance).StartCoroutine(LoadRenderTexture(DeadMap.camera)); } } private static IEnumerator LoadRenderTexture(Camera camera) { RenderTexture activeTexture = camera.activeTexture; while ((Object)(object)activeTexture == (Object)null) { yield return null; activeTexture = camera.activeTexture; } DeadMap.renderTexture = activeTexture; DeadMap.Logger.LogInfo((object)"Loaded map render texture."); } } [HarmonyPatch(typeof(RoundDirector))] internal static class RoundDirectorPatch { [HarmonyPostfix] [HarmonyPatch("StartRound")] private static void StartRound_Postfix() { DeadMap.hideValuables = false; } } [HarmonyPatch(typeof(SpectateCamera))] internal static class SpectateCameraPatch { [HarmonyPrefix] [HarmonyPatch("StateNormal")] private static void StateNormal_Prefix() { if ((SemiFunc.RunIsLevel() || SemiFunc.RunIsShop()) && !DeadMap.spectating && (Object)(object)SpectateCamera.instance.player != (Object)null) { DeadMap.SetSpectating(isSpectating: true); } } } }
plugins/DeadSemiBotChat.dll
Decompiled 3 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("jack.apfel")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DeadSemiBotChat")] [assembly: AssemblyTitle("DeadSemiBotChat")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SemiBotChat { [BepInPlugin("jack.apfel.SemiBotChat", "SemiBotChat", "1.0.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class SemiBotChat : BaseUnityPlugin { [HarmonyPatch(typeof(TruckScreenText), "Update")] private class TruckScreenTextPatch { private static void Prefix(TruckScreenText __instance) { allowMessage = (isDead ? toggleChatForDeadPlayers.Value : toggleChatForLivingPlayers.Value); if (!allowMessage) { playerSentMessage = ":o"; } else if (playerSentMessage != "" && playerSentMessage != ":o" && allowMessage) { __instance.MessageSendCustom(PlayerController.instance.playerSteamID, playerSentMessage, 0); playerSentMessage = ":o"; } } } [HarmonyPatch(typeof(ChatManager), "MessageSend")] private class LobbyChatUIPatch { private static void Prefix(ChatManager __instance) { if (!(__instance.chatMessage == "") && __instance.spamTimer <= 0f) { playerSentMessage = __instance.chatMessage; } } } [HarmonyPatch(typeof(PlayerHealth), "Update")] private class PlayerHealthPatch { private static void Prefix(PlayerHealth __instance) { if (__instance.health <= 0) { isDead = true; } else { isDead = false; } } } public static string playerSentMessage = ""; public static bool isDead; public static bool allowMessage; public static ConfigEntry<bool> toggleChatForDeadPlayers; public static ConfigEntry<bool> toggleChatForLivingPlayers; internal static SemiBotChat Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded! :D"); LoadConfigs(); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } private void LoadConfigs() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown toggleChatForDeadPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Client Settings", "Enable Chat for Dead Players", true, new ConfigDescription("Enables messages from Dead Players to be sent to the Truck Screen", (AcceptableValueBase)null, Array.Empty<object>())); toggleChatForLivingPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("Client Settings", "Enable Chat for Living Players", true, new ConfigDescription("Enables messages from Living Players to be sent to the Truck Screen", (AcceptableValueBase)null, Array.Empty<object>())); } } }
plugins/ILoveILoveMOD.dll
Decompiled 3 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("Sossic")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ILoveILoveMOD")] [assembly: AssemblyTitle("ILoveILoveMOD")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class ChestPainHeadTrap : Trap { private PhysGrabObject physgrabObject; public Transform ChestPainHeadValuable; [Space] [Header("Sounds")] public Sound ChestPainHeadMusic; private bool ChestPainHeadPlaying; private Rigidbody rb; public override void Start() { ((Trap)this).Start(); rb = ((Component)this).GetComponent<Rigidbody>(); physgrabObject = ((Component)this).GetComponent<PhysGrabObject>(); ChestPainHeadPlaying = false; } public override void Update() { if (!base.trapTriggered && physgrabObject.grabbed) { base.trapStart = true; } if (ChestPainHeadMusic != null) { ChestPainHeadMusic.PlayLoop(ChestPainHeadPlaying, 2f, 2f, 1f); } else { Debug.LogWarning((object)"ChestPainHeadMusic is null"); } if (base.trapStart) { ChestPainStart(); ChestPainHeadPlaying = true; } if (!physgrabObject.grabbed) { base.trapStart = false; ChestPainStop(); } } private void ChestPainStart() { ChestPainHeadPlaying = true; } private void ChestPainStop() { ChestPainHeadPlaying = false; } } namespace ILoveILoveMOD { [BepInPlugin("Sossic.ILoveILoveMOD", "ILoveILoveMOD", "1.0")] public class ILoveILoveMOD : BaseUnityPlugin { private void Awake() { } private void Update() { } } }
plugins/MCZombieMod.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using MCZombieMod.AI; using MCZombieMod.Items; using Microsoft.CodeAnalysis; using PaintedThornStudios.PaintedUtils; using PaintedUtils; using Photon.Pun; using REPOLib.Modules; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("CarsonJF")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("MCZombie Mod for REPO")] [assembly: AssemblyFileVersion("1.2.1.0")] [assembly: AssemblyInformationalVersion("1.2.1+bdcda596674b5ad9822154aad1f413fa6298e692")] [assembly: AssemblyProduct("MCZombieMod")] [assembly: AssemblyTitle("MCZombieMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class PlayerSickness : MonoBehaviourPun { [CompilerGenerated] private sealed class <PukeActiveRoutine>d__17 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject pukeEffect; public SemiPuke semiPuke; public PlayerSickness <>4__this; private float <timer>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PukeActiveRoutine>d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <timer>5__1 = 0f; break; case 1: <>1__state = -1; break; } if (<timer>5__1 < <>4__this.pukeDuration) { semiPuke.PukeActive(pukeEffect.transform.position, ((Component)<>4__this).transform.rotation); <timer>5__1 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } Object.Destroy((Object)(object)pukeEffect, 1f); <>4__this.isPuking = false; if (<>4__this.isSick) { <>4__this.nextPukeTime = Random.Range(<>4__this.minPukeInterval, <>4__this.maxPukeInterval); } 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(); } } [Header("Sickness Settings")] public float sicknessDuration = 60f; public float minPukeInterval = 10f; public float maxPukeInterval = 30f; public float pukeDuration = 3f; [Header("Prefab References")] public GameObject pukePrefab; private bool isSick = false; private bool isPuking = false; private float sickTimer = 0f; private float nextPukeTime = 0f; private PlayerAvatar playerAvatar; private void Awake() { if ((Object)(object)playerAvatar == (Object)null) { playerAvatar = ((Component)this).GetComponentInParent<PlayerAvatar>(); } if ((Object)(object)playerAvatar == (Object)null) { Debug.LogWarning((object)"[SICKNESS] PlayerAvatar not found on self or parent."); } } private PhotonView GetAvatarView() { return ((Object)(object)playerAvatar != (Object)null) ? ((Component)playerAvatar).GetComponentInChildren<PhotonView>() : null; } public void AssignPlayerAvatar(PlayerAvatar avatar) { playerAvatar = avatar; } public void BeginSickness() { if ((Object)(object)playerAvatar == (Object)null) { playerAvatar = ((Component)this).GetComponentInParent<PlayerAvatar>(); if ((Object)(object)playerAvatar == (Object)null) { Debug.LogWarning((object)"PlayerSickness: No PlayerAvatar found on self or parent!"); return; } } if (playerAvatar.isLocal) { Debug.Log((object)"[SICKNESS] Starting RPC_BeginSickness"); playerAvatar.photonView.RPC("RPC_BeginSickness", (RpcTarget)3, Array.Empty<object>()); } else { Debug.LogWarning((object)"Tried to start sickness but playerAvatar is not local."); } } public void StartSicknessLocal() { if (!isSick) { isSick = true; sickTimer = sicknessDuration + Random.Range(-10f, 10f); nextPukeTime = Random.Range(2f, 5f); Debug.Log((object)$"[SICKNESS] Local sickness started: {sickTimer:F1}s"); } } private void Update() { if (!isSick) { return; } sickTimer -= Time.deltaTime; if (sickTimer <= 0f) { isSick = false; } else if (!isPuking) { nextPukeTime -= Time.deltaTime; if (nextPukeTime <= 0f) { ((MonoBehaviourPun)this).photonView.RPC("RPC_StartPukeEffect", (RpcTarget)0, Array.Empty<object>()); } } } [PunRPC] private void RPC_StartPukeEffect() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (!isPuking && !((Object)(object)pukePrefab == (Object)null) && !((Object)(object)playerAvatar == (Object)null)) { isPuking = true; Transform val = (playerAvatar.isLocal ? playerAvatar.localCameraTransform : ((Component)playerAvatar.playerAvatarVisuals).transform); GameObject val2 = Object.Instantiate<GameObject>(pukePrefab, val); val2.transform.localPosition = new Vector3(0f, -0.2f, 0.3f); val2.transform.localRotation = Quaternion.identity; SemiPuke componentInChildren = val2.GetComponentInChildren<SemiPuke>(); if ((Object)(object)componentInChildren != (Object)null) { ((MonoBehaviour)this).StartCoroutine(PukeActiveRoutine(val2, componentInChildren)); } else { Debug.LogError((object)"No SemiPuke component found!"); } } } [IteratorStateMachine(typeof(<PukeActiveRoutine>d__17))] private IEnumerator PukeActiveRoutine(GameObject pukeEffect, SemiPuke semiPuke) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PukeActiveRoutine>d__17(0) { <>4__this = this, pukeEffect = pukeEffect, semiPuke = semiPuke }; } public bool IsSick() { return isSick; } [PunRPC] public void RPC_BeginSickness() { if (!isSick) { isSick = true; float num = Random.Range(-10f, 10f); sickTimer = sicknessDuration + num; nextPukeTime = Random.Range(2f, 5f); Debug.Log((object)$"Got sick! Will be sick for {sickTimer:F1} seconds. First puke in {nextPukeTime:F1} seconds"); } } [PunRPC] public void RPC_EnsureSicknessOnTarget() { if ((Object)(object)((Component)this).GetComponent<PlayerSickness>() == (Object)null) { PlayerAvatar componentInParent = ((Component)this).GetComponentInParent<PlayerAvatar>(); if ((Object)(object)componentInParent != (Object)null) { PlayerSickness playerSickness = ((Component)this).gameObject.AddComponent<PlayerSickness>(); playerSickness.AssignPlayerAvatar(componentInParent); Debug.Log((object)("[SICKNESS] RPC-added PlayerSickness to: " + componentInParent.playerName)); } } } } namespace MCZombieMod { public class MCZombieConfig : BaseEnemyConfig { public ConfigEntry<int> ZombiePlayerDamage { get; private set; } public ConfigEntry<float> ZombiePlayerDamageCooldown { get; private set; } public ConfigEntry<float> ZombiePlayerTumbleForce { get; private set; } public ConfigEntry<float> ZombiePhysHitForce { get; private set; } public ConfigEntry<float> ZombiePhysHitTorque { get; private set; } public ConfigEntry<bool> ZombiePhysDestroy { get; private set; } public ConfigEntry<int> ZombieHealth { get; private set; } public ConfigEntry<float> ZombieSpawnChance { get; private set; } public ConfigEntry<float> ZombieSpeedMultiplier { get; private set; } public ConfigEntry<float> SpawnChance { get; private set; } public ConfigEntry<int> MaxHordeSpawn { get; private set; } public ConfigEntry<bool> HordeOnHurt { get; private set; } public ConfigEntry<float> FleshDropChance { get; private set; } public ConfigEntry<int> FleshDropAmountMin { get; private set; } public ConfigEntry<int> FleshDropAmountMax { get; private set; } public ConfigEntry<bool> CanEatFlesh { get; private set; } public ConfigEntry<int> FleshHealAmount { get; private set; } public ConfigEntry<int> GlobalHordeLimit { get; private set; } public MCZombieConfig(ConfigFile config) { ((BaseEnemyConfig)this).InitializeConfig(config); } protected override void InitializeConfig(ConfigFile config) { ((BaseEnemyConfig)this).Health = config.Bind<float>("Zombie", "Health", 200f, "Base health of zombies"); ((BaseEnemyConfig)this).SpeedMultiplier = config.Bind<float>("Zombie", "Speed Multiplier", 1f, "Multiplier for zombie movement speed"); ((BaseEnemyConfig)this).PlayerDamage = config.Bind<int>("Zombie", "Player Damage", 45, "Damage dealt to players"); ((BaseEnemyConfig)this).PlayerDamageCooldown = config.Bind<float>("Zombie", "Player Damage Cooldown", 3f, "Cooldown between player damage"); ((BaseEnemyConfig)this).PlayerTumbleForce = config.Bind<float>("Zombie", "Player Tumble Force", 5f, "Force applied to players when hit"); ((BaseEnemyConfig)this).PhysHitForce = config.Bind<float>("Zombie", "Phys Hit Force", 10f, "Force applied to physics objects when hit"); ((BaseEnemyConfig)this).PhysHitTorque = config.Bind<float>("Zombie", "Phys Hit Torque", 5f, "Torque applied to physics objects when hit"); ((BaseEnemyConfig)this).PhysDestroy = config.Bind<bool>("Zombie", "Phys Destroy", false, "Whether zombies can instantly destroy physics objects"); SpawnChance = config.Bind<float>("Zombie", "Horde Spawn Chance", 10f, "Chance for a zombie to spawn when hurt or killed (percentage)"); MaxHordeSpawn = config.Bind<int>("Zombie", "Max Number of Zombies a Zombie can spawn", 2, "Maximum number of zombies a zombie can spawn. if set to 2, each zombie can spawn 2 zombies when horde is triggered."); HordeOnHurt = config.Bind<bool>("Zombie", "Horde on Hurt by Anything", false, "Whether zombies can spawn a horde when hurt by ANYTHING."); FleshDropChance = config.Bind<float>("Zombie", "Flesh Drop Chance", 100f, "Chance for a zombie to drop flesh on death"); FleshDropAmountMin = config.Bind<int>("Zombie", "Flesh Drop Amount Min", 1, "Minimum amount of flesh dropped on death"); FleshDropAmountMax = config.Bind<int>("Zombie", "Flesh Drop Amount Max", 3, "Maximum amount of flesh dropped on death"); CanEatFlesh = config.Bind<bool>("Zombie", "Can Eat Flesh", true, "Whether Rotten Flesh is edible"); FleshHealAmount = config.Bind<int>("Zombie", "Flesh Heal Amount", 10, "Amount of health to heal the player for when eating flesh"); GlobalHordeLimit = config.Bind<int>("Zombie", "Global Horde Limit", 10, "Maximum total number of zombies allowed in the game at once"); } } public class MCZombieConfigController : EnemyConfigController { private MCZombieConfig zombieConfig; private DropTable dropTable; protected override void Awake() { zombieConfig = MCZombieMod.Instance.Config; base.config = (BaseEnemyConfig)(object)zombieConfig; ItemDropper componentInChildren = ((Component)this).GetComponentInChildren<ItemDropper>(); if ((Object)(object)componentInChildren != (Object)null) { dropTable = componentInChildren.DropTable; } ((EnemyConfigController)this).Awake(); } protected override void HandleDeath() { } protected override void OnDestroy() { ((EnemyConfigController)this).OnDestroy(); } protected override void ApplyConfigurations() { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (base.config == null) { return; } ((EnemyConfigController)this).ApplyConfigurations(); if (zombieConfig == null) { return; } if ((Object)(object)dropTable != (Object)null && dropTable.drops != null && dropTable.drops.Count > 0) { ItemDrop val = dropTable.drops.Find((ItemDrop d) => d.guaranteed); if (val != null) { if (zombieConfig.FleshDropChance.Value < 100f) { val.guaranteed = false; val.dropChanceType = (DropChanceType)1; val.chance = zombieConfig.FleshDropChance.Value; } val.minQuantity = zombieConfig.FleshDropAmountMin.Value; val.maxQuantity = zombieConfig.FleshDropAmountMax.Value; } } EnemyMCZombie.spawnHordeChance = zombieConfig.SpawnChance.Value; EnemyMCZombie.HordeOnHurt = zombieConfig.HordeOnHurt.Value; EnemyMCZombie component = ((Component)this).GetComponent<EnemyMCZombie>(); if ((Object)(object)component != (Object)null) { component.MaxHordeSpawn = zombieConfig.MaxHordeSpawn.Value; } RottenFleshValuable.GlobalFleshHealAmount = zombieConfig.FleshHealAmount.Value; } public override void RefreshConfigurations() { ((EnemyConfigController)this).RefreshConfigurations(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("CarsonJF.MCZombieMod", "MCZombieMod", "1.2.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MCZombieMod : BaseUnityPlugin { private static readonly string BundleName = GetModName(); private AssetBundle? _assetBundle; private bool _hasFixedAudioMixerGroups = false; internal static MCZombieMod Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } internal MCZombieConfig Config { get; private set; } private static string GetModName() { object obj = typeof(MCZombieMod).GetCustomAttributes(typeof(BepInPlugin), inherit: false)[0]; BepInPlugin val = (BepInPlugin)((obj is BepInPlugin) ? obj : null); return ((val != null) ? val.Name : null) ?? "MCZombieMod"; } private void LoadAssetBundle() { if (!((Object)(object)_assetBundle != (Object)null)) { _assetBundle = AssetBundleUtil.LoadAssetBundle((BaseUnityPlugin)(object)this, BundleName, Logger); } } private void LoadEnemiesFromResources() { if ((Object)(object)_assetBundle == (Object)null) { return; } List<EnemySetup> list = (from name in _assetBundle.GetAllAssetNames() where name.Contains("/enemies/") && name.EndsWith(".asset") select _assetBundle.LoadAsset<EnemySetup>(name)).ToList(); foreach (EnemySetup item in list) { if ((Object)(object)item != (Object)null) { Enemies.RegisterEnemy(item); } else { Logger.LogWarning((object)"Failed to load enemy asset"); } } if (list.Count > 0) { Logger.LogInfo((object)$"Successfully registered {list.Count} enemies through REPOLib"); } } private void LoadNetworkPrefabsFromResources() { if (!((Object)(object)_assetBundle == (Object)null)) { NetworkPrefabUtil.RegisterNetworkPrefabs(_assetBundle, Logger); } } private void FixAllPrefabAudioMixerGroups() { if (!((Object)(object)_assetBundle == (Object)null) && !_hasFixedAudioMixerGroups) { AssetBundleUtil.FixAudioMixerGroups(_assetBundle, Logger); _hasFixedAudioMixerGroups = true; } } private void Awake() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown Instance = this; Config = new MCZombieConfig(((BaseUnityPlugin)this).Config); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; LoadAssetBundle(); LoadEnemiesFromResources(); LoadNetworkPrefabsFromResources(); FixAllPrefabAudioMixerGroups(); Harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.PatchAll(); } } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { if (!_hasFixedAudioMixerGroups) { FixAllPrefabAudioMixerGroups(); } } } } namespace MCZombieMod.Items { public class RottenFleshEvents : MonoBehaviour { private RottenFleshValuable rottenFlesh; private PhysGrabber localGrabber; private void Awake() { rottenFlesh = ((Component)this).GetComponent<RottenFleshValuable>(); localGrabber = Object.FindObjectOfType<PhysGrabber>(); } public void OnUse() { PhysGrabber[] array = Object.FindObjectsOfType<PhysGrabber>(); PhysGrabber[] array2 = array; foreach (PhysGrabber val in array2) { PlayerAvatar component = ((Component)val).GetComponent<PlayerAvatar>(); if ((Object)(object)component != (Object)null && component.isLocal) { rottenFlesh.EatFlesh(((Component)val).gameObject); return; } } Debug.LogError((object)"No local player found to eat the flesh."); } } public class RottenFleshValuable : MonoBehaviour { [CompilerGenerated] private sealed class <StartSicknessAfterEffects>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public RottenFleshValuable <>4__this; private float <remainingTime>5__1; private PhotonView <view>5__2; private int <i>5__3; private PhotonView <pview>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartSicknessAfterEffects>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <view>5__2 = null; <pview>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <i>5__3 = 0; goto IL_00a1; case 1: <>1__state = -1; <i>5__3++; goto IL_00a1; case 2: { <>1__state = -1; break; } IL_00a1: if (<i>5__3 < <>4__this.eatEffectPlays) { <>4__this.PlayRandomEatSound(); if ((Object)(object)<>4__this.eatParticles != (Object)null) { <>4__this.eatParticles.Play(); } <>2__current = (object)new WaitForSeconds(<>4__this.effectPlayInterval); <>1__state = 1; return true; } <remainingTime>5__1 = <>4__this.eatEffectDuration - (float)<>4__this.eatEffectPlays * <>4__this.effectPlayInterval; if (<remainingTime>5__1 > 0f) { <>2__current = (object)new WaitForSeconds(<remainingTime>5__1); <>1__state = 2; return true; } break; } <>4__this.audioSource.PlayOneShot(<>4__this.eatBurpSound); if ((Object)(object)<>4__this.playerAvatar != (Object)null && <>4__this.playerAvatar.isLocal) { Debug.Log((object)("Healed local player " + <>4__this.playerAvatar.playerName + " for " + <>4__this.fleshHealAmount + " health")); <>4__this.playerAvatar.playerHealth.HealOther(<>4__this.fleshHealAmount, true); <>4__this.playerAvatar.HealedOther(); <pview>5__4 = ((Component)<>4__this).GetComponent<PhotonView>(); if (PhotonNetwork.IsConnected && (Object)(object)<pview>5__4 != (Object)null && <pview>5__4.IsMine) { <pview>5__4.RPC("RPC_DestroyFlesh", (RpcTarget)0, Array.Empty<object>()); } else { Object.Destroy((Object)(object)((Component)<>4__this).gameObject); } <pview>5__4 = null; } if ((Object)(object)Inventory.instance != (Object)null && (Object)(object)Inventory.instance.physGrabber != (Object)null && (Object)(object)Inventory.instance.physGrabber.grabbedPhysGrabObject != (Object)null && (Object)(object)((Component)Inventory.instance.physGrabber.grabbedPhysGrabObject).gameObject == (Object)(object)((Component)<>4__this).gameObject) { Inventory.instance.physGrabber.ReleaseObject(0.1f); } <view>5__2 = ((Component)<>4__this).GetComponent<PhotonView>(); if (PhotonNetwork.IsConnected && (Object)(object)<view>5__2 != (Object)null) { <view>5__2.RPC("RPC_DestroyFlesh", (RpcTarget)0, Array.Empty<object>()); } else { Object.Destroy((Object)(object)((Component)<>4__this).gameObject); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static int GlobalFleshHealAmount = 25; [Header("Prefab References")] [SerializeField] private AudioClip[] eatSoundClips; [SerializeField] private AudioClip eatBurpSound; public ParticleSystem eatParticles; public float eatEffectDuration = 2f; public int eatEffectPlays = 9; public float effectPlayInterval = 0.07f; private PlayerAvatar playerAvatar; private AudioSource audioSource; private int fleshHealAmount = GlobalFleshHealAmount; private void Awake() { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); audioSource.spatialBlend = 1f; audioSource.playOnAwake = false; fleshHealAmount = GlobalFleshHealAmount; } private void PlayRandomEatSound() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (eatSoundClips != null && eatSoundClips.Length != 0) { int num = Random.Range(0, eatSoundClips.Length); audioSource.PlayOneShot(eatSoundClips[num]); GameDirector.instance.CameraImpact.ShakeDistance(5f, 1f, 6f, ((Component)this).transform.position, 0.2f); } } public void EatFlesh(GameObject player) { PlayerAvatar component = player.GetComponent<PlayerAvatar>(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)"EatFlesh failed: PlayerAvatar component missing."); return; } if (!component.isLocal) { Debug.LogError((object)"EatFlesh failed: PlayerAvatar is not local."); return; } Debug.Log((object)("Eating flesh for " + component.playerName)); playerAvatar = component; PhotonView componentInChildren = ((Component)playerAvatar).GetComponentInChildren<PhotonView>(); GameObject val = ((componentInChildren != null) ? ((Component)componentInChildren).gameObject : null); PlayerSickness playerSickness = null; if ((Object)(object)val != (Object)null) { playerSickness = val.GetComponent<PlayerSickness>(); if ((Object)(object)playerSickness == (Object)null) { playerSickness = val.AddComponent<PlayerSickness>(); playerSickness.AssignPlayerAvatar(playerAvatar); Debug.Log((object)("[SICKNESS] Added and assigned PlayerSickness to " + ((Object)val).name)); } } else { Debug.LogWarning((object)"[SICKNESS] Failed to find PhotonView holder to attach sickness!"); } ((MonoBehaviour)this).StartCoroutine(StartSicknessAfterEffects()); } [IteratorStateMachine(typeof(<StartSicknessAfterEffects>d__13))] private IEnumerator StartSicknessAfterEffects() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartSicknessAfterEffects>d__13(0) { <>4__this = this }; } [PunRPC] public void RPC_DestroyFlesh() { Object.Destroy((Object)(object)((Component)this).gameObject); } } } namespace MCZombieMod.AI { public class EnemyMCZombie : MonoBehaviour { public enum State { Spawn, Idle, Roam, Investigate, Chase, LookForPlayer, Attack, Leave, Stun } private Enemy _enemy; private PhotonView _photonView; public PlayerAvatar _targetPlayer; private bool _stateImpulse; private bool _deathImpulse; private bool _attackImpulse; [Header("State")] [SerializeField] public State currentState; [SerializeField] public float stateTimer; public static float spawnHordeChance = 0.2f; private Quaternion _horizontalRotationTarget = Quaternion.identity; private Vector3 _agentDestination; private Vector3 _targetPosition; private bool _hurtImpulse; private float hurtLerp; private int _hurtAmount; private Material _hurtableMaterial; private float _pitCheckTimer; private bool _pitCheck; private float _ambientTimer; private bool _ambientImpulse; private bool _attackWindowOpen = false; private float _attackWindowTimer = 0f; private Vector3 _lastSeenPlayerPosition; private float _attackCooldown; private float _lookForPlayerTimer; private int _unsuccessfulAttackCount; private float _interestTimer; private float _maxInterestTime = 30f; private float _hurtInterestLoss = 0.5f; private float _currentInterest = 1f; [Header("Animation")] [SerializeField] private EnemyMCZombieAnim animator; [SerializeField] private SkinnedMeshRenderer _renderer; [SerializeField] private AnimationCurve hurtCurve; [Header("Rotation and LookAt")] public SpringQuaternion horizontalRotationSpring; public SpringQuaternion headLookAtSpring; public Transform headLookAtTarget; public Transform headLookAtSource; private float _spawnCooldown = 0f; private const float SPAWN_COOLDOWN_TIME = 5f; private int _spawnedZombies = 0; private int _maxHordeSpawn = 2; private const int DEFAULT_MAX_SPAWNED_ZOMBIES = 2; private static bool _hordeOnHurt = false; private static int _totalZombies = 0; private const int MAX_TOTAL_ZOMBIES = 10; public Enemy Enemy => _enemy; public PhotonView PhotonView => _photonView; private EnemyNavMeshAgent _navMeshAgent => EnemyReflectionUtil.GetEnemyNavMeshAgent(_enemy); private EnemyRigidbody _rigidbody => EnemyReflectionUtil.GetEnemyRigidbody(_enemy); private EnemyParent _enemyParent => EnemyReflectionUtil.GetEnemyParent(_enemy); private EnemyVision _vision => EnemyReflectionUtil.GetEnemyVision(_enemy); private EnemyStateInvestigate _investigate => EnemyReflectionUtil.GetEnemyStateInvestigate(_enemy); public bool DeathImpulse { get { return _deathImpulse; } set { _deathImpulse = value; } } public float RandomSpawnChance { get; set; } public float CurrentInterest => _currentInterest; private int MAX_SPAWNED_ZOMBIES => _maxHordeSpawn; public static bool HordeOnHurt { get { return _hordeOnHurt; } set { _hordeOnHurt = value; } } public int MaxHordeSpawn { get { return _maxHordeSpawn; } set { _maxHordeSpawn = value; } } public static int TotalZombies => _totalZombies; private void Awake() { _enemy = ((Component)this).GetComponent<Enemy>(); _photonView = ((Component)this).GetComponent<PhotonView>(); _hurtAmount = Shader.PropertyToID("_ColorOverlayAmount"); if ((Object)(object)_renderer != (Object)null) { _hurtableMaterial = ((Renderer)_renderer).material; } hurtCurve = AssetManager.instance.animationCurveImpact; if ((Object)(object)_navMeshAgent != (Object)null) { Type type = ((object)_navMeshAgent).GetType(); FieldInfo field = type.GetField("Radius", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(_navMeshAgent, 0.5f); } FieldInfo field2 = type.GetField("Height", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(_navMeshAgent, 2f); } FieldInfo field3 = type.GetField("ObstacleAvoidanceType", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(_navMeshAgent, (object)(ObstacleAvoidanceType)4); } FieldInfo field4 = type.GetField("AvoidancePriority", BindingFlags.Instance | BindingFlags.NonPublic); if (field4 != null) { field4.SetValue(_navMeshAgent, Random.Range(0, 100)); } } } private void OnDestroy() { } public void OnPlayerHit() { _unsuccessfulAttackCount = 0; _attackWindowOpen = false; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayPlayerHit", (RpcTarget)0, Array.Empty<object>()); } else { animator.PlayPlayerHitSound(); } } private void Update() { //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) if ((!GameManager.Multiplayer() || PhotonNetwork.IsMasterClient) && LevelGenerator.Instance.Generated) { if (!_enemy.IsStunned()) { if (_enemy.IsStunned()) { UpdateState(State.Stun); } switch (currentState) { case State.Spawn: StateSpawn(); break; case State.Idle: StateIdle(); break; case State.Roam: StateRoam(); break; case State.Investigate: StateInvestigate(); break; case State.Chase: StateChase(); break; case State.LookForPlayer: StateLookForPlayer(); break; case State.Attack: StateAttack(); break; case State.Leave: StateLeave(); break; case State.Stun: StateStun(); break; default: throw new ArgumentOutOfRangeException(); } RotationLogic(); TargetingLogic(); } HurtEffect(); if (_ambientTimer > 0f) { _ambientTimer -= Time.deltaTime; } else { _ambientImpulse = true; } if (_attackCooldown > 0f) { _attackCooldown -= Time.deltaTime; } if (_spawnCooldown > 0f) { _spawnCooldown -= Time.deltaTime; } if (!_enemy.IsStunned()) { Vector3 agentVelocity = EnemyReflectionUtil.GetAgentVelocity(_navMeshAgent); float magnitude = ((Vector3)(ref agentVelocity)).magnitude; float num = magnitude / 2f + 1f; float @float = animator.animator.GetFloat("Walking"); float num2 = Mathf.MoveTowards(@float, num, Time.deltaTime * 10f); if (Mathf.Abs(@float - num2) > 0.01f) { if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_SetFloat", (RpcTarget)0, new object[2] { "Walking", num2 }); } else { animator.animator.SetFloat("Walking", num2); } } bool flag = magnitude > 0.1f; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_SetBool", (RpcTarget)0, new object[2] { "isWalking", flag }); } else { animator.animator.SetBool("isWalking", flag); } } } if (GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient) { _navMeshAgent.Warp(((Component)_rigidbody).transform.position); } } private void LateUpdate() { HeadLookAtLogic(); } private void UpdateState(State newState) { if (newState != currentState) { currentState = newState; stateTimer = 0f; _stateImpulse = true; if (GameManager.Multiplayer()) { _photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { currentState }); } else { UpdateStateRPC(currentState); } } } [PunRPC] private void UpdateStateRPC(State _state) { currentState = _state; } [PunRPC] private void UpdatePlayerTargetRPC(int viewID) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.photonView.ViewID == viewID) { _targetPlayer = item; break; } } } private void TargetingLogic() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if (currentState == State.Chase && Object.op_Implicit((Object)(object)_targetPlayer)) { Vector3 val = ((Component)_targetPlayer).transform.position + ((Component)_targetPlayer).transform.forward * 1.5f; if (_pitCheckTimer <= 0f) { _pitCheckTimer = 0.1f; _pitCheck = !Physics.Raycast(val + Vector3.up, Vector3.down, 4f, LayerMask.GetMask(new string[1] { "Default" })); } else { _pitCheckTimer -= Time.deltaTime; } if (_pitCheck) { val = ((Component)_targetPlayer).transform.position; } _targetPosition = Vector3.Lerp(_targetPosition, val, 20f * Time.deltaTime); } } private void RotationLogic() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) Vector3 val = EnemyReflectionUtil.GetAgentVelocity(_navMeshAgent); val = ((Vector3)(ref val)).normalized; if (((Vector3)(ref val)).magnitude > 0.01f) { val = EnemyReflectionUtil.GetAgentVelocity(_navMeshAgent); _horizontalRotationTarget = Quaternion.LookRotation(((Vector3)(ref val)).normalized); ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f); } if (currentState == State.Spawn || currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate || currentState == State.Leave) { horizontalRotationSpring.speed = 5f; horizontalRotationSpring.damping = 0.7f; } else { horizontalRotationSpring.speed = 10f; horizontalRotationSpring.damping = 0.8f; } ((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f); } private void HeadLookAtLogic() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_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_0084: 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) if (currentState == State.Chase && !_enemy.IsStunned() && Object.op_Implicit((Object)(object)_targetPlayer) && !EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer)) { Vector3 val = _targetPlayer.PlayerVisionTarget.VisionTransform.position - headLookAtTarget.position; val = SemiFunc.ClampDirection(val, headLookAtTarget.forward, 60f); headLookAtSource.rotation = SemiFunc.SpringQuaternionGet(headLookAtSpring, Quaternion.LookRotation(val), -1f); } else { headLookAtSource.rotation = SemiFunc.SpringQuaternionGet(headLookAtSpring, headLookAtTarget.rotation, -1f); } } private void HurtEffect() { if (!_hurtImpulse) { return; } hurtLerp += 2.5f * Time.deltaTime; hurtLerp = Mathf.Clamp01(hurtLerp); if ((Object)(object)_hurtableMaterial != (Object)null) { _hurtableMaterial.SetFloat(_hurtAmount, hurtCurve.Evaluate(hurtLerp)); } if (hurtLerp > 1f) { _hurtImpulse = false; if ((Object)(object)_hurtableMaterial != (Object)null) { _hurtableMaterial.SetFloat(_hurtAmount, 0f); } } } private void StateSpawn() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _navMeshAgent.Warp(((Component)_rigidbody).transform.position); _navMeshAgent.ResetPath(); _stateImpulse = false; } } private void StateIdle() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; stateTimer = Random.Range(4f, 8f); _navMeshAgent.Warp(((Component)_rigidbody).transform.position); _navMeshAgent.ResetPath(); } if (!SemiFunc.EnemySpawnIdlePause()) { stateTimer -= Time.deltaTime; if (stateTimer <= 0f) { UpdateState(State.Roam); } if (SemiFunc.EnemyForceLeave(_enemy)) { UpdateState(State.Leave); } } } private void StateRoam() { //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { bool flag = false; _ambientTimer = Random.Range(5f, 15f); stateTimer = Random.Range(4f, 8f); LevelPoint val = SemiFunc.LevelPointGet(((Component)this).transform.position, 10f, 25f); if (!Object.op_Implicit((Object)(object)val)) { val = SemiFunc.LevelPointGet(((Component)this).transform.position, 0f, 999f); } NavMeshHit val2 = default(NavMeshHit); if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 3f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" }))) { _agentDestination = ((NavMeshHit)(ref val2)).position; flag = true; } if (!flag) { return; } EnemyReflectionUtil.SetNotMovingTimer(_rigidbody, 0f); _stateImpulse = false; } else { _navMeshAgent.SetDestination(_agentDestination); if (EnemyReflectionUtil.GetNotMovingTimer(_rigidbody) > 2f) { UpdateState(State.Idle); } if (stateTimer <= 0f) { UpdateState(State.Idle); } } if (SemiFunc.EnemyForceLeave(_enemy)) { UpdateState(State.Leave); } if (_ambientImpulse) { _ambientImpulse = false; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayRoam", (RpcTarget)0, Array.Empty<object>()); } else { animator.PlayRoamSound(); } _ambientTimer = Random.Range(15f, 20f); } } private void StateInvestigate() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; stateTimer = Random.Range(24f, 30f); _ambientTimer = Random.Range(5f, 15f); } _navMeshAgent.SetDestination(_targetPosition); stateTimer -= Time.deltaTime; _vision.StandOverride(0.25f); if (Object.op_Implicit((Object)(object)_targetPlayer) && !EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer)) { float num = Vector3.Distance(((Component)_rigidbody).transform.position, ((Component)_targetPlayer).transform.position); if (num <= 5f) { _lastSeenPlayerPosition = ((Component)_targetPlayer).transform.position; UpdateState(State.Chase); return; } } if (stateTimer <= 0f) { UpdateState(State.Idle); return; } if (_ambientImpulse) { _ambientImpulse = false; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayCurious", (RpcTarget)0, Array.Empty<object>()); } else { animator.PlayCuriousSound(); } _ambientTimer = Random.Range(15f, 20f); } NavMeshHit val = default(NavMeshHit); if (_navMeshAgent.CanReach(_targetPosition, 1f) && Vector3.Distance(((Component)_rigidbody).transform.position, _navMeshAgent.GetPoint()) < 2f && !NavMesh.SamplePosition(_targetPosition, ref val, 0.5f, -1)) { UpdateState(State.Roam); } } private void StateChase() { //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _ambientTimer = Random.Range(5f, 15f); _interestTimer = _maxInterestTime; } if (!Object.op_Implicit((Object)(object)_targetPlayer) || EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer)) { _lastSeenPlayerPosition = (Object.op_Implicit((Object)(object)_targetPlayer) ? ((Component)_targetPlayer).transform.position : _lastSeenPlayerPosition); if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayLookForPlayer", (RpcTarget)0, Array.Empty<object>()); } else { animator.PlayLookForPlayerSound(); } UpdateState(State.LookForPlayer); return; } _interestTimer -= Time.deltaTime; if (_interestTimer <= 0f) { _currentInterest -= 0.1f * Time.deltaTime; if (_currentInterest <= 0f) { _lastSeenPlayerPosition = (Object.op_Implicit((Object)(object)_targetPlayer) ? ((Component)_targetPlayer).transform.position : _lastSeenPlayerPosition); UpdateState(State.LookForPlayer); return; } } float num = Vector3.Distance(((Component)_rigidbody).transform.position, ((Component)_targetPlayer).transform.position); if (num <= 2f && _attackCooldown <= 0f) { _attackImpulse = true; _attackCooldown = 4f; UpdateState(State.Attack); return; } if (Object.op_Implicit((Object)(object)_targetPlayer) && Vector3.Distance(((Component)_targetPlayer).transform.position, ((Component)this).transform.position) < 1.5f) { float num2 = ((Component)this).transform.position.y - ((Component)_targetPlayer).transform.position.y; if (num2 > 1f && EnemyReflectionUtil.GetNotMovingTimer(_rigidbody) > 1f) { _navMeshAgent.Warp(((Component)this).transform.position + Vector3.back * 2f); _lastSeenPlayerPosition = (Object.op_Implicit((Object)(object)_targetPlayer) ? ((Component)_targetPlayer).transform.position : _lastSeenPlayerPosition); UpdateState(State.LookForPlayer); OnStun(); return; } } if (!hasTargetLineOfSight()) { _lastSeenPlayerPosition = ((Component)_targetPlayer).transform.position; UpdateState(State.LookForPlayer); return; } _interestTimer = _maxInterestTime; if (num > 6f && (_targetPlayer.isCrawling || _targetPlayer.isTumbling)) { _currentInterest -= Time.deltaTime * 0.2f; if (_currentInterest <= 0f) { _lastSeenPlayerPosition = (Object.op_Implicit((Object)(object)_targetPlayer) ? ((Component)_targetPlayer).transform.position : _lastSeenPlayerPosition); UpdateState(State.LookForPlayer); return; } } _targetPosition = ((Component)_targetPlayer).transform.position; _navMeshAgent.SetDestination(_targetPosition); Vector3 val = ((Component)_rigidbody).transform.position + Vector3.up * 1.5f; Vector3 val2 = ((Component)_targetPlayer).transform.position + Vector3.up * 1f - val; _horizontalRotationTarget = Quaternion.LookRotation(val2); ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f); ((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f); if (_ambientImpulse) { _ambientImpulse = false; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayChasePlayer", (RpcTarget)0, Array.Empty<object>()); } else { animator.PlayChasePlayerSound(); } _ambientTimer = Random.Range(15f, 20f); } } private void StateLookForPlayer() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _interestTimer = Random.Range(8f, 12f); _ambientTimer = Random.Range(5f, 15f); _lookForPlayerTimer = Random.Range(2f, 5f); } _interestTimer -= Time.deltaTime; if (Object.op_Implicit((Object)(object)_targetPlayer) && !EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer)) { bool flag = true; float num = Vector3.Distance(((Component)_rigidbody).transform.position, ((Component)_targetPlayer).transform.position); NavMeshHit val = default(NavMeshHit); if (num > 8f || !hasTargetLineOfSight() || !NavMesh.SamplePosition(_targetPosition, ref val, 0.5f, -1)) { flag = false; } if (flag) { _lastSeenPlayerPosition = ((Component)_targetPlayer).transform.position; UpdateState(State.Chase); return; } } if (_interestTimer <= 0f) { UpdateState(State.Leave); return; } if (_lookForPlayerTimer <= 0f) { _targetPosition = _lastSeenPlayerPosition + Random.insideUnitSphere * 3f; _navMeshAgent.SetDestination(_targetPosition); _lookForPlayerTimer = Random.Range(2f, 5f); } if (_ambientImpulse) { _ambientImpulse = false; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayVision", (RpcTarget)0, Array.Empty<object>()); } else { animator.PlayVisionSound(); } _ambientTimer = Random.Range(15f, 20f); } } private void StateAttack() { //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _attackImpulse = false; _attackWindowOpen = true; _attackWindowTimer = 2.6f; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayAttack", (RpcTarget)0, Array.Empty<object>()); } else { animator.AttackPlayer(); animator.PlayAttackSound(); } _navMeshAgent.ResetPath(); } _unsuccessfulAttackCount++; if (_unsuccessfulAttackCount >= 2) { _unsuccessfulAttackCount = 0; _currentInterest -= 0.6f; if (_currentInterest <= 0f) { UpdateState(State.Roam); _currentInterest = 0f; return; } } if (_attackWindowOpen) { _attackWindowTimer -= Time.deltaTime; if (_attackWindowTimer <= 0f) { _attackWindowOpen = false; if (Object.op_Implicit((Object)(object)_targetPlayer) && !EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer)) { float num = Vector3.Distance(((Component)_rigidbody).transform.position, ((Component)_targetPlayer).transform.position); if (num <= 2f) { if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayAttack", (RpcTarget)0, Array.Empty<object>()); } else { animator.AttackPlayer(); animator.PlayAttackSound(); } } } _navMeshAgent.SetDestination(_targetPosition); } } else { animator.animator.SetBool("isAttacking", false); _navMeshAgent.SetDestination(_targetPosition); } if (Object.op_Implicit((Object)(object)_targetPlayer) && !EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer)) { Vector3 val = ((Component)_rigidbody).transform.position + Vector3.up * 1.5f; Vector3 val2 = ((Component)_targetPlayer).transform.position + Vector3.up * 1f - val; float magnitude = ((Vector3)(ref val2)).magnitude; bool flag = false; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val, ((Vector3)(ref val2)).normalized, ref val3, magnitude, LayerMask.GetMask(new string[1] { "Default" }))) { if (((Component)((RaycastHit)(ref val3)).transform).CompareTag("Player")) { flag = true; } } else { flag = true; } if (!flag) { UpdateState(State.LookForPlayer); return; } _horizontalRotationTarget = Quaternion.LookRotation(val2); ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref _horizontalRotationTarget)).eulerAngles.y, 0f); ((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(horizontalRotationSpring, _horizontalRotationTarget, -1f); float num2 = Vector3.Distance(((Component)_rigidbody).transform.position, ((Component)_targetPlayer).transform.position); if (num2 <= 10f) { _lastSeenPlayerPosition = ((Component)_targetPlayer).transform.position; UpdateState(State.Chase); return; } } if ((Object)(object)_targetPlayer != (Object)null && Vector3.Distance(((Component)_targetPlayer).transform.position, ((Component)this).transform.position) < 1.5f) { float num3 = ((Component)this).transform.position.y - ((Component)_targetPlayer).transform.position.y; if (num3 > 1f && EnemyReflectionUtil.GetNotMovingTimer(_rigidbody) > 1f) { _navMeshAgent.Warp(((Component)this).transform.position + Vector3.back * 2f); UpdateState(State.Roam); OnStun(); return; } } UpdateState(State.LookForPlayer); } private void StateLeave() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _ambientTimer = Random.Range(5f, 15f); stateTimer = 5f; bool flag = false; LevelPoint val = SemiFunc.LevelPointGetPlayerDistance(((Component)this).transform.position, 30f, 50f, false); if (!Object.op_Implicit((Object)(object)val)) { val = SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 5f); } NavMeshHit val2 = default(NavMeshHit); if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 1f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" }))) { _agentDestination = ((NavMeshHit)(ref val2)).position; flag = true; } if (flag) { _enemy.NavMeshAgent.SetDestination(_agentDestination); EnemyReflectionUtil.SetNotMovingTimer(_rigidbody, 0f); _stateImpulse = false; } } else { if (EnemyReflectionUtil.GetNotMovingTimer(_rigidbody) > 2f) { stateTimer -= Time.deltaTime; } SemiFunc.EnemyCartJump(_enemy); if (Vector3.Distance(((Component)this).transform.position, _agentDestination) < 1f || stateTimer <= 0f) { SemiFunc.EnemyCartJumpReset(_enemy); UpdateState(State.Idle); } } if (_ambientImpulse) { _ambientImpulse = false; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayRoam", (RpcTarget)0, Array.Empty<object>()); } else { animator.PlayRoamSound(); } _ambientTimer = Random.Range(15f, 20f); } } private void StateStun() { if (_stateImpulse) { _stateImpulse = false; } if (!_enemy.IsStunned()) { UpdateState(State.Idle); } } public void OnSpawn() { if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(_enemy)) { UpdateState(State.Spawn); if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_SetTrigger", (RpcTarget)0, new object[1] { "Spawn" }); _photonView.RPC("RPC_PlaySpawn", (RpcTarget)0, Array.Empty<object>()); _photonView.RPC("RPC_PlaySpawnParticles", (RpcTarget)0, Array.Empty<object>()); } else { animator.animator.SetTrigger("Spawn"); animator.PlaySpawnSound(); animator.SpawnParticlesImpulse(); } } } [PunRPC] private void PlaySpawnEffectsRPC() { _photonView.RPC("RPC_SetTrigger", (RpcTarget)0, new object[1] { "Attack" }); animator.SpawnParticlesImpulse(); animator.PlaySpawnSound(); } public void OnVision() { //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) if ((currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate) && !_enemy.IsStunned()) { if (SemiFunc.IsMasterClientOrSingleplayer()) { _targetPlayer = EnemyReflectionUtil.GetVisionTriggeredPlayer(_vision); if (SemiFunc.IsMultiplayer()) { _photonView.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { _photonView.ViewID }); } UpdateState(State.Investigate); animator.PlayVisionSound(); } } else if (currentState == State.Investigate || currentState == State.LookForPlayer) { if (!Object.op_Implicit((Object)(object)_targetPlayer)) { _targetPlayer = EnemyReflectionUtil.GetVisionTriggeredPlayer(_vision); } if (Enemy.Vision.onVisionTriggeredCulled && !Enemy.Vision.onVisionTriggeredNear) { _targetPosition = ((Component)_targetPlayer).transform.position; } else if (Enemy.Vision.onVisionTriggeredDistance < 5f) { UpdateState(State.Chase); } } } public void OnInvestigate() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && (currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate || currentState == State.LookForPlayer)) { _targetPosition = EnemyReflectionUtil.GetOnInvestigateTriggeredPosition(_investigate); UpdateState(State.Investigate); } } public void OnHurt() { _hurtImpulse = true; _unsuccessfulAttackCount = 0; _currentInterest -= _hurtInterestLoss; if (_currentInterest <= 0f) { UpdateState(State.Roam); } if (HordeOnHurt && SemiFunc.IsMasterClientOrSingleplayer() && _spawnedZombies < MAX_SPAWNED_ZOMBIES && _spawnCooldown <= 0f) { RandomSpawnChance = Random.Range(0f, 100f); if (RandomSpawnChance <= spawnHordeChance) { ZombieHordeSpawn(); _spawnCooldown = 5f; _spawnedZombies++; } } if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayHurt", (RpcTarget)0, Array.Empty<object>()); return; } animator.PlayHurtSound(); animator.HurtParticlesImpulse(); } [PunRPC] private void PlayHurtEffectsRPC() { animator.PlayHurtSound(); animator.HurtParticlesImpulse(); } public void OnObjectHurt() { if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_enemy.Health.onObjectHurtPlayer != (Object)null && _spawnedZombies < MAX_SPAWNED_ZOMBIES && _spawnCooldown <= 0f) { RandomSpawnChance = Random.Range(0f, 100f); if (RandomSpawnChance <= spawnHordeChance) { ZombieHordeSpawn(); _spawnCooldown = 5f; _spawnedZombies++; } } _hurtImpulse = true; _unsuccessfulAttackCount = 0; _currentInterest -= _hurtInterestLoss; if (_currentInterest <= 0f) { UpdateState(State.Roam); } animator.PlayHurtSound(); animator.HurtParticlesImpulse(); } public void ZombieHordeSpawn() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || _totalZombies >= 10) { return; } EnemySetup enemyByName = Enemies.GetEnemyByName("mczombie"); Vector3 val = _lastSeenPlayerPosition + Random.insideUnitSphere * 3f; NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(val + Random.insideUnitSphere * 3f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" }))) { if (SemiFunc.IsMultiplayer()) { _photonView.RPC("SpawnEnemyRPC", (RpcTarget)0, new object[2] { ((NavMeshHit)(ref val2)).position, ((Component)_enemy).transform.rotation }); } else { Enemies.SpawnEnemy(enemyByName, ((NavMeshHit)(ref val2)).position, ((Component)_enemy).transform.rotation, false); } _totalZombies++; } } [PunRPC] private void SpawnEnemyRPC(Vector3 position, Quaternion rotation) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) EnemySetup enemyByName = Enemies.GetEnemyByName("mczombie"); Enemies.SpawnEnemy(enemyByName, position, rotation, false); _totalZombies++; } public void OnDeath() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) _deathImpulse = true; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayDeath", (RpcTarget)0, Array.Empty<object>()); } else { animator.PlayDeathSound(); animator.DeathParticlesImpulse(); } GameDirector.instance.CameraShake.ShakeDistance(3f, 3f, 10f, ((Component)this).transform.position, 0.5f); GameDirector.instance.CameraImpact.ShakeDistance(3f, 3f, 10f, ((Component)this).transform.position, 0.05f); if (SemiFunc.IsMasterClientOrSingleplayer()) { _enemyParent.Despawn(); RandomSpawnChance = Random.Range(0f, 100f); if (_spawnCooldown <= 0f && RandomSpawnChance <= spawnHordeChance && _spawnedZombies < MAX_SPAWNED_ZOMBIES) { ZombieHordeSpawn(); _spawnCooldown = 5f; _spawnedZombies++; } } _totalZombies--; } public void OnStun() { if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayStunned", (RpcTarget)0, Array.Empty<object>()); } else { animator.OnStun(); } } public void OnUnstun() { if (SemiFunc.IsMultiplayer()) { _photonView.RPC("RPC_PlayUnstunned", (RpcTarget)0, Array.Empty<object>()); } else { animator.OnUnstun(); } } public void OnGrabbed() { if (SemiFunc.IsMasterClientOrSingleplayer() && currentState != State.Attack && currentState != State.Chase && currentState != State.Stun) { _targetPlayer = _enemy.Vision.onVisionTriggeredPlayer; if (SemiFunc.IsMultiplayer()) { _photonView.RPC("UpdatePlayerTargetRPC", (RpcTarget)0, new object[1] { _targetPlayer.photonView.ViewID }); } UpdateState(State.Chase); } } public void OnSpawnComplete() { UpdateState(State.Idle); } public bool hasTargetLineOfSight() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_targetPlayer) || EnemyReflectionUtil.IsPlayerDisabled(_targetPlayer)) { return false; } Vector3 val = ((Component)_rigidbody).transform.position + Vector3.up * 1.5f; Vector3 val2 = ((Component)_targetPlayer).transform.position + Vector3.up * 1f - val; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude > 10f) { return false; } bool result = false; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val, ((Vector3)(ref val2)).normalized, ref val3, magnitude, LayerMask.GetMask(new string[1] { "Default" }))) { if (((Component)((RaycastHit)(ref val3)).transform).CompareTag("Player")) { result = true; } } else { result = true; } return result; } [PunRPC] private void PlayAttackEffectsRPC() { animator.PlayAttackSound(); animator.AttackPlayer(); animator.animator.SetBool("isAttacking", true); } [PunRPC] private void TriggerAttackRPC() { _photonView.RPC("RPC_SetTrigger", (RpcTarget)0, new object[1] { "Attack" }); } [PunRPC] public void RPC_SetTrigger(string trigger) { animator.animator.SetTrigger(trigger); } [PunRPC] public void RPC_SetBool(string param, bool value) { animator.animator.SetBool(param, value); } [PunRPC] public void RPC_SetFloat(string param, float value) { animator.animator.SetFloat(param, value); } [PunRPC] public void RPC_PlayAttack() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) animator.animator.SetTrigger("Attack"); animator.attackSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } [PunRPC] public void RPC_PlayHurt() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) animator.hurtSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); ParticleSystem[] hurtParticles = animator.hurtParticles; foreach (ParticleSystem val in hurtParticles) { ((Component)val).gameObject.SetActive(true); val.Play(); } } [PunRPC] public void RPC_PlayDeath() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) animator.deathSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); ParticleSystem[] deathParticles = animator.deathParticles; foreach (ParticleSystem val in deathParticles) { ((Component)val).gameObject.SetActive(true); val.Play(); } } [PunRPC] public void RPC_PlaySpawn() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) animator.spawnSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); ParticleSystem[] spawnParticles = animator.spawnParticles; foreach (ParticleSystem val in spawnParticles) { ((Component)val).gameObject.SetActive(true); val.Play(); } } [PunRPC] public void RPC_SetDespawn() { EnemyReflectionUtil.GetEnemyParent(Enemy).Despawn(); } [PunRPC] public void RPC_PlayRoam() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) animator.roamSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } [PunRPC] public void RPC_PlayVision() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) animator.visionSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } [PunRPC] public void RPC_PlayCurious() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) animator.curiousSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } [PunRPC] public void RPC_PlayLookForPlayer() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) animator.lookForPlayerSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } [PunRPC] public void RPC_PlayChasePlayer() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) animator.chasePlayerSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } [PunRPC] public void RPC_PlayPlayerHit() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) animator.playerHitSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } [PunRPC] public void RPC_PlayStunned() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) animator.animator.SetBool("isStunned", true); animator.stunnedSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } [PunRPC] public void RPC_PlayUnstunned() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) animator.animator.SetBool("isStunned", false); animator.unstunnedSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } [PunRPC] public void RPC_PlayFootstep() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) animator.footstepSounds.Play(Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } [PunRPC] public void RPC_PlayDeathParticles() { ParticleSystem[] deathParticles = animator.deathParticles; foreach (ParticleSystem val in deathParticles) { ((Component)val).gameObject.SetActive(true); val.Play(); } } [PunRPC] public void RPC_PlayHurtParticles() { ParticleSystem[] hurtParticles = animator.hurtParticles; foreach (ParticleSystem val in hurtParticles) { ((Component)val).gameObject.SetActive(true); val.Play(); } } [PunRPC] public void RPC_PlaySpawnParticles() { ParticleSystem[] spawnParticles = animator.spawnParticles; foreach (ParticleSystem val in spawnParticles) { ((Component)val).gameObject.SetActive(true); val.Play(); } } } public class EnemyMCZombieAnim : MonoBehaviour { public enum AnimValueType { Trigger, Float, Int, Bool } [Serializable] public class AnimValueDisplay { public string name; public AnimValueType type; public bool enabled = true; } [Header("References")] public EnemyMCZombie controller; public Animator animator; public HurtCollider hurtCollider; public Rigidbody rigidbody; [Header("Particles")] public ParticleSystem[] hurtParticles; public ParticleSystem[] deathParticles; public ParticleSystem[] spawnParticles; [Header("Sounds")] public Sound roamSounds; public Sound curiousSounds; public Sound visionSounds; public Sound hurtSounds; public Sound deathSounds; public Sound attackSounds; public Sound lookForPlayerSounds; public Sound chasePlayerSounds; public Sound stunnedSounds; public Sound unstunnedSounds; public Sound footstepSounds; public Sound spawnSounds; public Sound playerHitSounds; [Header("Constraints")] public ParentConstraint parentConstraint; [SerializeField] private List<AnimValueDisplay> availableAnimValues = new List<AnimValueDisplay> { new AnimValueDisplay { name = "Walking", type = AnimValueType.Float }, new AnimValueDisplay { name = "isWalking", type = AnimValueType.Bool }, new AnimValueDisplay { name = "isStunned", type = AnimValueType.Bool }, new AnimValueDisplay { name = "isAttacking", type = AnimValueType.Bool } }; public List<AnimValueDisplay> AvailableAnimValues => availableAnimValues; private void Awake() { animator = ((Component)this).GetComponent<Animator>(); if ((Object)(object)hurtCollider == (Object)null) { hurtCollider = ((Component)this).GetComponentInChildren<HurtCollider>(); } if ((Object)(object)hurtCollider != (Object)null) { ((Component)hurtCollider).gameObject.SetActive(false); } if ((Object)(object)parentConstraint == (Object)null) { parentConstraint = ((Component)this).GetComponent<ParentConstraint>(); } Transform obj = ((Component)this).transform.parent.Find("Rigidbody"); rigidbody = ((obj != null) ? ((Component)obj).GetComponent<Rigidbody>() : null); if ((Object)(object)rigidbody == (Object)null) { Debug.LogError((object)"Rigidbody not found"); } } private void Update() { if (controller.DeathImpulse) { controller.DeathImpulse = false; animator.SetTrigger("Death"); } } public void SetDespawn() { EnemyReflectionUtil.GetEnemyParent(controller.Enemy).Despawn(); } public void DeathParticlesImpulse() { ParticleSystem[] array = deathParticles; foreach (ParticleSystem val in array) { ((Component)val).gameObject.SetActive(true); val.Play(); } } public void HurtParticlesImpulse() { ParticleSystem[] array = hurtParticles; foreach (ParticleSystem val in array) { ((Component)val).gameObject.SetActive(true); val.Play(); } } public void SpawnParticlesImpulse() { ParticleSystem[] array = spawnParticles; foreach (ParticleSystem val in array) { ((Component)val).gameObject.SetActive(true); val.Play(); } } public void PlayRoamSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) roamSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayVisionSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) visionSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayCuriousSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) curiousSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayHurtSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) hurtSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayDeathSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) deathSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayAttackSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) attackSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void AttackPlayer() { animator.SetTrigger("Attack"); } public void PlayLookForPlayerSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) lookForPlayerSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayChasePlayerSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) chasePlayerSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlaySpawnSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) spawnSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void PlayPlayerHitSound() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) playerHitSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void OnFootstep() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) footstepSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void OnStun() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) animator.SetBool("isStunned", true); stunnedSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void OnUnstun() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) animator.SetBool("isStunned", false); unstunnedSounds.Play(controller.Enemy.CenterTransform.position, 1f, 1f, 1f, 1f); } public void OnSpawnComplete() { controller.OnSpawnComplete(); ((Behaviour)parentConstraint).enabled = true; rigidbody.isKinematic = false; } public void OnSpawnsStart() { ((Behaviour)parentConstraint).enabled = false; rigidbody.isKinematic = true; } } }
plugins/MenuLib.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using MenuLib.MonoBehaviors; using MenuLib.Structs; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MenuLib")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.3.0")] [assembly: AssemblyInformationalVersion("1.0.0+d09ef1dec861a6323ece44f68f5fa7fbdc3dacbd")] [assembly: AssemblyProduct("MenuLib")] [assembly: AssemblyTitle("MenuLib")] [assembly: AssemblyVersion("2.3.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MenuLib { [BepInPlugin("nickklmao.menulib", "Menu Lib", "2.3.0")] internal sealed class Entry : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Action<Action<MenuPageMain>, MenuPageMain> <0>__MenuPageMain_StartHook; public static Action<Action<MenuPageSettings>, MenuPageSettings> <1>__MenuPageSettings_StartHook; public static Action<Action<MenuPageColor>, MenuPageColor> <2>__MenuPageColor_StartHook; public static Action<Action<MenuPageEsc>, MenuPageEsc> <3>__MenuPageEsc_StartHook; public static Action<Action<MenuPageLobby>, MenuPageLobby> <4>__MenuPageLobby_StartHook; public static Manipulator <5>__SemiFunc_UIMouseHoverILHook; public static Manipulator <6>__MenuPage_StateClosingILHook; public static Manipulator <7>__MenuScrollBox_UpdateILHook; } private const string MOD_NAME = "Menu Lib"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("Menu Lib"); private static void MenuPageMain_StartHook(Action<MenuPageMain> orig, MenuPageMain self) { orig(self); MenuAPI.mainMenuBuilderDelegate?.Invoke(((Component)self).transform); } private static void MenuPageSettings_StartHook(Action<MenuPageSettings> orig, MenuPageSettings self) { orig(self); MenuAPI.settingsMenuBuilderDelegate?.Invoke(((Component)self).transform); } private static void MenuPageColor_StartHook(Action<MenuPageColor> orig, MenuPageColor self) { orig(self); MenuAPI.colorMenuBuilderDelegate?.Invoke(((Component)self).transform); } private static void MenuPageEsc_StartHook(Action<MenuPageEsc> orig, MenuPageEsc self) { orig(self); MenuAPI.escapeMenuBuilderDelegate?.Invoke(((Component)self).transform); } private static void MenuPageLobby_StartHook(Action<MenuPageLobby> orig, MenuPageLobby self) { orig(self); MenuAPI.lobbyMenuBuilderDelegate?.Invoke(((Component)self).transform); } private static void SemiFunc_UIMouseHoverILHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel val4 = default(ILLabel); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchBrfalse(instruction, ref val4) && val4.Target.OpCode == OpCodes.Ldarg_1 }); val.Index += 2; val.RemoveRange(27); val.Emit(OpCodes.Ldloc_0); val.EmitDelegate<Func<MenuScrollBox, Vector2, bool>>((Func<MenuScrollBox, Vector2, bool>)delegate(MenuScrollBox menuScrollBox, Vector2 vector) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) RectTransform val3 = (RectTransform)((Transform)menuScrollBox.scroller).parent; float y = ((Transform)val3).position.y; float num = y + val3.sizeDelta.y; return vector.y > y && vector.y < num; }); ILLabel val2 = val.DefineLabel(); val.Emit(OpCodes.Brtrue_S, (object)val2); val.Emit(OpCodes.Ldc_I4_0); val.Emit(OpCodes.Ret); val.MarkLabel(val2); } private static void MenuPage_StateClosingILHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchLdfld<MenuPage>(instruction, "stateStart") }); val.Index += 2; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<MenuPage>>((Action<MenuPage>)delegate(MenuPage menuPage) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value2)) { RectTransform val2 = (RectTransform)((Component)menuPage).transform; Vector2 val3 = Vector2.op_Implicit(((Transform)val2).position); Rect rect = val2.rect; float num = 0f - ((Rect)(ref rect)).height; rect = value2.rectTransform.rect; val3.y = num - ((Rect)(ref rect)).height; REPOReflection.menuPage_AnimateAwayPosition.SetValue(menuPage, val3); } }); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCall<Object>(instruction, "Destroy") }); val.Index -= 5; val.RemoveRange(6); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<MenuPage>>((Action<MenuPage>)delegate(MenuPage menuPage) { if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value) && (value.isCachedPage || !value.pageWasActivatedOnce)) { ((Behaviour)menuPage).enabled = false; } else { MenuManager.instance.PageRemove(menuPage); Object.Destroy((Object)(object)((Component)menuPage).gameObject); } }); } private static void MenuScrollBox_UpdateILHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction instruction) => ILPatternMatchingExt.MatchLdarg(instruction, 0), (Instruction instruction) => ILPatternMatchingExt.MatchLdfld<MenuScrollBox>(instruction, "scrollBoxActive") }); val.RemoveRange(4); ILLabel val2 = val.MarkLabel(); val.Index -= 2; val.Remove(); val.Emit(OpCodes.Brtrue_S, (object)val2); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "InputScrollY") }); int index = val.Index; val.Index = index - 1; val.Remove(); ILLabel val3 = val.DefineLabel(); val.Emit(OpCodes.Bne_Un_S, (object)val3); val.Index += 2; object operand = il.Instrs[val.Index].Operand; ILLabel val4 = (ILLabel)((operand is ILLabel) ? operand : null); index = val.Index; val.Index = index + 1; val.RemoveRange(24); val.MarkLabel(val3); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_0); val.Emit<MenuScrollBox>(OpCodes.Ldfld, "parentPage"); val.EmitDelegate<Action<MenuScrollBox, MenuPage>>((Action<MenuScrollBox, MenuPage>)delegate(MenuScrollBox menuScrollBox, MenuPage menuPage) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) float num = SemiFunc.InputMovementY(); float num2 = SemiFunc.InputScrollY(); float num5; if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value)) { float? scrollSpeed = value.scrollView.scrollSpeed; if (scrollSpeed.HasValue) { float valueOrDefault = scrollSpeed.GetValueOrDefault(); valueOrDefault *= 10f; float num3 = Mathf.Abs((float)REPOReflection.menuScrollBox_ScrollerEndPosition.GetValue(menuScrollBox) - (float)REPOReflection.menuScrollBox_ScrollerStartPosition.GetValue(menuScrollBox)); float num4 = (num + (float)Math.Sign(num2)) * valueOrDefault / num3; Rect rect = menuScrollBox.scrollBarBackground.rect; num5 = num4 * ((Rect)(ref rect)).height; goto IL_00c1; } } float num6 = (float)REPOReflection.menuScrollBox_ScrollHeight.GetValue(menuScrollBox); num5 = num * 20f / (num6 * 0.01f) + num2 / (num6 * 0.01f); goto IL_00c1; IL_00c1: float num7 = (float)REPOReflection.menuScrollBox_ScrollHandleTargetPosition.GetValue(menuScrollBox); REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(menuScrollBox, num7 + num5); }); val.GotoPrev(new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "InputMovementY") }); ILLabel val5 = val.MarkLabel(); val.Emit(OpCodes.Ldarg_0); val.Emit<MenuScrollBox>(OpCodes.Ldfld, "scrollBoxActive"); val.Emit(OpCodes.Brfalse_S, (object)val4); val.GotoPrev((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCall<Input>(instruction, "GetMouseButton") }); val.Remove(); val.Emit(OpCodes.Brfalse, (object)val5); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, typeof(SemiFunc), "UIMouseHover") }); val.Remove(); val.Emit(OpCodes.Brfalse, (object)val5); } private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown logger.LogDebug((object)"Hooking `MenuPageMain.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageMain), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageMain>, MenuPageMain>(MenuPageMain_StartHook)); logger.LogDebug((object)"Hooking `MenuPageSettings.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageSettings), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageSettings>, MenuPageSettings>(MenuPageSettings_StartHook)); logger.LogDebug((object)"Hooking `MenuPageColor.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageColor), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageColor>, MenuPageColor>(MenuPageColor_StartHook)); logger.LogDebug((object)"Hooking `MenuPageEsc.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageEsc), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageEsc>, MenuPageEsc>(MenuPageEsc_StartHook)); logger.LogDebug((object)"Hooking `MenuPageLobby.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageLobby), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageLobby>, MenuPageLobby>(MenuPageLobby_StartHook)); logger.LogDebug((object)"Hooking `SemiFunc.UIMouseHover`"); MethodInfo methodInfo = AccessTools.Method(typeof(SemiFunc), "UIMouseHover", (Type[])null, (Type[])null); object obj = <>O.<5>__SemiFunc_UIMouseHoverILHook; if (obj == null) { Manipulator val = SemiFunc_UIMouseHoverILHook; <>O.<5>__SemiFunc_UIMouseHoverILHook = val; obj = (object)val; } new ILHook((MethodBase)methodInfo, (Manipulator)obj); logger.LogDebug((object)"Hooking `MenuPage.StateClosing`"); MethodInfo methodInfo2 = AccessTools.Method(typeof(MenuPage), "StateClosing", (Type[])null, (Type[])null); object obj2 = <>O.<6>__MenuPage_StateClosingILHook; if (obj2 == null) { Manipulator val2 = MenuPage_StateClosingILHook; <>O.<6>__MenuPage_StateClosingILHook = val2; obj2 = (object)val2; } new ILHook((MethodBase)methodInfo2, (Manipulator)obj2); logger.LogDebug((object)"Hooking `MenuScrollBox.Update`"); MethodInfo methodInfo3 = AccessTools.Method(typeof(MenuScrollBox), "Update", (Type[])null, (Type[])null); object obj3 = <>O.<7>__MenuScrollBox_UpdateILHook; if (obj3 == null) { Manipulator val3 = MenuScrollBox_UpdateILHook; <>O.<7>__MenuScrollBox_UpdateILHook = val3; obj3 = (object)val3; } new ILHook((MethodBase)methodInfo3, (Manipulator)obj3); } } public static class MenuAPI { public delegate void BuilderDelegate(Transform parent); internal static BuilderDelegate mainMenuBuilderDelegate; internal static BuilderDelegate settingsMenuBuilderDelegate; internal static BuilderDelegate colorMenuBuilderDelegate; internal static BuilderDelegate lobbyMenuBuilderDelegate; internal static BuilderDelegate escapeMenuBuilderDelegate; internal static readonly Dictionary<MenuPage, REPOPopupPage> customMenuPages = new Dictionary<MenuPage, REPOPopupPage>(); private static MenuButtonPopUp menuButtonPopup; public static void AddElementToMainMenu(BuilderDelegate builderDelegate) { mainMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(mainMenuBuilderDelegate, builderDelegate); } public static void AddElementToSettingsMenu(BuilderDelegate builderDelegate) { settingsMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(settingsMenuBuilderDelegate, builderDelegate); } public static void AddElementToColorMenu(BuilderDelegate builderDelegate) { colorMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(colorMenuBuilderDelegate, builderDelegate); } public static void AddElementToLobbyMenu(BuilderDelegate builderDelegate) { lobbyMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(lobbyMenuBuilderDelegate, builderDelegate); } public static void AddElementToEscapeMenu(BuilderDelegate builderDelegate) { escapeMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(escapeMenuBuilderDelegate, builderDelegate); } public static void CloseAllPagesAddedOnTop() { MenuManager.instance.PageCloseAllAddedOnTop(); } public static void OpenPopup(string header, Color headerColor, string content, Action onLeftClicked, Action onRightClicked = null) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)menuButtonPopup)) { menuButtonPopup = ((Component)MenuManager.instance).gameObject.AddComponent<MenuButtonPopUp>(); } menuButtonPopup.option1Event = new UnityEvent(); menuButtonPopup.option2Event = new UnityEvent(); if (onLeftClicked != null) { menuButtonPopup.option1Event.AddListener(new UnityAction(onLeftClicked.Invoke)); } if (onRightClicked != null) { menuButtonPopup.option2Event.AddListener(new UnityAction(onRightClicked.Invoke)); } MenuManager.instance.PagePopUpTwoOptions(menuButtonPopup, header, headerColor, content, "Yes", "No"); } public static REPOButton CreateREPOButton(string text, Action onClick, Transform parent, Vector2 localPosition = default(Vector2)) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.buttonTemplate, parent); ((Object)obj).name = "Menu Button - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOButton rEPOButton = ((Component)obj).gameObject.AddComponent<REPOButton>(); ((TMP_Text)rEPOButton.labelTMP).text = text; rEPOButton.onClick = onClick; return rEPOButton; } public static REPOToggle CreateREPOToggle(string text, Action<bool> onToggle, Transform parent, Vector2 localPosition = default(Vector2), string leftButtonText = "ON", string rightButtonText = "OFF", bool defaultValue = false) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.toggleTemplate, parent); ((Object)obj).name = "Menu Toggle - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOToggle rEPOToggle = ((Component)obj).gameObject.AddComponent<REPOToggle>(); ((TMP_Text)rEPOToggle.labelTMP).text = text; ((TMP_Text)rEPOToggle.leftButtonTMP).text = leftButtonText; ((TMP_Text)rEPOToggle.rightButtonTMP).text = rightButtonText; rEPOToggle.onToggle = onToggle; rEPOToggle.SetState(defaultValue, invokeCallback: false); return rEPOToggle; } public static REPOSlider CreateREPOSlider(string text, string description, Action<float> onValueChanged, Transform parent, Vector2 localPosition = default(Vector2), float min = 0f, float max = 1f, int precision = 2, float defaultValue = 0f, string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent); ((Object)obj).name = "Float Slider - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent<REPOSlider>(); ((TMP_Text)rEPOSlider.labelTMP).text = text; ((TMP_Text)rEPOSlider.descriptionTMP).text = description; rEPOSlider.onValueChanged = onValueChanged; rEPOSlider.min = min; rEPOSlider.max = max; rEPOSlider.precision = precision; rEPOSlider.prefix = prefix; rEPOSlider.postfix = postfix; rEPOSlider.barBehavior = barBehavior; rEPOSlider.SetValue(defaultValue, invokeCallback: false); return rEPOSlider; } public static REPOSlider CreateREPOSlider(string text, string description, Action<int> onValueChanged, Transform parent, Vector2 localPosition = default(Vector2), int min = 0, int max = 1, int defaultValue = 0, string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent); ((Object)obj).name = "Int Slider - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent<REPOSlider>(); ((TMP_Text)rEPOSlider.labelTMP).text = text; ((TMP_Text)rEPOSlider.descriptionTMP).text = description; rEPOSlider.onValueChanged = delegate(float f) { onValueChanged(Convert.ToInt32(f)); }; rEPOSlider.min = min; rEPOSlider.max = max; rEPOSlider.precision = 0; rEPOSlider.prefix = prefix; rEPOSlider.postfix = postfix; rEPOSlider.barBehavior = barBehavior; rEPOSlider.SetValue(defaultValue, invokeCallback: false); return rEPOSlider; } public static REPOSlider CreateREPOSlider(string text, string description, Action<string> onOptionChanged, Transform parent, string[] stringOptions, string defaultOption, Vector2 localPosition = default(Vector2), string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue) { //IL_002b: 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) RectTransform val = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent); ((Object)val).name = "Option Slider - " + text; ((Transform)val).localPosition = Vector2.op_Implicit(localPosition); REPOSlider repoSlider = ((Component)val).gameObject.AddComponent<REPOSlider>(); ((TMP_Text)repoSlider.labelTMP).text = text; ((TMP_Text)repoSlider.descriptionTMP).text = description; repoSlider.onValueChanged = delegate(float f) { onOptionChanged(repoSlider.stringOptions.ElementAtOrDefault(Convert.ToInt32(f)) ?? repoSlider.stringOptions.FirstOrDefault()); }; repoSlider.stringOptions = stringOptions; repoSlider.prefix = prefix; repoSlider.postfix = postfix; repoSlider.barBehavior = barBehavior; int num = Array.IndexOf(stringOptions, defaultOption); if (num == -1) { num = 0; } repoSlider.SetValue(num, invokeCallback: false); return repoSlider; } public static REPOSlider CreateREPOSlider(string text, string description, Action<int> onOptionChanged, Transform parent, string[] stringOptions, string defaultOption, Vector2 localPosition = default(Vector2), string prefix = "", string postfix = "", REPOSlider.BarBehavior barBehavior = REPOSlider.BarBehavior.UpdateWithValue) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.sliderTemplate, parent); ((Object)obj).name = "Option Slider - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOSlider rEPOSlider = ((Component)obj).gameObject.AddComponent<REPOSlider>(); ((TMP_Text)rEPOSlider.labelTMP).text = text; ((TMP_Text)rEPOSlider.descriptionTMP).text = description; rEPOSlider.onValueChanged = delegate(float f) { onOptionChanged(Convert.ToInt32(f)); }; rEPOSlider.stringOptions = stringOptions; rEPOSlider.prefix = prefix; rEPOSlider.postfix = postfix; rEPOSlider.barBehavior = barBehavior; int num = Array.IndexOf(stringOptions, defaultOption); if (num == -1) { num = 0; } rEPOSlider.SetValue(num, invokeCallback: false); return rEPOSlider; } public static REPOLabel CreateREPOLabel(string text, Transform parent, Vector2 localPosition = default(Vector2)) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.labelTemplate, parent); ((Object)obj).name = "Label - " + text; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOLabel rEPOLabel = ((Component)obj).gameObject.AddComponent<REPOLabel>(); ((TMP_Text)rEPOLabel.labelTMP).text = text; return rEPOLabel; } public static REPOSpacer CreateREPOSpacer(Transform parent, Vector2 localPosition = default(Vector2), Vector2 size = default(Vector2)) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)new GameObject("Spacer", new Type[1] { typeof(RectTransform) }).transform; ((Transform)val).SetParent(parent); REPOSpacer result = ((Component)val).gameObject.AddComponent<REPOSpacer>(); ((Transform)val).localPosition = Vector2.op_Implicit(localPosition); val.sizeDelta = size; return result; } [Obsolete("Switch to the overload with the 'shouldCachePage' argument!")] public static REPOPopupPage CreateREPOPopupPage(string headerText, REPOPopupPage.PresetSide presetSide, bool pageDimmerVisibility = false, float spacing = 0f) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) return CreateREPOPopupPage(headerText, pageDimmerVisibility, spacing, (presetSide == REPOPopupPage.PresetSide.Left) ? null : new Vector2?(new Vector2(40f, 0f))); } [Obsolete("Switch to the overload with the 'shouldCachePage' argument!")] public static REPOPopupPage CreateREPOPopupPage(string headerText, bool pageDimmerVisibility = false, float spacing = 0f, Vector2? localPosition = null) { return CreateREPOPopupPage(headerText, shouldCachePage: false, pageDimmerVisibility, spacing, localPosition); } public static REPOPopupPage CreateREPOPopupPage(string headerText, REPOPopupPage.PresetSide presetSide, bool shouldCachePage, bool pageDimmerVisibility = false, float spacing = 0f) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) return CreateREPOPopupPage(headerText, shouldCachePage, pageDimmerVisibility, spacing, (presetSide == REPOPopupPage.PresetSide.Left) ? null : new Vector2?(new Vector2(40f, 0f))); } public static REPOPopupPage CreateREPOPopupPage(string headerText, bool shouldCachePage, bool pageDimmerVisibility = false, float spacing = 0f, Vector2? localPosition = null) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Object.Instantiate<RectTransform>(REPOTemplates.popupPageTemplate, ((Component)MenuHolder.instance).transform); ((Object)obj).name = "Menu Page " + headerText; REPOPopupPage rEPOPopupPage = ((Component)obj).gameObject.AddComponent<REPOPopupPage>(); ((Transform)rEPOPopupPage.rectTransform).localPosition = Vector2.op_Implicit((Vector2)(((??)localPosition) ?? new Vector2(-280f, 0f))); ((TMP_Text)rEPOPopupPage.headerTMP).text = headerText; rEPOPopupPage.isCachedPage = shouldCachePage; rEPOPopupPage.pageDimmerVisibility = pageDimmerVisibility; rEPOPopupPage.scrollView.spacing = spacing; customMenuPages.Add(rEPOPopupPage.menuPage, rEPOPopupPage); return rEPOPopupPage; } public static REPOAvatarPreview CreateREPOAvatarPreview(Transform parent, Vector2 localPosition = default(Vector2), bool enableBackgroundImage = false, Color? backgroundImageColor = null) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Transform obj = Object.Instantiate<Transform>(REPOTemplates.avatarPreviewTemplate, parent); ((Object)obj).name = "Player Avatar Preview"; REPOAvatarPreview rEPOAvatarPreview = ((Component)obj).gameObject.AddComponent<REPOAvatarPreview>(); ((Transform)rEPOAvatarPreview.rectTransform).localPosition = Vector2.op_Implicit(localPosition); rEPOAvatarPreview.enableBackgroundImage = enableBackgroundImage; rEPOAvatarPreview.backgroundImageColor = (Color)(((??)backgroundImageColor) ?? Color.white); rEPOAvatarPreview.previewSize = new Vector2(184f, 345f); return rEPOAvatarPreview; } public static REPOObjectPreview CreateREPOObjectPreview(Transform parent, GameObject previewObject, Vector2 localPosition = default(Vector2), bool enableBackgroundImage = false, Color? backgroundImageColor = null) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Transform obj = Object.Instantiate<Transform>(REPOTemplates.avatarPreviewTemplate, parent); ((Object)obj).name = "Object Preview"; REPOObjectPreview rEPOObjectPreview = ((Component)obj).gameObject.AddComponent<REPOObjectPreview>(); ((Transform)rEPOObjectPreview.rectTransform).localPosition = Vector2.op_Implicit(localPosition); rEPOObjectPreview.enableBackgroundImage = enableBackgroundImage; rEPOObjectPreview.backgroundImageColor = (Color)(((??)backgroundImageColor) ?? Color.white); rEPOObjectPreview.previewObject = previewObject; rEPOObjectPreview.previewSize = new Vector2(184f, 345f); return rEPOObjectPreview; } internal static void OpenMenuPage(MenuPage menuPage, bool pageOnTop) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) object? value = REPOReflection.menuManager_CurrentMenuPage.GetValue(MenuManager.instance); MenuPage val = (MenuPage)((value is MenuPage) ? value : null); List<MenuPage> list = REPOReflection.menuManager_AddedPagesOnTop.GetValue(MenuManager.instance) as List<MenuPage>; if (pageOnTop && !Object.op_Implicit((Object)(object)val)) { pageOnTop = false; } if (pageOnTop) { if (list == null || list.Contains(val)) { return; } } else if (Object.op_Implicit((Object)(object)val)) { REPOReflection.menuManager_PageInactiveAdd.Invoke(MenuManager.instance, new object[1] { val }); val.PageStateSet((PageState)3); } ((Component)menuPage).transform.SetAsLastSibling(); ((Behaviour)menuPage).enabled = true; menuPage.ResetPage(); menuPage.PageStateSet((PageState)0); MenuManager.instance.PageAdd(menuPage); ((MonoBehaviour)menuPage).StartCoroutine(REPOReflection.menuPage_LateStart.Invoke(menuPage, null) as IEnumerator); REPOReflection.menuPage_AddedPageOnTop.SetValue(menuPage, false); if (!pageOnTop) { MenuManager.instance.PageSetCurrent(menuPage.menuPageIndex, menuPage); REPOReflection.menuPage_PageIsOnTopOfOtherPage.SetValue(menuPage, true); REPOReflection.menuPage_PageUnderThisPage.SetValue(menuPage, val); } else { REPOReflection.menuPage_ParentPage.SetValue(menuPage, val); list.Add(menuPage); } } internal static void CloseMenuPage(MenuPage menuPage, bool closePagesAddedOnTop) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (closePagesAddedOnTop) { CloseAllPagesAddedOnTop(); } menuPage.PageStateSet((PageState)2); object? value = REPOReflection.menuPage_PageUnderThisPage.GetValue(menuPage); MenuPage val = (MenuPage)((value is MenuPage) ? value : null); if (val != null) { MenuManager.instance.PageSetCurrent(val.menuPageIndex, val); } } } public static class REPOReflection { public static readonly FieldInfo menuManager_CurrentMenuPage = AccessTools.Field(typeof(MenuManager), "currentMenuPage"); public static readonly FieldInfo menuManager_AddedPagesOnTop = AccessTools.Field(typeof(MenuManager), "addedPagesOnTop"); public static readonly FieldInfo menuPage_AddedPageOnTop = AccessTools.Field(typeof(MenuPage), "addedPageOnTop"); public static readonly FieldInfo menuPage_PageUnderThisPage = AccessTools.Field(typeof(MenuPage), "pageUnderThisPage"); public static readonly FieldInfo menuPage_ParentPage = AccessTools.Field(typeof(MenuPage), "parentPage"); public static readonly FieldInfo menuPage_PageIsOnTopOfOtherPage = AccessTools.Field(typeof(MenuPage), "pageIsOnTopOfOtherPage"); public static readonly FieldInfo menuPage_ScrollBoxes = AccessTools.Field(typeof(MenuPage), "scrollBoxes"); public static readonly FieldInfo menuPage_CurrentPageState = AccessTools.Field(typeof(MenuPage), "currentPageState"); public static readonly FieldInfo menuPage_AnimateAwayPosition = AccessTools.Field(typeof(MenuPage), "animateAwayPosition"); public static readonly FieldInfo menuButton_ParentPage = AccessTools.Field(typeof(MenuButton), "parentPage"); public static readonly FieldInfo menuScrollBox_ScrollerEndPosition = AccessTools.Field(typeof(MenuScrollBox), "scrollerEndPosition"); public static readonly FieldInfo menuScrollBox_ScrollerStartPosition = AccessTools.Field(typeof(MenuScrollBox), "scrollerStartPosition"); public static readonly FieldInfo menuScrollBox_ScrollHandleTargetPosition = AccessTools.Field(typeof(MenuScrollBox), "scrollHandleTargetPosition"); public static readonly FieldInfo menuScrollBox_ScrollHeight = AccessTools.Field(typeof(MenuScrollBox), "scrollHeight"); public static readonly FieldInfo menuSelectableElement_MenuID = AccessTools.Field(typeof(MenuSelectableElement), "menuID"); public static readonly MethodInfo menuManager_PageInactiveAdd = AccessTools.Method(typeof(MenuManager), "PageInactiveAdd", (Type[])null, (Type[])null); public static readonly MethodInfo menuPage_LateStart = AccessTools.Method(typeof(MenuPage), "LateStart", (Type[])null, (Type[])null); } internal static class REPOTemplates { internal static readonly RectTransform pageDimmerTemplate; internal static readonly RectTransform simplePageTemplate; internal static readonly RectTransform buttonTemplate; internal static readonly RectTransform popupPageTemplate; internal static readonly RectTransform toggleTemplate; internal static readonly RectTransform sliderTemplate; internal static readonly RectTransform labelTemplate; internal static readonly Transform avatarPreviewTemplate; static REPOTemplates() { //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_0050: Expected I4, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown foreach (MenuPages menuPage in MenuManager.instance.menuPages) { Transform transform = menuPage.menuPage.transform; MenuPageIndex menuPageIndex = menuPage.menuPageIndex; switch ((int)menuPageIndex) { case 0: simplePageTemplate = (RectTransform)transform; buttonTemplate = (RectTransform)((Transform)simplePageTemplate).Find("Menu Button - Quit game"); break; case 2: pageDimmerTemplate = (RectTransform)transform.GetChild(0); break; case 4: popupPageTemplate = (RectTransform)transform; break; case 5: { Transform obj = transform.Find("Menu Scroll Box/Mask/Scroller"); toggleTemplate = (RectTransform)obj.Find("Bool Setting - Push to Talk"); sliderTemplate = (RectTransform)obj.Find("Slider - microphone"); break; } case 6: labelTemplate = (RectTransform)transform.Find("Scroll Box/Mask/Scroller").Find("Header Movement"); break; case 1: avatarPreviewTemplate = transform.Find("Menu Element Player Avatar"); break; } } } } } namespace MenuLib.Structs { public struct Padding { public float left; public float top; public float right; public float bottom; public Padding(float left, float top, float right, float bottom) { this.left = left; this.top = top; this.right = right; this.bottom = bottom; } } } namespace MenuLib.MonoBehaviors { public sealed class REPOAvatarPreview : REPOElement { private PlayerAvatarMenu playerAvatarMenu; private Image backgroundImage; private RectTransform renderTextureRectTransform; public bool enableBackgroundImage { get { return ((Behaviour)backgroundImage).enabled; } set { ((Behaviour)backgroundImage).enabled = value; } } public Color backgroundImageColor { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Graphic)backgroundImage).color; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Graphic)backgroundImage).color = value; } } public Vector2 previewSize { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return base.rectTransform.sizeDelta; } set { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Vector2 val; if (value.x > value.y) { val = value; val.y = value.x / (8f / 15f); value = val; } else { val = value; val.x = value.y * (8f / 15f); value = val; } RectTransform obj = renderTextureRectTransform; val = (base.rectTransform.sizeDelta = value); obj.sizeDelta = val; ((Transform)renderTextureRectTransform).localPosition = Vector3.zero; } } public PlayerAvatarVisuals playerAvatarVisuals { get; private set; } public Transform rigTransform => playerAvatarVisuals.meshParent.transform; private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) base.rectTransform = ((Component)this).gameObject.AddComponent<RectTransform>(); base.rectTransform.pivot = Vector2.right; RectTransform obj = base.rectTransform; Vector2 anchorMin = (base.rectTransform.anchorMax = Vector2.zero); obj.anchorMin = anchorMin; renderTextureRectTransform = (RectTransform)((Transform)base.rectTransform).GetChild(1); ((Transform)renderTextureRectTransform).localPosition = Vector3.zero; playerAvatarMenu = ((Component)this).GetComponentInChildren<PlayerAvatarMenuHover>().playerAvatarMenu; playerAvatarVisuals = ((Component)playerAvatarMenu).GetComponentInChildren<PlayerAvatarVisuals>(); backgroundImage = ((Component)this).gameObject.AddComponent<Image>(); ((Behaviour)backgroundImage).enabled = false; } private void OnDestroy() { if (Object.op_Implicit((Object)(object)playerAvatarMenu)) { if (Object.op_Implicit((Object)(object)playerAvatarMenu.cameraAndStuff)) { Object.Destroy((Object)(object)((Component)playerAvatarMenu.cameraAndStuff).gameObject); } Object.Destroy((Object)(object)((Component)playerAvatarMenu).gameObject); } } } public sealed class REPOButton : REPOElement { public MenuButton menuButton; public TextMeshProUGUI labelTMP; [Obsolete("Update the button clicked event using the 'onClick' field rather than through the button")] public Button button; public Action onClick; public Vector2? overrideButtonSize; private string previousText; private Vector2? previousOverrideButtonSize; public Vector2 GetLabelSize() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((TMP_Text)labelTMP).GetPreferredValues(); } private void Awake() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown Transform transform = ((Component)this).transform; base.rectTransform = (RectTransform)(object)((transform is RectTransform) ? transform : null); button = ((Component)this).GetComponent<Button>(); menuButton = ((Component)this).GetComponent<MenuButton>(); labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(); button.onClick = new ButtonClickedEvent(); ((UnityEvent)button.onClick).AddListener((UnityAction)delegate { onClick?.Invoke(); }); Object.Destroy((Object)(object)((Component)this).GetComponent<MenuButtonPopUp>()); } private void Update() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (((TMP_Text)labelTMP).text == previousText) { Vector2? val = overrideButtonSize; Vector2? val2 = previousOverrideButtonSize; if (val.HasValue == val2.HasValue && (!val.HasValue || val.GetValueOrDefault() == val2.GetValueOrDefault())) { return; } } base.rectTransform.sizeDelta = (Vector2)(((??)overrideButtonSize) ?? GetLabelSize()); previousText = ((TMP_Text)labelTMP).text; previousOverrideButtonSize = overrideButtonSize; } private void OnTransformParentChanged() { REPOReflection.menuButton_ParentPage.SetValue(menuButton, ((Component)this).GetComponentInParent<MenuPage>()); } } public class REPOElement : MonoBehaviour { private REPOScrollViewElement _repoScrollViewElement; public RectTransform rectTransform { get; protected set; } public REPOScrollViewElement repoScrollViewElement { get { if (Object.op_Implicit((Object)(object)_repoScrollViewElement)) { return _repoScrollViewElement; } return _repoScrollViewElement = ((Component)this).GetComponent<REPOScrollViewElement>(); } } } public sealed class REPOLabel : REPOElement { public TextMeshProUGUI labelTMP; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) base.rectTransform = (RectTransform)((Component)this).transform; labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(); Vector2 sizeDelta = (((TMP_Text)labelTMP).rectTransform.pivot = (base.rectTransform.pivot = Vector2.zero)); RectTransform obj = ((TMP_Text)labelTMP).rectTransform; RectTransform obj2 = base.rectTransform; ((Vector2)(ref sizeDelta))..ctor(200f, 30f); obj2.sizeDelta = sizeDelta; obj.sizeDelta = sizeDelta; ((TMP_Text)labelTMP).fontSize = 30f; TextMeshProUGUI obj3 = labelTMP; bool enableWordWrapping = (((TMP_Text)labelTMP).enableAutoSizing = false); ((TMP_Text)obj3).enableWordWrapping = enableWordWrapping; ((TMP_Text)labelTMP).alignment = (TextAlignmentOptions)513; ((TMP_Text)labelTMP).margin = Vector4.zero; } private void Start() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) ((Transform)((TMP_Text)labelTMP).rectTransform).localPosition = Vector2.op_Implicit(Vector2.zero); } } public sealed class REPOObjectPreview : REPOElement { private PlayerAvatarMenuHover playerAvatarMenuHover; private Image backgroundImage; private RectTransform renderTextureRectTransform; private GameObject _previewObject; public GameObject previewObject { get { return _previewObject; } set { if (!((Object)(object)_previewObject == (Object)(object)value)) { UpdatePreviewGameObject(value); _previewObject = value; } } } public bool enableBackgroundImage { get { return ((Behaviour)backgroundImage).enabled; } set { ((Behaviour)backgroundImage).enabled = value; } } public Color backgroundImageColor { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Graphic)backgroundImage).color; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Graphic)backgroundImage).color = value; } } public Vector2 previewSize { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return base.rectTransform.sizeDelta; } set { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Vector2 val; if (value.x > value.y) { val = value; val.y = value.x / (8f / 15f); value = val; } else { val = value; val.x = value.y * (8f / 15f); value = val; } RectTransform obj = renderTextureRectTransform; val = (base.rectTransform.sizeDelta = value); obj.sizeDelta = val; ((Transform)renderTextureRectTransform).localPosition = Vector3.zero; } } private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) base.rectTransform = ((Component)this).gameObject.AddComponent<RectTransform>(); base.rectTransform.pivot = Vector2.right; RectTransform obj = base.rectTransform; Vector2 anchorMin = (base.rectTransform.anchorMax = Vector2.zero); obj.anchorMin = anchorMin; renderTextureRectTransform = (RectTransform)((Transform)base.rectTransform).GetChild(1); ((Transform)renderTextureRectTransform).localPosition = Vector3.zero; playerAvatarMenuHover = ((Component)this).GetComponentInChildren<PlayerAvatarMenuHover>(); ((Component)playerAvatarMenuHover.playerAvatarMenu.cameraAndStuff).GetComponentInChildren<Camera>().farClipPlane = 100f; backgroundImage = ((Component)this).gameObject.AddComponent<Image>(); ((Behaviour)backgroundImage).enabled = false; } private void Start() { Transform transform = ((Component)playerAvatarMenuHover.playerAvatarMenu).transform; for (int i = 0; i < 3; i++) { Object.Destroy((Object)(object)((Component)transform.GetChild(i)).gameObject); } } private void OnDestroy() { if (!Object.op_Implicit((Object)(object)playerAvatarMenuHover) || !Object.op_Implicit((Object)(object)playerAvatarMenuHover.playerAvatarMenu)) { return; } PlayerAvatarMenu playerAvatarMenu = playerAvatarMenuHover.playerAvatarMenu; if (Object.op_Implicit((Object)(object)playerAvatarMenu)) { Transform cameraAndStuff = playerAvatarMenu.cameraAndStuff; if (Object.op_Implicit((Object)(object)cameraAndStuff)) { Object.Destroy((Object)(object)((Component)cameraAndStuff).gameObject); } Object.Destroy((Object)(object)((Component)playerAvatarMenu).gameObject); } } private void UpdatePreviewGameObject(GameObject previewGameObject) { if (Object.op_Implicit((Object)(object)previewObject)) { Object.Destroy((Object)(object)previewObject); } previewGameObject.transform.SetParent(((Component)playerAvatarMenuHover.playerAvatarMenu).transform, false); Rigidbody component = previewGameObject.GetComponent<Rigidbody>(); if (component != null) { component.automaticInertiaTensor = false; } } } public sealed class REPOPopupPage : MonoBehaviour { public enum PresetSide { Left, Right } public delegate RectTransform ScrollViewBuilderDelegate(Transform scrollView); public RectTransform rectTransform; public RectTransform maskRectTransform; public RectTransform scrollBarRectTransform; public MenuPage menuPage; public TextMeshProUGUI headerTMP; public MenuScrollBox menuScrollBox; public REPOScrollView scrollView; public bool closeMenuOnEscape = true; internal bool pageWasActivatedOnce; private GameObject pageDimmerGameObject; private RawImage pageDimmerRawImage; private RectTransform scrollBarFillRectTransform; private RectTransform scrollBarOutlineRectTransform; private Vector2 defaultMaskSizeDelta; private Vector2 defaultMaskPosition; private Padding _maskPadding; public bool pageDimmerVisibility { get { return pageDimmerGameObject.gameObject.activeSelf; } set { pageDimmerGameObject.gameObject.SetActive(value); } } public bool isCachedPage { get; internal set; } public float pageDimmerOpacity { get { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Graphic)pageDimmerRawImage).color.a; } set { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) RawImage obj = pageDimmerRawImage; Color color = ((Graphic)pageDimmerRawImage).color; color.a = value; ((Graphic)obj).color = color; } } public Padding maskPadding { get { return _maskPadding; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) Vector2 sizeDelta = defaultMaskSizeDelta; Vector2 val = defaultMaskPosition; sizeDelta.x -= value.left + value.right; sizeDelta.y -= value.top + value.bottom; if (value.left != 0f) { val.x += value.left; } if (value.bottom != 0f) { val.y += value.bottom; } maskRectTransform.sizeDelta = sizeDelta; ((Transform)maskRectTransform).localPosition = Vector2.op_Implicit(val); _maskPadding = value; UpdateScrollBarPosition(); } } public void OpenPage(bool openOnTop) { MenuAPI.OpenMenuPage(menuPage, openOnTop); pageWasActivatedOnce = true; scrollView.UpdateElements(); } public void ClosePage(bool closePagesAddedOnTop) { MenuAPI.CloseMenuPage(menuPage, closePagesAddedOnTop); } public void AddElement(MenuAPI.BuilderDelegate builderDelegate) { builderDelegate?.Invoke(((Component)this).transform); } public void AddElement(RectTransform elementRectTransform, Vector2 localPosition = default(Vector2)) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ((Transform)elementRectTransform).SetParent(((Component)this).transform); ((Transform)elementRectTransform).localPosition = Vector2.op_Implicit(localPosition); } public void AddElementToScrollView(ScrollViewBuilderDelegate scrollViewBuilderDelegate, float topPadding = 0f, float bottomPadding = 0f) { object obj; if (scrollViewBuilderDelegate == null) { obj = null; } else { RectTransform obj2 = scrollViewBuilderDelegate((Transform)(object)menuScrollBox.scroller); obj = ((obj2 != null) ? ((Component)obj2).gameObject.AddComponent<REPOScrollViewElement>() : null); } REPOScrollViewElement rEPOScrollViewElement = (REPOScrollViewElement)obj; if (rEPOScrollViewElement != null) { rEPOScrollViewElement.onSettingChanged = scrollView.UpdateElements; rEPOScrollViewElement.topPadding = topPadding; rEPOScrollViewElement.bottomPadding = bottomPadding; } } public void AddElementToScrollView(RectTransform elementRectTransform, Vector2 localPosition = default(Vector2), float topPadding = 0f, float bottomPadding = 0f) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) REPOScrollViewElement rEPOScrollViewElement = ((Component)elementRectTransform).gameObject.AddComponent<REPOScrollViewElement>(); if (rEPOScrollViewElement != null) { rEPOScrollViewElement.onSettingChanged = scrollView.UpdateElements; ((Transform)elementRectTransform).SetParent((Transform)(object)menuScrollBox.scroller); ((Transform)elementRectTransform).localPosition = Vector2.op_Implicit(localPosition); rEPOScrollViewElement.topPadding = topPadding; rEPOScrollViewElement.bottomPadding = bottomPadding; } } private void Awake() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown menuPage = ((Component)this).GetComponent<MenuPage>(); headerTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(); menuScrollBox = ((Component)this).GetComponentInChildren<MenuScrollBox>(); rectTransform = (RectTransform)new GameObject("Page Content", new Type[1] { typeof(RectTransform) }).transform; ((Transform)rectTransform).SetParent(((Component)this).transform); ((Component)this).transform.Find("Panel").SetParent((Transform)(object)rectTransform); ((TMP_Text)headerTMP).transform.parent.SetParent((Transform)(object)rectTransform); ((Component)menuScrollBox).transform.SetParent((Transform)(object)rectTransform); pageDimmerGameObject = ((Component)Object.Instantiate<RectTransform>(REPOTemplates.pageDimmerTemplate, ((Component)this).transform)).gameObject; pageDimmerGameObject.transform.SetAsFirstSibling(); pageDimmerRawImage = pageDimmerGameObject.GetComponentInChildren<RawImage>(); menuPage.menuPageIndex = (MenuPageIndex)(-1); RectTransform scroller = menuScrollBox.scroller; for (int i = 2; i < ((Transform)scroller).childCount; i++) { Object.Destroy((Object)(object)((Component)((Transform)scroller).GetChild(i)).gameObject); } scrollView = ((Component)scroller).gameObject.AddComponent<REPOScrollView>(); scrollView.popupPage = this; maskRectTransform = (RectTransform)((Transform)scroller).parent; defaultMaskSizeDelta = maskRectTransform.sizeDelta; defaultMaskPosition = Vector2.op_Implicit(((Transform)maskRectTransform).localPosition); menuScrollBox.scroller.sizeDelta = maskRectTransform.sizeDelta; scrollBarRectTransform = (RectTransform)menuScrollBox.scrollBar.transform; scrollBarFillRectTransform = (RectTransform)((Transform)scrollBarRectTransform).Find("Scroll Bar Bg (2)"); scrollBarOutlineRectTransform = (RectTransform)((Transform)scrollBarRectTransform).Find("Scroll Bar Bg (1)"); maskPadding = new Padding(0f, 0f, 0f, 25f); Object.Destroy((Object)(object)((Component)this).GetComponent<MenuPageSettingsPage>()); } private void Start() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) REPOReflection.menuScrollBox_ScrollerEndPosition.SetValue(menuScrollBox, 0); RectTransform scroller = menuScrollBox.scroller; Vector3 localPosition = ((Transform)menuScrollBox.scroller).localPosition; localPosition.y = 0f; ((Transform)scroller).localPosition = localPosition; REPOReflection.menuPage_ScrollBoxes.SetValue(menuPage, 2); if (!pageWasActivatedOnce) { menuPage.PageStateSet((PageState)2); } } private void Update() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 if (closeMenuOnEscape) { PageState val = (PageState)REPOReflection.menuPage_CurrentPageState.GetValue(menuPage); if (SemiFunc.InputDown((InputKey)18) && (int)val != 2) { ClosePage(closePagesAddedOnTop: false); } } } private void UpdateScrollBarPosition() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (Object.op_Implicit((Object)(object)scrollBarRectTransform)) { RectTransform obj = scrollBarRectTransform; Vector3 localPosition = ((Transform)scrollBarRectTransform).localPosition; localPosition.y = ((Transform)maskRectTransform).localPosition.y; ((Transform)obj).localPosition = localPosition; Vector2 sizeDelta = scrollBarRectTransform.sizeDelta; sizeDelta.y = maskRectTransform.sizeDelta.y; RectTransform scrollBarBackground = menuScrollBox.scrollBarBackground; RectTransform obj2 = scrollBarFillRectTransform; Vector2 val2 = (scrollBarRectTransform.sizeDelta = sizeDelta); Vector2 sizeDelta2 = (obj2.sizeDelta = val2); scrollBarBackground.sizeDelta = sizeDelta2; scrollBarOutlineRectTransform.sizeDelta = sizeDelta + new Vector2(4f, 4f); } } } public sealed class REPOScrollView : MonoBehaviour { public REPOPopupPage popupPage; public float? scrollSpeed; private REPOScrollViewElement[] scrollViewElements = Array.Empty<REPOScrollViewElement>(); private float _spacing; public float spacing { get { return _spacing; } set { if (!(Math.Abs(_spacing - value) < float.Epsilon)) { _spacing = value; UpdateElements(); } } } public void UpdateElements() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) scrollViewElements = ((Component)this).GetComponentsInChildren<REPOScrollViewElement>(true); float num = 0f; float num2 = popupPage.maskRectTransform.sizeDelta.y; REPOScrollViewElement[] array = scrollViewElements; Rect rect; foreach (REPOScrollViewElement rEPOScrollViewElement in array) { if (rEPOScrollViewElement.visibility) { Vector3 localPosition = ((Transform)rEPOScrollViewElement.rectTransform).localPosition; num2 -= rEPOScrollViewElement.topPadding; float num3 = num2; rect = rEPOScrollViewElement.rectTransform.rect; num2 = num3 - ((Rect)(ref rect)).height; num = (localPosition.y = num2); num2 -= rEPOScrollViewElement.bottomPadding; num2 -= spacing; ((Transform)rEPOScrollViewElement.rectTransform).localPosition = localPosition; } } GameObject gameObject = ((Component)popupPage.scrollBarRectTransform).gameObject; MenuScrollBox menuScrollBox = popupPage.menuScrollBox; RectTransform scroller = menuScrollBox.scroller; float num4 = num; if (!(num4 < 0f)) { if (num4 >= 0f && gameObject.activeSelf) { ((Component)popupPage.scrollBarRectTransform).gameObject.SetActive(false); Vector3 localPosition2 = ((Transform)scroller).localPosition; localPosition2.y = 0f; ((Transform)scroller).localPosition = localPosition2; } } else if (!gameObject.activeSelf) { ((Component)popupPage.scrollBarRectTransform).gameObject.SetActive(true); } FieldInfo menuScrollBox_ScrollerStartPosition = REPOReflection.menuScrollBox_ScrollerStartPosition; float num5 = num; rect = menuScrollBox.scrollHandle.rect; float num6 = 0.55f * ((Rect)(ref rect)).height; rect = menuScrollBox.scrollBarBackground.rect; menuScrollBox_ScrollerStartPosition.SetValue(menuScrollBox, Math.Abs(num5 / (1f - num6 / ((Rect)(ref rect)).height))); } public void SetScrollPosition(float normalizedPosition) { //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_004a: Unknown result type (might be due to invalid IL or missing references) normalizedPosition = Mathf.Clamp(1f - normalizedPosition, 0f, 1f); Rect rect = popupPage.menuScrollBox.scrollBarBackground.rect; float height = ((Rect)(ref rect)).height; float num = normalizedPosition * height; float num2 = popupPage.menuScrollBox.scrollHandle.sizeDelta.y / 2f; if (num < num2) { num = num2; } else if (num > height - num2) { num = height - num2; } REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(popupPage.menuScrollBox, num); } private void OnTransformChildrenChanged() { UpdateElements(); } private void Update() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) RectTransform maskRectTransform = popupPage.maskRectTransform; REPOScrollViewElement[] array = scrollViewElements; foreach (REPOScrollViewElement rEPOScrollViewElement in array) { if (!rEPOScrollViewElement.visibility) { continue; } Vector3 position = ((Component)rEPOScrollViewElement).transform.position; bool num = position.y <= ((Transform)maskRectTransform).position.y + maskRectTransform.sizeDelta.y + 50f && position.y >= ((Transform)maskRectTransform).position.y - 50f; GameObject gameObject = ((Component)rEPOScrollViewElement).gameObject; if (!num) { if (gameObject.activeSelf) { gameObject.SetActive(false); } } else if (!gameObject.activeSelf) { gameObject.SetActive(true); } } } } public sealed class REPOScrollViewElement : MonoBehaviour { public RectTransform rectTransform; internal Action onSettingChanged; private bool _visibility = true; private float _topPadding; private float _bottomPadding; public float topPadding { get { return _topPadding; } set { if (!(Math.Abs(_topPadding - value) < float.Epsilon)) { _topPadding = value; onSettingChanged?.Invoke(); } } } public float bottomPadding { get { return _bottomPadding; } set { if (!(Math.Abs(_bottomPadding - value) < float.Epsilon)) { _bottomPadding = value; onSettingChanged?.Invoke(); } } } public bool visibility { get { return _visibility; } set { if (_visibility != value) { _visibility = value; ((Component)this).gameObject.SetActive(value); onSettingChanged?.Invoke(); } } } private void Awake() { ref RectTransform reference = ref rectTransform; Transform transform = ((Component)this).transform; reference = (RectTransform)(object)((transform is RectTransform) ? transform : null); } private void OnRectTransformDimensionsChange() { onSettingChanged?.Invoke(); } } public sealed class REPOSlider : REPOElement { public enum BarBehavior { UpdateWithValue, StaticAtMinimum, StaticAtMaximum } public TextMeshProUGUI labelTMP; public TextMeshProUGUI descriptionTMP; public REPOTextScroller repoTextScroller; public Action<float> onValueChanged; public BarBehavior barBehavior; public float value; public string prefix; public string postfix; private RectTransform barRectTransform; private RectTransform barSizeRectTransform; private RectTransform barPointerRectTransform; private RectTransform barMaskRectTransform; private RectTransform sliderBackgroundRectTransform; private RectTransform backgroundFillRectTransform; private RectTransform backgroundOutlineRectTransform; private TextMeshProUGUI valueTMP; private TextMeshProUGUI maskedValueTMP; private MenuPage menuPage; private MenuSelectableElement menuSelectableElement; private float _min; private float _max = 1f; private float previousValue; private float _precisionDecimal = 0.01f; private int _precision = 2; private string[] _stringOptions = Array.Empty<string>(); private string currentDescription; private bool isHovering; public float min { get { string[] array = stringOptions; if (array == null || array.Length == 0) { return _min; } return 0f; } set { _min = value; } } public float max { get { string[] array = stringOptions; if (array == null || array.Length == 0) { return _max; } return stringOptions.Length - 1; } set { _max = value; } } public string[] stringOptions { get { return _stringOptions; } set { _stringOptions = value; UpdateBarText(); } } public int precision { get { string[] array = stringOptions; if (array == null || array.Length == 0) { return _precision; } return 0; } set { precisionDecimal = ((value == 0) ? 1f : Mathf.Pow(10f, (float)(-value))); _precision = value; } } public float precisionDecimal { get { string[] array = stringOptions; if (array == null || array.Length == 0) { return _precisionDecimal; } return 1f; } set { _precisionDecimal = value; } } private float normalizedValue => (value - min) / (max - min); private bool hasValueChanged => Math.Abs(value - previousValue) > float.Epsilon; public void SetValue(float newValue, bool invokeCallback) { newValue = Mathf.Clamp(newValue, min, max); if (invokeCallback && Math.Abs(value - newValue) > float.Epsilon) { onValueChanged(newValue); } previousValue = (value = newValue); UpdateBarVisual(); UpdateBarText(); } public void Decrement() { float num = value - precisionDecimal; if (Math.Abs(value - min) < float.Epsilon) { num = max; } else if (num < min) { num = min; } SetValue(num, invokeCallback: true); } public void Increment() { float num = value + precisionDecimal; if (Math.Abs(max - value) < float.Epsilon) { num = min; } else if (num > max) { num = max; } SetValue(num, invokeCallback: true); } private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Expected O, but got Unknown //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Expected O, but got Unknown //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Expected O, but got Unknown //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Expected O, but got Unknown //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Expected O, but got Unknown base.rectTransform = (RectTransform)((Component)this).transform; menuPage = ((Component)this).GetComponentInParent<MenuPage>(); menuSelectableElement = ((Component)this).GetComponent<MenuSelectableElement>(); labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(); descriptionTMP = ((Component)((Component)this).transform.Find("Big Setting Text")).GetComponent<TextMeshProUGUI>(); valueTMP = ((Component)((Component)this).transform.Find("Bar Text")).GetComponent<TextMeshProUGUI>(); barMaskRectTransform = (RectTransform)((Component)this).transform.Find("MaskedText"); maskedValueTMP = ((Component)barMaskRectTransform).GetComponentInChildren<TextMeshProUGUI>(); barPointerRectTransform = (RectTransform)((Component)((Component)this).transform.Find("Bar Pointer")).transform; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(5.3f, 0f); RectTransform obj = ((TMP_Text)labelTMP).rectTransform; ((Transform)obj).localPosition = ((Transform)obj).localPosition - val; ((TMP_Text)descriptionTMP).alignment = (TextAlignmentOptions)514; TextMeshProUGUI obj2 = descriptionTMP; bool enableWordWrapping = (((TMP_Text)descriptionTMP).enableAutoSizing = false); ((TMP_Text)obj2).enableWordWrapping = enableWordWrapping; ((TMP_Text)descriptionTMP).overflowMode = (TextOverflowModes)2; TextMeshProUGUI obj3 = descriptionTMP; ((TMP_Text)obj3).fontSize = ((TMP_Text)obj3).fontSize - 5f; repoTextScroller = ((Component)descriptionTMP).gameObject.AddComponent<REPOTextScroller>(); repoTextScroller.textMeshPro = (TMP_Text)(object)descriptionTMP; RectTransform obj4 = ((TMP_Text)descriptionTMP).rectTransform; obj4.sizeDelta -= new Vector2(0f, 4f); RectTransform obj5 = ((TMP_Text)descriptionTMP).rectTransform; ((Transform)obj5).localPosition = ((Transform)obj5).localPosition - val; sliderBackgroundRectTransform = (RectTransform)((Component)this).transform.Find("SliderBG"); backgroundFillRectTransform = (RectTransform)((Transform)sliderBackgroundRectTransform).Find("RawImage (2)"); backgroundOutlineRectTransform = (RectTransform)((Transform)sliderBackgroundRectTransform).Find("RawImage (3)"); RectTransform obj6 = sliderBackgroundRectTransform; ((Transform)obj6).localPosition = ((Transform)obj6).localPosition - val; RectTransform obj7 = ((TMP_Text)valueTMP).rectTransform; ((Transform)obj7).localPosition = ((Transform)obj7).localPosition - val; Transform parent = ((Transform)((TMP_Text)maskedValueTMP).rectTransform).parent; parent.localPosition -= val; Transform val2 = ((Component)this).transform.Find("Bar"); val2.localPosition -= val; barRectTransform = (RectTransform)val2.Find("RawImage"); barRectTransform.pivot = Vector2.zero; ((Transform)barRectTransform).localPosition = Vector2.op_Implicit(new Vector2(0f, -5f)); barSizeRectTransform = (RectTransform)((Component)this).transform.Find("BarSize"); RectTransform obj8 = barSizeRectTransform; ((Transform)obj8).localPosition = ((Transform)obj8).localPosition - val; Vector2 sizeDelta = ((TMP_Text)labelTMP).rectTransform.sizeDelta; sizeDelta.y -= 10f; ((TMP_Text)labelTMP).rectTransform.sizeDelta = sizeDelta; Button[] componentsInChildren = ((Component)this).GetComponentsInChildren<Button>(); Button obj9 = componentsInChildren[0]; Transform transform = ((Component)obj9).transform; transform.localPosition -= val; obj9.onClick = new ButtonClickedEvent(); ((UnityEvent)obj9.onClick).AddListener(new UnityAction(Decrement)); Button obj10 = componentsInChildren[1]; Transform transform2 = ((Component)obj10).transform; transform2.localPosition -= val; obj10.onClick = new ButtonClickedEvent(); ((UnityEvent)obj10.onClick).AddListener(new UnityAction(Increment)); Object.Destroy((Object)(object)((Component)((Transform)sliderBackgroundRectTransform).Find("RawImage (4)")).gameObject); Object.Destroy((Object)(object)((Component)((Transform)sliderBackgroundRectTransform).Find("RawImage (5)")).gameObject); Object.Destroy((Object)(object)((Component)val2.Find("Extra Bar")).gameObject); Object.Destroy((Object)(object)((Component)this).GetComponent<MenuSliderMicrophone>()); Object.Destroy((Object)(object)((Component)this).GetComponent<MenuSlider>()); } private void Update() { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) HandleDescription(); if (SemiFunc.UIMouseHover(menuPage, barSizeRectTransform, REPOReflection.menuSelectableElement_MenuID.GetValue(menuSelectableElement) as string, 5f, 5f)) { if (!isHovering) { MenuManager.instance.MenuEffectHover(SemiFunc.MenuGetPitchFromYPos(base.rectTransform), -1f); } isHovering = true; SemiFunc.MenuSelectionBoxTargetSet(menuPage, barSizeRectTransform, new Vector2(-3f, 0f), new Vector2(20f, 10f)); if (!((Component)barPointerRectTransform).gameObject.activeSelf) { ((Component)barPointerRectTransform).gameObject.SetActive(true); } HandleHovering(); } else { isHovering = false; if (((Component)barPointerRectTransform).gameObject.activeSelf) { RectTransform obj = barPointerRectTransform; Vector3 localPosition = ((Transform)barPointerRectTransform).localPosition; localPosition.x = -1000f; ((Transform)obj).localPosition = localPosition; ((Component)barPointerRectTransform).gameObject.SetActive(false); } } if (hasValueChanged) { value = Mathf.Clamp(value, min, max); UpdateBarVisual(); UpdateBarText(); onValueChanged(previousValue = value); } } private void HandleDescription() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (!(((TMP_Text)descriptionTMP).text == currentDescription)) { bool flag = !string.IsNullOrEmpty(((TMP_Text)descriptionTMP).text); backgroundFillRectTransform.sizeDelta = new Vector2(109.8f, flag ? 33f : 15f); backgroundOutlineRectTransform.sizeDelta = new Vector2(108f, flag ? 30.6f : 15f); if (Object.op_Implicit((Object)(object)base.repoScrollViewElement)) { base.repoScrollViewElement.bottomPadding = (flag ? 25f : 1f); base.repoScrollViewElement.onSettingChanged?.Invoke(); } currentDescription = ((TMP_Text)descriptionTMP).text; } } private void HandleHovering() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) float x = SemiFunc.UIMouseGetLocalPositionWithinRectTransform(barSizeRectTransform).x; float num = max - min; float num2 = precisionDecimal / num; float num3 = Mathf.Round(Mathf.Clamp01(x / barSizeRectTransform.sizeDelta.x) / num2) * num2; float x2 = Mathf.Clamp(((Transform)barSizeRectTransform).localPosition.x + num3 * barSizeRectTransform.sizeDelta.x, ((Transform)barSizeRectTransform).localPosition.x, ((Transform)barSizeRectTransform).localPosition.x + barSizeRectTransform.sizeDelta.x) - 2f; RectTransform obj = barPointerRectTransform; Vector3 localPosition = ((Transform)barPointerRectTransform).localPosition; localPosition.x = x2; ((Transform)obj).localPosition = localPosition; if (Input.GetMouseButton(0)) { value = min + num3 * num; if (hasValueChanged) { MenuManager.instance.MenuEffectClick((MenuClickEffectType)4, menuPage, -1f, -1f, false); } } } private void UpdateBarVisual() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) float num = barBehavior switch { BarBehavior.UpdateWithValue => normalizedValue, BarBehavior.StaticAtMinimum => 0f, BarBehavior.StaticAtMaximum => 1f, _ => throw new ArgumentOutOfRangeException(), }; RectTransform obj = barRectTransform; RectTransform obj2 = barMaskRectTransform; Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(num * 100f, 10f); obj2.sizeDelta = sizeDelta; obj.sizeDelta = sizeDelta; } private void UpdateBarText() { float num = value; if (prefix == null) { prefix = string.Empty; } if (postfix == null) { postfix = string.Empty; } string text = prefix; string[] array = stringOptions; text = ((array == null || array.Length == 0) ? (text + num.ToString($"F{precision}", CultureInfo.CurrentCulture)) : (text + (stringOptions.ElementAtOrDefault(Convert.ToInt32(num)) ?? stringOptions.First()))); TextMeshProUGUI obj = maskedValueTMP; string text3 = (((TMP_Text)valueTMP).text = text + postfix); ((TMP_Text)obj).text = text3; } } public sealed class REPOSpacer : REPOElement { private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) base.rectTransform = (RectTransform)((Component)this).transform; base.rectTransform.pivot = Vector2.zero; } } public sealed class REPOTextScroller : MonoBehaviour { public TMP_Text textMeshPro; public int maxCharacters; public float initialWaitTime = 5f; public float startWaitTime = 3f; public float endWaitTime = 3f; public float scrollingSpeedInSecondsPerCharacter = 0.5f; private bool isInitial = true; public IEnumerator Animate() { while (true) { textMeshPro.firstVisibleCharacter = 0; textMeshPro.maxVisibleCharacters = maxCharacters; if (isInitial) { yield return (object)new WaitForSeconds(initialWaitTime); isInitial = false; } else { yield return (object)new WaitForSeconds(startWaitTime); } while (textMeshPro.maxVisibleCharacters < textMeshPro.text.Length) { TMP_Text obj = textMeshPro; int firstVisibleCharacter = obj.firstVisibleCharacter; obj.firstVisibleCharacter = firstVisibleCharacter + 1; TMP_Text obj2 = textMeshPro; firstVisibleCharacter = obj2.maxVisibleCharacters; obj2.maxVisibleCharacters = firstVisibleCharacter + 1; yield return (object)new WaitForSeconds(scrollingSpeedInSecondsPerCharacter); } yield return (object)new WaitForSeconds(endWaitTime); } } private void Awake() { if (!Object.op_Implicit((Object)(object)textMeshPro)) { textMeshPro = (TMP_Text)(object)((Component)this).GetComponent<TextMeshProUGUI>(); } } } public sealed class REPOToggle : REPOElement { public TextMeshProUGUI labelTMP; public TextMeshProUGUI leftButtonTMP; public TextMeshProUGUI rightButtonTMP; public Action<bool> onToggle; private RectTransform optionBox; private RectTransform optionBoxBehind; private Vector3 targetPosition; private Vector3 targetScale; public bool state { get; private set; } public void SetState(bool newState, bool invokeCallback) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) targetPosition = (newState ? new Vector3(137.8f, 12.3f) : new Vector3(212.644f, 12.3f)); targetScale = (newState ? new Vector3(73f, 22f, 1f) : new Vector3(74f, 22f, 1f)); if (invokeCallback && state != newState) { onToggle?.Invoke(newState); } state = newState; } private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown Transform transform = ((Component)this).transform; base.rectTransform = (RectTransform)(object)((transform is RectTransform) ? transform : null); labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(); optionBox = (RectTransform)((Component)this).transform.Find("Option Box"); optionBoxBehind = (RectTransform)((Component)this).transform.Find("Option Box Behind"); Vector3 val = Vector3.right * 100f; Transform obj = ((Component)this).transform.Find("SliderBG"); obj.localPosition += val; RectTransform obj2 = ((TMP_Text)labelTMP).rectTransform; obj2.sizeDelta -= new Vector2(0f, 4f); RectTransform obj3 = ((TMP_Text)labelTMP).rectTransform; ((Transform)obj3).localPosition = ((Transform)obj3).localPosition + val; Transform obj4 = ((Component)this).transform.Find("RawImage"); obj4.localPosition += val; Transform obj5 = ((Component)this).transform.Find("RawImage (1)"); obj5.localPosition += val; Transform obj6 = ((Component)this).transform.Find("RawImage (2)"); obj6.localPosition += val; Button[] componentsInChildren = ((Component)this).GetComponentsInChildren<Button>(); Button val2 = componentsInChildren[0]; Transform transform2 = ((Component)val2).transform; transform2.localPosition += val; val2.onClick = new ButtonClickedEvent(); ((UnityEvent)val2.onClick).AddListener((UnityAction)delegate { SetState(newState: true, invokeCallback: true); }); leftButtonTMP = ((Component)val2).GetComponentInChildren<TextMeshProUGUI>(); Button val3 = componentsInChildren[1]; Transform transform3 = ((Component)val3).transform; transform3.localPosition += val; val3.onClick = new ButtonClickedEvent(); ((UnityEvent)val3.onClick).AddListener((UnityAction)delegate { SetState(newState: false, invokeCallback: true); }); rightButtonTMP = ((Component)val3).GetComponentInChildren<TextMeshProUGUI>(); Object.Destroy((Object)(object)((Component)this).GetComponent<MenuTwoOptions>()); } private void OnTransformParentChanged() { MenuButton[] componentsInChildren = ((Component)this).GetComponentsInChildren<MenuButton>(); foreach (MenuButton obj in componentsInChildren) { REPOReflection.menuButton_ParentPage.SetValue(obj, ((Component)this).GetComponentInParent<MenuPage>()); } } private void Update() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown resul
plugins/MoreHead.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using MenuLib; using MenuLib.MonoBehaviors; using MenuLib.Structs; using Microsoft.CodeAnalysis; using MoreHead; using Newtonsoft.Json; using Photon.Pun; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("YMC_MHZ")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyDescription("一个简单好玩的装饰模组,提供unitypackage,供玩家自行导入模型。")] [assembly: AssemblyFileVersion("1.3.9.0")] [assembly: AssemblyInformationalVersion("1.3.9+25faefb2e5f0c84e2b9564d63c147f71d30303b0")] [assembly: AssemblyProduct("MoreHead")] [assembly: AssemblyTitle("MoreHead")] [assembly: AssemblyVersion("1.3.9.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [BepInPlugin("Mhz.REPOMoreHead", "MoreHead", "1.3.9")] public class Morehead : BaseUnityPlugin { private const string PluginGuid = "Mhz.REPOMoreHead"; private const string PluginName = "MoreHead"; private const string PluginVersion = "1.3.9"; public static ManualLogSource? Logger; public static Morehead? Instance { get; private set; } public static string GetPluginVersion() { return "1.3.9"; } private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Instance = this; Logger = ((BaseUnityPlugin)this).Logger; try { Harmony val = new Harmony("Mhz.REPOMoreHead"); val.PatchAll(typeof(PlayerAvatarVisualsPatch)); val.PatchAll(typeof(PlayerUpdatePatch)); val.PatchAll(typeof(PlayerAvatarAwakePatch)); val.PatchAll(typeof(GameDirectorUpdatePatch)); val.PatchAll(typeof(PlayerRevivePatch)); val.PatchAll(typeof(MenuManagerStartPatch)); val.PatchAll(typeof(MenuButtonHoveringPatch)); val.PatchAll(typeof(MenuButtonHoverEndPatch)); val.PatchAll(typeof(MenuPageStateSetPatch)); string text = "\n\n ███▄ ▄███▓ ▒█████ ██▀███ ▓█████ ██░ ██ ▓█████ ▄▄▄ ▓█████▄ \n▓██▒▀█▀ ██▒▒██▒ ██▒▓██ ▒ ██▒▓█ ▀ ▓██░ ██▒▓█ ▀▒████▄ ▒██▀ ██▌\n▓██ ▓██░▒██░ ██▒▓██ ░▄█ ▒▒███ ▒██▀███░▒███ ▒██ ▀█▄ ░██ █▌\n▒██ ▒██ ▒██ ██░▒███▀█▄ ▒▓█ ▄ ░▓█ ░██ ▒▓█ ▄░██▄▄▄▄██ ░▓█▄ ▌\n▒██▒ ░██▒░ ████▓▒░░██▓ ▒██▒░▒████▒░▓█▒░██▓░▒████▒▓█ ▓██▒░▒████▓ v1.3.9\n░ ▒░ ░ ░░ ▒░▒░▒░ ░ ▒▓ ░▒▓░░░ ▒░ ░ ▒ ░░▒░▒░░ ▒░ ░▒▒ ▓▒█░ ▒▒▓ ▒ \n░ ░ ░ ░ ▒ ▒░ ░▒ ░ ▒░ ░ ░ ░ ▒ ░▒░ ░ ░ ░ ░ ▒ ▒▒ ░ ░ ▒ ▒ \n░ ░ ░ ░ ░ ▒ ░░ ░ ░ ░ ░░ ░ ░ ░ ▒ ░ ░ ░ \n ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ \n"; ManualLogSource? logger = Logger; if (logger != null) { logger.LogMessage((object)text); } HeadDecorationManager.Initialize(); ConfigManager.Initialize(); } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("Harmony补丁应用失败: " + ex.Message)); } } } private void OnApplicationQuit() { ConfigManager.SaveConfig(); } public static bool GetDecorationState(string? name) { return HeadDecorationManager.GetDecorationState(name); } } [HarmonyPatch(typeof(MenuManager))] [HarmonyPatch("Start")] internal class MenuManagerStartPatch { [HarmonyPostfix] private static void Postfix() { try { if ((Object)(object)MenuManager.instance != (Object)null && MenuManager.instance.menuPages != null && MenuManager.instance.menuPages.Count > 0) { MoreHeadUI.Initialize(); MoreHeadUI.InitializeShortcutListener(); return; } ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogWarning((object)"MenuManager未准备好,无法初始化UI"); } } catch (Exception arg) { ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogError((object)$"在MenuManager.Start补丁中初始化UI时出错: {arg}"); } } } } [HarmonyPatch(typeof(PlayerAvatar))] [HarmonyPatch("Update")] internal class PlayerUpdatePatch { private static void Postfix(PlayerAvatar __instance) { if (__instance.photonView.IsMine && GameManager.Multiplayer() && PhotonNetwork.LocalPlayer != null) { } } public static void UpdatePlayerDecorations(PlayerAvatar playerAvatar) { try { if ((Object)(object)playerAvatar?.playerAvatarVisuals == (Object)null) { return; } Dictionary<string, Transform> decorationParentNodes = DecorationUtils.GetDecorationParentNodes(((Component)playerAvatar.playerAvatarVisuals).transform); if (decorationParentNodes.Count == 0) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogWarning((object)"找不到任何装饰物父级节点"); } return; } DecorationUtils.EnsureDecorationContainers(decorationParentNodes); foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { if (decorationParentNodes.TryGetValue(decoration.ParentTag ?? string.Empty, out var value)) { Transform val = value.Find("HeadDecorations"); if ((Object)(object)val != (Object)null) { DecorationUtils.UpdateDecoration(val, decoration.Name ?? string.Empty, decoration.IsVisible); } } else { ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogWarning((object)("找不到装饰物 " + decoration.DisplayName + " 的父级节点: " + decoration.ParentTag)); } } } } catch (Exception ex) { ManualLogSource? logger3 = Morehead.Logger; if (logger3 != null) { logger3.LogError((object)("更新玩家装饰物时出错: " + ex.Message)); } } } public static void UpdateMenuPlayerDecorations() { try { PlayerAvatarVisuals val = FindMenuPlayerVisuals(); if ((Object)(object)val == (Object)null) { return; } Dictionary<string, Transform> decorationParentNodes = DecorationUtils.GetDecorationParentNodes(((Component)val).transform); if (decorationParentNodes.Count == 0) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogWarning((object)"找不到任何菜单角色装饰物父级节点"); } return; } DecorationUtils.EnsureDecorationContainers(decorationParentNodes); foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { if (decorationParentNodes.TryGetValue(decoration.ParentTag ?? string.Empty, out var value)) { Transform val2 = value.Find("HeadDecorations"); if ((Object)(object)val2 != (Object)null) { Transform val3 = val2.Find(decoration.Name); if ((Object)(object)val3 == (Object)null) { AddMenuDecoration(val2, decoration.Name); } else { DecorationUtils.UpdateDecoration(val2, decoration.Name ?? string.Empty, decoration.IsVisible); } } } else { ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogWarning((object)("找不到菜单角色装饰物 " + decoration.DisplayName + " 的父级节点: " + decoration.ParentTag)); } } } } catch (Exception ex) { ManualLogSource? logger3 = Morehead.Logger; if (logger3 != null) { logger3.LogError((object)("更新菜单角色装饰物状态失败: " + ex.Message)); } } } private static PlayerAvatarVisuals? FindMenuPlayerVisuals() { if ((Object)(object)PlayerAvatarMenu.instance == (Object)null) { return null; } return ((Component)PlayerAvatarMenu.instance).GetComponentInChildren<PlayerAvatarVisuals>(); } public static void AddMenuDecoration(Transform parent, string? decorationName) { string decorationName2 = decorationName; try { Transform val = parent.Find(decorationName2); if ((Object)(object)val != (Object)null) { bool decorationState = Morehead.GetDecorationState(decorationName2); ((Component)val).gameObject.SetActive(decorationState); return; } DecorationInfo decorationInfo = HeadDecorationManager.Decorations.Find((DecorationInfo d) => d.Name != null && d.Name.Equals(decorationName2, StringComparison.OrdinalIgnoreCase)); if (decorationInfo != null && (Object)(object)decorationInfo.Prefab != (Object)null) { GameObject val2 = Object.Instantiate<GameObject>(decorationInfo.Prefab, parent); ((Object)val2).name = decorationName2; val2.SetActive(decorationInfo.IsVisible); return; } ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogWarning((object)("AddMenuDecoration: 找不到装饰物 " + decorationName2 + " 或其预制体为空")); } } catch (Exception ex) { ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogError((object)("为菜单角色添加装饰物时出错: " + ex.Message)); } } } } [HarmonyPatch(typeof(PlayerAvatar))] [HarmonyPatch("Awake")] internal class PlayerAvatarAwakePatch { private static void Postfix(PlayerAvatar __instance) { ((Component)__instance).gameObject.AddComponent<HeadDecorationSync>(); } } public class HeadDecorationSync : MonoBehaviourPun { public void SyncAllDecorations() { try { string[] array = new string[HeadDecorationManager.Decorations.Count]; bool[] array2 = new bool[HeadDecorationManager.Decorations.Count]; string[] array3 = new string[HeadDecorationManager.Decorations.Count]; for (int i = 0; i < HeadDecorationManager.Decorations.Count; i++) { DecorationInfo decorationInfo = HeadDecorationManager.Decorations[i]; array[i] = decorationInfo.Name; array2[i] = decorationInfo.IsVisible; array3[i] = decorationInfo.ParentTag; } ((MonoBehaviourPun)this).photonView.RPC("UpdateAllDecorations", (RpcTarget)1, new object[3] { array, array2, array3 }); } catch (Exception ex) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("同步所有装饰物状态失败: " + ex.Message)); } } } [PunRPC] private void UpdateAllDecorations(string[] names, bool[] states, string[] parentTags) { try { PlayerAvatar component = ((Component)this).GetComponent<PlayerAvatar>(); if ((Object)(object)component == (Object)null || (Object)(object)component.playerAvatarVisuals == (Object)null) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogWarning((object)"找不到PlayerAvatar或PlayerAvatarVisuals组件"); } return; } Dictionary<string, Transform> decorationParentNodes = DecorationUtils.GetDecorationParentNodes(((Component)component.playerAvatarVisuals).transform); if (decorationParentNodes.Count == 0) { ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogWarning((object)"找不到任何装饰物父级节点"); } return; } DecorationUtils.EnsureDecorationContainers(decorationParentNodes); for (int i = 0; i < names.Length; i++) { string decorationName = names[i]; bool showDecoration = states[i]; string key = parentTags[i]; if (decorationParentNodes.TryGetValue(key, out var value)) { Transform val = value.Find("HeadDecorations"); if ((Object)(object)val != (Object)null) { DecorationUtils.UpdateDecoration(val, decorationName, showDecoration); } } } } catch (Exception ex) { ManualLogSource? logger3 = Morehead.Logger; if (logger3 != null) { logger3.LogError((object)("RPC更新所有装饰物状态失败: " + ex.Message)); } } } } [HarmonyPatch(typeof(PlayerAvatarVisuals))] [HarmonyPatch("Start")] internal class PlayerAvatarVisualsPatch { private static void Postfix(PlayerAvatarVisuals __instance) { try { Dictionary<string, Transform> decorationParentNodes = DecorationUtils.GetDecorationParentNodes(((Component)__instance).transform); if (decorationParentNodes.Count == 0) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogWarning((object)$"找不到任何装饰物父级节点 (isMenuAvatar: {__instance.isMenuAvatar})"); } return; } DecorationUtils.EnsureDecorationContainers(decorationParentNodes); if (__instance.isMenuAvatar) { foreach (KeyValuePair<string, Transform> item in decorationParentNodes) { string key = item.Key; Transform value = item.Value; Transform val = value.Find("HeadDecorations"); if ((Object)(object)val != (Object)null) { foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { if (decoration.ParentTag == key) { PlayerUpdatePatch.AddMenuDecoration(val, decoration.Name); } } } } return; } foreach (DecorationInfo decoration2 in HeadDecorationManager.Decorations) { if (decorationParentNodes.TryGetValue(decoration2.ParentTag ?? string.Empty, out var value2)) { Transform val2 = value2.Find("HeadDecorations"); if ((Object)(object)val2 != (Object)null) { AddNewDecoration(val2, decoration2, __instance); } } else { ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogWarning((object)("初始化时找不到装饰物 " + decoration2.DisplayName + " 的父级节点: " + decoration2.ParentTag)); } } } if (!GameManager.Multiplayer() || !((Object)(object)__instance.playerAvatar != (Object)null) || !((Object)(object)__instance.playerAvatar.photonView != (Object)null) || !__instance.playerAvatar.photonView.IsMine) { return; } try { HeadDecorationSync component = ((Component)__instance.playerAvatar).GetComponent<HeadDecorationSync>(); if ((Object)(object)component != (Object)null) { component.SyncAllDecorations(); return; } ManualLogSource? logger3 = Morehead.Logger; if (logger3 != null) { logger3.LogWarning((object)"找不到HeadDecorationSync组件,无法同步初始状态"); } } catch (Exception ex) { ManualLogSource? logger4 = Morehead.Logger; if (logger4 != null) { logger4.LogError((object)("同步初始装饰物状态失败: " + ex.Message)); } } } catch (Exception ex2) { ManualLogSource? logger5 = Morehead.Logger; if (logger5 != null) { logger5.LogError((object)$"添加装饰物失败: {ex2.Message} (isMenuAvatar: {__instance.isMenuAvatar})"); } } } private static void AddNewDecoration(Transform parent, DecorationInfo decoration, PlayerAvatarVisuals __instance) { Transform val = parent.Find(decoration.Name); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(decoration.IsVisible); return; } if ((Object)(object)decoration.Prefab != (Object)null) { try { GameObject val2 = Object.Instantiate<GameObject>(decoration.Prefab, parent); ((Object)val2).name = decoration.Name; val2.SetActive(decoration.IsVisible); return; } catch (Exception ex) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("实例化预制体时出错: " + ex.Message)); } return; } } ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogWarning((object)("AddNewDecoration: 装饰物 " + decoration.DisplayName + " 的预制体为空")); } } } [HarmonyPatch(typeof(GameDirector))] [HarmonyPatch("Update")] internal class GameDirectorUpdatePatch { private static gameState previousState; private static void Postfix(GameDirector __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) try { if ((int)previousState != 2 && (int)__instance.currentState == 2) { SyncAllPlayersDecorations(); } previousState = __instance.currentState; } catch (Exception ex) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("监听游戏状态变化时出错: " + ex.Message)); } } } private static void SyncAllPlayersDecorations() { try { PlayerAvatar val = FindLocalPlayer(); if ((Object)(object)val != (Object)null) { PlayerUpdatePatch.UpdatePlayerDecorations(val); HeadDecorationSync component = ((Component)val).GetComponent<HeadDecorationSync>(); if ((Object)(object)component != (Object)null) { component.SyncAllDecorations(); } } } catch (Exception ex) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("同步所有玩家装饰物状态时出错: " + ex.Message)); } } } private static PlayerAvatar? FindLocalPlayer() { try { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val?.photonView != (Object)null && val.photonView.IsMine) { return val; } } } catch (Exception ex) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("查找本地玩家时出错: " + ex.Message)); } } return null; } } [HarmonyPatch(typeof(PlayerAvatar))] [HarmonyPatch("ReviveRPC")] internal class PlayerRevivePatch { [CompilerGenerated] private sealed class <DelayedSync>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlayerAvatar playerAvatar; private Exception <e>5__1; private HeadDecorationSync <syncComponent>5__2; private Exception <e>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedSync>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <e>5__1 = null; <syncComponent>5__2 = null; <e>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 2; return true; case 2: <>1__state = -1; try { PlayerUpdatePatch.UpdatePlayerDecorations(playerAvatar); } catch (Exception ex) { <e>5__1 = ex; ManualLogSource? logger3 = Morehead.Logger; if (logger3 != null) { logger3.LogError((object)("更新玩家装饰物状态失败: " + <e>5__1.Message)); } } <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 3; return true; case 3: <>1__state = -1; try { <syncComponent>5__2 = ((Component)playerAvatar).GetComponent<HeadDecorationSync>(); if ((Object)(object)<syncComponent>5__2 != (Object)null) { <syncComponent>5__2.SyncAllDecorations(); } else { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogWarning((object)"玩家复活后找不到HeadDecorationSync组件"); } } <syncComponent>5__2 = null; } catch (Exception ex) { <e>5__3 = ex; ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogError((object)("同步装饰物状态失败: " + <e>5__3.Message)); } } 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 void Postfix(PlayerAvatar __instance) { try { if (__instance.photonView.IsMine) { ((MonoBehaviour)__instance).StartCoroutine(DelayedSync(__instance)); } } catch (Exception ex) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("玩家复活时同步装饰物状态失败: " + ex.Message)); } } } [IteratorStateMachine(typeof(<DelayedSync>d__1))] private static IEnumerator DelayedSync(PlayerAvatar playerAvatar) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedSync>d__1(0) { playerAvatar = playerAvatar }; } } public class DecorationButtonMarker : MonoBehaviour { public DecorationInfo? Decoration { get; set; } public bool HasHandledHover { get; set; } } [HarmonyPatch(typeof(MenuButton))] [HarmonyPatch("OnHovering")] internal class MenuButtonHoveringPatch { [HarmonyPostfix] private static void Postfix(MenuButton __instance) { try { if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).gameObject == (Object)null || !((Component)__instance).gameObject.activeInHierarchy) { return; } DecorationButtonMarker decorationButtonMarker = null; try { foreach (DecorationButtonMarker value2 in MoreHeadUI.buttonMarkers.Values) { if ((Object)(object)value2 != (Object)null && (Object)(object)((Component)value2).gameObject != (Object)null && (Object)(object)((Component)value2).gameObject == (Object)(object)((Component)__instance).gameObject) { decorationButtonMarker = value2; break; } } } catch (Exception) { return; } if ((Object)(object)decorationButtonMarker == (Object)null || decorationButtonMarker.Decoration == null || decorationButtonMarker.HasHandledHover) { return; } DecorationInfo decoration = decorationButtonMarker.Decoration; if (string.IsNullOrEmpty(decoration.ModName)) { return; } if (MoreHeadUI.decorationButtons.TryGetValue(decoration.Name ?? string.Empty, out REPOButton value)) { if ((Object)(object)value == (Object)null || (Object)(object)value.labelTMP == (Object)null) { return; } if (!((TMP_Text)value.labelTMP).text.Contains(decoration.ModName)) { ((TMP_Text)value.labelTMP).text = ((TMP_Text)value.labelTMP).text + " <size=12><color=#AAAAAA>- " + decoration.ModName + "</color></size>"; } } decorationButtonMarker.HasHandledHover = true; } catch (Exception ex2) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("MenuButton.OnHovering补丁出错: " + ex2.Message + "\n" + ex2.StackTrace)); } } } } [HarmonyPatch(typeof(MenuButton))] [HarmonyPatch("OnHoverEnd")] internal class MenuButtonHoverEndPatch { [HarmonyPostfix] private static void Postfix(MenuButton __instance) { try { if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).gameObject == (Object)null || !((Component)__instance).gameObject.activeInHierarchy) { return; } DecorationButtonMarker decorationButtonMarker = null; try { foreach (DecorationButtonMarker value3 in MoreHeadUI.buttonMarkers.Values) { if ((Object)(object)value3 != (Object)null && (Object)(object)((Component)value3).gameObject != (Object)null && (Object)(object)((Component)value3).gameObject == (Object)(object)((Component)__instance).gameObject) { decorationButtonMarker = value3; break; } } } catch (Exception) { return; } if ((Object)(object)decorationButtonMarker == (Object)null || decorationButtonMarker.Decoration == null) { return; } DecorationInfo decoration = decorationButtonMarker.Decoration; if (string.IsNullOrEmpty(decoration.ModName)) { return; } if (MoreHeadUI.decorationButtons.TryGetValue(decoration.Name ?? string.Empty, out REPOButton value)) { if ((Object)(object)value == (Object)null || (Object)(object)value.labelTMP == (Object)null) { return; } string text = ((TMP_Text)value.labelTMP).text; string value2 = " <size=12><color=#AAAAAA>- " + decoration.ModName + "</color></size>"; int num = text.IndexOf(value2); if (num != -1) { ((TMP_Text)value.labelTMP).text = text.Substring(0, num).TrimEnd(); } } decorationButtonMarker.HasHandledHover = false; } catch (Exception ex2) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("MenuButton.OnHoverEnd补丁出错: " + ex2.Message + "\n" + ex2.StackTrace)); } } } } [HarmonyPatch(typeof(MenuPage))] [HarmonyPatch("PageStateSet")] internal class MenuPageStateSetPatch { [HarmonyPostfix] private static void Postfix(MenuPage __instance, PageState pageState) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 try { if (((int)pageState == 2 || (int)pageState == 3) && (Object)(object)MoreHeadUI.decorationsPage != (Object)null && (Object)(object)__instance == (Object)(object)MoreHeadUI.decorationsPage.menuPage) { MoreHeadUI.SafeDestroyAvatar(); } } catch (Exception ex) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("MenuPage.PageStateSet补丁出错: " + ex.Message + "\n" + ex.StackTrace)); } } } } namespace MoreHead { public static class ConfigManager { private class ConfigData { public Dictionary<int, Dictionary<string, bool>> OutfitStates { get; set; } = new Dictionary<int, Dictionary<string, bool>>(); public int CurrentOutfitIndex { get; set; } = 1; } private const string MOD_DATA_FOLDER = "REPOModData"; private const string MOD_FOLDER = "MoreHead"; private const string CONFIG_FILENAME = "MoreHeadConfig.json"; private const string OUTFIT_CONFIG_FILENAME = "MoreHeadOutfits.json"; private static Dictionary<string?, bool> _decorationStates = new Dictionary<string, bool>(); private static Dictionary<int, Dictionary<string?, bool>> _outfitStates = new Dictionary<int, Dictionary<string, bool>>(); private static ManualLogSource? Logger => Morehead.Logger; public static int CurrentOutfitIndex { get; private set; } = 1; private static string NewConfigFilePath => Path.Combine(Application.persistentDataPath, "REPOModData", "MoreHead", "MoreHeadConfig.json"); private static string OutfitConfigFilePath => Path.Combine(Application.persistentDataPath, "REPOModData", "MoreHead", "MoreHeadOutfits.json"); private static string BepInExConfigFilePath => Path.Combine(Paths.ConfigPath, "MoreHeadConfig.json"); private static string OldConfigFilePath { get { Morehead? instance = Morehead.Instance; return Path.Combine(Path.GetDirectoryName((instance != null) ? ((BaseUnityPlugin)instance).Info.Location : null) ?? string.Empty, "MoreHeadConfig.txt"); } } public static void Initialize() { try { EnsureModDataDirectoryExists(); InitializeOutfitStates(); LoadConfig(); ApplyOutfit(CurrentOutfitIndex); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("初始化配置管理器时出错: " + ex.Message)); } } } private static void InitializeOutfitStates() { for (int i = 1; i <= 5; i++) { if (!_outfitStates.ContainsKey(i)) { _outfitStates[i] = new Dictionary<string, bool>(); } } } private static void EnsureModDataDirectoryExists() { try { string text = Path.Combine(Application.persistentDataPath, "REPOModData"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)("已创建MOD数据总文件夹: " + text)); } } string text2 = Path.Combine(text, "MoreHead"); if (!Directory.Exists(text2)) { Directory.CreateDirectory(text2); ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogInfo((object)("已创建MOD特定文件夹: " + text2)); } } } catch (Exception ex) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("创建MOD数据目录时出错: " + ex.Message)); } } } private static void LoadConfig() { try { _decorationStates.Clear(); LoadOutfitConfig(); if (File.Exists(NewConfigFilePath) && LoadJsonConfig(NewConfigFilePath)) { if (_outfitStates[1].Count == 0) { _outfitStates[1] = new Dictionary<string, bool>(_decorationStates); SaveOutfitConfig(); ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"已将单套配置迁移到第1套装备方案"); } } return; } if (File.Exists(BepInExConfigFilePath) && LoadJsonConfig(BepInExConfigFilePath)) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogInfo((object)("已从BepInEx配置目录加载配置: " + BepInExConfigFilePath)); } SaveConfigWithoutUpdate(); ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogInfo((object)("已将配置从BepInEx目录迁移到Unity存档位置: " + NewConfigFilePath)); } if (_outfitStates[1].Count == 0) { _outfitStates[1] = new Dictionary<string, bool>(_decorationStates); SaveOutfitConfig(); ManualLogSource? logger4 = Logger; if (logger4 != null) { logger4.LogInfo((object)"已将单套配置迁移到第1套装备方案"); } } try { File.Delete(BepInExConfigFilePath); ManualLogSource? logger5 = Logger; if (logger5 != null) { logger5.LogInfo((object)("已删除BepInEx配置文件: " + BepInExConfigFilePath)); } return; } catch (Exception ex) { ManualLogSource? logger6 = Logger; if (logger6 != null) { logger6.LogWarning((object)("删除BepInEx配置文件失败: " + ex.Message)); } return; } } if (!File.Exists(OldConfigFilePath)) { return; } try { string[] array = File.ReadAllLines(OldConfigFilePath); string[] array2 = array; foreach (string text in array2) { if (!string.IsNullOrWhiteSpace(text)) { string[] array3 = text.Split('='); if (array3.Length == 2) { string key = array3[0].Trim(); bool value = array3[1].Trim().Equals("1", StringComparison.OrdinalIgnoreCase); _decorationStates[key] = value; } } } if (_decorationStates.Count <= 0) { return; } ManualLogSource? logger7 = Logger; if (logger7 != null) { logger7.LogInfo((object)$"已从旧文本格式加载配置,包含 {_decorationStates.Count} 个装饰物状态"); } SaveConfigWithoutUpdate(); ManualLogSource? logger8 = Logger; if (logger8 != null) { logger8.LogInfo((object)("已将旧文本格式配置迁移到新的JSON格式: " + NewConfigFilePath)); } if (_outfitStates[1].Count == 0) { _outfitStates[1] = new Dictionary<string, bool>(_decorationStates); SaveOutfitConfig(); ManualLogSource? logger9 = Logger; if (logger9 != null) { logger9.LogInfo((object)"已将单套配置迁移到第1套装备方案"); } } try { File.Delete(OldConfigFilePath); ManualLogSource? logger10 = Logger; if (logger10 != null) { logger10.LogInfo((object)("已删除旧文本配置文件: " + OldConfigFilePath)); } } catch (Exception ex2) { ManualLogSource? logger11 = Logger; if (logger11 != null) { logger11.LogWarning((object)("删除旧文本配置文件失败: " + ex2.Message)); } } } catch (Exception ex3) { ManualLogSource? logger12 = Logger; if (logger12 != null) { logger12.LogError((object)("从旧文本格式加载配置时出错: " + ex3.Message)); } } } catch (Exception ex4) { ManualLogSource? logger13 = Logger; if (logger13 != null) { logger13.LogError((object)("加载配置时出错: " + ex4.Message)); } _decorationStates.Clear(); } } private static void LoadOutfitConfig() { try { InitializeOutfitStates(); if (File.Exists(OutfitConfigFilePath)) { string text = File.ReadAllText(OutfitConfigFilePath); ConfigData configData = JsonConvert.DeserializeObject<ConfigData>(text); if (configData != null) { _outfitStates.Clear(); foreach (KeyValuePair<int, Dictionary<string, bool>> outfitState in configData.OutfitStates) { _outfitStates[outfitState.Key] = new Dictionary<string, bool>(); foreach (KeyValuePair<string, bool> item in outfitState.Value) { _outfitStates[outfitState.Key][item.Key] = item.Value; } } CurrentOutfitIndex = configData.CurrentOutfitIndex; if (CurrentOutfitIndex < 1 || CurrentOutfitIndex > 5) { CurrentOutfitIndex = 1; } return; } } InitializeOutfitStates(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("加载多套装备方案配置时出错: " + ex.Message)); } InitializeOutfitStates(); } } private static bool LoadJsonConfig(string filePath) { //IL_0095: Expected O, but got Unknown try { string text = File.ReadAllText(filePath); Dictionary<string, bool> dictionary = JsonConvert.DeserializeObject<Dictionary<string, bool>>(text); if (dictionary != null) { foreach (KeyValuePair<string, bool> item in dictionary) { _decorationStates[item.Key] = item.Value; } ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)$"已从JSON加载配置,包含 {_decorationStates.Count} 个装饰物状态"); } return true; } } catch (JsonException val) { JsonException val2 = val; ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("解析JSON配置文件时出错: " + ((Exception)(object)val2).Message)); } } catch (Exception ex) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("加载JSON配置文件时出错: " + ex.Message)); } } return false; } public static void SaveConfig() { try { UpdateConfigData(); SaveToFile(); SaveCurrentOutfit(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("保存配置时出错: " + ex.Message)); } } } private static void SaveConfigWithoutUpdate() { try { SaveToFile(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("保存配置时出错: " + ex.Message)); } } } private static void SaveToFile() { try { EnsureModDataDirectoryExists(); string contents = JsonConvert.SerializeObject((object)_decorationStates, (Formatting)1); File.WriteAllText(NewConfigFilePath, contents); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("写入配置文件时出错: " + ex.Message)); } } } private static void SaveOutfitConfig() { try { EnsureModDataDirectoryExists(); ConfigData configData = new ConfigData { OutfitStates = new Dictionary<int, Dictionary<string, bool>>(), CurrentOutfitIndex = CurrentOutfitIndex }; foreach (KeyValuePair<int, Dictionary<string, bool>> outfitState in _outfitStates) { configData.OutfitStates[outfitState.Key] = new Dictionary<string, bool>(); foreach (KeyValuePair<string, bool> item in outfitState.Value) { if (item.Key != null) { configData.OutfitStates[outfitState.Key][item.Key] = item.Value; } } } string contents = JsonConvert.SerializeObject((object)configData, (Formatting)1); File.WriteAllText(OutfitConfigFilePath, contents); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("写入多套装备方案配置文件时出错: " + ex.Message)); } } } private static void UpdateConfigData() { _decorationStates.Clear(); foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { _decorationStates[decoration.Name] = decoration.IsVisible; } } public static void ApplySavedStates() { try { int num = 0; foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { if (_decorationStates.TryGetValue(decoration.Name, out var value)) { decoration.IsVisible = value; num++; } } if (num > 0) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)$"已应用 {num} 个已保存的装饰物状态"); } } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("应用已保存的装饰物状态时出错: " + ex.Message)); } } } public static void SwitchOutfit(int outfitIndex) { if (outfitIndex < 1 || outfitIndex > 5) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)$"无效的装备方案索引: {outfitIndex},索引应在1-5之间"); } return; } try { SaveCurrentOutfitState(); CurrentOutfitIndex = outfitIndex; ApplyOutfit(outfitIndex); SaveAllConfigs(); } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("切换装备方案时出错: " + ex.Message)); } } } private static void SaveCurrentOutfitState() { try { if (CurrentOutfitIndex < 1 || CurrentOutfitIndex > 5) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)$"无效的当前装备方案索引: {CurrentOutfitIndex},重置为1"); } CurrentOutfitIndex = 1; } Dictionary<string, bool> dictionary = new Dictionary<string, bool>(); foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { dictionary[decoration.Name] = decoration.IsVisible; } _outfitStates[CurrentOutfitIndex] = dictionary; } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("保存当前装备状态到方案时出错: " + ex.Message)); } } } private static void SaveAllConfigs() { try { UpdateConfigData(); SaveToFile(); SaveOutfitConfig(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("保存所有配置时出错: " + ex.Message)); } } } private static void ApplyOutfit(int outfitIndex) { try { if (!_outfitStates.TryGetValue(outfitIndex, out Dictionary<string, bool> value)) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)$"找不到装备方案 {outfitIndex},使用空方案"); } value = new Dictionary<string, bool>(); _outfitStates[outfitIndex] = value; } int num = 0; foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { decoration.IsVisible = false; } foreach (DecorationInfo decoration2 in HeadDecorationManager.Decorations) { if (value.TryGetValue(decoration2.Name, out var value2)) { decoration2.IsVisible = value2; num++; } } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("应用装备方案时出错: " + ex.Message)); } } } public static void SaveCurrentOutfit() { try { SaveCurrentOutfitState(); SaveOutfitConfig(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("保存当前装备状态到方案时出错: " + ex.Message)); } } } public static int GetCurrentOutfitIndex() { return CurrentOutfitIndex; } } public static class DecorationUtils { private const string HEAD_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side/_____________________________________/ANIM HEAD TOP/code_head_top"; private const string NECK_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side"; private const string BODY_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/ANIM BODY TOP SCALE"; private const string HIP_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT"; private const string LEFT_ARM_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM L/code_arm_l"; private const string RIGHT_ARM_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM R/code_arm_r_parent/code_arm_r/ANIM ARM R SCALE"; private const string LEFT_LEG_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG L BOT/_____________________________________/ANIM LEG L TOP"; private const string RIGHT_LEG_NODE_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG R BOT/_____________________________________/ANIM LEG R TOP"; public static Dictionary<string, Transform> GetDecorationParentNodes(Transform rootTransform) { //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform val = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side/_____________________________________/ANIM HEAD TOP/code_head_top"); if ((Object)(object)val != (Object)null) { dictionary["head"] = val; } Transform val2 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side"); if ((Object)(object)val2 != (Object)null) { dictionary["neck"] = val2; } Transform val3 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/ANIM BODY TOP SCALE"); if ((Object)(object)val3 != (Object)null) { dictionary["body"] = val3; } Transform val4 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT"); if ((Object)(object)val4 != (Object)null) { dictionary["hip"] = val4; } Transform val5 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM L/code_arm_l"); if ((Object)(object)val5 != (Object)null) { dictionary["leftarm"] = val5; } Transform val6 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM R/code_arm_r_parent/code_arm_r/ANIM ARM R SCALE"); if ((Object)(object)val6 != (Object)null) { dictionary["rightarm"] = val6; } Transform val7 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG L BOT/_____________________________________/ANIM LEG L TOP"); if ((Object)(object)val7 != (Object)null) { dictionary["leftleg"] = val7; } Transform val8 = rootTransform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG R BOT/_____________________________________/ANIM LEG R TOP"); if ((Object)(object)val8 != (Object)null) { dictionary["rightleg"] = val8; } if ((Object)(object)rootTransform != (Object)null) { bool flag = false; PlayerAvatar componentInChildren = ((Component)rootTransform.parent).GetComponentInChildren<PlayerAvatar>(); if ((Object)(object)componentInChildren != (Object)null) { flag = !SemiFunc.IsMultiplayer() || ((Object)(object)componentInChildren.photonView != (Object)null && componentInChildren.photonView.IsMine); } Transform val9 = rootTransform.Find("WorldDecorationFollower"); if ((Object)(object)val9 != (Object)null) { if (flag) { ((Component)val9).gameObject.SetActive(false); } else { ((Component)val9).gameObject.SetActive(true); } dictionary["world"] = val9; } else { GameObject val10 = new GameObject("WorldDecorationFollower"); val10.transform.SetParent(rootTransform, false); val10.transform.localPosition = Vector3.zero; val10.transform.localRotation = Quaternion.identity; val10.transform.localScale = Vector3.one; val10.AddComponent<WorldSpaceFollower>(); if (flag) { val10.SetActive(false); } else { val10.SetActive(true); } dictionary["world"] = val10.transform; } } return dictionary; } public static void EnsureDecorationContainers(Dictionary<string, Transform> parentNodes) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) foreach (KeyValuePair<string, Transform> parentNode in parentNodes) { Transform value = parentNode.Value; Transform val = value.Find("HeadDecorations"); if ((Object)(object)val == (Object)null) { val = new GameObject("HeadDecorations").transform; val.SetParent(value, false); val.localPosition = Vector3.zero; val.localRotation = Quaternion.identity; val.localScale = Vector3.one; } } } public static void UpdateDecoration(Transform parent, string decorationName, bool showDecoration) { Transform val = parent.Find(decorationName); if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf != showDecoration) { ((Component)val).gameObject.SetActive(showDecoration); } } } public class WorldSpaceFollower : MonoBehaviour { private Transform? _rootTransform; private Vector3 _initialOffset; private void Start() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) _rootTransform = ((Component)this).transform.parent; if ((Object)(object)_rootTransform != (Object)null) { _initialOffset = ((Component)this).transform.position - _rootTransform.position; ((Component)this).transform.rotation = Quaternion.identity; ((Component)this).transform.localScale = Vector3.one; } } private void LateUpdate() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_rootTransform != (Object)null) { ((Component)this).transform.position = _rootTransform.position + _initialOffset; ((Component)this).transform.rotation = Quaternion.Euler(0f, _rootTransform.eulerAngles.y, 0f); ((Component)this).transform.localScale = Vector3.one; } } } public class DecorationInfo { public string? Name { get; set; } public string? DisplayName { get; set; } public bool IsVisible { get; set; } public GameObject? Prefab { get; set; } public string? ParentTag { get; set; } public string? BundlePath { get; set; } public string? ModName { get; set; } } public static class HeadDecorationManager { private static ConfigEntry<bool>? _enableVerboseLogging; private static Dictionary<string?, string> parentPathMap = new Dictionary<string, string> { { "head", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side/_____________________________________/ANIM HEAD TOP/code_head_top" }, { "neck", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side" }, { "body", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/ANIM BODY TOP SCALE" }, { "hip", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT" }, { "leftarm", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM L/code_arm_l" }, { "rightarm", "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side/_____________________________________/ANIM ARM R/code_arm_r_parent/code_arm_r/ANIM ARM R SCALE" }, { "leftleg", "[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG L BOT/_____________________________________/ANIM LEG L TOP" }, { "rightleg", "[RIG]/code_lean/code_tilt/ANIM BOT/code_leg_twist/_____________________________________/ANIM LEG R BOT/_____________________________________/ANIM LEG R TOP" }, { "world", "" } }; private static Dictionary<string, List<DecorationInfo>> externalDecorations = new Dictionary<string, List<DecorationInfo>>(); private static ManualLogSource? Logger => Morehead.Logger; public static List<DecorationInfo> Decorations { get; private set; } = new List<DecorationInfo>(); public static void Initialize() { try { Morehead? instance = Morehead.Instance; _enableVerboseLogging = ((instance != null) ? ((BaseUnityPlugin)instance).Config.Bind<bool>("Logging", "EnableVerboseLogging", true, "启用模型加载日志(默认开启) Enable model loading logs (default: on)") : null); ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"正在初始化装饰物管理器..."); } Decorations.Clear(); LoadAllDecorations(); ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogInfo((object)$"装饰物管理器初始化完成,共加载了 {Decorations.Count} 个装饰物"); } } catch (Exception ex) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("初始化装饰物管理器时出错: " + ex.Message)); } } } private static void LoadAllDecorations() { try { Morehead? instance = Morehead.Instance; string directoryName = Path.GetDirectoryName((instance != null) ? ((BaseUnityPlugin)instance).Info.Location : null); if (string.IsNullOrEmpty(directoryName)) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)"无法获取MOD所在目录"); } return; } string text = Path.Combine(directoryName, "Decorations"); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogInfo((object)("已创建装饰物目录: " + text)); } } List<string> list = new List<string>(); string[] files = Directory.GetFiles(text, "*.hhh"); list.AddRange(files); try { string pluginPath = Paths.PluginPath; if (!string.IsNullOrEmpty(pluginPath) && Directory.Exists(pluginPath)) { string[] files2 = Directory.GetFiles(pluginPath, "*.hhh", SearchOption.AllDirectories); list.AddRange(files2); } else { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogWarning((object)"无法找到BepInEx/plugins目录,将只加载本地装饰物"); } } } catch (Exception ex) { ManualLogSource? logger4 = Logger; if (logger4 != null) { logger4.LogError((object)("搜索plugins目录时出错: " + ex.Message)); } } list = list.Distinct().ToList(); if (list.Count == 0) { ManualLogSource? logger5 = Logger; if (logger5 != null) { logger5.LogWarning((object)"未找到任何装饰物包文件,请确保.hhh文件已放置"); } } foreach (string item in list) { LoadDecorationBundle(item); } } catch (Exception ex2) { ManualLogSource? logger6 = Logger; if (logger6 != null) { logger6.LogError((object)("加载装饰物时出错: " + ex2.Message)); } } } private static void LoadDecorationBundle(string bundlePath) { AssetBundle val = null; try { if (!File.Exists(bundlePath)) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)("文件不存在: " + bundlePath)); } return; } FileInfo fileInfo = new FileInfo(bundlePath); if (fileInfo.Length < 1024) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)$"文件过小,可能不是有效的AssetBundle: {bundlePath}, 大小: {fileInfo.Length} 字节"); } return; } string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(bundlePath); string parentTag = "head"; string text = fileNameWithoutExtension; if (fileNameWithoutExtension.Contains("_")) { string[] array = fileNameWithoutExtension.Split('_'); if (array.Length >= 2) { string text2 = array[^1].ToLower(); if (parentPathMap.ContainsKey(text2)) { parentTag = text2; text = string.Join("_", array, 0, array.Length - 1); } } } string text3 = EnsureUniqueName(text); if (text3 != text) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogWarning((object)("检测到重名,将基础名称从 " + text + " 修改为 " + text3)); } text = text3; } try { val = AssetBundle.LoadFromFile(bundlePath); if ((Object)(object)val == (Object)null) { ManualLogSource? logger4 = Logger; if (logger4 != null) { logger4.LogError((object)("无法加载AssetBundle,文件可能已损坏或不是有效的AssetBundle: " + bundlePath)); } return; } } catch (Exception ex) { ManualLogSource? logger5 = Logger; if (logger5 != null) { logger5.LogError((object)("加载AssetBundle时出错,文件可能不是有效的AssetBundle: " + bundlePath + ", 错误: " + ex.Message)); } return; } try { string[] allAssetNames; try { allAssetNames = val.GetAllAssetNames(); } catch (Exception ex2) { ManualLogSource? logger6 = Logger; if (logger6 != null) { logger6.LogError((object)("获取AssetBundle资源名称时出错: " + bundlePath + ", 错误: " + ex2.Message)); } val.Unload(true); return; } if (allAssetNames.Length == 0) { ManualLogSource? logger7 = Logger; if (logger7 != null) { logger7.LogWarning((object)("AssetBundle不包含任何资源: " + bundlePath)); } val.Unload(true); return; } bool flag = false; GameObject val2 = null; string[] array2 = allAssetNames; foreach (string text4 in array2) { try { val2 = val.LoadAsset<GameObject>(text4); if ((Object)(object)val2 != (Object)null) { flag = true; break; } } catch (Exception ex3) { ManualLogSource? logger8 = Logger; if (logger8 != null) { logger8.LogWarning((object)("加载资源 " + text4 + " 时出错: " + ex3.Message)); } } } if (!flag || (Object)(object)val2 == (Object)null) { ManualLogSource? logger9 = Logger; if (logger9 != null) { logger9.LogWarning((object)("AssetBundle不包含有效的GameObject资源: " + bundlePath)); } val.Unload(true); return; } string text5 = ((Object)val2).name; string text6 = EnsureUniqueDisplayName(text5); if (text6 != text5) { ManualLogSource? logger10 = Logger; if (logger10 != null) { logger10.LogWarning((object)("检测到显示名称重复,将显示名称从 " + text5 + " 修改为 " + text6)); } text5 = text6; } DecorationInfo decorationInfo = new DecorationInfo { Name = text, DisplayName = text5, IsVisible = false, Prefab = val2, ParentTag = parentTag, BundlePath = bundlePath, ModName = GetModNameFromPath(bundlePath) }; Decorations.Add(decorationInfo); ConfigEntry<bool>? enableVerboseLogging = _enableVerboseLogging; if (enableVerboseLogging == null || enableVerboseLogging.Value) { ManualLogSource? logger11 = Logger; if (logger11 != null) { logger11.LogInfo((object)("成功加载装饰物: " + decorationInfo.DisplayName + ", 标签: " + decorationInfo.ParentTag)); } } val.Unload(false); } catch (Exception ex4) { ManualLogSource? logger12 = Logger; if (logger12 != null) { logger12.LogError((object)("处理AssetBundle时出错: " + ex4.Message)); } if ((Object)(object)val != (Object)null) { val.Unload(true); } } } catch (Exception ex5) { ManualLogSource? logger13 = Logger; if (logger13 != null) { logger13.LogError((object)("加载装饰物包时出错: " + ex5.Message + ", 路径: " + bundlePath)); } if ((Object)(object)val != (Object)null) { val.Unload(true); } } } private static string EnsureUniqueName(string baseName) { string name = baseName; int num = 1; while (Decorations.Any((DecorationInfo d) => d.Name != null && d.Name.Equals(name, StringComparison.OrdinalIgnoreCase))) { name = $"{baseName}({num})"; num++; } return name; } private static string EnsureUniqueDisplayName(string baseDisplayName) { string displayName = baseDisplayName; int num = 1; while (Decorations.Any((DecorationInfo d) => d.DisplayName != null && d.DisplayName.Equals(displayName, StringComparison.OrdinalIgnoreCase))) { displayName = $"{baseDisplayName}({num})"; num++; } return displayName; } private static string? GetParentTagFromPrefab(GameObject prefab) { string text = ((Object)prefab).name.ToLower(); foreach (string key in parentPathMap.Keys) { if (key != null && text.Contains(key)) { return key; } } return null; } public static bool GetDecorationState(string? name) { string name2 = name; DecorationInfo decorationInfo = Decorations.FirstOrDefault((DecorationInfo d) => d.Name != null && d.Name.Equals(name2, StringComparison.OrdinalIgnoreCase)); if (decorationInfo == null) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)("GetDecorationState: 找不到装饰物 " + name2)); } } return decorationInfo?.IsVisible ?? false; } public static void SetDecorationState(string name, bool isVisible) { string name2 = name; DecorationInfo decorationInfo = Decorations.FirstOrDefault((DecorationInfo d) => d.Name != null && d.Name.Equals(name2, StringComparison.OrdinalIgnoreCase)); if (decorationInfo != null) { decorationInfo.IsVisible = isVisible; ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)$"设置装饰物 {decorationInfo.DisplayName} 显示状态为: {isVisible}"); } } else { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)("SetDecorationState: 找不到装饰物 " + name2)); } } } public static bool ToggleDecorationState(string? name) { string name2 = name; DecorationInfo decorationInfo = Decorations.FirstOrDefault((DecorationInfo d) => d.Name != null && d.Name.Equals(name2, StringComparison.OrdinalIgnoreCase)); if (decorationInfo != null) { decorationInfo.IsVisible = !decorationInfo.IsVisible; return decorationInfo.IsVisible; } ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)("ToggleDecorationState: 找不到装饰物 " + name2)); } return false; } public static string GetParentPath(string parentTag) { if (parentPathMap.TryGetValue(parentTag.ToLower(), out string value)) { return value; } return parentPathMap["head"]; } public static void DisableAllDecorations() { try { int num = 0; foreach (DecorationInfo decoration in Decorations) { if (decoration.IsVisible) { decoration.IsVisible = false; num++; } } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("关闭所有装饰物时出错: " + ex.Message)); } } } public static bool LoadExternalAssetBundle(byte[] bundleData, string resourceName) { try { string text = Path.Combine(Path.GetTempPath(), resourceName); File.WriteAllBytes(text, bundleData); LoadDecorationBundle(text); try { File.Delete(text); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)("清理临时文件失败: " + ex.Message)); } } return true; } catch (Exception ex2) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("加载外部AB包失败: " + ex2.Message)); } return false; } } public static void LoadExternalAssetBundlesFromAssembly(Assembly assembly) { try { int num = 0; string name2 = assembly.GetName().Name; string location = assembly.Location; string fileName = Path.GetFileName(location); if (!externalDecorations.ContainsKey(name2)) { externalDecorations[name2] = new List<DecorationInfo>(); } else { externalDecorations[name2].Clear(); } int count = Decorations.Count; string[] manifestResourceNames = assembly.GetManifestResourceNames(); IEnumerable<string> enumerable = manifestResourceNames.Where((string name) => name.EndsWith(".hhh", StringComparison.OrdinalIgnoreCase)); if (!enumerable.Any()) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)("在DLL " + name2 + " 中未找到.hhh资源")); } return; } ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogInfo((object)$"在DLL {name2} 中找到 {enumerable.Count()} 个.hhh资源"); } foreach (string item in enumerable) { try { string text = item.Substring(0, item.Length - 4); string text2 = ((!text.Contains(".")) ? text : text.Split('.').Last()); ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogInfo((object)("处理资源: " + item + ", 提取文件名: " + text2)); } byte[] array; using (Stream stream = assembly.GetManifestResourceStream(item)) { if (stream == null) { continue; } array = new byte[stream.Length]; stream.Read(array, 0, array.Length); goto IL_01bc; } IL_01bc: if (LoadExternalAssetBundle(array, text2 + ".hhh")) { num++; } } catch (Exception ex) { ManualLogSource? logger4 = Logger; if (logger4 != null) { logger4.LogError((object)("加载资源 " + item + " 失败: " + ex.Message)); } } } if (num > 0) { for (int i = count; i < Decorations.Count; i++) { DecorationInfo decorationInfo = Decorations[i]; decorationInfo.ModName = fileName; externalDecorations[name2].Add(decorationInfo); } ManualLogSource? logger5 = Logger; if (logger5 != null) { logger5.LogInfo((object)$"成功从DLL {name2} 加载了 {num} 个资源,已保存到外部装饰物记录中"); } ConfigManager.ApplySavedStates(); } } catch (Exception ex2) { ManualLogSource? logger6 = Logger; if (logger6 != null) { logger6.LogError((object)("从DLL加载资源失败: " + ex2.Message)); } } } public static List<DecorationInfo> GetDecorationsFromAssembly(Assembly assembly) { string name = assembly.GetName().Name; if (externalDecorations.TryGetValue(name, out List<DecorationInfo> value)) { return value; } return new List<DecorationInfo>(); } public static List<GameObject> GetDecorationGameObjectsFromAssembly(Assembly assembly) { List<GameObject> list = new List<GameObject>(); foreach (DecorationInfo item in GetDecorationsFromAssembly(assembly)) { if ((Object)(object)item.Prefab != (Object)null) { list.Add(item.Prefab); } } return list; } public static DecorationInfo GetDecorationByName(Assembly assembly, string decorationName) { string decorationName2 = decorationName; List<DecorationInfo> decorationsFromAssembly = GetDecorationsFromAssembly(assembly); return decorationsFromAssembly.FirstOrDefault((DecorationInfo d) => (d.Name != null && d.Name.Equals(decorationName2, StringComparison.OrdinalIgnoreCase)) || (d.DisplayName != null && d.DisplayName.Equals(decorationName2, StringComparison.OrdinalIgnoreCase))); } public static List<DecorationInfo> FindDecorationsByPartialName(Assembly assembly, string partialName) { string partialName2 = partialName; if (string.IsNullOrEmpty(partialName2)) { return new List<DecorationInfo>(); } List<DecorationInfo> decorationsFromAssembly = GetDecorationsFromAssembly(assembly); return decorationsFromAssembly.Where((DecorationInfo d) => (d.Name != null && d.Name.IndexOf(partialName2, StringComparison.OrdinalIgnoreCase) >= 0) || (d.DisplayName != null && d.DisplayName.IndexOf(partialName2, StringComparison.OrdinalIgnoreCase) >= 0)).ToList(); } public static void RecreateUI() { try { MoreHeadUI.RecreateUI(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("重新创建UI时出错: " + ex.Message)); } } } private static string? GetModNameFromPath(string? bundlePath) { try { if (string.IsNullOrEmpty(bundlePath)) { return null; } string pluginPath = Paths.PluginPath; if (string.IsNullOrEmpty(pluginPath) || !Directory.Exists(pluginPath)) { return null; } if (!bundlePath.StartsWith(pluginPath, StringComparison.OrdinalIgnoreCase)) { return null; } string directoryName = Path.GetDirectoryName(bundlePath); if (string.IsNullOrEmpty(directoryName)) { return null; } string text = directoryName; while (!string.IsNullOrEmpty(text)) { DirectoryInfo? parent = Directory.GetParent(text); if (parent == null || parent.FullName.Equals(pluginPath, StringComparison.OrdinalIgnoreCase)) { break; } text = Directory.GetParent(text)?.FullName ?? string.Empty; } if (string.IsNullOrEmpty(text)) { return null; } string fileName = Path.GetFileName(text); string[] array = fileName.Split('-'); if (array.Length <= 1) { return fileName; } string text2 = array[^1]; bool flag = IsLikelyVersionNumber(text2); if (flag && array.Length > 2) { return array[^2]; } if (flag) { return array[0]; } return text2; } catch (Exception ex) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("获取模组名称时出错: " + ex.Message)); } return null; } } private static bool IsLikelyVersionNumber(string text) { if (text.Length == 0 || !char.IsDigit(text[0])) { return false; } bool flag = false; bool flag2 = false; foreach (char c in text) { if (char.IsDigit(c)) { flag = true; } else if (c == '.' || c == '_' || c == '-') { flag2 = true; } } return flag && flag2; } } public static class MoreHeadUI { private class ShortcutKeyListener : MonoBehaviour { public static ShortcutKeyListener? 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); return; } Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void Update() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) for (int i = 1; i <= 5; i++) { KeyCode val = (KeyCode)(282 + (i - 1)); if (Input.GetKeyDown(val)) { SwitchOutfitWithShortcut(i); } } } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static BuilderDelegate <>9__17_0; public static BuilderDelegate <>9__17_1; public static Func<DecorationInfo, bool> <>9__18_0; public static Action <>9__22_1; public static BuilderDelegate <>9__22_0; public static BuilderDelegate <>9__34_0; public static Func<DecorationInfo, bool> <>9__38_0; public static Func<DecorationInfo, string> <>9__38_1; public static Func<DecorationInfo, bool> <>9__38_2; public static Func<DecorationInfo, string> <>9__38_3; public static BuilderDelegate <>9__40_0; public static BuilderDelegate <>9__40_1; internal void <Initialize>b__17_0(Transform parent) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("<color=#FF0000>M</color><color=#FF3300>O</color><color=#FF6600>R</color><color=#FF9900>E</color><color=#FFCC00>H</color><color=#FFDD00>E</color><color=#FFEE00>A</color><color=#FFFF00>D</color>", (Action)OnMenuButtonClick, parent, Vector2.zero); } internal void <Initialize>b__17_1(Transform parent) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("<color=#FF0000>M</color><color=#FF3300>O</color><color=#FF6600>R</color><color=#FF9900>E</color><color=#FFCC00>H</color><color=#FFDD00>E</color><color=#FFEE00>A</color><color=#FFFF00>D</color>", (Action)OnMenuButtonClick, parent, Vector2.zero); } internal bool <InitializeDataCache>b__18_0(DecorationInfo decoration) { return LIMB_TAGS.Contains(decoration.ParentTag?.ToUpper()); } internal void <AddAuthorCredit>b__22_0(Transform parent) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("<size=10><color=#FFFFA0>Masaicker</color> and <color=#FFFFA0>Yuriscat</color> co-developed.\n由<color=#FFFFA0>马赛克了</color>和<color=#FFFFA0>尤里的猫</color>共同制作。</size>", (Action)delegate { }, parent, new Vector2(300f, 329f)); } internal void <AddAuthorCredit>b__22_1() { } internal void <CreateAvatarPreview>b__34_0(Transform parent) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) avatarPreview = MenuAPI.CreateREPOAvatarPreview(parent, new Vector2(420f, 10f), false, (Color?)null); } internal bool <CreateAllDecorationButtons>b__38_0(DecorationInfo decoration) { return IsBuiltInDecoration(decoration); } internal string <CreateAllDecorationButtons>b__38_1(DecorationInfo decoration) { return decoration.DisplayName; } internal bool <CreateAllDecorationButtons>b__38_2(DecorationInfo decoration) { return !IsBuiltInDecoration(decoration); } internal string <CreateAllDecorationButtons>b__38_3(DecorationInfo decoration) { return decoration.DisplayName; } internal void <AddActionButtons>b__40_0(Transform parent) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("<size=18><color=#FFFFFF>C</color><color=#E6E6E6>L</color><color=#CCCCCC>O</color><color=#B3B3B3>S</color><color=#999999>E</color></size>", (Action)OnCloseButtonClick, parent, new Vector2(301f, 0f)); } internal void <AddActionButtons>b__40_1(Transform parent) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("<size=18><color=#FFAA00>CLEAR ALL</color></size>", (Action)OnDisableAllButtonClick, parent, new Vector2(401f, 0f)); } } [CompilerGenerated] private sealed class <DelayedOpenMoreHeadUI>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private Exception <e>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedOpenMoreHeadUI>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <e>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; try { if ((Object)(object)decorationsPage == (Object)null) { decorationsPage = MenuAPI.CreateREPOPopupPage(PAGE_TITLE, true, true, 0f, (Vector2?)new Vector2(-299f, 10f)); SetupPopupPage(decorationsPage); CreateAllDecorationButtons(decorationsPage); CreateTagFilterButtons(decorationsPage); AddAuthorCredit(decorationsPage); AddActionButtons(decorationsPage); } decorationsPage.OpenPage(false); MonoBehaviour obj = Object.FindObjectOfType<MonoBehaviour>(); if (obj != null) { obj.StartCoroutine(DelayedShowTagDecorations(currentTagFilter)); } UpdateAvatarPreview(); UpdateButtonStates(); } catch (Exception ex) { <e>5__1 = ex; ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("延迟打开设置页面时出错: " + <e>5__1.Message)); } } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DelayedShowTagDecorations>d__42 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string tag; private Exception <e>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedShowTagDecorations>d__42(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <e>5__1 = null; <>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; try { ShowTagDecorations(tag); } catch (Exception ex) { <e>5__1 = ex; ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("延迟显示标签装饰物时出错: " + <e>5__1.Message)); } } 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 REPOPopupPage? decorationsPage; public static Dictionary<string?, REPOButton> decorationButtons = new Dictionary<string, REPOButton>(); public static Dictionary<string?, DecorationButtonMarker?> buttonMarkers = new Dictionary<string, DecorationButtonMarker>(); private static Dictionary<string, List<REPOScrollViewElement>> tagScrollViewElements = new Dictionary<string, List<REPOScrollViewElement>>(); private static string currentTagFilter = "ALL"; private static Dictionary<string, REPOButton> tagFilterButtons = new Dictionary<string, REPOButton>(); private static Dictionary<string, List<DecorationInfo>> decorationDataCache = new Dictionary<string, List<DecorationInfo>>(); private static Dictionary<string, Dictionary<string, string>> buttonTextCache = new Dictionary<string, Dictionary<string, string>>(); private static REPOAvatarPreview? avatarPreview; private const string BUTTON_NAME = "<color=#FF0000>M</color><color=#FF3300>O</color><color=#FF6600>R</color><color=#FF9900>E</color><color=#FFCC00>H</color><color=#FFDD00>E</color><color=#FFEE00>A</color><color=#FFFF00>D</color>"; private static readonly string PAGE_TITLE = "Rotate robot: A/D <size=12><color=#AAAAAA>v" + Morehead.GetPluginVersion() + "</color></size>"; private static readonly string[] ALL_TAGS = new string[7] { "ALL", "HEAD", "NECK", "BODY", "HIP", "LIMBS", "WORLD" }; private static readonly string[] FULL_TAGS = new string[10] { "ALL", "HEAD", "NECK", "BODY", "HIP", "LEFTARM", "RIGHTARM", "LEFTLEG", "RIGHTLEG", "WORLD" }; private static readonly string[] LIMB_TAGS = new string[4] { "LEFTARM", "RIGHTARM", "LEFTLEG", "RIGHTLEG" }; private static Dictionary<int, REPOButton> outfitButtons = new Dictionary<int, REPOButton>(); private static ManualLogSource? Logger => Morehead.Logger; public static void Initialize() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown try { object obj = <>c.<>9__17_0; if (obj == null) { BuilderDelegate val = delegate(Transform parent) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("<color=#FF0000>M</color><color=#FF3300>O</color><color=#FF6600>R</color><color=#FF9900>E</color><color=#FFCC00>H</color><color=#FFDD00>E</color><color=#FFEE00>A</color><color=#FFFF00>D</color>", (Action)OnMenuButtonClick, parent, Vector2.zero); }; <>c.<>9__17_0 = val; obj = (object)val; } MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj); object obj2 = <>c.<>9__17_1; if (obj2 == null) { BuilderDelegate val2 = delegate(Transform parent) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("<color=#FF0000>M</color><color=#FF3300>O</color><color=#FF6600>R</color><color=#FF9900>E</color><color=#FFCC00>H</color><color=#FFDD00>E</color><color=#FFEE00>A</color><color=#FFFF00>D</color>", (Action)OnMenuButtonClick, parent, Vector2.zero); }; <>c.<>9__17_1 = val2; obj2 = (object)val2; } MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj2); InitializeDataCache(); ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"MoreHead UI已初始化"); } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("初始化UI时出错: " + ex.Message)); } } } private static void InitializeDataCache() { try { decorationDataCache.Clear(); buttonTextCache.Clear(); string[] aLL_TAGS = ALL_TAGS; foreach (string tag in aLL_TAGS) { List<DecorationInfo> list = ((!(tag == "LIMBS")) ? HeadDecorationManager.Decorations.Where((DecorationInfo decoration) => tag == "ALL" || decoration.ParentTag?.ToUpper() == tag).ToList() : HeadDecorationManager.Decorations.Where((DecorationInfo decoration) => LIMB_TAGS.Contains(decoration.ParentTag?.ToUpper())).ToList()); decorationDataCache[tag] = list; buttonTextCache[tag] = new Dictionary<string, string>(); foreach (DecorationInfo item in list) { string buttonText = GetButtonText(item, item.IsVisible); buttonTextCache[tag][item.Name ?? string.Empty] = buttonText; } } ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"数据缓存初始化完成"); } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("初始化数据缓存时出错: " + ex.Message)); } } } private static void OnMenuButtonClick() { try { if ((Object)(object)MenuPageEsc.instance != (Object)null) { MenuPageEsc.instance.ButtonEventContinue(); } MonoBehaviour obj = Object.FindObjectOfType<MonoBehaviour>(); if (obj != null) { obj.StartCoroutine(DelayedOpenMoreHeadUI()); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("打开设置页面时出错: " + ex.Message)); } } } [IteratorStateMachine(typeof(<DelayedOpenMoreHeadUI>d__20))] private static IEnumerator DelayedOpenMoreHeadUI() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedOpenMoreHeadUI>d__20(0); } private static void SetupPopupPage(REPOPopupPage page) { //IL_0042: 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) try { if ((Object)(object)((Component)page).gameObject != (Object)null) { ((Object)((Component)page).gameObject).name = "MoreHead_Page"; } page.pageDimmerVisibility = true; page.maskPadding = new Padding(10f, 10f, 20f, 10f); ((Transform)((TMP_Text)page.headerTMP).rectTransform).position = new Vector3(170f, 344f, 0f); page.pageDimmerOpacity = 0.85f; page.scrollView.scrollSpeed = 4f; } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("设置弹出页面属性时出错: " + ex.Message)); } } } private static void AddAuthorCredit(REPOPopupPage page) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown try { object obj = <>c.<>9__22_0; if (obj == null) { BuilderDelegate val = delegate(Transform parent) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("<size=10><color=#FFFFA0>Masaicker</color> and <color=#FFFFA0>Yuriscat</color> co-developed.\n由<color=#FFFFA0>马赛克了</color>和<color=#FFFFA0>尤里的猫</color>共同制作。</size>", (Action)delegate { }, parent, new Vector2(300f, 329f)); }; <>c.<>9__22_0 = val; obj = (object)val; } page.AddElement((BuilderDelegate)obj); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("添加作者标记时出错: " + ex.Message)); } } } private static bool IsBuiltInDecoration(DecorationInfo decoration) { string bundlePath = decoration.BundlePath; if (string.IsNullOrEmpty(bundlePath)) { return false; } Morehead? instance = Morehead.Instance; string directoryName = Path.GetDirectoryName((instance != null) ? ((BaseUnityPlugin)instance).Info.Location : null); if (string.IsNullOrEmpty(directoryName)) { return false; } string value = Path.Combine(directoryName, "Decorations"); return bundlePath.StartsWith(value); } private static void CreateTagFilterButtons(REPOPopupPage? page) { //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown try { tagFilterButtons.Clear(); CreateOutfitButtons(page); for (int i = 0; i < ALL_TAGS.Length; i++) { string text = ALL_TAGS[i]; string text2 = text.ToLower(); int num = i; if (1 == 0) { } string text3 = text2 switch { "head" => "#00AAFF", "neck" => "#AA00FF", "body" => "#FFAA00", "hip" => "#FF00AA", "limbs" => "#AACCAA", "world" => "#00FFAA", _ => "#FFFFFF", }; if (1 == 0) { } string text4 = text3; string buttonText = ((text2 == currentTagFilter.ToLower()) ? ("<size=13><u><color=" + text4 + ">" + text + "</color></u></size>") : ("<size=13><color=" + text4 + "50>" + text + "</color></size>")); string tagForCallback = ((text2 == "all") ? "ALL" : text); int xPosition = 50 + i * 35; if (page == null) { continue; } page.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) REPOButton value = MenuAPI.CreateREPOButton(buttonText, (Action)delegate { OnTagFilterButtonClick(tagForCallback); }, parent, new Vector2((float)xPosition, 20f)); tagFilterButtons[tagForCallback] = value; }); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("创建标签筛选按钮时出错: " + ex.Message)); } } } private static void OnTagFilterButtonClick(string tag) { try { if (tag == currentTagFilter) { REPOPopupPage? obj = decorationsPage; if (obj != null) { obj.scrollView.SetScrollPosition(0f); } } else { ShowTagDecorations(tag); UpdateTagButtonHighlights(); UpdateButtonStates(); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("切换标签筛选时出错: " + ex.Message)); } } } private static void UpdateButtonStates() { try { if (decorationButtons.Count == 0) { return; } if (decorationDataCache.TryGetValue(currentTagFilter, out List<DecorationInfo> value)) { foreach (DecorationInfo item in value) { if (!decorationButtons.TryGetValue(item.Name ?? string.Empty, out REPOButton value2)) { continue; } if (buttonTextCache.TryGetValue(currentTagFilter, out Dictionary<string, string> value3) && value3.TryGetValue(item.Name ?? string.Empty, out var value4)) { value4 = GetButtonText(item, item.IsVisible); value3[item.Name ?? string.Empty] = value4; } else { value4 = GetButtonText(item, item.IsVisible); if (buttonTextCache.TryGetValue(currentTagFilter, out value3)) { value3[item.Name ?? string.Empty] = value4; } } ((TMP_Text)value2.labelTMP).text = value4; } } UpdateTagButtonHighlights(); UpdateOutfitButtonHighlights(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("更新按钮状态时出错: " + ex.Message)); } } } private static void UpdateTagButtonHighlights() { try { string[] aLL_TAGS = ALL_TAGS; foreach (string text in aLL_TAGS) { string text2 = ((text == "ALL") ? "ALL" : text); if (tagFilterButtons.TryGetValue(text2, out REPOButton value)) { string text3 = text.ToLower(); if (1 == 0) { } string text4 = text3 switch { "head" => "#00AAFF", "neck" => "#AA00FF", "body" => "#FFAA00", "hip" => "#FF00AA", "limbs" => "#AACCAA", "world" => "#00FFAA", _ => "#FFFFFF", }; if (1 == 0) { } string text5 = text4; string text6 = ((text2 == currentTagFilter) ? ("<size=13><u><color=" + text5 + ">" + text + "</color></u></size>") : ("<size=13><color=" + text5 + "50>" + text + "</color></size>")); ((TMP_Text)value.labelTMP).text = text6; } } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("更新标签按钮高亮状态时出错: " + ex.Message)); } } } private static void OnDecorationButtonClick(string? decorationName) { string decorationName2 = decorationName; try { DecorationInfo decorationInfo = HeadDecorationManager.Decorations.FirstOrDefault((DecorationInfo d) => d.Name != null && d.Name.Equals(decorationName2, StringComparison.OrdinalIgnoreCase)); if (decorationInfo == null) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)("OnDecorationButtonClick: 找不到装饰物: " + decorationName2)); } return; } bool isEnabled = HeadDecorationManager.ToggleDecorationState(decorationName2); string buttonText = GetButtonText(decorationInfo, isEnabled); string[] aLL_TAGS = ALL_TAGS; foreach (string text in aLL_TAGS) { bool flag = false; if (text == "ALL") { flag = true; } else if (text == "LIMBS" && LIMB_TAGS.Contains(decorationInfo.ParentTag?.ToUpper())) { flag = true; } else if (decorationInfo.ParentTag?.ToUpper() == text) { flag = true; } if (flag && buttonTextCache.TryGetValue(text, out Dictionary<string, string> value)) { value[decorationName2 ?? string.Empty] = buttonText; } } if (decorationButtons.TryGetValue(decorationName2 ?? string.Empty, out REPOButton value2)) { ((TMP_Text)value2.labelTMP).text = buttonText; if (buttonMarkers.TryGetValue(decorationName2 ?? string.Empty, out DecorationButtonMarker value3) && value3?.Decoration != null && !string.IsNullOrEmpty(value3.Decoration.ModName) && !((TMP_Text)value2.labelTMP).text.Contains(value3.Decoration.ModName)) { ((TMP_Text)value2.labelTMP).text = ((TMP_Text)value2.labelTMP).text + " <size=12><color=#AAAAAA>- " + value3.Decoration.ModName + "</color></size>"; } } UpdateDecorations(); ConfigManager.SaveConfig(); } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("切换装饰物 " + decorationName2 + " 状态时出错: " + ex.Message)); } } } private static string GetButtonText(DecorationInfo decoration, bool isEnabled) { string text = decoration.DisplayName?.ToUpper() ?? "UNKNOWN"; string text2 = decoration.ParentTag ?? "unknown"; string text3 = text2.ToLower(); if (1 == 0) { } string text4 = text3 switch { "head" => "#00AAFF", "neck" => "#AA00FF", "body" => "#FFAA00", "hip" => "#FF00AA", "leftarm" => "#88CC88", "rightarm" => "#88CC88", "leftleg" => "#88BBEE", "rightleg" => "#88BBEE", "world" => "#00FFAA", _ => "#AAAAAA", }; if (1 == 0) { } string text5 = text4; string text6 = ""; if (LIMB_TAGS.Contains(text2.ToUpper())) { string text7 = text2.ToLower(); if (1 == 0) { } text4 = text7 switch { "leftarm" => "L-ARM", "rightarm" => "R-ARM", "leftleg" => "L-LEG", "rightleg" => "R-LEG", _ => text2, }; if (1 == 0) { } string text8 = text4; text6 = "<color=" + text5 + "><size=12>(" + text8 + ")</size></color> "; } else { text6 = "<color=" + text5 + "><size=12>(" + text2 + ")</size></color> "; } return "<size=16>" + (isEnabled ? "<color=#00FF00>[+]</color>" : "<color=#FF0000>[-]</color>") + " " + text6 + text + "</size>"; } private static void OnCloseButtonClick() { try { REPOPopupPage? obj = decorationsPage; if (obj != null) { obj.ClosePage(true); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("关闭页面时出错: " + ex.Message)); } } } private static void UpdateDecorations() { try { PlayerAvatar val = FindLocalPlayer(); if ((Object)(object)val != (Object)null) { PlayerUpdatePatch.UpdatePlayerDecorations(val); HeadDecorationSync component = ((Component)val).GetComponent<HeadDecorationSync>(); if ((Object)(object)component != (Object)null) { component.SyncAllDecorations(); } } PlayerUpdatePatch.UpdateMenuPlayerDecorations(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("更新装饰物状态时出错: " + ex.Message)); } } } private static PlayerAvatar? FindLocalPlayer() { try { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val?.photonView != (Object)null && val.photonView.IsMine) { return val; } } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("查找本地玩家时出错: " + ex.Message)); } } return null; } private static void UpdateAvatarPreview() { try { if (!((Object)(object)decorationsPage == (Object)null)) { if ((Object)(object)avatarPreview != (Object)null) { SafeDestroyAvatar(); } CreateAvatarPreview(decorationsPage); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.Lo
plugins/MoreShopItems.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreShopItems.Compatability; using MoreShopItems.Config; using Photon.Pun; using REPOLib.Modules; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MoreShopItems")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.3.3.0")] [assembly: AssemblyInformationalVersion("1.3.3")] [assembly: AssemblyProduct("More Shop Items")] [assembly: AssemblyTitle("MoreShopItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MoreShopItems { [BepInPlugin("MoreShopItems", "More Shop Items", "1.3.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("MoreShopItems"); internal Dictionary<string, ConfigEntry<int>> intConfigEntries = new Dictionary<string, ConfigEntry<int>>(); internal Dictionary<string, ConfigEntry<bool>> boolConfigEntries = new Dictionary<string, ConfigEntry<bool>>(); internal static GameObject CustomItemShelf; internal static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } private void Awake() { Instance = CheckInstance(); Logger = ((BaseUnityPlugin)this).Logger; LoadConfig(); AssetBundle bundle = LoadAssetBundle("moreshopitems_assets.file"); CustomItemShelf = LoadAssetFromBundle(bundle, "custom_soda_shelf"); NetworkPrefabs.RegisterNetworkPrefab(CustomItemShelf); _harmony.PatchAll(typeof(ShopManagerPatch)); _harmony.PatchAll(typeof(PunManagerPatch)); Logger.LogInfo((object)"\n __ __ ___ _ ___ _ \n| \\/ |___ _ _ ___ / __| |_ ___ _ __ |_ _| |_ ___ _ __ ___\n| |\\/| / _ \\ '_/ -_) \\__ \\ ' \\/ _ \\ '_ \\ | || _/ -_) ' \\(_-<\n|_| |_\\___/_| \\___| |___/_||_\\___/ .__/ |___|\\__\\___|_|_|_/__/\n |_| v1.3.3\n"); } private Plugin CheckInstance() { if ((Object)(object)Instance == (Object)null) { return this; } return Instance; } private void LoadConfig() { string[] configDescriptions = ConfigEntries.GetConfigDescriptions(); intConfigEntries.Add("Max Upgrades In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Upgrades", "Max Upgrades In Shop", 5, configDescriptions[0], -1, 20)); intConfigEntries.Add("Max Upgrade Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Upgrades", "Max Upgrade Purchase Amount", 0, configDescriptions[1], 0, 1000)); intConfigEntries.Add("Max Melee Weapons In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Melee Weapons In Shop", 5, configDescriptions[2], -1, 20)); intConfigEntries.Add("Max Melee Weapon Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Melee Weapon Purchase Amount", 0, configDescriptions[3], 0, 1000)); intConfigEntries.Add("Max Guns In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Guns In Shop", 5, configDescriptions[4], -1, 20)); intConfigEntries.Add("Max Gun Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Gun Purchase Amount", 0, configDescriptions[5], 0, 1000)); intConfigEntries.Add("Max Grenades In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Grenades In Shop", 5, configDescriptions[6], -1, 20)); intConfigEntries.Add("Max Grenade Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Grenade Purchase Amount", 0, configDescriptions[7], 0, 1000)); intConfigEntries.Add("Max Mines In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Mines In Shop", 5, configDescriptions[8], -1, 20)); intConfigEntries.Add("Max Mine Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Weapons", "Max Mine Purchase Amount", 0, configDescriptions[9], 0, 1000)); intConfigEntries.Add("Max Health-Packs In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Health-Packs", "Max Health-Packs In Shop", 15, configDescriptions[10], -1, 20)); intConfigEntries.Add("Max Health-Pack Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Health-Packs", "Max Health-Pack Purchase Amount", 0, configDescriptions[11], 0, 1000)); intConfigEntries.Add("Max Drones In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Drones In Shop", 5, configDescriptions[12], -1, 20)); intConfigEntries.Add("Max Drone Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Drone Purchase Amount", 0, configDescriptions[13], 0, 1000)); intConfigEntries.Add("Max Orbs In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Orbs In Shop", 5, configDescriptions[14], -1, 20)); intConfigEntries.Add("Max Orb Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Orb Purchase Amount", 0, configDescriptions[15], 0, 1000)); intConfigEntries.Add("Max Crystals In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Crystals In Shop", 5, configDescriptions[16], -1, 20)); intConfigEntries.Add("Max Crystal Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Crystal Purchase Amount", 0, configDescriptions[17], 0, 1000)); intConfigEntries.Add("Max Trackers In Shop", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Trackers In Shop", 5, configDescriptions[18], -1, 20)); intConfigEntries.Add("Max Tracker Purchase Amount", ConfigHelper.CreateConfig<ConfigEntry<int>>("Utilities", "Max Tracker Purchase Amount", 0, configDescriptions[19], 0, 1000)); boolConfigEntries.Add("Override Modded Items", ConfigHelper.CreateConfig<ConfigEntry<bool>>("General", "Override Modded Items", true, configDescriptions[20], -1, -1)); boolConfigEntries.Add("Override Single-Use Upgrades", ConfigHelper.CreateConfig<ConfigEntry<bool>>("General", "Override Single-Use Upgrades", false, configDescriptions[21], -1, -1)); boolConfigEntries.Add("Spawn Additional Shelving", ConfigHelper.CreateConfig<ConfigEntry<bool>>("General", "Spawn Additional Shelving", true, configDescriptions[22], -1, -1)); } private AssetBundle LoadAssetBundle(string filename) { return AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), filename)); } private GameObject LoadAssetFromBundle(AssetBundle bundle, string name) { return bundle.LoadAsset<GameObject>(name); } } [HarmonyPatch(typeof(ShopManager))] internal static class ShopManagerPatch { private static readonly FieldRef<ShopManager, int> itemSpawnTargetAmount_ref = AccessTools.FieldRefAccess<ShopManager, int>("itemSpawnTargetAmount"); private static readonly FieldRef<ShopManager, int> itemConsumablesAmount_ref = AccessTools.FieldRefAccess<ShopManager, int>("itemConsumablesAmount"); private static readonly FieldRef<ShopManager, int> itemUpgradesAmount_ref = AccessTools.FieldRefAccess<ShopManager, int>("itemUpgradesAmount"); private static readonly FieldRef<ShopManager, int> itemHealthPacksAmount_ref = AccessTools.FieldRefAccess<ShopManager, int>("itemHealthPacksAmount"); private static GameObject shelf; internal static bool isMoreUpgrades = false; [HarmonyPrefix] [HarmonyPatch("Awake")] private static void SetValues(ShopManager __instance) { ref int reference = ref itemSpawnTargetAmount_ref.Invoke(__instance); ref int reference2 = ref itemConsumablesAmount_ref.Invoke(__instance); ref int reference3 = ref itemUpgradesAmount_ref.Invoke(__instance); ref int reference4 = ref itemHealthPacksAmount_ref.Invoke(__instance); reference = 250; reference2 = 100; reference3 = 50; reference4 = 50; } [HarmonyPrefix] [HarmonyPatch("ShopInitialize")] private static void SpawnShelf() { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) if (!(RunManager.instance.levelCurrent.ResourcePath == "Shop") || !Plugin.Instance.boolConfigEntries["Spawn Additional Shelving"].Value) { return; } GameObject val = GameObject.Find("Soda Shelf"); GameObject val2 = GameObject.Find("Module Switch BOT"); if ((Object)(object)val != (Object)null && !val2.GetComponent<ModulePropSwitch>().ConnectedParent.activeSelf) { if (!SemiFunc.IsMultiplayer()) { shelf = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, val.transform.position, val.transform.rotation, val2.transform); } else { if (!SemiFunc.IsMasterClient()) { val.SetActive(false); return; } shelf = PhotonNetwork.Instantiate(((Object)Plugin.CustomItemShelf).name, val.transform.position, val.transform.rotation, (byte)0, (object[])null); SetParent(val2.transform, shelf); } val.SetActive(false); } else { GameObject val3 = GameObject.Find("Shop Magazine Stand (1)"); GameObject val4 = GameObject.Find("Shop Magazine Stand"); GameObject val5 = GameObject.Find("Module Switch (1) top"); if ((Object)(object)val3 != (Object)null && !val5.GetComponent<ModulePropSwitch>().ConnectedParent.activeSelf) { if (!SemiFunc.IsMultiplayer()) { shelf = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, val3.transform.position, val3.transform.rotation * Quaternion.Euler(0f, 90f, 0f), val5.transform.parent); } else { if (!SemiFunc.IsMasterClient()) { val3.SetActive(false); if ((Object)(object)val4 != (Object)null) { val4.SetActive(false); } return; } shelf = PhotonNetwork.Instantiate(((Object)Plugin.CustomItemShelf).name, val3.transform.position, val3.transform.rotation * Quaternion.Euler(0f, 90f, 0f), (byte)0, (object[])null); SetParent(val5.transform, shelf); } val3.SetActive(false); if ((Object)(object)val4 != (Object)null) { val4.SetActive(false); } } else { GameObject val6 = GameObject.Find("Module Switch (2) left"); GameObject val7 = GameObject.Find("Candy Shelf"); if (!((Object)(object)val6 != (Object)null) || val6.GetComponent<ModulePropSwitch>().ConnectedParent.activeSelf) { Plugin.Logger.LogInfo((object)"Edge case found. Temporarily preventing spawn of custom shelf."); return; } if (!SemiFunc.IsMultiplayer()) { shelf = Object.Instantiate<GameObject>(Plugin.CustomItemShelf, val6.transform.position + val6.transform.right * 0.5f - val6.transform.forward * 0.8f, val6.transform.rotation * Quaternion.Euler(0f, 180f, 0f), val5.transform.parent); } else { if (!SemiFunc.IsMasterClient()) { if ((Object)(object)val7 != (Object)null) { val7.SetActive(false); } return; } shelf = PhotonNetwork.Instantiate(((Object)Plugin.CustomItemShelf).name, val6.transform.position + val6.transform.right * 0.5f - val6.transform.forward * 0.8f, val6.transform.rotation * Quaternion.Euler(0f, 180f, 0f), (byte)0, (object[])null); SetParent(val6.transform, shelf); } if ((Object)(object)val7 != (Object)null) { val7.SetActive(false); } } } Plugin.Logger.LogInfo((object)"Successfully spawned the shelf!"); } [HarmonyPrefix] [HarmonyPatch("ShopInitialize")] private static void AdjustItems() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected I4, but got Unknown //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Invalid comparison between Unknown and I4 //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Invalid comparison between Unknown and I4 //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Invalid comparison between Unknown and I4 if (!(RunManager.instance.levelCurrent.ResourcePath == "Shop") || (Object)(object)StatsManager.instance == (Object)null || (!SemiFunc.IsMasterClient() && SemiFunc.IsMultiplayer())) { return; } Dictionary<string, ConfigEntry<int>> intConfigEntries = Plugin.Instance.intConfigEntries; Dictionary<string, ConfigEntry<bool>> boolConfigEntries = Plugin.Instance.boolConfigEntries; Plugin.Logger.LogInfo((object)("Override modded items = " + boolConfigEntries["Override Modded Items"].Value)); foreach (Item value in StatsManager.instance.itemDictionary.Values) { int num = -2; int maxPurchaseAmount = -2; itemType itemType = value.itemType; itemType val = itemType; switch ((int)val) { case 0: if (intConfigEntries["Max Drones In Shop"].Value != -1) { num = intConfigEntries["Max Drones In Shop"].Value; maxPurchaseAmount = intConfigEntries["Max Drone Purchase Amount"].Value; } break; case 1: if (intConfigEntries["Max Orbs In Shop"].Value != -1) { num = intConfigEntries["Max Orbs In Shop"].Value; maxPurchaseAmount = intConfigEntries["Max Orb Purchase Amount"].Value; } break; case 3: if (intConfigEntries["Max Upgrades In Shop"].Value != -1) { num = intConfigEntries["Max Upgrades In Shop"].Value; maxPurchaseAmount = intConfigEntries["Max Upgrade Purchase Amount"].Value; } break; case 5: if (intConfigEntries["Max Crystals In Shop"].Value != -1) { num = intConfigEntries["Max Crystals In Shop"].Value; maxPurchaseAmount = intConfigEntries["Max Crystal Purchase Amount"].Value; } break; case 6: if (intConfigEntries["Max Grenades In Shop"].Value != -1) { num = intConfigEntries["Max Grenades In Shop"].Value; maxPurchaseAmount = intConfigEntries["Max Grenade Purchase Amount"].Value; } break; case 7: if (intConfigEntries["Max Melee Weapons In Shop"].Value != -1) { num = intConfigEntries["Max Melee Weapons In Shop"].Value; maxPurchaseAmount = intConfigEntries["Max Melee Weapon Purchase Amount"].Value; } break; case 8: if (intConfigEntries["Max Health-Packs In Shop"].Value != -1) { num = intConfigEntries["Max Health-Packs In Shop"].Value; maxPurchaseAmount = intConfigEntries["Max Health-Pack Purchase Amount"].Value; } break; case 9: if (intConfigEntries["Max Guns In Shop"].Value != -1) { num = intConfigEntries["Max Guns In Shop"].Value; maxPurchaseAmount = intConfigEntries["Max Gun Purchase Amount"].Value; } break; case 10: if (intConfigEntries["Max Trackers In Shop"].Value != -1) { num = intConfigEntries["Max Trackers In Shop"].Value; maxPurchaseAmount = intConfigEntries["Max Tracker Purchase Amount"].Value; } break; case 11: if (intConfigEntries["Max Mines In Shop"].Value != -1) { num = intConfigEntries["Max Mines In Shop"].Value; maxPurchaseAmount = intConfigEntries["Max Mine Purchase Amount"].Value; } break; default: continue; } bool flag = (int)value.itemType == 3; if ((int)value.itemType == 2 || (int)value.itemType == 12 || num == -2) { continue; } if (boolConfigEntries["Override Modded Items"].Value) { if (boolConfigEntries["Override Single-Use Upgrades"].Value && flag) { SetItemValues(value, num, maxPurchaseAmount); } else if (value.maxPurchase) { if (!flag) { SetItemValues(value, num, maxPurchaseAmount); } } else { SetItemValues(value, num, maxPurchaseAmount); } } else if ((!MoreUpgradesMOD.isLoaded() || !value.itemAssetName.Contains("Modded")) && !(VanillaUpgradesMOD.isLoaded() && flag)) { if (boolConfigEntries["Override Single-Use Upgrades"].Value && flag) { SetItemValues(value, num, maxPurchaseAmount); } else if (flag && !value.maxPurchase) { SetItemValues(value, num, maxPurchaseAmount); } else if (!flag) { SetItemValues(value, num, maxPurchaseAmount); } } } } private static void SetItemValues(Item item, int maxInShop, int maxPurchaseAmount) { item.maxAmountInShop = (item.maxAmount = maxInShop); item.maxPurchase = maxPurchaseAmount > 0; item.maxPurchaseAmount = maxPurchaseAmount; } [PunRPC] public static void SetParent(Transform parent, GameObject gameObj) { gameObj.transform.SetParent(parent); } } [HarmonyPatch(typeof(PunManager))] internal static class PunManagerPatch { [HarmonyPrefix] [HarmonyPatch("TruckPopulateItemVolumes")] private static void RemoveNullValues() { if (!((Object)(object)ItemManager.instance == (Object)null) && (SemiFunc.IsMasterClient() || !SemiFunc.IsMultiplayer())) { ItemManager.instance.itemVolumes.RemoveAll((ItemVolume volume) => (Object)(object)volume == (Object)null); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "MoreShopItems"; public const string PLUGIN_NAME = "More Shop Items"; public const string PLUGIN_VERSION = "1.3.3"; } } namespace MoreShopItems.Compatability { internal class MoreUpgradesMOD { internal const string modGUID = "bulletbot.moreupgrades"; public static bool isLoaded() { return Chainloader.PluginInfos.ContainsKey("bulletbot.moreupgrades"); } } internal class VanillaUpgradesMOD { internal const string modGUID = "bulletbot.vanillaupgrades"; public static bool isLoaded() { return Chainloader.PluginInfos.ContainsKey("bulletbot.vanillaupgrades"); } } } namespace MoreShopItems.Constants { public static class Values { public const int TargetSpawnAmount = 250; public const int UpgradesAmount = 50; public const int HealthPacksAmount = 50; public const int ConsumablesAmount = 100; } } namespace MoreShopItems.Config { public static class ConfigEntries { private static string[] DESCRIPTIONS = new string[23] { "How many of each upgrade to spawn in the shop.", "How many upgrades you can purchase total. Set 0 to disable", "How many of each melee weapon to spawn in the shop.", "How many melee weapons you can purchase total. Set 0 to disable", "How many of each gun to spawn in the shop.", "How many guns you can purchase total. Set 0 to disable", "How many of each grenade to spawn in the shop.", "How many grenades you can purchase total. Set 0 to disable", "How many of each mine to spawn in the shop.", "How many mines you can purchase total. Set 0 to disable", "How many of each health-pack to spawn in the shop.", "How many health-packs you can purchase total. Set 0 to disable", "How many of each drone to spawn in the shop.", "How many drones you can purchase total. Set 0 to disable", "How many of each orb to spawn in the shop.", "How many orbs you can purchase total. Set 0 to disable", "How many of each crystal to spawn in the shop.", "How many crystals you can purchase total. Set 0 to disable", "How many trackers to spawn in the shop.", "How many trackers you can purchase total. Set 0 to disable", "Overrides the values (MaxAmountInShop, MaxPurchaseAmount) set by other item/upgrade mods.", "Overrides the values (MaxAmountInShop, MaxPurchaseAmount) of single-use upgrades.", "Spawns the additional shelving into the shop (set false to disable the shelf spawning)." }; public static string[] GetConfigDescriptions() { return DESCRIPTIONS; } } public class ConfigHelper { public static T CreateConfig<T>(string section, string name, object value, string desc, int min, int max) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (value is int) { return (T)(object)((BaseUnityPlugin)Plugin.Instance).Config.Bind<int>(section, name, (int)value, new ConfigDescription(desc, (AcceptableValueBase)(object)new AcceptableValueRange<int>(min, max), Array.Empty<object>())); } return (T)(object)((BaseUnityPlugin)Plugin.Instance).Config.Bind<bool>(section, name, (bool)value, new ConfigDescription(desc, (AcceptableValueBase)null, Array.Empty<object>())); } } }
plugins/MoreUpgrades.dll
Decompiled 3 weeks agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CustomColors; using HarmonyLib; using MoreUpgrades.Classes; using MoreUpgrades.Properties; using Photon.Pun; using REPOLib.Modules; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MoreUpgrades")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MoreUpgrades")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5e12a72d-c200-488d-940a-653d1003d96e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoreUpgrades { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("bulletbot.moreupgrades", "MoreUpgrades", "1.4.8")] internal class Plugin : BaseUnityPlugin { internal static class CustomColors { internal const string modGUID = "x753.CustomColors"; internal static bool IsLoaded() { return Chainloader.PluginInfos.ContainsKey("x753.CustomColors"); } internal static void OnAwake() { instance.PatchAll("CustomColorsPatches"); } } private const string modGUID = "bulletbot.moreupgrades"; private const string modName = "MoreUpgrades"; private const string modVer = "1.4.8"; internal static Plugin instance; internal ManualLogSource logger; private readonly Harmony harmony = new Harmony("bulletbot.moreupgrades"); internal AssetBundle assetBundle; internal List<UpgradeItem> upgradeItems; private void PatchAll(string name) { foreach (Type item in from t in Assembly.GetExecutingAssembly().GetTypes() where t.Namespace == "MoreUpgrades." + name select t) { harmony.PatchAll(item); } } private GameObject GetVisualsFromComponent(Component component) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown GameObject val = null; if (((object)component).GetType() == typeof(EnemyParent)) { EnemyParent val2 = (EnemyParent)(object)((component is EnemyParent) ? component : null); Enemy val3 = (Enemy)AccessTools.Field(typeof(EnemyParent), "Enemy").GetValue(component); try { val = ((Component)val2.EnableObject.gameObject.GetComponentInChildren<Animator>()).gameObject; } catch { } if ((Object)(object)val == (Object)null) { try { val = ((Component)((Component)val3).GetComponent<EnemyVision>().VisionTransform).gameObject; } catch { } } if ((Object)(object)val == (Object)null) { val = ((Component)val3).gameObject; } } else if (((object)component).GetType() == typeof(PlayerAvatar)) { PlayerAvatar val4 = (PlayerAvatar)(object)((component is PlayerAvatar) ? component : null); val = ((Component)val4.playerAvatarVisuals).gameObject; } return val; } internal void AddEnemyToMap(Component component, string enemyName = null) { //IL_0153: Unknown result type (might be due to invalid IL or missing references) UpgradeItem upgradeItem = upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == "Map Enemy Tracker"); if (upgradeItem == null) { return; } EnemyParent val = (EnemyParent)(object)((component is EnemyParent) ? component : null); if (val != null && enemyName == null) { enemyName = val.enemyName; } if ((from x in upgradeItem.GetConfig<string>("Exclude Enemies").Split(new char[1] { ',' }) select x.Trim() into x where !string.IsNullOrEmpty(x) select x).Contains(enemyName)) { return; } GameObject visuals = GetVisualsFromComponent(component); List<(GameObject, Color)> variable = upgradeItem.GetVariable<List<(GameObject, Color)>>("AddToMap"); List<GameObject> variable2 = upgradeItem.GetVariable<List<GameObject>>("RemoveFromMap"); if (!((Object)(object)visuals == (Object)null) && !variable.Any(((GameObject, Color) x) => (Object)(object)x.Item1 == (Object)(object)visuals)) { if (variable2.Contains(visuals)) { variable2.Remove(visuals); } variable.Add((visuals, upgradeItem.GetConfig<Color>("Color"))); } } internal void RemoveEnemyFromMap(Component component, string enemyName = null) { UpgradeItem upgradeItem = upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == "Map Enemy Tracker"); if (upgradeItem == null) { return; } EnemyParent val = (EnemyParent)(object)((component is EnemyParent) ? component : null); if (val != null && enemyName == null) { enemyName = val.enemyName; } if ((from x in upgradeItem.GetConfig<string>("Exclude Enemies").Split(new char[1] { ',' }) select x.Trim() into x where !string.IsNullOrEmpty(x) select x).Contains(enemyName)) { return; } GameObject visuals = GetVisualsFromComponent(component); List<(GameObject, Color)> variable = upgradeItem.GetVariable<List<(GameObject, Color)>>("AddToMap"); List<GameObject> variable2 = upgradeItem.GetVariable<List<GameObject>>("RemoveFromMap"); if ((Object)(object)visuals == (Object)null || variable2.Contains(visuals)) { return; } if (variable.Any(((GameObject, Color) x) => (Object)(object)x.Item1 == (Object)(object)visuals)) { variable.RemoveAll(((GameObject, Color) x) => (Object)(object)x.Item1 == (Object)(object)visuals); } variable2.Add(visuals); } internal void AddPlayerToMap(PlayerAvatar playerAvatar) { //IL_00b6: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) UpgradeItem upgradeItem = upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == "Map Player Tracker"); if (upgradeItem == null) { return; } GameObject visuals = GetVisualsFromComponent((Component)(object)playerAvatar); List<(GameObject, Color)> variable = upgradeItem.GetVariable<List<(GameObject, Color)>>("AddToMap"); List<GameObject> variable2 = upgradeItem.GetVariable<List<GameObject>>("RemoveFromMap"); if (!((Object)(object)visuals == (Object)null) && !variable.Any(((GameObject, Color) x) => (Object)(object)x.Item1 == (Object)(object)visuals)) { if (variable2.Contains(visuals)) { variable2.Remove(visuals); } Color item = upgradeItem.GetConfig<Color>("Color"); if (upgradeItem.GetConfig<bool>("Player Color")) { item = (Color)AccessTools.Field(typeof(PlayerAvatarVisuals), "color").GetValue(playerAvatar.playerAvatarVisuals); } variable.Add((visuals, item)); } } internal void RemovePlayerToMap(PlayerAvatar playerAvatar) { UpgradeItem upgradeItem = upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == "Map Player Tracker"); if (upgradeItem == null) { return; } GameObject visuals = GetVisualsFromComponent((Component)(object)playerAvatar); List<(GameObject, Color)> variable = upgradeItem.GetVariable<List<(GameObject, Color)>>("AddToMap"); List<GameObject> variable2 = upgradeItem.GetVariable<List<GameObject>>("RemoveFromMap"); if ((Object)(object)visuals == (Object)null || variable2.Contains(visuals)) { return; } if (variable.Any(((GameObject, Color) x) => (Object)(object)x.Item1 == (Object)(object)visuals)) { variable.RemoveAll(((GameObject, Color) x) => (Object)(object)x.Item1 == (Object)(object)visuals); } variable2.Add(visuals); } internal static float ItemValueMultiplier(float itemValueMultiplier, string itemAssetName) { if ((Object)(object)MoreUpgradesManager.instance == (Object)null) { return itemValueMultiplier; } return (instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.fullName == itemAssetName) != null) ? 1f : itemValueMultiplier; } internal static float UpgradeValueIncrease(float upgradeValueIncrease, string itemAssetName) { if ((Object)(object)MoreUpgradesManager.instance == (Object)null) { return upgradeValueIncrease; } UpgradeItem upgradeItem = instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.fullName == itemAssetName); if (upgradeItem == null) { return upgradeValueIncrease; } float num = (upgradeItem.HasConfig("Price Increase Scaling") ? upgradeItem.GetConfig<float>("Price Increase Scaling") : upgradeItem.upgradeItemBase.priceIncreaseScaling); if (num < 0f) { num = upgradeValueIncrease; } return num; } private void Awake() { //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) instance = this; logger = Logger.CreateLogSource("MoreUpgrades"); assetBundle = AssetBundle.LoadFromMemory(Resources.moreupgrades); if ((Object)(object)assetBundle == (Object)null) { logger.LogError((object)"Something went wrong when loading the asset bundle."); return; } upgradeItems = new List<UpgradeItem>(); UpgradeItem sprintUsage = new UpgradeItem(new UpgradeItemBase { name = "Sprint Usage", maxAmount = 10, maxAmountInShop = 2, minPrice = 9000f, maxPrice = 14000f }); sprintUsage.AddConfig("Scaling Factor", 0.1f, "Formula: energySprintDrain / (1 + (upgradeAmount * scalingFactor))"); UpgradeItem upgradeItem2 = sprintUsage; upgradeItem2.onFixedUpdate = (Action)Delegate.Combine(upgradeItem2.onFixedUpdate, (Action)delegate { int amount = sprintUsage.GetAmount(); if ((Object)(object)PlayerController.instance != (Object)null && amount != 0) { if (!sprintUsage.HasVariable("OriginalEnergySprintDrain")) { sprintUsage.AddVariable("OriginalEnergySprintDrain", PlayerController.instance.EnergySprintDrain); } float variable8 = sprintUsage.GetVariable<float>("OriginalEnergySprintDrain"); PlayerController.instance.EnergySprintDrain = variable8 / (1f + (float)amount * sprintUsage.GetConfig<float>("Scaling Factor")); } }); upgradeItems.Add(sprintUsage); UpgradeItem valuableCount = new UpgradeItem(new UpgradeItemBase { name = "Valuable Count", minPrice = 30000f, maxPrice = 40000f, maxPurchaseAmount = 1, priceIncreaseScaling = 0f }); valuableCount.AddConfig("Display Total Value", defaultValue: true, "Whether to display the total value next to the valuable counter."); UpgradeItem upgradeItem3 = valuableCount; upgradeItem3.onInit = (Action)Delegate.Combine(upgradeItem3.onInit, (Action)delegate { valuableCount.AddVariable("CurrentValuables", new List<ValuableObject>()); valuableCount.AddVariable("Changed", value: false); valuableCount.AddVariable("PreviousCount", 0); valuableCount.AddVariable("PreviousValue", 0); valuableCount.AddVariable("TextLength", 0); }); UpgradeItem upgradeItem4 = valuableCount; upgradeItem4.onUpdate = (Action)Delegate.Combine(upgradeItem4.onUpdate, (Action)delegate { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown if (!SemiFunc.RunIsLobby() && !SemiFunc.RunIsShop() && (Object)(object)MissionUI.instance != (Object)null && valuableCount.GetAmount() != 0) { TextMeshProUGUI val5 = (TextMeshProUGUI)AccessTools.Field(typeof(MissionUI), "Text").GetValue(MissionUI.instance); string text = (string)AccessTools.Field(typeof(MissionUI), "messagePrev").GetValue(MissionUI.instance); List<ValuableObject> variable3 = valuableCount.GetVariable<List<ValuableObject>>("CurrentValuables"); bool variable4 = valuableCount.GetVariable<bool>("Changed"); int variable5 = valuableCount.GetVariable<int>("PreviousCount"); int variable6 = valuableCount.GetVariable<int>("PreviousValue"); int variable7 = valuableCount.GetVariable<int>("TextLength"); int count = variable3.Count; bool config = valuableCount.GetConfig<bool>("Display Total Value"); int num3 = (config ? variable3.Select((ValuableObject x) => (int)x.dollarValueCurrent).Sum() : 0); if (!Utility.IsNullOrWhiteSpace(((TMP_Text)val5).text) && (variable4 || variable5 != count || variable6 != num3)) { string text2 = ((TMP_Text)val5).text; if (!variable4 && (variable5 != count || variable6 != num3)) { text2 = text2.Substring(0, text2.Length - variable7); } string text3 = $"\nValuables: <b>{count}</b>" + (config ? (" (<color=#558B2F>$</color><b>" + SemiFunc.DollarGetString(num3) + "</b>)") : ""); text2 += text3; valuableCount.SetVariable("PreviousCount", count); valuableCount.SetVariable("PreviousValue", num3); valuableCount.SetVariable("TextLength", text3.Length); ((TMP_Text)val5).text = text2; AccessTools.Field(typeof(MissionUI), "messagePrev").SetValue(MissionUI.instance, text2); if (variable4) { valuableCount.SetVariable("Changed", value: false); } } } }); upgradeItems.Add(valuableCount); UpgradeItem mapEnemyTracker = new UpgradeItem(new UpgradeItemBase { name = "Map Enemy Tracker", minPrice = 50000f, maxPrice = 60000f, maxPurchaseAmount = 1, priceIncreaseScaling = 0f }); mapEnemyTracker.AddConfig("Arrow Icon", defaultValue: true, "Whether the icon should appear as an arrow showing direction instead of a dot."); mapEnemyTracker.AddConfig<Color>("Color", Color.red, "The color of the icon."); mapEnemyTracker.AddConfig("Exclude Enemies", "", "Exclude specific enemies from displaying their icon by listing their names.\nExample: 'Gnome, Clown', seperated by commas."); UpgradeItem upgradeItem5 = mapEnemyTracker; upgradeItem5.onInit = (Action)Delegate.Combine(upgradeItem5.onInit, (Action)delegate { mapEnemyTracker.AddVariable("AddToMap", new List<(GameObject, Color)>()); mapEnemyTracker.AddVariable("RemoveFromMap", new List<GameObject>()); }); UpgradeItem upgradeItem6 = mapEnemyTracker; upgradeItem6.onUpdate = (Action)Delegate.Combine(upgradeItem6.onUpdate, (Action)delegate { if (!SemiFunc.RunIsLobby() && !SemiFunc.RunIsShop()) { UpdateTracker(mapEnemyTracker); } }); upgradeItems.Add(mapEnemyTracker); UpgradeItem mapPlayerTracker = new UpgradeItem(new UpgradeItemBase { name = "Map Player Tracker", minPrice = 30000f, maxPrice = 40000f, maxPurchaseAmount = 1, priceIncreaseScaling = 0f }); mapPlayerTracker.AddConfig("Arrow Icon", defaultValue: true, "Whether the icon should appear as an arrow showing direction instead of a dot."); mapPlayerTracker.AddConfig("Player Color", defaultValue: false, "Whether the icon should be colored as the player."); mapPlayerTracker.AddConfig<Color>("Color", Color.blue, "The color of the icon."); UpgradeItem upgradeItem7 = mapPlayerTracker; upgradeItem7.onInit = (Action)Delegate.Combine(upgradeItem7.onInit, (Action)delegate { mapPlayerTracker.AddVariable("AddToMap", new List<(GameObject, Color)>()); mapPlayerTracker.AddVariable("RemoveFromMap", new List<GameObject>()); }); UpgradeItem upgradeItem8 = mapPlayerTracker; upgradeItem8.onUpdate = (Action)Delegate.Combine(upgradeItem8.onUpdate, (Action)delegate { UpdateTracker(mapPlayerTracker); }); upgradeItems.Add(mapPlayerTracker); SceneManager.activeSceneChanged += delegate { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown if (!((Object)(object)RunManager.instance == (Object)null) && !((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelMainMenu) && !((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelLobbyMenu)) { GameObject val3 = new GameObject("More Upgrades Manager"); PhotonView val4 = val3.AddComponent<PhotonView>(); val4.ViewID = 1863; val3.AddComponent<MoreUpgradesManager>(); } }; logger.LogMessage((object)"MoreUpgrades has started."); PatchAll("Patches"); if (CustomColors.IsLoaded()) { CustomColors.OnAwake(); } void UpdateTracker(UpgradeItem upgradeItem) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)SemiFunc.PlayerAvatarLocal() != (Object)null && upgradeItem.GetAmount() != 0) { List<(GameObject, Color)> variable = upgradeItem.GetVariable<List<(GameObject, Color)>>("AddToMap"); for (int num = variable.Count - 1; num >= 0; num--) { var (val, color) = variable[num]; variable.RemoveAt(num); MapCustom component = val.GetComponent<MapCustom>(); if (!((Object)(object)component != (Object)null)) { component = val.AddComponent<MapCustom>(); component.color = color; component.sprite = (upgradeItem.GetConfig<bool>("Arrow Icon") ? assetBundle.LoadAsset<Sprite>("Map Tracker") : SemiFunc.PlayerAvatarLocal().playerDeathHead.mapCustom.sprite); } } List<GameObject> variable2 = upgradeItem.GetVariable<List<GameObject>>("RemoveFromMap"); for (int num2 = variable2.Count - 1; num2 >= 0; num2--) { GameObject val2 = variable2[num2]; variable2.RemoveAt(num2); MapCustom component2 = val2.GetComponent<MapCustom>(); if (!((Object)(object)component2 == (Object)null)) { Object.Destroy((Object)(object)((Component)component2.mapCustomEntity).gameObject); Object.Destroy((Object)(object)component2); } } } } } } } namespace MoreUpgrades.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("MoreUpgrades.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] moreupgrades { get { object @object = ResourceManager.GetObject("moreupgrades", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace MoreUpgrades.Patches { [HarmonyPatch(typeof(ItemAttributes))] internal class ItemAttributesPatch { [HarmonyPatch("GetValue")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> GetValueTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(ShopManager), "instance"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ShopManager), "itemValueMultiplier"), (string)null) }); val.Advance(1); val.Insert((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(ItemAttributes), "itemAssetName")), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "ItemValueMultiplier", (Type[])null, (Type[])null)) }); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(ShopManager), "instance"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ShopManager), "upgradeValueIncrease"), (string)null) }); val.Advance(1); val.Insert((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(ItemAttributes), "itemAssetName")), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "UpgradeValueIncrease", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } } [HarmonyPatch(typeof(PlayerAvatar))] internal class PlayerAvatarPatch { [HarmonyPatch("LateStart")] [HarmonyPostfix] private static void LateStart(PlayerAvatar __instance) { if (!((Object)(object)MoreUpgradesManager.instance == (Object)null) && !((Object)(object)__instance == (Object)(object)SemiFunc.PlayerAvatarLocal())) { Plugin.instance.AddPlayerToMap(__instance); } } [HarmonyPatch("ReviveRPC")] [HarmonyPostfix] private static void ReviveRPC(PlayerAvatar __instance) { if (!((Object)(object)MoreUpgradesManager.instance == (Object)null) && !((Object)(object)__instance == (Object)(object)SemiFunc.PlayerAvatarLocal())) { Plugin.instance.AddPlayerToMap(__instance); } } [HarmonyPatch("PlayerDeathRPC")] [HarmonyPostfix] private static void PlayerDeathRPC(PlayerAvatar __instance) { if (!((Object)(object)MoreUpgradesManager.instance == (Object)null) && !((Object)(object)__instance == (Object)(object)SemiFunc.PlayerAvatarLocal())) { Plugin.instance.RemovePlayerToMap(__instance); Plugin.instance.RemoveEnemyFromMap((Component)(object)__instance); } } [HarmonyPatch("SetColorRPC")] [HarmonyPostfix] private static void SetColorRPC(PlayerAvatar __instance) { if (!((Object)(object)MoreUpgradesManager.instance == (Object)null) && !((Object)(object)__instance == (Object)(object)SemiFunc.PlayerAvatarLocal())) { UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == "Map Player Tracker"); if (upgradeItem != null && upgradeItem.GetConfig<bool>("Player Color")) { Plugin.instance.RemovePlayerToMap(__instance); Plugin.instance.AddPlayerToMap(__instance); } } } } [HarmonyPatch(typeof(EnemySlowMouth))] internal class EnemySlowMouthPatch { [HarmonyPatch("UpdateStateRPC")] [HarmonyPostfix] private static void UpdateStateRPC(EnemySlowMouth __instance, Enemy ___enemy) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Invalid comparison between Unknown and I4 if ((Object)(object)MoreUpgradesManager.instance == (Object)null || (Object)(object)___enemy == (Object)null) { return; } PlayerAvatar val = (PlayerAvatar)AccessTools.Field(typeof(EnemySlowMouth), "playerTarget").GetValue(__instance); EnemyParent val2 = (EnemyParent)AccessTools.Field(typeof(Enemy), "EnemyParent").GetValue(___enemy); State currentState = __instance.currentState; if ((int)currentState == 9) { Plugin.instance.RemoveEnemyFromMap((Component)(object)val2); if (!((Object)(object)val == (Object)(object)SemiFunc.PlayerAvatarLocal())) { Plugin.instance.RemovePlayerToMap(val); Plugin.instance.AddEnemyToMap((Component)(object)val, val2.enemyName); } } else if ((int)currentState == 11) { Plugin.instance.AddEnemyToMap((Component)(object)val2); if (!((Object)(object)val == (Object)(object)SemiFunc.PlayerAvatarLocal())) { Plugin.instance.AddPlayerToMap(val); Plugin.instance.RemoveEnemyFromMap((Component)(object)val, val2.enemyName); } } } } [HarmonyPatch(typeof(EnemyParent))] internal class EnemyParentPatch { [HarmonyPatch("SpawnRPC")] [HarmonyPostfix] private static void SpawnRPC(EnemyParent __instance) { if (!((Object)(object)MoreUpgradesManager.instance == (Object)null)) { Plugin.instance.AddEnemyToMap((Component)(object)__instance); } } [HarmonyPatch("DespawnRPC")] [HarmonyPostfix] private static void DespawnRPC(EnemyParent __instance) { if (!((Object)(object)MoreUpgradesManager.instance == (Object)null)) { Plugin.instance.RemoveEnemyFromMap((Component)(object)__instance); } } } [HarmonyPatch(typeof(EnemyHealth))] internal class EnemyHealthPatch { [HarmonyPatch("DeathRPC")] [HarmonyPostfix] private static void DeathRPC(EnemyHealth __instance, Enemy ___enemy) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (!((Object)(object)MoreUpgradesManager.instance == (Object)null)) { Plugin.instance.RemoveEnemyFromMap((Component)(EnemyParent)AccessTools.Field(typeof(Enemy), "EnemyParent").GetValue(___enemy)); } } } [HarmonyPatch(typeof(MissionUIPatch))] internal class MissionUIPatch { [HarmonyPatch(typeof(MissionUI), "MissionText")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: 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_0036: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(MissionUI), "messagePrev"), (string)null) }).Advance(1).Insert((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MissionUIPatch), "MissionText", (Type[])null, (Type[])null)) }) .InstructionEnumeration(); } private static void MissionText() { if (!((Object)(object)MoreUpgradesManager.instance == (Object)null)) { Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == "Valuable Count")?.SetVariable("Changed", value: true); } } } [HarmonyPatch(typeof(StatsManager))] internal class StatsManagerPatch { [HarmonyPatch("Start")] [HarmonyPrefix] private static void Start(StatsManager __instance) { foreach (UpgradeItem upgradeItem in Plugin.instance.upgradeItems) { __instance.dictionaryOfDictionaries.Add("playerUpgradeModded" + upgradeItem.saveName, upgradeItem.playerUpgrades); __instance.dictionaryOfDictionaries.Add("appliedPlayerUpgradeModded" + upgradeItem.saveName, upgradeItem.appliedPlayerUpgrades); } } [HarmonyPatch("FetchPlayerUpgrades")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> FetchPlayerUpgradesTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Ldloca_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(KeyValuePair<string, Dictionary<string, int>>), "get_Key", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Ldstr, (object)"playerUpgrade", (string)null) }); object operand = val.Operand; val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(string), "Trim", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null) }); object operand2 = val.Operand; val.Advance(1); val.Insert((CodeInstruction[])(object)new CodeInstruction[5] { new CodeInstruction(OpCodes.Ldloca_S, operand), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(KeyValuePair<string, Dictionary<string, int>>), "get_Key", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Ldloc_S, operand2), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(StatsManagerPatch), "FetchPlayerUpgrades", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Stloc_S, operand2) }); return val.InstructionEnumeration(); } private static string FetchPlayerUpgrades(string key, string text) { string prefix = "playerUpgradeModded"; if ((Object)(object)MoreUpgradesManager.instance == (Object)null || !key.StartsWith(prefix)) { return text; } UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.saveName == key.Substring(prefix.Length)); if (upgradeItem == null) { return text; } return upgradeItem.HasConfig("Display Name") ? upgradeItem.GetConfig<string>("Display Name") : upgradeItem.name; } } [HarmonyPatch(typeof(ValuableObject))] internal class ValuableObjectPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(ValuableObject __instance) { if ((Object)(object)MoreUpgradesManager.instance == (Object)null) { return; } UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == "Valuable Count"); if (upgradeItem != null) { List<ValuableObject> variable = upgradeItem.GetVariable<List<ValuableObject>>("CurrentValuables"); if (!variable.Contains(__instance)) { variable.Add(__instance); } } } } [HarmonyPatch(typeof(PhysGrabObject))] internal class PhysGrabObjectPatch { [HarmonyPatch("OnDestroy")] [HarmonyPostfix] private static void OnDestroy(PhysGrabObject __instance) { if ((Object)(object)MoreUpgradesManager.instance == (Object)null) { return; } ValuableObject component = ((Component)__instance).gameObject.GetComponent<ValuableObject>(); if ((Object)(object)component == (Object)null) { return; } UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == "Valuable Count"); if (upgradeItem != null) { List<ValuableObject> variable = upgradeItem.GetVariable<List<ValuableObject>>("CurrentValuables"); if (variable.Contains(component)) { variable.Remove(component); } } } } [HarmonyPatch(typeof(ItemUpgrade))] internal class ItemUpgradePatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(ItemUpgrade __instance) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown if ((Object)(object)MoreUpgradesManager.instance == (Object)null) { return; } GameObject gameObject = ((Component)__instance).gameObject; UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.fullName == gameObject.GetComponent<ItemAttributes>().item.itemAssetName); if (upgradeItem == null) { return; } __instance.upgradeEvent = new UnityEvent(); __instance.upgradeEvent.AddListener((UnityAction)delegate { if (upgradeItem.HasConfig("Allow Team Upgrades") && upgradeItem.GetConfig<bool>("Allow Team Upgrades")) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { MoreUpgradesManager.instance.Upgrade(upgradeItem.name, SemiFunc.PlayerGetSteamID(item)); } return; } MoreUpgradesManager.instance.Upgrade(upgradeItem.name, SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID((int)AccessTools.Field(typeof(ItemToggle), "playerTogglePhotonID").GetValue(gameObject.GetComponent<ItemToggle>())))); }); } } [HarmonyPatch(typeof(ShopManager))] internal class ShopManagerPatch { [HarmonyPatch("GetAllItemsFromStatsManager")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> GetAllItemsFromStatsManagerTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Expected O, but got Unknown //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3] { new CodeMatch((OpCode?)OpCodes.Br, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloca_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Dictionary<string, Item>.ValueCollection.Enumerator), "get_Current", (Type[])null, (Type[])null), (string)null) }); object operand = val.Operand; val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Dictionary<string, Item>.ValueCollection.Enumerator), "get_Current", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_1, (object)null, (string)null) }); val.Advance(1); val.Insert((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloc_1, (object)null), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ShopManagerPatch), "GetAllItemsFromStatsManager", (Type[])null, (Type[])null)), new CodeInstruction(OpCodes.Brtrue, operand) }); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ShopManager), "itemValueMultiplier"), (string)null) }); val.Advance(1); val.Insert((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloc_1, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(Item), "itemAssetName")), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "ItemValueMultiplier", (Type[])null, (Type[])null)) }); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[2] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ShopManager), "upgradeValueIncrease"), (string)null) }); val.Advance(1); val.Insert((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldloc_1, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(Item), "itemAssetName")), new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Plugin), "UpgradeValueIncrease", (Type[])null, (Type[])null)) }); return val.InstructionEnumeration(); } private static bool GetAllItemsFromStatsManager(Item item) { if ((Object)(object)MoreUpgradesManager.instance == (Object)null) { return false; } UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.fullName == item.itemAssetName); return upgradeItem != null && upgradeItem.HasConfig("Enabled") && !upgradeItem.GetConfig<bool>("Enabled"); } } } namespace MoreUpgrades.CustomColorsPatches { [HarmonyPatch(typeof(ModdedColorPlayerAvatar))] internal class ModdedColorPlayerAvatarPatch { [HarmonyPatch("ModdedSetColorRPC")] [HarmonyPostfix] private static void ModdedSetColorRPC(ModdedColorPlayerAvatar __instance) { PlayerAvatar avatar = __instance.avatar; if (!((Object)(object)MoreUpgradesManager.instance == (Object)null) && !((Object)(object)avatar == (Object)(object)SemiFunc.PlayerAvatarLocal())) { UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == "Map Player Tracker"); if (upgradeItem != null && upgradeItem.GetConfig<bool>("Player Color")) { Plugin.instance.RemovePlayerToMap(avatar); Plugin.instance.AddPlayerToMap(avatar); } } } } } namespace MoreUpgrades.Classes { public static class MoreUpgradesLib { public static bool IsManagerActive() { return (Object)(object)MoreUpgradesManager.instance != (Object)null; } public static IReadOnlyList<UpgradeItem> GetCoreUpgradeItems() { return Plugin.instance.upgradeItems.Where((UpgradeItem x) => x.modGUID == null).ToList(); } public static IReadOnlyList<UpgradeItem> GetUpgradeItemsByMod(string modGUID) { return Plugin.instance.upgradeItems.Where((UpgradeItem x) => x.modGUID == modGUID).ToList(); } public static UpgradeItem Register(string modGUID, Item item, GameObject prefab, UpgradeItemBase upgradeItemBase) { if (string.IsNullOrEmpty(modGUID)) { Plugin.instance.logger.LogWarning((object)"Couldn't register the upgrade item because the modGUID is not valid."); return null; } if ((Object)(object)Plugin.instance.assetBundle == (Object)null) { Plugin.instance.logger.LogWarning((object)(modGUID + ": Couldn't register the upgrade item because the core mod failed to start. Contact the mod creator.")); return null; } if ((Object)(object)item == (Object)null || (Object)(object)prefab == (Object)null) { Plugin.instance.logger.LogWarning((object)(modGUID + ": Couldn't register the upgrade item because the item or prefab are not valid.")); return null; } string name = upgradeItemBase.name; if (string.IsNullOrEmpty(name)) { Plugin.instance.logger.LogWarning((object)(modGUID + ": Couldn't register the upgrade item because the base name is not valid.")); return null; } if (Plugin.instance.upgradeItems.Any((UpgradeItem x) => x.name.ToLower().Trim() == name.ToLower().Trim())) { Plugin.instance.logger.LogWarning((object)(modGUID + ": An upgrade item with the name '" + name.Trim() + "' already exists. Duplicate upgrade items are not allowed.")); return null; } UpgradeItem upgradeItem = new UpgradeItem(upgradeItemBase, modGUID, item, prefab); Plugin.instance.upgradeItems.Add(upgradeItem); return upgradeItem; } } internal class MoreUpgradesManager : MonoBehaviour { internal static MoreUpgradesManager instance; internal PhotonView photonView; private bool checkPlayerUpgrades; private void Awake() { instance = this; photonView = ((Component)this).GetComponent<PhotonView>(); foreach (UpgradeItem upgradeItem in Plugin.instance.upgradeItems) { upgradeItem.variables.Clear(); upgradeItem.onInit?.Invoke(); } if (SemiFunc.IsMasterClientOrSingleplayer()) { ((MonoBehaviour)this).StartCoroutine("WaitUntilLevel"); } } private void LateUpdate() { foreach (UpgradeItem upgradeItem in Plugin.instance.upgradeItems) { upgradeItem.onLateUpdate?.Invoke(); } } private void FixedUpdate() { foreach (UpgradeItem upgradeItem in Plugin.instance.upgradeItems) { if (checkPlayerUpgrades) { if (upgradeItem.HasConfig("Starting Amount")) { int config = upgradeItem.GetConfig<int>("Starting Amount"); if (config >= 0) { foreach (PlayerAvatar item in SemiFunc.PlayerGetAll()) { string text = SemiFunc.PlayerGetSteamID(item); if (!upgradeItem.appliedPlayerUpgrades.ContainsKey(text)) { upgradeItem.appliedPlayerUpgrades[text] = 0; } if (upgradeItem.appliedPlayerUpgrades[text] != config) { Upgrade(upgradeItem.name, text, config - upgradeItem.appliedPlayerUpgrades[text]); upgradeItem.appliedPlayerUpgrades[text] = config; } } } } if (upgradeItem.HasConfig("Sync Host Upgrades") && upgradeItem.GetConfig<bool>("Sync Host Upgrades")) { int amount = upgradeItem.GetAmount(); foreach (PlayerAvatar item2 in from x in SemiFunc.PlayerGetAll() where (Object)(object)x != (Object)(object)SemiFunc.PlayerAvatarLocal() select x) { string steamId = SemiFunc.PlayerGetSteamID(item2); int amount2 = upgradeItem.GetAmount(steamId); Upgrade(upgradeItem.name, steamId, amount - amount2); } } } upgradeItem.onFixedUpdate?.Invoke(); } } private void Update() { foreach (UpgradeItem upgradeItem in Plugin.instance.upgradeItems) { upgradeItem.onUpdate?.Invoke(); } } private IEnumerator WaitUntilLevel() { yield return (object)new WaitUntil((Func<bool>)(() => SemiFunc.LevelGenDone())); checkPlayerUpgrades = true; if (!GameManager.Multiplayer()) { yield break; } foreach (UpgradeItem upgradeItem in Plugin.instance.upgradeItems) { foreach (PlayerAvatar playerAvatar in SemiFunc.PlayerGetAll()) { string steamId = SemiFunc.PlayerGetSteamID(playerAvatar); photonView.RPC("UpgradeRPC", (RpcTarget)4, new object[3] { upgradeItem.name, steamId, upgradeItem.GetAmount(steamId) }); } } } internal void Upgrade(string upgradeItemName, string steamId, int amount = 1) { if (amount == 0) { return; } UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == upgradeItemName); if (upgradeItem != null) { upgradeItem.playerUpgrades[steamId] += amount; if ((Object)(object)SemiFunc.PlayerAvatarGetFromSteamID(steamId) == (Object)(object)SemiFunc.PlayerAvatarLocal()) { upgradeItem.onChanged?.Invoke(); } if (GameManager.Multiplayer()) { photonView.RPC("UpgradeRPC", (RpcTarget)(SemiFunc.IsMasterClient() ? 1 : 2), new object[3] { upgradeItemName, steamId, upgradeItem.playerUpgrades[steamId] }); } } } [PunRPC] internal void UpgradeRPC(string upgradeItemName, string steamId, int amount) { UpgradeItem upgradeItem = Plugin.instance.upgradeItems.FirstOrDefault((UpgradeItem x) => x.name == upgradeItemName); if (upgradeItem != null && upgradeItem.playerUpgrades[steamId] != amount) { upgradeItem.playerUpgrades[steamId] = amount; if ((Object)(object)SemiFunc.PlayerAvatarGetFromSteamID(steamId) == (Object)(object)SemiFunc.PlayerAvatarLocal()) { upgradeItem.onChanged?.Invoke(); } if (SemiFunc.IsMasterClient()) { photonView.RPC("UpgradeRPC", (RpcTarget)1, new object[3] { upgradeItemName, steamId, amount }); } } } } public class UpgradeItem { internal string saveName; internal string sectionName; internal UpgradeItemBase upgradeItemBase; private Dictionary<string, ConfigEntryBase> configEntries; internal Dictionary<string, int> playerUpgrades; internal Dictionary<string, int> appliedPlayerUpgrades; internal Dictionary<string, object> variables; public Action onInit; public Action onLateUpdate; public Action onFixedUpdate; public Action onUpdate; public Action onChanged; public string name { get; private set; } public string fullName { get; private set; } public string modGUID { get; private set; } public bool HasConfig(string key) { ConfigEntryBase value; return configEntries.TryGetValue(key, out value); } public bool AddConfig<T>(string key, T defaultValue, string description = "") { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown if (configEntries.ContainsKey(key)) { Plugin.instance.logger.LogWarning((object)("A config entry with the key '" + key + "' already exists. Duplicates are not allowed.")); return false; } ConfigEntryBase val = null; val = (ConfigEntryBase)(object)((defaultValue is int) ? ((BaseUnityPlugin)Plugin.instance).Config.Bind<T>(sectionName, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())) : ((!(defaultValue is float)) ? ((BaseUnityPlugin)Plugin.instance).Config.Bind<T>(sectionName, key, defaultValue, description) : ((BaseUnityPlugin)Plugin.instance).Config.Bind<T>(sectionName, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 100000f), Array.Empty<object>())))); configEntries.Add(key, val); return true; } public bool AddConfig<T>(string key, T defaultValue, ConfigDescription description = null) { if (configEntries.ContainsKey(key)) { Plugin.instance.logger.LogWarning((object)("A config entry with the key '" + key + "' already exists. Duplicates are not allowed.")); return false; } configEntries.Add(key, (ConfigEntryBase)(object)((BaseUnityPlugin)Plugin.instance).Config.Bind<T>(sectionName, key, defaultValue, description)); return true; } public bool AddConfig(string key, ConfigEntryBase value) { if (configEntries.ContainsKey(key)) { Plugin.instance.logger.LogWarning((object)("A config entry with the key '" + key + "' already exists. Duplicates are not allowed.")); return false; } configEntries.Add(key, value); return true; } public bool SetConfig<T>(string key, T value) { if (!configEntries.TryGetValue(key, out var value2)) { Plugin.instance.logger.LogWarning((object)("A config entry with the key '" + key + "' does not exist. Returning default value.")); return false; } if (value2 is ConfigEntry<T> val) { val.Value = value; return true; } Plugin.instance.logger.LogWarning((object)("Type mismatch for config entry '" + key + "'. Expected: " + value2.SettingType.FullName + ", but got: " + typeof(T).FullName + ". Returning default value.")); return false; } public T GetConfig<T>(string key) { if (!configEntries.TryGetValue(key, out var value)) { Plugin.instance.logger.LogWarning((object)("A config entry with the key '" + key + "' does not exist. Returning default value.")); return default(T); } if (value is ConfigEntry<T> val) { return val.Value; } Plugin.instance.logger.LogWarning((object)("Type mismatch for config entry '" + key + "'. Expected: " + value.SettingType.FullName + ", but got: " + typeof(T).FullName + ". Returning default value.")); return default(T); } public bool HasVariable(string key) { object value; return variables.TryGetValue(key, out value); } public bool AddVariable<T>(string key, T value) { if (HasVariable(key)) { Plugin.instance.logger.LogWarning((object)("A variable with the key '" + key + "' already exists. Duplicates are not allowed.")); return false; } variables.Add(key, value); return true; } public bool SetVariable<T>(string key, T value) { if (!variables.TryGetValue(key, out var value2)) { Plugin.instance.logger.LogWarning((object)("A variable with the key '" + key + "' does not exist.")); return false; } if (value2 is T) { variables[key] = value; return true; } Plugin.instance.logger.LogWarning((object)("Type mismatch for variable '" + key + "'. Expected: " + value2.GetType().FullName + ", but got: " + typeof(T).FullName + ".")); return false; } public T GetVariable<T>(string key) { if (!variables.TryGetValue(key, out var value)) { Plugin.instance.logger.LogWarning((object)("A variable with the key '" + key + "' does not exist. Returning default value.")); return default(T); } if (value is T result) { return result; } Plugin.instance.logger.LogWarning((object)("Type mismatch for variable '" + key + "'. Expected: " + value.GetType().FullName + ", but got: " + typeof(T).FullName + ". Returning default value.")); return default(T); } public int GetAmount(string steamId = null) { if (steamId != null) { return playerUpgrades.ContainsKey(steamId) ? playerUpgrades[steamId] : 0; } PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if ((Object)(object)val != (Object)null) { steamId = SemiFunc.PlayerGetSteamID(val); } return (steamId != null && playerUpgrades.ContainsKey(steamId)) ? playerUpgrades[steamId] : 0; } internal UpgradeItem(UpgradeItemBase upgradeItemBase, string modGUID = null, Item modItem = null, GameObject modPrefab = null) { UpgradeItem upgradeItem = this; name = upgradeItemBase.name; fullName = "Modded Item Upgrade Player " + name; this.modGUID = modGUID; saveName = new string(name.Where((char x) => !char.IsWhiteSpace(x)).ToArray()); sectionName = name + ((!Utility.IsNullOrWhiteSpace(modGUID)) ? (" (" + modGUID + ")") : ""); this.upgradeItemBase = upgradeItemBase; configEntries = new Dictionary<string, ConfigEntryBase>(); playerUpgrades = new Dictionary<string, int>(); appliedPlayerUpgrades = new Dictionary<string, int>(); variables = new Dictionary<string, object>(); TryAddConfig<bool>("Enabled", defaultValue: true, "Whether the upgrade item can be spawned to the shop."); TryAddConfig<int>("Max Amount", upgradeItemBase.maxAmount, "The maximum number of times the upgrade item can appear in the truck."); TryAddConfig<int>("Max Amount In Shop", upgradeItemBase.maxAmountInShop, "The maximum number of times the upgrade item can appear in the shop."); TryAddConfig<float>("Minimum Price", upgradeItemBase.minPrice, "The minimum cost to purchase the upgrade item."); TryAddConfig<float>("Maximum Price", upgradeItemBase.maxPrice, "The maximum cost to purchase the upgrade item."); TryAddConfig<float>("Price Increase Scaling", upgradeItemBase.priceIncreaseScaling, "The scale of the price increase based on the total number of upgrade item purchased.\nDefault scaling is set to 0.5. (Note: Other mods may modify this value, affecting the game's default scaling.)\nSet to -1 to use the default scaling."); TryAddConfig<int>("Max Purchase Amount", upgradeItemBase.maxPurchaseAmount, "The maximum number of times the upgrade item can be purchased before it is no longer available in the shop.\nSet to 0 to disable the limit."); TryAddConfig<bool>("Allow Team Upgrades", defaultValue: false, "Whether the upgrade item applies to the entire team instead of just one player."); TryAddConfig<bool>("Sync Host Upgrades", defaultValue: false, "Whether the host should sync the item upgrade for the entire team."); TryAddConfig<int>("Starting Amount", 0, "The number of times the upgrade item is applied at the start of the game."); TryAddConfig<string>("Display Name", name, "The display name of the upgrade item."); Item val = modItem ?? Plugin.instance.assetBundle.LoadAsset<Item>(name); ((Object)val).name = fullName; val.itemAssetName = fullName; val.itemName = (HasConfig("Display Name") ? GetConfig<string>("Display Name") : name) + " Upgrade"; val.maxAmount = (HasConfig("Max Amount") ? GetConfig<int>("Max Amount") : upgradeItemBase.maxAmount); val.maxAmountInShop = (HasConfig("Max Amount In Shop") ? GetConfig<int>("Max Amount In Shop") : upgradeItemBase.maxAmountInShop); val.maxPurchaseAmount = (HasConfig("Max Purchase Amount") ? GetConfig<int>("Max Purchase Amount") : upgradeItemBase.maxPurchaseAmount); val.maxPurchase = val.maxPurchaseAmount > 0; val.value = ScriptableObject.CreateInstance<Value>(); val.value.valueMin = (HasConfig("Minimum Price") ? GetConfig<float>("Minimum Price") : upgradeItemBase.minPrice); val.value.valueMax = (HasConfig("Maximum Price") ? GetConfig<float>("Maximum Price") : upgradeItemBase.maxPrice); GameObject val2 = modPrefab ?? Plugin.instance.assetBundle.LoadAsset<GameObject>(name + " Prefab"); ((Object)val2).name = fullName; val2.GetComponent<ItemAttributes>().item = val; val.prefab = val2; Items.RegisterItem(val); void TryAddConfig<T>(string key, T defaultValue, string description = "") { if (!upgradeItemBase.excludeConfigs.Contains(key)) { AddConfig(key, defaultValue, description); } } } } public class UpgradeItemBase { public string name = null; public int maxAmount = 1; public int maxAmountInShop = 1; public float minPrice = 1000f; public float maxPrice = 1000f; public int maxPurchaseAmount = 0; public float priceIncreaseScaling = -1f; public List<string> excludeConfigs = new List<string>(); } }
plugins/MyLegSoundMod.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MyLegSoundMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MyLegSoundMod")] [assembly: AssemblyTitle("MyLegSoundMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace MyLegSoundMod { [BepInPlugin("com.jarias.mylegsoundmod", "MyLeg Sound Mod", "1.0.5")] public class MyLegSoundMod : BaseUnityPlugin { internal static AssetBundle bundle; internal static List<AudioClip> sounds; internal static AudioClip myLegSound; private void Awake() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)"MyLegSoundMod: Loading bundle..."); bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "myleg")); if ((Object)(object)bundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"MyLegSoundMod: Failed to load bundle."); return; } sounds = bundle.LoadAllAssets<AudioClip>().ToList(); myLegSound = sounds.FirstOrDefault(); if ((Object)(object)myLegSound != (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("MyLegSoundMod: Loaded clip: " + ((Object)myLegSound).name)); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"MyLegSoundMod: No AudioClip found in bundle."); } new Harmony("com.jarias.mylegsoundmod").PatchAll(); } } } namespace MyLegSoundMod.Patches { [HarmonyPatch(typeof(PlayerDeathEffects))] [HarmonyPatch("Start")] public class PlayerDeathEffectsPatch { [HarmonyPostfix] public static void Postfix(PlayerDeathEffects __instance) { if ((Object)(object)__instance != (Object)null && (Object)(object)MyLegSoundMod.myLegSound != (Object)null) { __instance.deathSound.Sounds = (AudioClip[])(object)new AudioClip[1] { MyLegSoundMod.myLegSound }; Debug.Log((object)"MyLegSoundMod: Replaced death sound."); } else { Debug.LogWarning((object)"MyLegSoundMod: Could not replace death sound — something is null."); } } } }
plugins/PaintedUtils.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using REPOLib.Objects; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Rendering.PostProcessing; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("PaintedThornStudios")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Utility Mod for REPO")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+b146dd2fb175251d2e279618d7cbe678063ab8e2")] [assembly: AssemblyProduct("PaintedUtils")] [assembly: AssemblyTitle("PaintedUtils")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/yourusername/PaintedUtils.git")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PaintedThornStudios.PaintedUtils { public class AssetBundleUtil { public static AssetBundle LoadAssetBundle(BaseUnityPlugin modInstance, string bundleName, ManualLogSource logger) { string directoryName = Path.GetDirectoryName(modInstance.Info.Location); string text = Path.Combine(directoryName, bundleName + ".bundle"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { logger.LogError((object)("Failed to load bundle from " + text)); return null; } return val; } public static void FixAudioMixerGroups(AssetBundle bundle, ManualLogSource logger) { if ((Object)(object)bundle == (Object)null) { return; } string[] allAssetNames = bundle.GetAllAssetNames(); foreach (string text in allAssetNames) { GameObject val = bundle.LoadAsset<GameObject>(text); if ((Object)(object)val == (Object)null) { continue; } AudioSource[] componentsInChildren = val.GetComponentsInChildren<AudioSource>(true); AudioSource[] array = componentsInChildren; foreach (AudioSource val2 in array) { if ((Object)(object)val2.outputAudioMixerGroup == (Object)null) { logger.LogWarning((object)("AudioSource in " + text + " has no mixer group assigned")); } } } } } public class EnemyReflectionUtil { public static EnemyNavMeshAgent GetEnemyNavMeshAgent(Enemy enemy) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Type type = ((object)enemy).GetType(); FieldInfo field = type.GetField("NavMeshAgent", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (EnemyNavMeshAgent)field.GetValue(enemy); } Debug.LogError((object)"NavMeshAgent field not found!"); return null; } public static EnemyRigidbody GetEnemyRigidbody(Enemy enemy) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Type type = ((object)enemy).GetType(); FieldInfo field = type.GetField("Rigidbody", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (EnemyRigidbody)field.GetValue(enemy); } Debug.LogError((object)"Rigidbody field not found!"); return null; } public static EnemyParent GetEnemyParent(Enemy enemy) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Type type = ((object)enemy).GetType(); FieldInfo field = type.GetField("EnemyParent", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (EnemyParent)field.GetValue(enemy); } Debug.LogError((object)"EnemyParent field not found!"); return null; } public static EnemyVision GetEnemyVision(Enemy enemy) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Type type = ((object)enemy).GetType(); FieldInfo field = type.GetField("Vision", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (EnemyVision)field.GetValue(enemy); } Debug.LogError((object)"Vision field not found!"); return null; } public static EnemyStateInvestigate GetEnemyStateInvestigate(Enemy enemy) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Type type = ((object)enemy).GetType(); FieldInfo field = type.GetField("StateInvestigate", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (EnemyStateInvestigate)field.GetValue(enemy); } Debug.LogError((object)"StateInvestigate field not found!"); return null; } public static bool IsEnemyJumping(Enemy enemy) { Type type = ((object)enemy).GetType(); FieldInfo field = type.GetField("Jump", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { Type fieldType = field.FieldType; FieldInfo field2 = fieldType.GetField("jumping", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { return (bool)field2.GetValue(field.GetValue(enemy)); } Debug.LogError((object)"Jumping field not found!"); return false; } Debug.LogError((object)"Jump field not found!"); return false; } public static bool IsPlayerDisabled(PlayerAvatar playerTarget) { Type type = ((object)playerTarget).GetType(); FieldInfo field = type.GetField("isDisabled", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (bool)field.GetValue(playerTarget); } Debug.LogError((object)"isDisabled field not found!"); return false; } public static Vector3 GetAgentVelocity(EnemyNavMeshAgent agent) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Type type = ((object)agent).GetType(); FieldInfo field = type.GetField("AgentVelocity", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (Vector3)field.GetValue(agent); } Debug.LogError((object)"AgentVelocity field not found!"); return Vector3.zero; } public static Vector3 GetOnInvestigateTriggeredPosition(EnemyStateInvestigate investigate) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Type type = ((object)investigate).GetType(); FieldInfo field = type.GetField("onInvestigateTriggeredPosition", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (Vector3)field.GetValue(investigate); } Debug.LogError((object)"onInvestigateTriggeredPosition field not found!"); return Vector3.zero; } public static PlayerAvatar GetVisionTriggeredPlayer(EnemyVision vision) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Type type = ((object)vision).GetType(); FieldInfo field = type.GetField("onVisionTriggeredPlayer", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (PlayerAvatar)field.GetValue(vision); } Debug.LogError((object)"onVisionTriggeredPlayer field not found!"); return null; } public static float GetNotMovingTimer(EnemyRigidbody rb) { Type type = ((object)rb).GetType(); FieldInfo field = type.GetField("notMovingTimer", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { return (float)field.GetValue(rb); } Debug.LogError((object)"NotMovingTimer field not found!"); return 0f; } public static void SetNotMovingTimer(EnemyRigidbody rb, float value) { Type type = ((object)rb).GetType(); FieldInfo field = type.GetField("notMovingTimer", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(rb, value); } else { Debug.LogError((object)"NotMovingTimer field not found!"); } } } public class NetworkPrefabUtil { public static void RegisterNetworkPrefabs(AssetBundle bundle, ManualLogSource logger) { AssetBundle bundle2 = bundle; if ((Object)(object)bundle2 == (Object)null) { return; } List<GameObject> list = (from name in bundle2.GetAllAssetNames() where name.Contains("/prefabs/") && name.EndsWith(".prefab") select bundle2.LoadAsset<GameObject>(name)).ToList(); foreach (GameObject item in list) { NetworkPrefabs.RegisterNetworkPrefab(item); } if (list.Count > 0) { logger.LogInfo((object)$"Successfully registered {list.Count} network prefabs through REPOLib"); } } } } namespace PaintedUtils { [BepInPlugin("PaintedThornStudios.PaintedUtils", "PaintedUtils", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PaintedUtils : BaseUnityPlugin { private static readonly string BundleName = GetModName(); private AssetBundle? _assetBundle; private bool _hasFixedAudioMixerGroups = false; internal static PaintedUtils Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private static string GetModName() { object obj = typeof(PaintedUtils).GetCustomAttributes(typeof(BepInPlugin), inherit: false)[0]; BepInPlugin val = (BepInPlugin)((obj is BepInPlugin) ? obj : null); return ((val != null) ? val.Name : null) ?? "PaintedUtils"; } private void LoadAssetBundle() { if (!((Object)(object)_assetBundle != (Object)null)) { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string text = Path.Combine(directoryName, BundleName + ".bundle"); _assetBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_assetBundle == (Object)null) { Logger.LogError((object)("Failed to load bundle from " + text)); } } } private void FixAllPrefabAudioMixerGroups() { if ((Object)(object)_assetBundle == (Object)null) { return; } List<GameObject> list = (from name in _assetBundle.GetAllAssetNames() where name.EndsWith(".prefab") select _assetBundle.LoadAsset<GameObject>(name)).ToList(); foreach (GameObject item in list) { Utilities.FixAudioMixerGroups(item); } } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); LoadAssetBundle(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); Logger.LogInfo((object)"White Roses have been painted Red! @CarsonJF"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { if (!_hasFixedAudioMixerGroups) { FixAllPrefabAudioMixerGroups(); _hasFixedAudioMixerGroups = true; } } } public class ColorChanger : MonoBehaviour { [Serializable] public class ColorPreset { public string presetName; public Color color = Color.white; public float emissionIntensity = 0f; public bool affectChildren = true; } [SerializeField] private List<ColorPreset> colorPresets = new List<ColorPreset>(); [SerializeField] private string currentPresetName; [SerializeField] private bool applyOnAwake = false; private Dictionary<string, ColorPreset> presetLookup = new Dictionary<string, ColorPreset>(); private List<Renderer> affectedRenderers = new List<Renderer>(); private List<Material> originalMaterials = new List<Material>(); public List<ColorPreset> ColorPresets => colorPresets; public string CurrentPresetName => currentPresetName; private void Awake() { presetLookup.Clear(); foreach (ColorPreset colorPreset in colorPresets) { if (!string.IsNullOrEmpty(colorPreset.presetName) && !presetLookup.ContainsKey(colorPreset.presetName)) { presetLookup.Add(colorPreset.presetName, colorPreset); } } CacheRenderers(); if (applyOnAwake && !string.IsNullOrEmpty(currentPresetName)) { ApplyColorPreset(currentPresetName); } } private void CacheRenderers() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown affectedRenderers.Clear(); originalMaterials.Clear(); Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { affectedRenderers.Add(val); Material[] materials = val.materials; Material[] array2 = materials; foreach (Material val2 in array2) { originalMaterials.Add(new Material(val2)); } } } public void ApplyColorPreset(string presetName) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(presetName) || !presetLookup.ContainsKey(presetName)) { Debug.LogWarning((object)("Color preset '" + presetName + "' not found on " + ((Object)((Component)this).gameObject).name)); return; } currentPresetName = presetName; ColorPreset colorPreset = presetLookup[presetName]; int num = 0; foreach (Renderer affectedRenderer in affectedRenderers) { if (!colorPreset.affectChildren && (Object)(object)((Component)affectedRenderer).transform != (Object)(object)((Component)this).transform) { num++; continue; } Material[] materials = affectedRenderer.materials; for (int i = 0; i < materials.Length; i++) { materials[i].color = colorPreset.color; if (materials[i].HasProperty("_EmissionColor") && colorPreset.emissionIntensity > 0f) { materials[i].EnableKeyword("_EMISSION"); materials[i].SetColor("_EmissionColor", colorPreset.color * colorPreset.emissionIntensity); } else if (materials[i].HasProperty("_EmissionColor")) { materials[i].DisableKeyword("_EMISSION"); } } affectedRenderer.materials = materials; num++; } Debug.Log((object)("Applied color preset '" + presetName + "' to " + ((Object)((Component)this).gameObject).name)); } public void ResetToOriginalMaterials() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown int num = 0; int num2 = 0; foreach (Renderer affectedRenderer in affectedRenderers) { Material[] materials = affectedRenderer.materials; for (int i = 0; i < materials.Length; i++) { if (num2 < originalMaterials.Count) { materials[i] = new Material(originalMaterials[num2]); num2++; } } affectedRenderer.materials = materials; num++; } Debug.Log((object)("Reset materials on " + ((Object)((Component)this).gameObject).name + " to original state")); } public void AddColorPreset(string name, Color color, float emissionIntensity = 0f, bool affectChildren = true) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) string name2 = name; if (string.IsNullOrEmpty(name2)) { Debug.LogError((object)"Cannot add color preset: name is empty"); return; } colorPresets.RemoveAll((ColorPreset p) => p.presetName == name2); ColorPreset colorPreset = new ColorPreset { presetName = name2, color = color, emissionIntensity = emissionIntensity, affectChildren = affectChildren }; colorPresets.Add(colorPreset); if (presetLookup.ContainsKey(name2)) { presetLookup[name2] = colorPreset; } else { presetLookup.Add(name2, colorPreset); } Debug.Log((object)("Added color preset '" + name2 + "' to " + ((Object)((Component)this).gameObject).name)); } public static void ColorObject(GameObject targetObject, Color color, float emissionIntensity = 0f) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = targetObject.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] materials = val.materials; for (int j = 0; j < materials.Length; j++) { materials[j].color = color; if (materials[j].HasProperty("_EmissionColor") && emissionIntensity > 0f) { materials[j].EnableKeyword("_EMISSION"); materials[j].SetColor("_EmissionColor", color * emissionIntensity); } else if (materials[j].HasProperty("_EmissionColor")) { materials[j].DisableKeyword("_EMISSION"); } } val.materials = materials; } Debug.Log((object)("Applied color to " + ((Object)targetObject).name)); } public static ColorChanger SetupOnObject(GameObject targetObject) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) ColorChanger colorChanger = targetObject.GetComponent<ColorChanger>(); if ((Object)(object)colorChanger == (Object)null) { colorChanger = targetObject.AddComponent<ColorChanger>(); Debug.Log((object)("Added ColorChanger component to " + ((Object)targetObject).name)); } if (colorChanger.colorPresets.Count == 0) { colorChanger.AddColorPreset("Default", Color.white); colorChanger.AddColorPreset("Red", Color.red, 1.5f); colorChanger.AddColorPreset("Green", Color.green, 1.5f); colorChanger.AddColorPreset("Blue", Color.blue, 1.5f); colorChanger.AddColorPreset("Yellow", Color.yellow, 1.5f); colorChanger.AddColorPreset("Purple", new Color(0.5f, 0f, 0.5f), 1.5f); colorChanger.AddColorPreset("Glowing", Color.white, 2f); } return colorChanger; } } public class DebugLogger : MonoBehaviour { public void PrintToLog(string message) { Debug.Log((object)("[" + ((Object)((Component)this).gameObject).name + "] " + message)); } } [CreateAssetMenu(menuName = "PaintedUtils/Drop Table")] public class DropTable : ScriptableObject { public List<ItemDropper.ItemDrop> drops = new List<ItemDropper.ItemDrop>(); public List<DropTable> nestedTables; [Range(0f, 100f)] public int nestedTableChance = 50; } public class SickEffect : PaintedPostProcessingEffect { private float rotationSpeed = 0.5f; private float rotationAmount = 2f; private float currentRotation = 0f; private bool rotatingRight = true; private float originalCameraNoise; private float originalCameraShake; public SickEffect(float duration = 10f, float intensity = 1f) { base.duration = duration; base.intensity = intensity; isActive = false; } public override void ApplyEffect(PlayerAvatar player) { if (player.isLocal) { isActive = true; Debug.Log((object)("Applying Sick Effect to " + ((Object)player).name)); originalCameraNoise = GameplayManager.instance.cameraNoise; originalCameraShake = GameplayManager.instance.cameraShake; GameplayManager.instance.OverrideCameraNoise(0.5f * intensity, duration); GameplayManager.instance.OverrideCameraShake(0.3f * intensity, duration); if ((Object)(object)PostProcessing.Instance != (Object)null) { ((ParameterOverride<float>)(object)PostProcessing.Instance.colorGrading.tint).value = 20f * intensity; ((ParameterOverride)PostProcessing.Instance.colorGrading.tint).overrideState = true; ((ParameterOverride<float>)(object)PostProcessing.Instance.chromaticAberration.intensity).value = 0.5f * intensity; ((ParameterOverride)PostProcessing.Instance.chromaticAberration.intensity).overrideState = true; } } } public override void RemoveEffect(PlayerAvatar player) { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (player.isLocal) { isActive = false; GameplayManager.instance.OverrideCameraNoise(originalCameraNoise, 0.5f); GameplayManager.instance.OverrideCameraShake(originalCameraShake, 0.5f); if ((Object)(object)PostProcessing.Instance != (Object)null) { ((ParameterOverride)PostProcessing.Instance.colorGrading.tint).overrideState = false; ((ParameterOverride)PostProcessing.Instance.chromaticAberration.intensity).overrideState = false; } if ((Object)(object)GameDirector.instance != (Object)null && (Object)(object)GameDirector.instance.MainCamera != (Object)null) { ((Component)GameDirector.instance.MainCamera).transform.localRotation = Quaternion.identity; } } } public override void UpdateEffect(PlayerAvatar player) { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) if (!isActive || !player.isLocal || !((Object)(object)GameDirector.instance != (Object)null) || !((Object)(object)GameDirector.instance.MainCamera != (Object)null)) { return; } if (rotatingRight) { currentRotation += rotationSpeed * Time.deltaTime; if (currentRotation >= rotationAmount) { rotatingRight = false; } } else { currentRotation -= rotationSpeed * Time.deltaTime; if (currentRotation <= 0f - rotationAmount) { rotatingRight = true; } } ((Component)GameDirector.instance.MainCamera).transform.localRotation = Quaternion.Euler(0f, 0f, currentRotation * intensity); } } public abstract class BaseEnemyConfig { public ConfigEntry<float> Health { get; protected set; } public ConfigEntry<float> SpeedMultiplier { get; protected set; } public ConfigEntry<int> PlayerDamage { get; protected set; } public ConfigEntry<float> PlayerDamageCooldown { get; protected set; } public ConfigEntry<float> PlayerTumbleForce { get; protected set; } public ConfigEntry<float> PhysHitForce { get; protected set; } public ConfigEntry<float> PhysHitTorque { get; protected set; } public ConfigEntry<bool> PhysDestroy { get; protected set; } protected abstract void InitializeConfig(ConfigFile config); } public class EnemyConfigController : MonoBehaviour { protected ItemDropper itemDropper; protected EnemyHealth enemyHealth; protected NavMeshAgent navMeshAgent; protected List<HurtCollider> hurtColliders = new List<HurtCollider>(); protected EnemyRigidbody enemyRigidbody; protected BaseEnemyConfig config; protected virtual void Awake() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown itemDropper = ((Component)this).GetComponentInChildren<ItemDropper>(true); enemyHealth = ((Component)this).GetComponentInChildren<EnemyHealth>(true); enemyRigidbody = ((Component)this).GetComponentInChildren<EnemyRigidbody>(true); navMeshAgent = ((Component)this).GetComponentInChildren<NavMeshAgent>(true); hurtColliders.AddRange(((Component)this).GetComponentsInChildren<HurtCollider>(true)); ValidateComponents(); if ((Object)(object)enemyHealth != (Object)null) { enemyHealth.onDeath.AddListener(new UnityAction(HandleDeath)); } ApplyConfigurations(); } protected virtual void ValidateComponents() { if ((Object)(object)itemDropper == (Object)null) { Debug.LogError((object)("ItemDropper component not found on " + ((Object)((Component)this).gameObject).name + " or its children!")); } else if ((Object)(object)enemyHealth == (Object)null) { Debug.LogError((object)("EnemyHealth component not found on " + ((Object)((Component)this).gameObject).name + " or its children!")); } else if (hurtColliders.Count == 0) { Debug.LogError((object)("No HurtCollider components found on " + ((Object)((Component)this).gameObject).name + " or its children!")); } else if ((Object)(object)enemyRigidbody == (Object)null) { Debug.LogError((object)("EnemyRigidbody component not found on " + ((Object)((Component)this).gameObject).name + " or its children!")); } } protected virtual void OnDestroy() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if ((Object)(object)enemyHealth != (Object)null) { enemyHealth.onDeath.RemoveListener(new UnityAction(HandleDeath)); } } protected virtual void HandleDeath() { } protected virtual void ApplyConfigurations() { if (config == null) { return; } foreach (HurtCollider hurtCollider in hurtColliders) { hurtCollider.playerDamage = config.PlayerDamage.Value; hurtCollider.playerDamageCooldown = config.PlayerDamageCooldown.Value; hurtCollider.playerTumbleForce = config.PlayerTumbleForce.Value; hurtCollider.physHitForce = config.PhysHitForce.Value; hurtCollider.physHitTorque = config.PhysHitTorque.Value; hurtCollider.physDestroy = config.PhysDestroy.Value; } enemyHealth.health = (int)config.Health.Value; enemyRigidbody.positionSpeedIdle *= config.SpeedMultiplier.Value; enemyRigidbody.positionSpeedChase *= config.SpeedMultiplier.Value; navMeshAgent.speed *= config.SpeedMultiplier.Value; } public virtual void RefreshConfigurations() { ApplyConfigurations(); } } public class EyeStateManager : MonoBehaviour { public class EyeStateData { public float Timer; public bool IsSpeaking; public bool IsInitialized; public Color EyeColor; public Color PupilColor; public float LightIntensity; public bool EyeColorRGB = false; public bool PupilColorRGB = false; public float RGBCycleSpeed = 0.5f; public float PupilSize = 3f; private float eyeHue = 0f; private float pupilHue = 0f; public void UpdateRGBColors() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (EyeColorRGB) { eyeHue = (eyeHue + Time.deltaTime * RGBCycleSpeed) % 1f; EyeColor = Color.HSVToRGB(eyeHue, 1f, 1f); } if (PupilColorRGB) { pupilHue = (pupilHue + Time.deltaTime * RGBCycleSpeed) % 1f; PupilColor = Color.HSVToRGB(pupilHue, 1f, 1f); } } } [CompilerGenerated] private sealed class <InitializeSpeakingState>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string playerName; public EyeStateManager <>4__this; private EyeStateData <data>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitializeSpeakingState>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <data>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.activeStates.TryGetValue(playerName, out <data>5__1)) { <data>5__1.IsInitialized = 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(); } } private static EyeStateManager? instance; private Dictionary<string, EyeStateData> activeStates = new Dictionary<string, EyeStateData>(); public static EyeStateManager Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { GameObject val = new GameObject("EyeStateManager"); instance = val.AddComponent<EyeStateManager>(); Object.DontDestroyOnLoad((Object)(object)val); } return instance; } } private void Update() { foreach (KeyValuePair<string, EyeStateData> item in activeStates.ToList()) { string key = item.Key; EyeStateData value = item.Value; if (value.Timer > 0f) { value.Timer -= Time.deltaTime; if (value.Timer <= 0f) { ResetEyes(key); activeStates.Remove(key); continue; } } if (value.IsInitialized && (value.EyeColorRGB || value.PupilColorRGB)) { value.UpdateRGBColors(); ApplyEyeState(key, value); } } } public void SetEyeState(string playerName, Color eyeColor, Color pupilColor, float lightIntensity, float duration = 0f, bool eyeColorRGB = false, bool pupilColorRGB = false, float pupilSize = 3f) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) EyeStateData eyeStateData = new EyeStateData { Timer = duration, IsSpeaking = true, IsInitialized = false, EyeColor = eyeColor, PupilColor = pupilColor, LightIntensity = lightIntensity, EyeColorRGB = eyeColorRGB, PupilColorRGB = pupilColorRGB, PupilSize = pupilSize }; activeStates[playerName] = eyeStateData; ApplyEyeState(playerName, eyeStateData); ((MonoBehaviour)this).StartCoroutine(InitializeSpeakingState(playerName)); } public void ClearEyeState(string playerName) { if (activeStates.TryGetValue(playerName, out EyeStateData _)) { ResetEyes(playerName); activeStates.Remove(playerName); } } private void ApplyEyeState(string playerName, EyeStateData data) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = SemiFunc.PlayerGetFromName(playerName); if (!((Object)(object)val?.playerHealth == (Object)null)) { val.playerHealth.overrideEyeMaterialColor = data.EyeColor; val.playerHealth.overridePupilMaterialColor = data.PupilColor; val.playerHealth.overrideEyeLightColor = data.EyeColor; val.playerHealth.overrideEyeLightIntensity = data.LightIntensity; val.playerHealth.EyeMaterialOverride((EyeOverrideState)100, 0.25f, 40); PlayerAvatar playerAvatar = ChatManager.instance.playerAvatar; if (playerAvatar != null) { playerAvatar.OverridePupilSize(data.PupilSize, 4, 15f, 0.3f, 15f, 0.3f, 0.1f); } } } private void ResetEyes(string playerName) { PlayerAvatar val = SemiFunc.PlayerGetFromName(playerName); if (!((Object)(object)val?.playerHealth == (Object)null)) { val.playerHealth.EyeMaterialOverride((EyeOverrideState)0, 0.25f, 0); } } [IteratorStateMachine(typeof(<InitializeSpeakingState>d__10))] private IEnumerator InitializeSpeakingState(string playerName) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitializeSpeakingState>d__10(0) { <>4__this = this, playerName = playerName }; } public EyeStateData? GetActiveStateFor(string playerName) { if (activeStates.TryGetValue(playerName, out EyeStateData value)) { return value; } return null; } } [HarmonyPatch(typeof(PlayerHealth), "Update")] public class ForceCustomEyeStatePatch { private static void Prefix(PlayerHealth __instance) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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 ((Object)(object)__instance == (Object)null || (Object)(object)__instance.photonView == (Object)null || !__instance.photonView.IsMine) { return; } string text = __instance.playerAvatar?.playerName; if (string.IsNullOrEmpty(text)) { return; } try { EyeStateManager.EyeStateData activeStateFor = EyeStateManager.Instance.GetActiveStateFor(text); if (activeStateFor != null) { __instance.overrideEyeMaterialColor = activeStateFor.EyeColor; __instance.overridePupilMaterialColor = activeStateFor.PupilColor; __instance.overrideEyeLightColor = activeStateFor.EyeColor; __instance.overrideEyeLightIntensity = activeStateFor.LightIntensity; if (__instance.overrideEyePriority < 50) { __instance.EyeMaterialOverride((EyeOverrideState)100, 0.25f, 50); } PlayerAvatar playerAvatar = __instance.playerAvatar; if (playerAvatar != null) { playerAvatar.OverridePupilSize(activeStateFor.PupilSize, 4, 1f, 1f, 15f, 0.3f, 0.1f); } } } catch (Exception arg) { Debug.LogError((object)$"[EyeStateManager] Failed to apply eye state for {text}: {arg}"); } } } public class ItemDropper : MonoBehaviour { public enum PrefabType { NetworkPrefab, Valuable, Item } public enum DropChanceType { Weight, Percentage } [Serializable] public class ItemDrop { public GameObject itemPrefab; public int minQuantity = 1; public int maxQuantity = 1; public DropChanceType dropChanceType = DropChanceType.Weight; [Tooltip("Used when Drop Chance Type is set to Weight")] public int weight = 100; [Range(0f, 100f)] [Tooltip("Percentage chance this item will drop. Used when Drop Chance Type is set to Percentage")] public float chance = 100f; public bool guaranteed = false; public PrefabType prefabType; public Rarity rarity; } [SerializeField] private DropTable dropTable; [SerializeField] private Transform dropTarget; [SerializeField] private float dropSpreadRadius = 0.5f; [SerializeField] private bool applyForce = true; [SerializeField] private float forceStrength = 3f; [SerializeField] private int minItemTypes = 1; [SerializeField] private int maxItemTypes = 3; public DropTable DropTable => dropTable; public float DropSpreadRadius => dropSpreadRadius; public float ForceStrength => forceStrength; public void InitializeDropTable(string dropTableResourcePath) { if ((Object)(object)dropTable == (Object)null) { dropTable = Resources.Load<DropTable>(dropTableResourcePath); if (!((Object)(object)dropTable != (Object)null)) { } } } public void InitializeDropTableFromName() { if ((Object)(object)dropTable != (Object)null) { return; } string text = ((Object)((Component)this).gameObject).name; string[] array = new string[3] { "Controller", "Prefab", "(Clone)" }; string[] array2 = array; foreach (string text2 in array2) { if (text.EndsWith(text2)) { text = text.Substring(0, text.Length - text2.Length).Trim(); } } string[] array3 = new string[3] { "DropTables/" + text + "DropTable", "DropTables/" + text, "DropTables/DefaultDropTable" }; string[] array4 = array3; foreach (string dropTableResourcePath in array4) { InitializeDropTable(dropTableResourcePath); if ((Object)(object)dropTable != (Object)null) { return; } } Debug.LogWarning((object)("Could not auto-load drop table for " + ((Object)((Component)this).gameObject).name + ". Tried paths: " + string.Join(", ", array3))); } public static ItemDropper SetupDropperOnObject(GameObject targetObject, string dropTablePath, float spreadRadius = 0.5f, float force = 3f) { ItemDropper itemDropper = targetObject.GetComponent<ItemDropper>(); if ((Object)(object)itemDropper == (Object)null) { itemDropper = targetObject.AddComponent<ItemDropper>(); } itemDropper.InitializeDropTable(dropTablePath); if ((Object)(object)itemDropper.DropTable != (Object)null) { typeof(ItemDropper).GetField("dropSpreadRadius", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(itemDropper, spreadRadius); typeof(ItemDropper).GetField("forceStrength", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(itemDropper, force); } return itemDropper; } public static void DropItemsAtPosition(DropTable dropTable, Vector3 position, float dropRadius = 0.5f, float force = 3f) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)dropTable == (Object)null) { Debug.LogWarning((object)"Cannot drop items: No drop table provided to static method"); dropTable = Resources.Load<DropTable>("DropTables/DefaultDropTable"); if ((Object)(object)dropTable == (Object)null) { Debug.LogError((object)"Failed to load fallback drop table. No items will be dropped."); return; } } foreach (ItemDrop drop in dropTable.drops) { bool flag = false; if (drop.guaranteed) { flag = true; } else if (drop.dropChanceType == DropChanceType.Percentage) { flag = Random.Range(0f, 100f) < drop.chance; } if (flag) { int num = Random.Range(drop.minQuantity, drop.maxQuantity + 1); for (int i = 0; i < num; i++) { Vector3 position2 = position + Random.insideUnitSphere * dropRadius; SpawnPrefabStatic(drop, position2, force); } } } List<ItemDrop> list = dropTable.drops.FindAll((ItemDrop d) => !d.guaranteed && d.dropChanceType == DropChanceType.Weight && d.weight > 0); if (list.Count > 0) { int num2 = Mathf.Clamp(Random.Range(1, 4), 1, list.Count); for (int j = 0; j < num2; j++) { if (list.Count == 0) { break; } int num3 = 0; foreach (ItemDrop item in list) { num3 += item.weight; } int num4 = Random.Range(0, num3); int num5 = 0; int index = 0; for (int k = 0; k < list.Count; k++) { num5 += list[k].weight; if (num4 < num5) { index = k; break; } } ItemDrop itemDrop = list[index]; list.RemoveAt(index); int num6 = Random.Range(itemDrop.minQuantity, itemDrop.maxQuantity + 1); for (int l = 0; l < num6; l++) { Vector3 position3 = position + Random.insideUnitSphere * dropRadius; SpawnPrefabStatic(itemDrop, position3, force); } } } if (dropTable.nestedTables != null && dropTable.nestedTables.Count > 0 && Random.Range(0, 100) < dropTable.nestedTableChance) { int index2 = Random.Range(0, dropTable.nestedTables.Count); DropTable dropTable2 = dropTable.nestedTables[index2]; if ((Object)(object)dropTable2 != (Object)null) { DropItemsAtPosition(dropTable2, position, dropRadius, force); } } } public static void DropItemsAtPosition(string dropTableResourcePath, Vector3 position, float dropRadius = 0.5f, float force = 3f) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) DropTable dropTable = Resources.Load<DropTable>(dropTableResourcePath); DropItemsAtPosition(dropTable, position, dropRadius, force); } public static void DropItemsForGameObject(GameObject sourceObject, string dropTableResourcePath = null) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)sourceObject == (Object)null) { Debug.LogError((object)"Cannot drop items: Source GameObject is null"); return; } ItemDropper component = sourceObject.GetComponent<ItemDropper>(); if ((Object)(object)component != (Object)null && (Object)(object)component.DropTable != (Object)null) { DropItemsAtPosition(component.DropTable, sourceObject.transform.position, component.DropSpreadRadius, component.ForceStrength); } else if (!string.IsNullOrEmpty(dropTableResourcePath)) { DropItemsAtPosition(dropTableResourcePath, sourceObject.transform.position); } else { DropItemsAtPosition((DropTable)null, sourceObject.transform.position, 0.5f, 3f); } } private static void SpawnPrefabStatic(ItemDrop drop, Vector3 position, float forceStrength) { //IL_0042: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } GameObject val = null; switch (drop.prefabType) { case PrefabType.NetworkPrefab: val = NetworkPrefabs.SpawnNetworkPrefab(((Object)drop.itemPrefab).name, position, Quaternion.identity, (byte)0, (object[])null); break; case PrefabType.Valuable: val = Valuables.SpawnValuable(Valuables.GetValuableByName(((Object)drop.itemPrefab).name), position, Quaternion.identity); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not spawn Valuable: " + ((Object)drop.itemPrefab).name)); } break; case PrefabType.Item: { string text = ((Object)drop.itemPrefab).name; if (!text.StartsWith("Item ")) { text = "Item " + text; } val = NetworkPrefabs.SpawnNetworkPrefab(text, position, Quaternion.identity, (byte)0, (object[])null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not spawn Item: " + text)); } break; } } if ((Object)(object)val != (Object)null && forceStrength > 0f) { Rigidbody component = val.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.AddForce(Random.onUnitSphere * forceStrength, (ForceMode)1); } } if ((Object)(object)drop.rarity != (Object)null && (Object)(object)val != (Object)null) { RarityEffectHandle effectHandle = RarityEffectManager.TryPlayEffects(drop.rarity, position, val.transform); RarityEffectTracker rarityEffectTracker = val.AddComponent<RarityEffectTracker>(); rarityEffectTracker.effectHandle = effectHandle; } } public void DropItems() { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)this.dropTable == (Object)null) { InitializeDropTableFromName(); if ((Object)(object)this.dropTable == (Object)null) { Debug.LogWarning((object)("No drop table found for " + ((Object)((Component)this).gameObject).name)); return; } } foreach (ItemDrop drop in this.dropTable.drops) { bool flag = false; if (drop.guaranteed) { flag = true; } else if (drop.dropChanceType == DropChanceType.Percentage) { flag = Random.Range(0f, 100f) < drop.chance; } if (flag) { int num = Random.Range(drop.minQuantity, drop.maxQuantity + 1); for (int i = 0; i < num; i++) { Vector3 spreadPosition = GetSpreadPosition(((Component)this).transform.position); SpawnPrefab(drop, spreadPosition); } } } List<ItemDrop> list = this.dropTable.drops.FindAll((ItemDrop d) => !d.guaranteed && d.dropChanceType == DropChanceType.Weight && d.weight > 0); if (list.Count > 0) { int num2 = Mathf.Clamp(Random.Range(minItemTypes, maxItemTypes + 1), 1, list.Count); for (int j = 0; j < num2; j++) { if (list.Count == 0) { break; } int index = PickWeightedIndex(list); ItemDrop itemDrop = list[index]; list.RemoveAt(index); int num3 = Random.Range(itemDrop.minQuantity, itemDrop.maxQuantity + 1); for (int k = 0; k < num3; k++) { Vector3 spreadPosition2 = GetSpreadPosition(((Component)this).transform.position); SpawnPrefab(itemDrop, spreadPosition2); } } } if (this.dropTable.nestedTables != null && this.dropTable.nestedTables.Count > 0 && Random.Range(0, 100) < this.dropTable.nestedTableChance) { int index2 = Random.Range(0, this.dropTable.nestedTables.Count); DropTable dropTable = this.dropTable.nestedTables[index2]; if ((Object)(object)dropTable != (Object)null) { DropTable dropTable2 = this.dropTable; this.dropTable = dropTable; DropItems(); this.dropTable = dropTable2; } } } private Vector3 GetSpreadPosition(Vector3 center) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) return center + Random.insideUnitSphere * dropSpreadRadius; } private void SpawnPrefab(ItemDrop drop, Vector3 position) { //IL_0042: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } GameObject val = null; switch (drop.prefabType) { case PrefabType.NetworkPrefab: val = NetworkPrefabs.SpawnNetworkPrefab(((Object)drop.itemPrefab).name, position, Quaternion.identity, (byte)0, (object[])null); break; case PrefabType.Valuable: val = Valuables.SpawnValuable(Valuables.GetValuableByName(((Object)drop.itemPrefab).name), position, Quaternion.identity); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not spawn Valuable: " + ((Object)drop.itemPrefab).name)); } break; case PrefabType.Item: { string text = ((Object)drop.itemPrefab).name; if (!text.StartsWith("Item ")) { text = "Item " + text; } val = NetworkPrefabs.SpawnNetworkPrefab(text, position, Quaternion.identity, (byte)0, (object[])null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not spawn Item: " + text)); } break; } } if ((Object)(object)val != (Object)null && applyForce) { Rigidbody component = val.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.AddForce(Random.onUnitSphere * forceStrength, (ForceMode)1); } } if ((Object)(object)drop.rarity != (Object)null && (Object)(object)val != (Object)null) { RarityEffectHandle effectHandle = RarityEffectManager.TryPlayEffects(drop.rarity, position, val.transform); RarityEffectTracker rarityEffectTracker = val.AddComponent<RarityEffectTracker>(); rarityEffectTracker.effectHandle = effectHandle; } } private int PickWeightedIndex(List<ItemDrop> drops) { int num = 0; foreach (ItemDrop drop in drops) { num += drop.weight; } int num2 = Random.Range(0, num); int num3 = 0; for (int i = 0; i < drops.Count; i++) { num3 += drops[i].weight; if (num2 < num3) { return i; } } return 0; } } public interface IPhysGrabber { IItemAttributes currentlyLookingAtItemAttributes { get; } } public interface IItemAttributes { GameObject gameObject { get; } string GetDisplayName(); } public static class GameInterfaces { public static IPhysGrabber PhysGrabber { get; set; } public static void UIItemInfoText(IItemAttributes itemAttributes, string promptText) { } } [RequireComponent(typeof(Collider))] public class ItemLibrary : MonoBehaviour, IItemAttributes { [Header("Prompt Settings")] public bool enablePrompt = true; [Tooltip("Displayed when the player looks at the item.")] public string promptText = "Press E to Interact"; [Tooltip("Display name for the item")] public string displayName; [Header("Battery Settings")] public bool useBattery = false; public ItemBattery battery; [Header("Interaction Settings")] public bool allowInteraction = true; public KeyCode interactionKey = (KeyCode)101; [Header("Unity Events")] public UnityEvent onInteract; public UnityEvent onLookAt; public UnityEvent onBatteryEmpty; private bool isLookedAt = false; public string GetDisplayName() { return (!string.IsNullOrEmpty(displayName)) ? displayName : ((Object)((Component)this).gameObject).name; } private void Start() { if (useBattery && (Object)(object)battery == (Object)null) { battery = ((Component)this).GetComponent<ItemBattery>(); if (!((Object)(object)battery == (Object)null)) { } } } private void Update() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) HandleLookAt(); if (isLookedAt && allowInteraction && Input.GetKeyDown(interactionKey)) { TryUse(); } if (useBattery && (Object)(object)battery != (Object)null && battery.batteryLife <= 0f) { onBatteryEmpty.Invoke(); } } private void HandleLookAt() { if (!enablePrompt || GameInterfaces.PhysGrabber == null) { return; } if (GameInterfaces.PhysGrabber.currentlyLookingAtItemAttributes != null && (Object)(object)GameInterfaces.PhysGrabber.currentlyLookingAtItemAttributes.gameObject == (Object)(object)((Component)this).gameObject) { if (!isLookedAt) { isLookedAt = true; onLookAt.Invoke(); } GameInterfaces.UIItemInfoText(this, promptText); } else { isLookedAt = false; } } private void TryUse() { if (allowInteraction && (!useBattery || !((Object)(object)battery != (Object)null) || !(battery.batteryLife <= 0f))) { onInteract.Invoke(); } } GameObject IItemAttributes.get_gameObject() { return ((Component)this).gameObject; } } public class ItemBattery : MonoBehaviour { [Header("Battery Settings")] public float batteryLife = 100f; public float maxBatteryLife = 100f; public float drainRate = 1f; public bool isDraining = false; [Header("Events")] public UnityEvent onBatteryEmpty; public UnityEvent onBatteryDrained; public UnityEvent onBatteryRecharged; private bool wasEmpty = false; private void Update() { if (isDraining) { DrainBattery(drainRate * Time.deltaTime); } if (batteryLife <= 0f && !wasEmpty) { wasEmpty = true; UnityEvent obj = onBatteryEmpty; if (obj != null) { obj.Invoke(); } } else if (batteryLife > 0f && wasEmpty) { wasEmpty = false; } } public void DrainBattery(float amount) { if (!(batteryLife <= 0f)) { batteryLife = Mathf.Max(0f, batteryLife - amount); UnityEvent obj = onBatteryDrained; if (obj != null) { obj.Invoke(); } } } public void RechargeBattery(float amount) { batteryLife = Mathf.Min(maxBatteryLife, batteryLife + amount); UnityEvent obj = onBatteryRecharged; if (obj != null) { obj.Invoke(); } } public void SetBatteryFull() { batteryLife = maxBatteryLife; UnityEvent obj = onBatteryRecharged; if (obj != null) { obj.Invoke(); } } public float GetBatteryPercentage() { return batteryLife / maxBatteryLife; } } public class MusicalItemHandler : MonoBehaviourPunCallbacks { public enum PowerOffBehavior { None, OnDrop, OnSlamWhenNotHeld, OnSlamWhenHeld, OnSlam } public enum SkipBehavior { None, SkipWhenNotHeld, SkipWhenHeld, SkipAlways } [CompilerGenerated] private sealed class <FadeIn>d__56 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MusicalItemHandler <>4__this; private float <startVolume>5__1; private float <targetVolume>5__2; private float <elapsedTime>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeIn>d__56(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; <startVolume>5__1 = <>4__this.audioSource.volume; <targetVolume>5__2 = <>4__this.volume * <>4__this.musicVolumeMultiplier; <elapsedTime>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<elapsedTime>5__3 < <>4__this.fadeDuration) { <elapsedTime>5__3 += Time.deltaTime; <>4__this.audioSource.volume = Mathf.Lerp(<startVolume>5__1, <targetVolume>5__2, <elapsedTime>5__3 / <>4__this.fadeDuration); <>2__current = null; <>1__state = 1; return true; } <>4__this.audioSource.volume = <targetVolume>5__2; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FadeOut>d__57 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MusicalItemHandler <>4__this; private float <startVolume>5__1; private float <elapsedTime>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeOut>d__57(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; <startVolume>5__1 = <>4__this.audioSource.volume; <elapsedTime>5__2 = 0f; break; case 1: <>1__state = -1; break; } if (<elapsedTime>5__2 < <>4__this.fadeDuration) { <elapsedTime>5__2 += Time.deltaTime; <>4__this.audioSource.volume = Mathf.Lerp(<startVolume>5__1, 0f, <elapsedTime>5__2 / <>4__this.fadeDuration); <>2__current = null; <>1__state = 1; return true; } <>4__this.audioSource.volume = 0f; <>4__this.audioSource.Stop(); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <RGBCycleLight>d__58 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MusicalItemHandler <>4__this; private float <hue>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RGBCycleLight>d__58(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <hue>5__1 = 0f; break; case 1: <>1__state = -1; break; } <hue>5__1 = (<hue>5__1 + Time.deltaTime * <>4__this.rgbCycleSpeed) % 1f; if ((Object)(object)<>4__this.speakerLight != (Object)null) { <>4__this.speakerLight.color = Color.HSVToRGB(<hue>5__1, 1f, 1f); } <>2__current = null; <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <StartFirstTrackWithDelay>d__49 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MusicalItemHandler <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartFirstTrackWithDelay>d__49(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.initialTrackDelay); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.PlayTrack(<>4__this.currentTrackIndex); 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(); } } [Header("Audio")] [SerializeField] private AudioSource audioSource; [SerializeField] private TrackData? trackData; [Range(0.1f, 10f)] [Tooltip("Multiplies the base volume of the music")] public float musicVolumeMultiplier = 1f; [Tooltip("Base volume level for the music (0-1)")] [Range(0f, 1f)] [SerializeField] private float volume = 1f; [Tooltip("Duration of fade in/out effects in seconds")] [SerializeField] private float fadeDuration = 1f; public Rarity.Sound? powerOnSound; public Rarity.Sound? powerOffSound; public Rarity.Sound? skipSound; private int currentTrack = -1; private AudioSource? currentTrackSource; [Header("Effects")] public ParticleSystem? musicParticles; public ParticleSystem? impactParticles; public Light? speakerLight; public float impactParticleDuration = 2f; public float lightIntensity = 2f; [Header("Settings")] public float minMessageDelay = 8f; public float maxMessageDelay = 16f; public bool skipOnImpact = true; public bool turnOffOnHeavyImpact = true; [Tooltip("Delay in seconds before the first track starts playing after power on")] public float initialTrackDelay = 1f; private float coolDownUntilNextMessage; private float initialMessageDelay = 8f; private float musicStartDelay = 5f; public bool requireHeldForNextTrack = true; public PowerOffBehavior powerOffBehavior = PowerOffBehavior.OnSlamWhenNotHeld; public SkipBehavior skipBehavior = SkipBehavior.SkipWhenNotHeld; private PhysGrabObject? physGrabObject; private PhysGrabObjectImpactDetector? impactDetector; private bool isPlaying; private float nextMessageTime; private Coroutine fadeCoroutine; private int currentTrackIndex = 0; private Coroutine rgbCycleCoroutine; private float rgbCycleSpeed = 0.5f; private string[][] trackMessages = new string[1][] { new string[6] { "Let's get this party started!", "Time to turn up!", "Music makes the world go round!", "Feel the beat!", "Dance like nobody's watching!", "Let the music take control!" } }; public void SetTrackMessages(string[][] newMessages) { trackMessages = newMessages; } private void Start() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>(); if ((Object)(object)impactDetector != (Object)null) { impactDetector.onImpactHeavy.AddListener(new UnityAction(OnHeavyImpact)); } if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); } audioSource.volume = 0f; audioSource.spatialBlend = 1f; audioSource.rolloffMode = (AudioRolloffMode)2; audioSource.maxDistance = 50f; if ((Object)(object)musicParticles != (Object)null) { MainModule main = musicParticles.main; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).loop = true; musicParticles.Stop(true, (ParticleSystemStopBehavior)0); } if ((Object)(object)impactParticles != (Object)null) { MainModule main2 = impactParticles.main; ((MainModule)(ref main2)).playOnAwake = false; impactParticles.Stop(true, (ParticleSystemStopBehavior)0); } if ((Object)(object)speakerLight != (Object)null) { ((Component)speakerLight).gameObject.SetActive(false); } isPlaying = false; } private void OnDestroy() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if ((Object)(object)impactDetector != (Object)null) { impactDetector.onImpactHeavy.RemoveListener(new UnityAction(OnHeavyImpact)); } ClearCurrentEyeState(); } private void ClearCurrentEyeState() { string playerName = ChatManager.instance.playerAvatar.playerName; EyeStateManager.Instance.ClearEyeState(playerName); } private void Update() { if (!isPlaying || (Object)(object)trackData == (Object)null) { return; } if (Time.time >= nextMessageTime) { SendTrackMessage(); } if ((Object)(object)physGrabObject != (Object)null) { if (physGrabObject.grabbed && !isPlaying) { StartMusic(); } else if (physGrabObject.grabbed && isPlaying && Time.time >= nextMessageTime) { SendTrackMessage(); } } if (isPlaying && (Object)(object)speakerLight != (Object)null && ((Component)speakerLight).gameObject.activeSelf) { TrackMessageData trackMessageData = trackData.GetTrackData(currentTrack); if (trackMessageData != null) { speakerLight.intensity = Mathf.Lerp(speakerLight.intensity, trackMessageData.lightIntensity, Time.deltaTime * 5f); } } if (powerOffBehavior == PowerOffBehavior.OnDrop && (Object)(object)physGrabObject != (Object)null && !physGrabObject.grabbed && isPlaying) { StopMusic(); } } private void SendTrackMessage() { //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)trackData == (Object)null || (Object)(object)ChatManager.instance == (Object)null || ChatManager.instance.StateIsPossessed() || (Object)(object)physGrabObject == (Object)null || !physGrabObject.heldByLocalPlayer || (Object)(object)physGrabObject == (Object)null || !physGrabObject.grabbed) { return; } TrackMessageData trackMessageData = trackData.GetTrackData(currentTrack); if (trackMessageData == null) { return; } string randomMessage = trackData.GetRandomMessage(currentTrack); if (string.IsNullOrEmpty(randomMessage)) { return; } float messageDuration = trackData.GetMessageDuration(currentTrack, randomMessage); Color val = default(Color); ((Color)(ref val))..ctor(trackMessageData.eyeColor.r, trackMessageData.eyeColor.g, trackMessageData.eyeColor.b, 1f); Color val2 = default(Color); ((Color)(ref val2))..ctor(trackMessageData.pupilColor.r, trackMessageData.pupilColor.g, trackMessageData.pupilColor.b, 1f); val.a = 1f; val2.a = 1f; string playerName = ChatManager.instance.playerAvatar.playerName; EyeStateManager.Instance.SetEyeState(playerName, val, val2, trackMessageData.lightIntensity, messageDuration + 1f, eyeColorRGB: false, pupilColorRGB: false, trackMessageData.pupilSize); if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("SyncSpeakerEyeEffect", (RpcTarget)1, new object[6] { playerName, new float[4] { val.r, val.g, val.b, val.a }, new float[4] { val2.r, val2.g, val2.b, val2.a }, trackMessageData.lightIntensity, trackMessageData.pupilSize, messageDuration + 1f }); } string newValue = "friend"; if (SemiFunc.IsMultiplayer()) { List<PlayerAvatar> list = SemiFunc.PlayerGetAllPlayerAvatarWithinRange(10f, ((Component)this).transform.position, false, default(LayerMask)); PlayerAvatar val3 = null; float num = float.MaxValue; foreach (PlayerAvatar item in list) { if ((Object)(object)item != (Object)(object)PlayerAvatar.instance) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; val3 = item; } } } if ((Object)(object)val3 != (Object)null) { newValue = val3.playerName; } } randomMessage = randomMessage.Replace("{playerName}", newValue); ChatManager.instance.PossessChatScheduleStart(10); ChatManager.instance.PossessChat((PossessChatID)1001, randomMessage, messageDuration, val, 0f, false, 0, (UnityEvent)null); ChatManager.instance.PossessChatScheduleEnd(); nextMessageTime = Time.time + trackData.messageFrequency + Random.Range(0f - trackData.messageRandomness, trackData.messageRandomness); } private void OnHeavyImpact() { if (!isPlaying) { return; } bool flag = (Object)(object)physGrabObject != (Object)null && physGrabObject.grabbed; if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } switch (powerOffBehavior) { case PowerOffBehavior.OnSlam: StopMusic(); return; case PowerOffBehavior.OnSlamWhenHeld: if (flag) { StopMusic(); return; } break; case PowerOffBehavior.OnSlamWhenNotHeld: if (!flag) { StopMusic(); return; } break; } switch (skipBehavior) { case SkipBehavior.SkipAlways: NextTrack(); break; case SkipBehavior.SkipWhenHeld: if (flag) { NextTrack(); } break; case SkipBehavior.SkipWhenNotHeld: if (!flag) { NextTrack(); } break; } } private void OnMediumImpact() { if (!isPlaying) { return; } bool flag = (Object)(object)physGrabObject != (Object)null && physGrabObject.grabbed; if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } switch (skipBehavior) { case SkipBehavior.SkipAlways: NextTrack(); break; case SkipBehavior.SkipWhenHeld: if (flag) { NextTrack(); } break; case SkipBehavior.SkipWhenNotHeld: if (!flag) { NextTrack(); } break; } } private void OnLightImpact() { } private void StopImpactParticles() { if ((Object)(object)impactParticles != (Object)null) { impactParticles.Stop(); ((Component)impactParticles).gameObject.SetActive(false); } } public void StartMusic() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (isPlaying) { return; } if ((Object)(object)trackData == (Object)null) { Debug.LogError((object)"Cannot start music: trackData is null"); return; } isPlaying = true; if ((Object)(object)powerOnSound?.clip != (Object)null) { AudioSource.PlayClipAtPoint(powerOnSound.clip, ((Component)this).transform.position, powerOnSound.volume); if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("PlayPowerOnSoundRPC", (RpcTarget)1, Array.Empty<object>()); } } ((MonoBehaviour)this).StartCoroutine(StartFirstTrackWithDelay()); if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("StartMusicRPC", (RpcTarget)1, Array.Empty<object>()); } } [PunRPC] private void StartMusicRPC() { if (!isPlaying) { isPlaying = true; ((MonoBehaviour)this).StartCoroutine(StartFirstTrackWithDelay()); } } [IteratorStateMachine(typeof(<StartFirstTrackWithDelay>d__49))] private IEnumerator StartFirstTrackWithDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartFirstTrackWithDelay>d__49(0) { <>4__this = this }; } public void StopMusic() { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if (!isPlaying) { return; } isPlaying = false; if (SemiFunc.IsMasterClientOrSingleplayer()) { if ((Object)(object)musicParticles != (Object)null) { musicParticles.Stop(); ((Component)musicParticles).gameObject.SetActive(false); } if ((Object)(object)impactParticles != (Object)null) { ((Component)impactParticles).gameObject.SetActive(true); impactParticles.Play(); } if (rgbCycleCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(rgbCycleCoroutine); rgbCycleCoroutine = null; } } if ((Object)(object)powerOffSound?.clip != (Object)null) { AudioSource.PlayClipAtPoint(powerOffSound.clip, ((Component)this).transform.position); } if ((Object)(object)speakerLight != (Object)null) { ((Component)speakerLight).gameObject.SetActive(false); } if (fadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(fadeCoroutine); } fadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeOut()); if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("StopMusicRPC", (RpcTarget)1, Array.Empty<object>()); } } [PunRPC] private void StopMusicRPC() { if (isPlaying) { isPlaying = false; if ((Object)(object)musicParticles != (Object)null) { musicParticles.Stop(true, (ParticleSystemStopBehavior)0); ((Component)musicParticles).gameObject.SetActive(false); } if ((Object)(object)impactParticles != (Object)null) { ((Component)impactParticles).gameObject.SetActive(true); impactParticles.Play(); } if (rgbCycleCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(rgbCycleCoroutine); rgbCycleCoroutine = null; } if ((Object)(object)speakerLight != (Object)null) { ((Component)speakerLight).gameObject.SetActive(false); } if (fadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(fadeCoroutine); } fadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeOut()); } } public void ToggleMusic() { if (isPlaying) { StopMusic(); } else { StartMusic(); } } public void NextTrack() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (isPlaying && !((Object)(object)trackData == (Object)null)) { currentTrackIndex = (currentTrackIndex + 1) % trackData.tracks.Count; PlayTrack(currentTrackIndex); if ((Object)(object)skipSound?.clip != (Object)null) { AudioSource.PlayClipAtPoint(skipSound.clip, ((Component)this).transform.position); } if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)this).photonView.RPC("NextTrackRPC", (RpcTarget)1, new object[1] { currentTrackIndex }); } } } [PunRPC] private void NextTrackRPC(int trackIndex) { if (isPlaying && (Object)(object)trackData != (Object)null) { currentTrackIndex = trackIndex; PlayTrack(currentTrackIndex); } } private void PlayTrack(int index) { //IL_0238: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)trackData == (Object)null) { Debug.LogError((object)"PlayTrack failed: trackData is null"); return; } if (fadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(fadeCoroutine); } if (rgbCycleCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(rgbCycleCoroutine); } TrackMessageData trackMessageData = trackData.GetTrackData(index); if (trackMessageData == null) { Debug.LogError((object)$"PlayTrack failed: No track data found for index {index}"); return; } if (trackMessageData.sound == null) { Debug.LogError((object)$"PlayTrack failed: Track {index} has no sound data"); return; } if ((Object)(object)trackMessageData.sound.clip == (Object)null) { Debug.LogError((object)$"PlayTrack failed: Track {index} sound has no audio clip"); return; } audioSource.clip = trackMessageData.sound.clip; audioSource.loop = true; audioSource.spatialBlend = trackMessageData.sound.spatialBlend; audioSource.dopplerLevel = trackMessageData.sound.doppler; audioSource.reverbZoneMix = trackMessageData.sound.reverbMix; audioSource.Play(); fadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeIn()); if ((Object)(object)trackMessageData.trackParticles != (Object)null) { if ((Object)(object)musicParticles != (Object)null) { musicParticles.Stop(true, (ParticleSystemStopBehavior)0); ((Component)musicParticles).gameObject.SetActive(false); } ((Component)trackMessageData.trackParticles).gameObject.SetActive(true); trackMessageData.trackParticles.Play(); } else if ((Object)(object)musicParticles != (Object)null) { ((Component)musicParticles).gameObject.SetActive(true); musicParticles.Play(); } if ((Object)(object)speakerLight != (Object)null) { ((Component)speakerLight).gameObject.SetActive(true); speakerLight.color = trackMessageData.lightColor; speakerLight.intensity = 0f; if (trackMessageData.lightColorRGB) { rgbCycleCoroutine = ((MonoBehaviour)this).StartCoroutine(RGBCycleLight()); } } nextMessageTime = Time.time + trackData.messageFrequency + Random.Range(0f - trackData.messageRandomness, trackData.messageRandomness); currentTrack = index; } [IteratorStateMachine(typeof(<FadeIn>d__56))] private IEnumerator FadeIn() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeIn>d__56(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<FadeOut>d__57))] private IEnumerator FadeOut() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeOut>d__57(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<RGBCycleLight>d__58))] private IEnumerator RGBCycleLight() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RGBCycleLight>d__58(0) { <>4__this = this }; } [PunRPC] private void PlayPowerOnSoundRPC() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)powerOnSound?.clip != (Object)null) { AudioSource.PlayClipAtPoint(powerOnSound.clip, ((Component)this).transform.position, powerOnSound.volume); } } [PunRPC] private void SyncSpeakerEyeEffect(string playerName, float[] eyeRGBA, float[] pupilRGBA, float intensity, float pupilSize, float duration) { //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) Color eyeColor = default(Color); ((Color)(ref eyeColor))..ctor(eyeRGBA[0], eyeRGBA[1], eyeRGBA[2], eyeRGBA[3]); Color pupilColor = default(Color); ((Color)(ref pupilColor))..ctor(pupilRGBA[0], pupilRGBA[1], pupilRGBA[2], pupilRGBA[3]); EyeStateManager.Instance.SetEyeState(playerName, eyeColor, pupilColor, intensity, duration, eyeColorRGB: false, pupilColorRGB: false, pupilSize); } } public abstract class PaintedPostProcessingEffect { public float duration; public float intensity; public bool isActive; public abstract void ApplyEffect(PlayerAvatar player); public abstract void RemoveEffect(PlayerAvatar player); public virtual void UpdateEffect(PlayerAvatar player) { } } public class PaintedPostProcessing : MonoBehaviour { private static PaintedPostProcessing instance; private Dictionary<PlayerAvatar, List<PaintedPostProcessingEffect>> activeEffects = new Dictionary<PlayerAvatar, List<PaintedPostProcessingEffect>>(); private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } public static void ApplyEffect(PlayerAvatar player, PaintedPostProcessingEffect effect) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown PaintedPostProcessingEffect effect2 = effect; if ((Object)(object)instance == (Object)null) { GameObject val = new GameObject("PaintedPostProcessing"); instance = val.AddComponent<PaintedPostProcessing>(); } if (!instance.activeEffects.ContainsKey(player)) { instance.activeEffects[player] = new List<PaintedPostProcessingEffect>(); } PaintedPostProcessingEffect paintedPostProcessingEffect = instance.activeEffects[player].Find((PaintedPostProcessingEffect e) => e.GetType() == effect2.GetType()); if (paintedPostProcessingEffect != null) { paintedPostProcessingEffect.RemoveEffect(player); instance.activeEffects[player].Remove(paintedPostProcessingEffect); } instance.activeEffects[player].Add(effect2); effect2.ApplyEffect(player); } public static void RemoveEffect(PlayerAvatar player, PaintedPostProcessingEffect effect) { if (!((Object)(object)instance == (Object)null) && instance.activeEffects.ContainsKey(player)) { effect.RemoveEffect(player); instance.activeEffects[player].Remove(effect); } } private void Update() { foreach (KeyValuePair<PlayerAvatar, List<PaintedPostProcessingEffect>> activeEffect in activeEffects) { PaintedPostProcessingEffect[] array = activeEffect.Value.ToArray(); foreach (PaintedPostProcessingEffect paintedPostProcessingEffect in array) { if (paintedPostProcessingEffect.duration > 0f) { paintedPostProcessingEffect.duration -= Time.deltaTime; paintedPostProcessingEffect.UpdateEffect(activeEffect.Key); if (paintedPostProcessingEffect.duration <= 0f) { paintedPostProcessingEffect.RemoveEffect(activeEffect.Key); activeEffect.Value.Remove(paintedPostProcessingEffect); } } } } } } [Serializable] public class PlayerEvent : UnityEvent<PhysGrabber> { } [Serializable] public class TimerEvent { public string name; public float interval = 1f; public bool onlyWhenGrabbed = false; public PlayerEvent onTimer; } [Serializable] public class UseEvent { public string name; public bool useCustomKey = false; public KeyCode customKey = (KeyCode)101; public bool canUseWhenNotGrabbed = false; public PlayerEvent onUse; } public class PaintedUtilItemEvents : MonoBehaviour { [CompilerGenerated] private sealed class <TimerRoutine>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TimerEvent timerEvent; public PaintedUtilItemEvents <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TimerRoutine>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; if (!timerEvent.onlyWhenGrabbed || <>4__this.wasGrabbed) { ((UnityEvent<PhysGrabber>)(object)timerEvent.onTimer).Invoke(Object.FindObjectOfType<PhysGrabber>()); } break; } <>2__current = (object)new WaitForSeconds(timerEvent.interval); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Grab Events")] public PlayerEvent onGrabbed; public PlayerEvent onReleased; [Header("Use Events")] public List<UseEvent> useEvents = new List<UseEvent>(); [Header("Timer Events")] public List<TimerEvent> timerEvents = new List<TimerEvent>(); private List<Coroutine> timerCoroutines = new List<Coroutine>(); private PhysGrabObject grabObject; private bool wasGrabbed = false; private void Awake() { grabObject = ((Component)this).GetComponent<PhysGrabObject>(); if ((Object)(object)grabObject == (Object)null) { Debug.LogWarning((object)("PaintedUtilItemEvents on " + ((Object)((Component)this).gameObject).name + " requires a PhysGrabObject component!")); ((Behaviour)this).enabled = false; } else { StartAllTimers(); } } private void Update() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (grabObject.grabbedLocal != wasGrabbed) { wasGrabbed = grabObject.grabbedLocal; if (wasGrabbed) { ((UnityEvent<PhysGrabber>)(object)onGrabbed).Invoke(Object.FindObjectOfType<PhysGrabber>()); } else { ((UnityEvent<PhysGrabber>)(object)onReleased).Invoke(Object.FindObjectOfType<PhysGrabber>()); } } foreach (UseEvent useEvent in useEvents) { if (useEvent.useCustomKey ? Input.GetKeyDown(useEvent.customKey) : SemiFunc.InputDown((InputKey)2)) { if (wasGrabbed) { ((UnityEvent<PhysGrabber>)(object)useEvent.onUse).Invoke(Object.FindObjectOfType<PhysGrabber>()); } else if (useEvent.canUseWhenNotGrabbed && IsPlayerLookingAtAndInRange()) { ((UnityEvent<PhysGrabber>)(object)useEvent.onUse).Invoke(Object.FindObjectOfType<PhysGrabber>()); } } } } private bool IsPlayerLookingAtAndInRange() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) PhysGrabber val = Object.FindObjectOfType<PhysGrabber>(); if ((Object)(object)val == (Object)null) { return false; } if ((Object)(object)val.currentlyLookingAtPhysGrabObject != (Object)(object)grabObject) { return false; } float num = Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position); return num <= val.grabRange; } private void StartAllTimers() { foreach (TimerEvent timerEvent in timerEvents) { if (timerEvent.interval > 0f) { Coroutine item = ((MonoBehaviour)this).StartCoroutine(TimerRoutine(timerEvent)); timerCoroutines.Add(item); } } } [IteratorStateMachine(typeof(<TimerRoutine>d__11))] private IEnumerator TimerRoutine(TimerEvent timerEvent) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TimerRoutine>d__11(0) { <>4__this = this, timerEvent = timerEvent }; } private void OnDestroy() { foreach (Coroutine timerCoroutine in timerCoroutines) { if (timerCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(timerCoroutine); } } timerCoroutines.Clear(); } } [CreateAssetMenu(menuName = "PaintedUtils/Rarity")] public class Rarity : ScriptableObject { [Serializable] public class Sound { public AudioClip clip; public float volume = 1f; [Range(0f, 3f)] public float pitch = 1f; [Range(0f, 1f)] public float volumeRandom = 0f; [Range(0f, 1f)] public float pitchRandom = 0f; [Range(0f, 1f)] public float spatialBlend = 1f; [Range(-3f, 3f)] public float doppler = 1f; [Range(0f, 10f)] public float reverbMix = 1f; public float falloffMultiplier = 1f; public int channel = 0; } public string rarityName; public ParticleSystem spawnEffect; public bool overrideEffectColor = false; public Color overrideColor = Color.white; public bool disableEffectOnGrab = false; public Sound spawnSound; public Color uiColor = Color.white; public Sprite icon; public void InitializeAudioSource(GameObject gameObject) { AudioSource val = gameObject.AddComponent<AudioSource>(); val.clip = spawnSound.clip; val.volume = spawnSound.volume * Random.Range(1f - spawnSound.volumeRandom, 1f); val.pitch = spawnSound.pitch * Random.Range(1f - spawnSound.pitchRandom, 1f); val.spatialBlend = spawnSound.spatialBlend; val.dopplerLevel = spawnSound.doppler; val.reverbZoneMix = spawnSound.reverbMix; val.rolloffMode = (AudioRolloffMode)2; val.maxDistance = 50f * spawnSound.falloffMultiplier; val.Play(); } } public class RarityEffectHandle { public ParticleSystem particleSystem; public GameObject particleGameObject; public AudioSource audioSource; public void DisableEffects() { if ((Object)(object)particleSystem != (Object)null) { particleSystem.Stop(true, (ParticleSystemStopBehavior)0); } if ((Object)(object)particleGameObject != (Object)null) { Object.Destroy((Object)(object)particleGameObject); } } } public static class RarityEffectManager { public static RarityEffectHandle TryPlayEffects(Rarity rarity, Vector3 position, Transform parent = null) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) RarityEffectHandle rarityEffectHandle = new RarityEffectHandle(); if ((Object)(object)rarity.spawnEffect != (Object)null) { ParticleSystem val = Object.Instantiate<ParticleSystem>(rarity.spawnEffect, position, Quaternion.identity, parent); ((Component)val).transform.up = Vector3.up; val.Play(); rarityEffectHandle.particleSystem = val; rarityEffectHandle.particleGameObject = ((Component)val).gameObject; if (rarity.overrideEffectColor) { ApplyColorOverrideToEffect(((Component)val).gameObject, rarity); } if (rarity.disableEffectOnGrab && (Object)(object)parent != (Object)null) { RarityEffectTracker rarityEffectTracker = ((Component)parent).gameObject.AddComponent<RarityEffectTracker>(); rarityEffectTracker.effectHandle = rarityEffectHandle; if ((Object)(object)((Component)parent).gameObject.GetComponent<PhysGrabObject>() != (Object)null) { ((Component)parent).gameObject.AddComponent<RarityGrabEffectHandler>(); } } } if (rarity.spawnSound != null && (Object)(object)rarity.spawnSound.clip != (Object)null) { rarity.InitializeAudioSource(rarityEffectHandle.particleGameObject); } return rarityEffectHandle; } private static void ApplyColorOverrideToEffect(GameObject targetEffectInstance, Rarity rarity) { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetEffectInstance == (Object)null || (Object)(object)rarity == (Object)null) { return; } ParticleSystem[] componentsInChildren = targetEffectInstance.GetComponentsInChildren<ParticleSystem>(true); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { MainModule main = val.main; if (rarity.overrideEffectColor) { ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(rarity.overrideColor); } } } } public class RarityEffectTracker : MonoBehaviour { public RarityEffectHandle effectHandle; public void DisableRarityEffects() { effectHandle?.DisableEffects(); } } public class RarityGrabEffectHandler : MonoBehaviour { private RarityEffectTracker tracker; private PhysGrabObject grabObject; private bool wasGrabbed = false; private void Awake() { tracker = ((Component)this).GetComponent<RarityEffectTracker>(); grabObject = ((Component)this).GetComponent<PhysGrabObject>(); } private void Update() { if (!((Object)(object)tracker == (Object)null) && !((Object)(object)grabObject == (Object)null) && grabObject.grabbedLocal != wasGrabbed) { wasGrabbed = grabObject.grabbedLocal; if (wasGrabbed) { tracker.DisableRarityEffects(); } } } } [Serializable] public class TrackMessageData { public List<string> messages = new List<string>(); public Rarity.Sound? sound; [Header("Eye Effects")] [Tooltip("Color of the eyes during TTS")] public Color eyeColor = Color.white; [Tooltip("Color of the pupils during TTS")] public Color pupilColor = Color.black; [Range(0.1f, 5f)] [Tooltip("Size of the pupils during TTS")] public float pupilSize = 3f; [Header("Speaker Light")] [Tooltip("Color of the speaker light")] public Color lightColor = Color.white; [Tooltip("If true, light will cycle through rainbow colors")] public bool lightColorRGB
plugins/REPOConfig.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using MenuLib; using MenuLib.MonoBehaviors; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("REPOConfig")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.8")] [assembly: AssemblyInformationalVersion("1.1.8+3b97423c394940b61392c8a9fabb926e81d675f6")] [assembly: AssemblyProduct("REPOConfig")] [assembly: AssemblyTitle("REPOConfig")] [assembly: AssemblyVersion("1.1.8.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPOConfig { internal sealed class ConfigMenu { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static BuilderDelegate <>9__2_0; public static BuilderDelegate <>9__2_1; public static BuilderDelegate <>9__2_2; public static Action <>9__4_8; public static BuilderDelegate <>9__4_4; public static ScrollViewBuilderDelegate <>9__4_7; public static Func<ConfigEntryBase, string> <>9__5_0; public static ScrollViewBuilderDelegate <>9__5_2; public static Func<KeyValuePair<ConfigDefinition, ConfigEntryBase>, ConfigEntryBase> <>9__6_0; internal void <Initialize>b__2_0(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(48.3f, 55.5f)); } internal void <Initialize>b__2_1(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(186f, 32f)); } internal void <Initialize>b__2_2(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(126f, 86f)); } internal void <CreateModList>b__4_4(Transform mainPageParent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Save Changes", (Action)delegate { KeyValuePair<ConfigEntryBase, object>[] array = changedEntries.ToArray(); changedEntries.Clear(); KeyValuePair<ConfigEntryBase, object>[] array2 = array; for (int i = 0; i < array2.Length; i++) { KeyValuePair<ConfigEntryBase, object> keyValuePair = array2[i]; var (val2, boxedValue) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair); val2.BoxedValue = boxedValue; } }, mainPageParent, new Vector2(370f, 18f)); } internal void <CreateModList>b__4_8() { KeyValuePair<ConfigEntryBase, object>[] array = changedEntries.ToArray(); changedEntries.Clear(); KeyValuePair<ConfigEntryBase, object>[] array2 = array; for (int i = 0; i < array2.Length; i++) { KeyValuePair<ConfigEntryBase, object> keyValuePair = array2[i]; var (val2, boxedValue) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair); val2.BoxedValue = boxedValue; } } internal RectTransform <CreateModList>b__4_7(Transform scrollView) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 10f); return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val)).rectTransform; } internal string <CreateModEntries>b__5_0(ConfigEntryBase entry) { return entry.Definition.Section; } internal RectTransform <CreateModEntries>b__5_2(Transform scrollView) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 20f); return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val)).rectTransform; } internal ConfigEntryBase <GetModConfigEntries>b__6_0(KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) { return configEntry.Value; } } private static readonly Dictionary<ConfigEntryBase, object> changedEntries = new Dictionary<ConfigEntryBase, object>(); internal static REPOButton lastClickedModButton; internal static void Initialize() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown object obj = <>c.<>9__2_0; if (obj == null) { BuilderDelegate val = delegate(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(48.3f, 55.5f)); }; <>c.<>9__2_0 = val; obj = (object)val; } MenuAPI.AddElementToMainMenu((BuilderDelegate)obj); object obj2 = <>c.<>9__2_1; if (obj2 == null) { BuilderDelegate val2 = delegate(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(186f, 32f)); }; <>c.<>9__2_1 = val2; obj2 = (object)val2; } MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj2); object obj3 = <>c.<>9__2_2; if (obj3 == null) { BuilderDelegate val3 = delegate(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(126f, 86f)); }; <>c.<>9__2_2 = val3; obj3 = (object)val3; } MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj3); } private static void CreateModMenu() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown changedEntries.Clear(); lastClickedModButton = null; REPOPopupPage repoPopupPage = MenuAPI.CreateREPOPopupPage("Mods", (PresetSide)0, false, true, 0f); repoPopupPage.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Back", (Action)delegate { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (changedEntries.Count == 0) { repoPopupPage.ClosePage(true); } else { MenuAPI.OpenPopup("Unsaved Changes", Color.red, "You have unsaved changes, are you sure you want to exit?", (Action)delegate { repoPopupPage.ClosePage(true); changedEntries.Clear(); }, (Action)null); } }, parent, new Vector2(66f, 18f)); }); CreateModList(repoPopupPage); repoPopupPage.OpenPage(false); } private static void CreateModList(REPOPopupPage mainModPage) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown foreach (KeyValuePair<string, ConfigEntryBase[]> modConfigEntry in GetModConfigEntries()) { var (modName, configEntryBases) = (KeyValuePair<string, ConfigEntryBase[]>)(ref modConfigEntry); mainModPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) REPOButton modButton = MenuAPI.CreateREPOButton(modName, (Action)null, parent, default(Vector2)); if (modName.Length > 24) { REPOButton obj = modButton; Vector2 labelSize = modButton.GetLabelSize(); labelSize.x = 250f; obj.overrideButtonSize = labelSize; REPOTextScroller val = ((Component)modButton.labelTMP).gameObject.AddComponent<REPOTextScroller>(); val.maxCharacters = 24; ((MonoBehaviour)MenuManager.instance).StartCoroutine(val.Animate()); } BuilderDelegate val2 = default(BuilderDelegate); modButton.onClick = delegate { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)lastClickedModButton == (Object)(object)modButton)) { if (changedEntries.Count == 0) { OpenPage(); } else { MenuAPI.OpenPopup("Unsaved Changes", Color.red, "You have unsaved changes, are you sure you want to exit?", (Action)delegate { changedEntries.Clear(); OpenPage(); }, (Action)null); } } }; return ((REPOElement)modButton).rectTransform; void OpenPage() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_007e: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown MenuAPI.CloseAllPagesAddedOnTop(); REPOPopupPage modPage = MenuAPI.CreateREPOPopupPage(modName, (PresetSide)1, false, false, 5f); REPOPopupPage obj3 = modPage; object obj4 = <>c.<>9__4_4; if (obj4 == null) { BuilderDelegate val3 = delegate(Transform mainPageParent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Save Changes", (Action)delegate { KeyValuePair<ConfigEntryBase, object>[] array3 = changedEntries.ToArray(); changedEntries.Clear(); KeyValuePair<ConfigEntryBase, object>[] array4 = array3; for (int j = 0; j < array4.Length; j++) { KeyValuePair<ConfigEntryBase, object> keyValuePair2 = array4[j]; var (val10, boxedValue) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair2); val10.BoxedValue = boxedValue; } }, mainPageParent, new Vector2(370f, 18f)); }; <>c.<>9__4_4 = val3; obj4 = (object)val3; } obj3.AddElement((BuilderDelegate)obj4); REPOPopupPage obj5 = modPage; BuilderDelegate obj6 = val2; if (obj6 == null) { BuilderDelegate val4 = delegate(Transform mainPageParent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Revert", (Action)delegate { if (changedEntries.Count != 0) { changedEntries.Clear(); lastClickedModButton = null; modButton.onClick(); } }, mainPageParent, new Vector2(585f, 18f)); }; BuilderDelegate val5 = val4; val2 = val4; obj6 = val5; } obj5.AddElement(obj6); modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) REPOButton val8 = MenuAPI.CreateREPOButton("Reset To Default", (Action)delegate { //IL_0059: Unknown result type (might be due to invalid IL or missing references) MenuAPI.OpenPopup("Reset " + modName + "'" + (modName.ToLower().EndsWith('s') ? string.Empty : "s") + " settings?", Color.red, "Are you sure you want to reset all settings back to default?", (Action)ResetToDefault, (Action)null); }, scrollView, default(Vector2)); RectTransform rectTransform = ((REPOElement)val8).rectTransform; Rect rect = modPage.maskRectTransform.rect; ((Transform)rectTransform).localPosition = Vector2.op_Implicit(new Vector2((((Rect)(ref rect)).width - val8.GetLabelSize().x) * 0.5f, 0f)); return ((REPOElement)val8).rectTransform; }, 0f, 0f); REPOPopupPage obj7 = modPage; object obj8 = <>c.<>9__4_7; if (obj8 == null) { ScrollViewBuilderDelegate val6 = delegate(Transform scrollView) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 val7 = default(Vector2); ((Vector2)(ref val7))..ctor(0f, 10f); return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val7)).rectTransform; }; <>c.<>9__4_7 = val6; obj8 = (object)val6; } obj7.AddElementToScrollView((ScrollViewBuilderDelegate)obj8, 0f, 0f); CreateModEntries(modPage, configEntryBases); modPage.OpenPage(true); lastClickedModButton = modButton; } void ResetToDefault() { ConfigEntryBase[] array2 = configEntryBases; foreach (ConfigEntryBase obj2 in array2) { obj2.BoxedValue = obj2.DefaultValue; } changedEntries.Clear(); lastClickedModButton = null; modButton.onClick(); } }, 0f, 0f); } } private static void CreateModEntries(REPOPopupPage modPage, ConfigEntryBase[] configEntryBases) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Expected O, but got Unknown //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Expected O, but got Unknown foreach (IGrouping<string, ConfigEntryBase> group in from entry in configEntryBases group entry by entry.Definition.Section) { modPage.AddElementToScrollView((ScrollViewBuilderDelegate)((Transform scrollView) => ((REPOElement)MenuAPI.CreateREPOLabel(FixNaming(group.Key), scrollView, default(Vector2))).rectTransform), 0f, 0f); foreach (ConfigEntryBase entry2 in group) { string modName = FixNaming(entry2.Definition.Key); string description = (Entry.showDescriptions.Value ? entry2.Description.Description.Replace("\n", string.Empty) : string.Empty); ConfigEntryBase val = entry2; if (!(val is ConfigEntry<bool>)) { if (!(val is ConfigEntry<float>)) { if (!(val is ConfigEntry<int>)) { if (!(val is ConfigEntry<string>)) { if (val == null || !entry2.SettingType.IsSubclassOf(typeof(Enum))) { continue; } Type enumType = entry2.SettingType; string[] values = Enum.GetNames(enumType); modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) REPOSlider val9 = MenuAPI.CreateREPOSlider(modName, description, (Action<int>)delegate(int i) { changedEntries[entry2] = Enum.Parse(enumType, values[i]); }, scrollView, values, entry2.BoxedValue.ToString(), default(Vector2), "", "", (BarBehavior)0); if (description.Length <= 43) { return ((REPOElement)val9).rectTransform; } ((TMP_Text)val9.descriptionTMP).maxVisibleCharacters = (val9.repoTextScroller.maxCharacters = 43); val9.repoTextScroller.scrollingSpeedInSecondsPerCharacter = Entry.descriptionScrollSpeed.Value; val9.repoTextScroller.endWaitTime = (val9.repoTextScroller.initialWaitTime = 5f); val9.repoTextScroller.startWaitTime = 3f; ((TMP_Text)val9.descriptionTMP).alignment = (TextAlignmentOptions)513; ((MonoBehaviour)modPage).StartCoroutine(val9.repoTextScroller.Animate()); return ((REPOElement)val9).rectTransform; }, 0f, 0f); continue; } AcceptableValueBase acceptableValues = entry2.Description.AcceptableValues; AcceptableValueList<string> acceptableValueList = acceptableValues as AcceptableValueList<string>; if (acceptableValueList == null) { continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) REPOSlider val8 = MenuAPI.CreateREPOSlider(modName, description, (Action<string>)delegate(string s) { changedEntries[entry2] = s; }, scrollView, acceptableValueList.AcceptableValues, (string)entry2.BoxedValue, default(Vector2), "", "", (BarBehavior)0); if (description.Length <= 43) { return ((REPOElement)val8).rectTransform; } ((TMP_Text)val8.descriptionTMP).maxVisibleCharacters = (val8.repoTextScroller.maxCharacters = 43); val8.repoTextScroller.scrollingSpeedInSecondsPerCharacter = Entry.descriptionScrollSpeed.Value; val8.repoTextScroller.endWaitTime = (val8.repoTextScroller.initialWaitTime = 5f); val8.repoTextScroller.startWaitTime = 3f; ((TMP_Text)val8.descriptionTMP).alignment = (TextAlignmentOptions)513; ((MonoBehaviour)modPage).StartCoroutine(val8.repoTextScroller.Animate()); return ((REPOElement)val8).rectTransform; }, 0f, 0f); continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) int num9; int num10; int num12; if (entry2.Description.AcceptableValues is AcceptableValueRange<int> val6) { num9 = val6.MinValue; num10 = val6.MaxValue; } else { int num11 = Math.Abs((int)entry2.BoxedValue); num12 = ((num11 > 100) ? (-(num10 = num11 * 2)) : ((num11 != 0) ? (-(num10 = num11 * 3)) : (-(num10 = 100)))); num9 = num12; } string text4 = modName; string text5 = description; Action<int> obj5 = delegate(int i) { changedEntries[entry2] = i; }; num12 = (int)entry2.BoxedValue; int num13 = num9; int num14 = num10; REPOSlider val7 = MenuAPI.CreateREPOSlider(text4, text5, obj5, scrollView, default(Vector2), num13, num14, num12, "", "", (BarBehavior)0); if (description.Length <= 43) { return ((REPOElement)val7).rectTransform; } ((TMP_Text)val7.descriptionTMP).maxVisibleCharacters = (val7.repoTextScroller.maxCharacters = 43); val7.repoTextScroller.scrollingSpeedInSecondsPerCharacter = Entry.descriptionScrollSpeed.Value; val7.repoTextScroller.endWaitTime = (val7.repoTextScroller.initialWaitTime = 5f); val7.repoTextScroller.startWaitTime = 3f; ((TMP_Text)val7.descriptionTMP).alignment = (TextAlignmentOptions)513; ((MonoBehaviour)modPage).StartCoroutine(val7.repoTextScroller.Animate()); return ((REPOElement)val7).rectTransform; }, 0f, 0f); continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) int num = 2; float num2; float num3; if (entry2.Description.AcceptableValues is AcceptableValueRange<float> val4) { num2 = val4.MinValue; num3 = val4.MaxValue; num = Mathf.Max(new int[3] { GetDecimalPlaces(num2), GetDecimalPlaces(num3), GetDecimalPlaces((float)entry2.DefaultValue) }); } else { float num4 = Math.Abs((float)entry2.BoxedValue); num2 = ((num4 == 0f) ? (0f - (num3 = 100f)) : (((double)num4 <= 0.001) ? (0f - (num3 = 10f)) : (((double)num4 <= 0.01) ? (0f - (num3 = 50f)) : ((!(num4 <= 100f)) ? (0f - (num3 = num4 * 2f)) : (0f - (num3 = num4 * 3f)))))); } string text2 = modName; string text3 = description; Action<float> obj4 = delegate(float f) { changedEntries[entry2] = f; }; float num5 = (float)entry2.BoxedValue; float num6 = num2; float num7 = num3; int num8 = num; REPOSlider val5 = MenuAPI.CreateREPOSlider(text2, text3, obj4, scrollView, default(Vector2), num6, num7, num8, num5, "", "", (BarBehavior)0); if (description.Length <= 43) { return ((REPOElement)val5).rectTransform; } ((TMP_Text)val5.descriptionTMP).maxVisibleCharacters = (val5.repoTextScroller.maxCharacters = 43); val5.repoTextScroller.scrollingSpeedInSecondsPerCharacter = Entry.descriptionScrollSpeed.Value; val5.repoTextScroller.endWaitTime = (val5.repoTextScroller.initialWaitTime = 5f); val5.repoTextScroller.startWaitTime = 3f; ((TMP_Text)val5.descriptionTMP).alignment = (TextAlignmentOptions)513; ((MonoBehaviour)modPage).StartCoroutine(val5.repoTextScroller.Animate()); return ((REPOElement)val5).rectTransform; }, 0f, 0f); continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) string text = modName; Action<bool> obj3 = delegate(bool b) { changedEntries[entry2] = b; }; bool flag = (bool)entry2.BoxedValue; return ((REPOElement)MenuAPI.CreateREPOToggle(text, obj3, scrollView, default(Vector2), "ON", "OFF", flag)).rectTransform; }, 0f, 0f); } REPOPopupPage obj = modPage; object obj2 = <>c.<>9__5_2; if (obj2 == null) { ScrollViewBuilderDelegate val2 = delegate(Transform scrollView) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0f, 20f); return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val3)).rectTransform; }; <>c.<>9__5_2 = val2; obj2 = (object)val2; } obj.AddElementToScrollView((ScrollViewBuilderDelegate)obj2, 0f, 0f); } } private static Dictionary<string, ConfigEntryBase[]> GetModConfigEntries() { Dictionary<string, ConfigEntryBase[]> dictionary = new Dictionary<string, ConfigEntryBase[]>(); foreach (PluginInfo value in Chainloader.PluginInfos.Values) { List<ConfigEntryBase> list = new List<ConfigEntryBase>(); foreach (ConfigEntryBase item in ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)value.Instance.Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) => configEntry.Value)) { ConfigDescription description = item.Description; object[] array = ((description != null) ? description.Tags : null); if (array == null || (!array.Contains("HideREPOConfig") && !array.Contains("HideFromREPOConfig"))) { list.Add(item); } } if (list.Count > 0) { dictionary.TryAdd(FixNaming(value.Metadata.Name), list.ToArray()); } } return dictionary; } private static string FixNaming(string input) { input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2"); input = Regex.Replace(input, "([A-Z])([A-Z][a-z])", "$1 $2"); input = Regex.Replace(input, "\\s+", " "); input = Regex.Replace(input, "([A-Z]\\.)\\s([A-Z]\\.)", "$1$2"); return input.Trim(); } private static int GetDecimalPlaces(float value) { string text = value.ToString(CultureInfo.InvariantCulture); int num = text.IndexOf('.'); if (num != -1) { string text2 = text; int num2 = num + 1; return text2.Substring(num2, text2.Length - num2).Length; } return 0; } } [BepInPlugin("nickklmao.repoconfig", "REPOConfig", "1.1.8")] [BepInDependency("nickklmao.menulib", "2.1.1")] internal sealed class Entry : BaseUnityPlugin { private const string MOD_NAME = "REPOConfig"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("REPOConfig"); internal static ConfigEntry<bool> showDescriptions; internal static ConfigEntry<float> descriptionScrollSpeed; private static ConfigEntry<bool> showInGame; private static void MenuPageMain_StartHook(Action<MenuPageMain> orig, MenuPageMain self) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) IOrderedEnumerable<Transform> orderedEnumerable = from Transform transform in (IEnumerable)((Component)self).transform where ((Object)transform).name.Contains("Menu Button") orderby transform.localPosition.y descending select transform; float num = 224f; foreach (Transform item in orderedEnumerable) { if (((Object)item).name.Contains("Quit")) { num -= 34f; } Vector3 localPosition = item.localPosition; localPosition.y = num; item.localPosition = localPosition; num -= 34f; } orig(self); } private void Awake() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) showDescriptions = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Show Descriptions", true, (ConfigDescription)null); showDescriptions.SettingChanged += delegate { REPOButton lastClickedModButton = ConfigMenu.lastClickedModButton; if (Object.op_Implicit((Object)(object)lastClickedModButton)) { ConfigMenu.lastClickedModButton = null; lastClickedModButton.onClick(); } }; descriptionScrollSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Description Scroll Speed", 0.15f, new ConfigDescription("How fast descriptions scroll. (Seconds per character)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 2f), Array.Empty<object>())); showInGame = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Show In Game", true, new ConfigDescription(string.Empty, (AcceptableValueBase)null, new object[1] { "HideFromREPOConfig" })); if (showInGame.Value) { logger.LogDebug((object)"Hooking `MenuPageMain.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageMain), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageMain>, MenuPageMain>(MenuPageMain_StartHook)); ConfigMenu.Initialize(); } } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] [Obsolete("This attribute is not used and will be removed eventually.")] public class REPOConfigEntryAttribute : Attribute { public REPOConfigEntryAttribute(string displayName) { } public REPOConfigEntryAttribute(string displayName, int min, int max, string prefix = "", string postfix = "") { } public REPOConfigEntryAttribute(string displayName, float min, float max, string prefix = "", string postfix = "") { } public REPOConfigEntryAttribute(string displayName, float min, float max, int precision = 2, string prefix = "", string postfix = "") { } public REPOConfigEntryAttribute(string displayName, string prefix = "", string postfix = "") { } public REPOConfigEntryAttribute(string displayName, params string[] customOptions) { } } }
plugins/REPOLib.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Commands; using REPOLib.Extensions; using REPOLib.Modules; using REPOLib.Objects; using REPOLib.Objects.Sdk; using REPOLib.Patches; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Zehs")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2025 Zehs")] [assembly: AssemblyDescription("Library for adding content to R.E.P.O.")] [assembly: AssemblyFileVersion("2.0.1.0")] [assembly: AssemblyInformationalVersion("2.0.1+56712f43ffba9641e36a63c6b573cff6e2791c96")] [assembly: AssemblyProduct("REPOLib")] [assembly: AssemblyTitle("REPOLib")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ZehsTeam/REPOLib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPOLib { public static class BundleLoader { private class LoadOperation { public enum State { LoadingBundle, LoadingContent } public string Path { get; } public DateTime StartTime { get; } public State CurrentState { get; set; } public bool LoadContents { get; } public Func<AssetBundle, IEnumerator>? OnBundleLoaded { get; } public AssetBundleCreateRequest BundleRequest { get; } public TimeSpan ElapsedTime => DateTime.Now - StartTime; public string FileName => System.IO.Path.GetFileNameWithoutExtension(Path); public LoadOperation(string path, Func<AssetBundle, IEnumerator>? onBundleLoaded = null, bool loadContents = true) { Path = path; StartTime = DateTime.Now; LoadContents = loadContents; OnBundleLoaded = onBundleLoaded; BundleRequest = AssetBundle.LoadFromFileAsync(path); base..ctor(); } } [StructLayout(LayoutKind.Auto)] [CompilerGenerated] private struct <>c__DisplayClass11_0 { public LoadOperation operation; } [CompilerGenerated] private sealed class <>c__DisplayClass6_0 { public Action<AssetBundle> onLoaded; } [CompilerGenerated] private sealed class <FinishLoadOperation>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadOperation operation; private <>c__DisplayClass11_0 <>8__1; private AssetBundle <bundle>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinishLoadOperation>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = default(<>c__DisplayClass11_0); <bundle>5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1.operation = operation; <>2__current = <>8__1.operation.BundleRequest; <>1__state = 1; return true; case 1: <>1__state = -1; <bundle>5__2 = <>8__1.operation.BundleRequest.assetBundle; if ((Object)(object)<bundle>5__2 == (Object)null) { Logger.LogError("Failed to load bundle " + <>8__1.operation.FileName + "!"); <FinishLoadOperation>g__Finish|11_0(ref <>8__1); return false; } if (<>8__1.operation.LoadContents) { <>2__current = LoadBundleContent(<>8__1.operation, <bundle>5__2); <>1__state = 2; return true; } goto IL_00f6; case 2: <>1__state = -1; goto IL_00f6; case 3: { <>1__state = -1; break; } IL_00f6: if (<>8__1.operation.OnBundleLoaded != null) { <>2__current = <>8__1.operation.OnBundleLoaded(<bundle>5__2); <>1__state = 3; return true; } break; } if (ConfigManager.ExtendedLogging.Value) { Logger.LogInfo($"Loaded bundle {<>8__1.operation.FileName} in {<>8__1.operation.ElapsedTime.TotalSeconds:N1}s"); } <FinishLoadOperation>g__Finish|11_0(ref <>8__1); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FinishLoadOperationsRoutine>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MonoBehaviour behaviour; private TMP_Text <text>5__2; private Action <disableLoadingUI>5__3; private float <lastUpdate>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinishLoadOperationsRoutine>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <text>5__2 = null; <disableLoadingUI>5__3 = null; <>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; LoadOperation[] array = _operations.ToArray(); foreach (LoadOperation operation in array) { behaviour.StartCoroutine(FinishLoadOperation(operation)); } (TMP_Text, Action) tuple = SetupLoadingUI(); <text>5__2 = tuple.Item1; <disableLoadingUI>5__3 = tuple.Item2; <lastUpdate>5__4 = Time.time; break; } case 2: <>1__state = -1; break; } while (_operations.Count > 0) { if (Time.time - <lastUpdate>5__4 > 1f) { <lastUpdate>5__4 = Time.time; string arg = ((_operations.Count == 1) ? "bundle" : "bundles"); <text>5__2.text = $"REPOLib: Waiting for {_operations.Count} {arg} to load..."; if (!ConfigManager.ExtendedLogging.Value) { continue; } foreach (LoadOperation operation2 in _operations) { string text = $"Loading {operation2.FileName}: {operation2.CurrentState}"; float? num = ((operation2.CurrentState != 0) ? null : new float?(((AsyncOperation)operation2.BundleRequest).progress)); float? num2 = num; if (num2.HasValue) { text += $" {num2.Value:P0}"; } Logger.LogDebug(text); } } <>2__current = null; <>1__state = 2; return true; } Logger.LogInfo("Finished loading bundles."); <disableLoadingUI>5__3(); Utilities.SafeInvokeEvent(BundleLoader.OnAllBundlesLoaded); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadBundleContent>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadOperation operation; public AssetBundle bundle; private AssetBundleRequest <assetRequest>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadBundleContent>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <assetRequest>5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; operation.CurrentState = LoadOperation.State.LoadingContent; <assetRequest>5__2 = bundle.LoadAllAssetsAsync<ScriptableObject>(); <>2__current = <assetRequest>5__2; <>1__state = 1; return true; case 1: { <>1__state = -1; Object[] allAssets = <assetRequest>5__2.allAssets; Mod[] array = allAssets.OfType<Mod>().ToArray(); int num = array.Length; if (num <= 1) { if (num == 0) { Logger.LogError("Bundle " + operation.FileName + " contains no mods!"); return false; } Mod mod = array[0]; foreach (Content item in allAssets.OfType<Content>()) { try { item.Initialize(mod); } catch (Exception ex) { Logger.LogError($"Failed to load {item.Name} ({((object)item).GetType().Name}) from bundle {operation.FileName} ({mod.Identifier}): {ex}"); } } return false; } Logger.LogError("Bundle " + operation.FileName + " contains more than one mod!"); 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 readonly List<LoadOperation> _operations = new List<LoadOperation>(); public static event Action? OnAllBundlesLoaded; internal static void LoadAllBundles(string root, string withExtension) { Logger.LogInfo("Loading all bundles with extension " + withExtension + " from root " + root, extended: true); string[] files = Directory.GetFiles(root, "*" + withExtension, SearchOption.AllDirectories); string[] array = files; foreach (string path in array) { LoadBundleAndContent(path); } } public static void LoadBundleAndContent(string path) { LoadBundle(path, (Func<AssetBundle, IEnumerator>?)null, loadContents: true); } public static void LoadBundle(string path, Action<AssetBundle> onLoaded, bool loadContents = false) { <>c__DisplayClass6_0 CS$<>8__locals0 = new <>c__DisplayClass6_0(); CS$<>8__locals0.onLoaded = onLoaded; LoadBundle(path, (Func<AssetBundle, IEnumerator>?)OnLoaded, loadContents); [IteratorStateMachine(typeof(<>c__DisplayClass6_0.<<LoadBundle>g__OnLoaded|0>d))] IEnumerator OnLoaded(AssetBundle bundle) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <>c__DisplayClass6_0.<<LoadBundle>g__OnLoaded|0>d(0) { <>4__this = CS$<>8__locals0, bundle = bundle }; } } public static void LoadBundle(string path, Func<AssetBundle, IEnumerator>? onLoaded = null, bool loadContents = false) { Logger.LogInfo("Loading bundle at " + path + "..."); _operations.Add(new LoadOperation(path, onLoaded, loadContents)); } internal static void FinishLoadOperations(MonoBehaviour behaviour) { behaviour.StartCoroutine(FinishLoadOperationsRoutine(behaviour)); } [IteratorStateMachine(typeof(<FinishLoadOperationsRoutine>d__9))] private static IEnumerator FinishLoadOperationsRoutine(MonoBehaviour behaviour) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinishLoadOperationsRoutine>d__9(0) { behaviour = behaviour }; } private static (TMP_Text, Action) SetupLoadingUI() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("HUD Canvas"); Transform hud = val.transform.Find("HUD"); ((Component)hud).gameObject.SetActive(false); TMP_Text val2 = Object.FindObjectOfType<TMP_Text>(); TMP_Text text = Object.Instantiate<TMP_Text>(val2, val.transform); ((Object)((Component)text).gameObject).name = "REPOLibText"; ((Component)text).gameObject.SetActive(true); text.text = "REPOLib is loading bundles... Hang tight!"; ((Graphic)text).color = Color.white; text.alignment = (TextAlignmentOptions)514; RectTransform component = ((Component)text).GetComponent<RectTransform>(); component.anchoredPosition = Vector2.zero; component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; return (text, delegate { ((Component)text).gameObject.SetActive(false); ((Component)hud).gameObject.SetActive(true); }); } [IteratorStateMachine(typeof(<FinishLoadOperation>d__11))] private static IEnumerator FinishLoadOperation(LoadOperation operation) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinishLoadOperation>d__11(0) { operation = operation }; } [IteratorStateMachine(typeof(<LoadBundleContent>d__12))] private static IEnumerator LoadBundleContent(LoadOperation operation, AssetBundle bundle) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadBundleContent>d__12(0) { operation = operation, bundle = bundle }; } [Obsolete("Use LoadBundleAndContent instead")] public static void LoadBundle(string path, string relativePath) { LoadBundleAndContent(path); } [CompilerGenerated] internal static void <FinishLoadOperation>g__Finish|11_0(ref <>c__DisplayClass11_0 P_0) { _operations.Remove(P_0.operation); } } internal static class ConfigManager { public static ConfigFile ConfigFile { get; private set; } public static ConfigEntry<bool> ExtendedLogging { get; private set; } public static ConfigEntry<bool> DeveloperMode { get; private set; } public static ConfigEntry<bool> VanillaDeveloperMode { get; private set; } public static void Initialize(ConfigFile configFile) { ConfigFile = configFile; BindConfigs(); } private static void BindConfigs() { ExtendedLogging = ConfigFile.Bind<bool>("General", "ExtendedLogging", false, "Enable extended logging."); DeveloperMode = ConfigFile.Bind<bool>("General", "DeveloperMode", false, "Enable developer mode cheats for testing."); VanillaDeveloperMode = ConfigFile.Bind<bool>("General", "VanillaDeveloperMode", false, "Enable vanilla developer mode cheats for testing."); VanillaDeveloperMode.SettingChanged += delegate { SteamManagerPatch.UpdateDeveloperMode(); }; } } internal static class Logger { public static ManualLogSource ManualLogSource { get; private set; } public static void Initialize(ManualLogSource manualLogSource) { ManualLogSource = manualLogSource; } public static void LogDebug(object data, bool extended = true) { Log((LogLevel)32, data, extended); } public static void LogInfo(object data, bool extended = false) { Log((LogLevel)16, data, extended); } public static void LogWarning(object data, bool extended = false) { Log((LogLevel)4, data, extended); } public static void LogError(object data, bool extended = false) { Log((LogLevel)2, data, extended); } public static void LogFatal(object data, bool extended = false) { Log((LogLevel)1, data, extended); } public static void Log(LogLevel logLevel, object data, bool extended = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!extended || IsExtendedLoggingEnabled()) { ManualLogSource manualLogSource = ManualLogSource; if (manualLogSource != null) { manualLogSource.Log(logLevel, data); } } } public static bool IsExtendedLoggingEnabled() { if (ConfigManager.ExtendedLogging == null) { return false; } return ConfigManager.ExtendedLogging.Value; } } [BepInPlugin("REPOLib", "REPOLib", "2.0.1")] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("REPOLib"); public static Plugin Instance { get; private set; } private void Awake() { Instance = this; Logger.Initialize(Logger.CreateLogSource("REPOLib")); Logger.LogInfo("REPOLib has awoken!"); _harmony.PatchAll(typeof(RunManagerPatch)); _harmony.PatchAll(typeof(EnemyDirectorPatch)); _harmony.PatchAll(typeof(StatsManagerPatch)); _harmony.PatchAll(typeof(SemiFuncPatch)); _harmony.PatchAll(typeof(AudioManagerPatch)); _harmony.PatchAll(typeof(SteamManagerPatch)); _harmony.PatchAll(typeof(EnemyGnomeDirectorPatch)); _harmony.PatchAll(typeof(EnemyBangDirectorPatch)); ConfigManager.Initialize(((BaseUnityPlugin)this).Config); BundleLoader.LoadAllBundles(Paths.PluginPath, ".repobundle"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "REPOLib"; public const string PLUGIN_NAME = "REPOLib"; public const string PLUGIN_VERSION = "2.0.1"; } } namespace REPOLib.Patches { [HarmonyPatch(typeof(AudioManager))] internal static class AudioManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { Utilities.FixAudioMixerGroupsOnPrefabs(); } } [HarmonyPatch(typeof(EnemyBangDirector))] internal static class EnemyBangDirectorPatch { [CompilerGenerated] private sealed class <PreSetup>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EnemyBangDirector instance; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PreSetup>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (LevelGenerator.Instance.Generated) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } goto IL_004e; case 1: <>1__state = -1; goto IL_004e; case 2: { <>1__state = -1; return false; } IL_004e: <>2__current = instance.Setup(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch("Awake")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> AwakeTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(EnemyBangDirector), "Setup", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(EnemyBangDirectorPatch), "PreSetup", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { Logger.LogError("EnemyBangDirectorPatch: failed to find required methods for AwakeTranspiler."); return instructions; } List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if ((instruction.opcode == OpCodes.Call || instruction.opcode == OpCodes.Callvirt) && instruction.operand is MethodInfo methodInfo3 && methodInfo3 == methodInfo) { list.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo2)); Logger.LogDebug("EnemyBangDirectorPatch: AwakeTranspiler replaced " + methodInfo.Name + " call with " + methodInfo2.Name + "."); } else { list.Add(instruction); } } return list.AsEnumerable(); } [IteratorStateMachine(typeof(<PreSetup>d__1))] private static IEnumerator PreSetup(EnemyBangDirector instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PreSetup>d__1(0) { instance = instance }; } } [HarmonyPatch(typeof(EnemyDirector))] internal static class EnemyDirectorPatch { private static bool _alreadyRegistered; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePatch() { if (_alreadyRegistered) { foreach (EnemySetup registeredEnemy in Enemies.RegisteredEnemies) { EnemyDirector.instance.AddEnemy(registeredEnemy); } return; } Enemies.RegisterInitialEnemies(); _alreadyRegistered = true; } } [HarmonyPatch(typeof(EnemyGnomeDirector))] internal static class EnemyGnomeDirectorPatch { [CompilerGenerated] private sealed class <PreSetup>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EnemyGnomeDirector instance; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PreSetup>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (LevelGenerator.Instance.Generated) { <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } goto IL_004e; case 1: <>1__state = -1; goto IL_004e; case 2: { <>1__state = -1; return false; } IL_004e: <>2__current = instance.Setup(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch("Awake")] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> AwakeTranspiler(IEnumerable<CodeInstruction> instructions) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown MethodInfo methodInfo = AccessTools.Method(typeof(EnemyGnomeDirector), "Setup", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(EnemyGnomeDirectorPatch), "PreSetup", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { Logger.LogError("EnemyGnomeDirectorPatch: failed to find required methods for AwakeTranspiler."); return instructions; } List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if ((instruction.opcode == OpCodes.Call || instruction.opcode == OpCodes.Callvirt) && instruction.operand is MethodInfo methodInfo3 && methodInfo3 == methodInfo) { list.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo2)); Logger.LogDebug("EnemyGnomeDirectorPatch: AwakeTranspiler replaced " + methodInfo.Name + " call with " + methodInfo2.Name + "."); } else { list.Add(instruction); } } return list.AsEnumerable(); } [IteratorStateMachine(typeof(<PreSetup>d__1))] private static IEnumerator PreSetup(EnemyGnomeDirector instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PreSetup>d__1(0) { instance = instance }; } } [HarmonyPatch(typeof(RunManager))] internal static class RunManagerPatch { private static bool _patchedAwake; [HarmonyPatch("Awake")] [HarmonyPostfix] [HarmonyPriority(0)] private static void AwakePatch(RunManager __instance) { if (!_patchedAwake) { _patchedAwake = true; NetworkPrefabs.Initialize(); NetworkingEvents.Initialize(); Levels.RegisterInitialLevels(); Valuables.RegisterInitialValuables(); BundleLoader.OnAllBundlesLoaded += CommandManager.Initialize; BundleLoader.FinishLoadOperations((MonoBehaviour)(object)__instance); } } } [HarmonyPatch(typeof(SemiFunc))] internal static class SemiFuncPatch { [HarmonyPatch("Command")] [HarmonyPrefix] private static bool CommandPatch(string _command) { if (_command.StartsWith("/")) { return Command(_command); } return true; } private static bool Command(string message) { string text = message.ToLower(); string text2 = text.Split(' ')[0].Substring(1); string text3 = ""; if (text.Length > text2.Length) { text3 = text.Substring(text2.Length + 1).Trim(); } CommandManager.CommandExecutionMethods.TryGetValue(text2, out MethodInfo value); if (value != null) { CommandExecutionAttribute customAttribute = value.GetCustomAttribute<CommandExecutionAttribute>(); if (CommandManager.CommandsEnabled.TryGetValue(customAttribute.Name, out var value2) && !value2) { return false; } if (customAttribute != null && customAttribute.RequiresDeveloperMode && !ConfigManager.DeveloperMode.Value) { Logger.LogWarning("Command " + text2 + " requires developer mode to be enabled. Enable it in REPOLib.cfg"); return false; } try { ParameterInfo[] parameters = value.GetParameters(); if (parameters.Length == 0) { value.Invoke(null, null); } else { value.Invoke(null, new object[1] { text3 }); } } catch (Exception arg) { Logger.LogError($"Error executing command: {arg}"); } return false; } return true; } [HarmonyPatch("EnemySpawn")] [HarmonyPrefix] private static bool EnemySpawnPatch(ref bool __result) { if (Enemies.SpawnNextEnemiesNotDespawned > 0) { Enemies.SpawnNextEnemiesNotDespawned--; __result = true; return false; } return true; } } [HarmonyPatch(typeof(StatsManager))] internal static class StatsManagerPatch { [HarmonyPatch("RunStartStats")] [HarmonyPostfix] private static void RunStartStatsPatch() { Items.RegisterItems(); } } [HarmonyPatch(typeof(SteamManager))] internal static class SteamManagerPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] public static void AwakePatch(SteamManager __instance) { UpdateDeveloperMode(); } public static void UpdateDeveloperMode() { if (ConfigManager.VanillaDeveloperMode == null || (Object)(object)SteamManager.instance == (Object)null) { return; } bool value = ConfigManager.VanillaDeveloperMode.Value; if (SteamManager.instance.developerMode != value) { if (value) { Logger.LogInfo("Enabling vanilla developer mode."); } else { Logger.LogInfo("Disabling vanilla developer mode."); } } SteamManager.instance.developerMode = value; } } } namespace REPOLib.Objects { public class CustomPrefabPool : IPunPrefabPool { public readonly Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>(); private DefaultPool? _defaultPool; public DefaultPool DefaultPool { get { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown if (_defaultPool == null) { _defaultPool = new DefaultPool(); } return _defaultPool; } set { if (value != null) { _defaultPool = value; } } } public bool RegisterPrefab(string prefabId, GameObject prefab) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab == (Object)null) { throw new ArgumentException("CustomPrefabPool: failed to register network prefab. Prefab is null."); } if (string.IsNullOrWhiteSpace(prefabId)) { throw new ArgumentException("CustomPrefabPool: failed to register network prefab. PrefabId is invalid."); } if (ResourcesHelper.HasPrefab(prefabId)) { Logger.LogError("CustomPrefabPool: failed to register network prefab \"" + prefabId + "\". Prefab already exists in Resources with the same prefab id."); return false; } if (Prefabs.TryGetValue(prefabId, out GameObject value, ignoreKeyCase: true)) { LogLevel logLevel = (LogLevel)(((Object)(object)value == (Object)(object)prefab) ? 4 : 2); Logger.Log(logLevel, "CustomPrefabPool: failed to register network prefab \"" + prefabId + "\". There is already a prefab registered with the same prefab id."); return false; } Prefabs[prefabId] = prefab; Logger.LogDebug("CustomPrefabPool: registered network prefab \"" + prefabId + "\""); return true; } public bool HasPrefab(GameObject prefab) { if (Prefabs.ContainsValue(prefab)) { return true; } if (ResourcesHelper.HasPrefab(prefab)) { return true; } return false; } public bool HasPrefab(string prefabId) { if (Prefabs.ContainsKey(prefabId, ignoreKeyCase: true)) { return true; } if (ResourcesHelper.HasPrefab(prefabId)) { return true; } return false; } public string? GetPrefabId(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { Logger.LogError("Failed to get prefab id. GameObject is null."); return string.Empty; } return Prefabs.GetKeyOrDefault(prefab); } public GameObject? GetPrefab(string prefabId) { return Prefabs.GetValueOrDefault(prefabId, ignoreKeyCase: true); } public GameObject? Instantiate(string prefabId, Vector3 position, Quaternion rotation) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(prefabId)) { throw new ArgumentException("CustomPrefabPool: failed to spawn network prefab. PrefabId is null."); } GameObject val; if (!Prefabs.TryGetValue(prefabId, out GameObject value, ignoreKeyCase: true)) { val = DefaultPool.Instantiate(prefabId, position, rotation); if ((Object)(object)val == (Object)null) { Logger.LogError("CustomPrefabPool: failed to spawn network prefab \"" + prefabId + "\". GameObject is null."); } return val; } bool activeSelf = value.activeSelf; if (activeSelf) { value.SetActive(false); } val = Object.Instantiate<GameObject>(value, position, rotation); if (activeSelf) { value.SetActive(true); } Logger.LogInfo($"CustomPrefabPool: spawned network prefab \"{prefabId}\" at position {position}, rotation {((Quaternion)(ref rotation)).eulerAngles}", extended: true); return val; } public void Destroy(GameObject gameObject) { Object.Destroy((Object)(object)gameObject); } } public class UnityObjectNameComparer<T> : IEqualityComparer<T> where T : Object { public StringComparison ComparisonType { get; private set; } public UnityObjectNameComparer(StringComparison comparisonType = StringComparison.OrdinalIgnoreCase) { ComparisonType = comparisonType; } public bool Equals(T x, T y) { if ((Object)(object)x == (Object)(object)y) { return true; } if ((Object)(object)x == (Object)null || (Object)(object)y == (Object)null) { return false; } return ((Object)x).name.Equals(((Object)y).name, ComparisonType); } public int GetHashCode(T obj) { if (!((Object)(object)obj != (Object)null)) { return 0; } return ((Object)obj).name.GetHashCode(); } } } namespace REPOLib.Objects.Sdk { public abstract class Content : ScriptableObject { public abstract string Name { get; } public abstract void Initialize(Mod mod); } [CreateAssetMenu(menuName = "REPOLib/Enemy", order = 3, fileName = "New Enemy")] public class EnemyContent : Content { [SerializeField] private EnemySetup _setup; public EnemySetup Setup => _setup; public override string Name { get { EnemySetup setup = Setup; return ((setup != null) ? ((Object)setup).name : null) ?? string.Empty; } } public override void Initialize(Mod mod) { Enemies.RegisterEnemy(Setup); } } [CreateAssetMenu(menuName = "REPOLib/Item", order = 2, fileName = "New Item")] public class ItemContent : Content { [SerializeField] private ItemAttributes _prefab; public ItemAttributes Prefab => _prefab; public override string Name { get { ItemAttributes prefab = Prefab; return ((prefab != null) ? ((Object)prefab).name : null) ?? string.Empty; } } public override void Initialize(Mod mod) { _prefab.item.prefab = ((Component)_prefab).gameObject; Items.RegisterItem(Prefab.item); } } [CreateAssetMenu(menuName = "REPOLib/Level", order = 4, fileName = "New Level")] public class LevelContent : Content { [SerializeField] private Level _level; public Level Level => _level; public override string Name { get { Level level = Level; return ((level != null) ? ((Object)level).name : null) ?? string.Empty; } } public override void Initialize(Mod mod) { Levels.RegisterLevel(Level); } } [CreateAssetMenu(menuName = "REPOLib/Mod", order = 0, fileName = "New Mod")] public class Mod : ScriptableObject { [SerializeField] private string _name; [SerializeField] private string _author; [SerializeField] private string _version = "1.0.0"; [SerializeField] private string _description; [SerializeField] private string _websiteUrl; [SerializeField] private string[] _dependencies = new string[1] { "Zehs-REPOLib-2.0.1" }; [SerializeField] private Sprite _icon; [SerializeField] private TextAsset _readme; public string Name => _name; public string Author => _author; public string Version => _version; public string Description => _description; public string WebsiteUrl => _websiteUrl; public IReadOnlyList<string> Dependencies => _dependencies; public Sprite Icon => _icon; public TextAsset Readme => _readme; public string FullName => Author + "-" + Name; public string Identifier => Author + "-" + Name + "-" + Version; } [CreateAssetMenu(menuName = "REPOLib/Valuable", order = 1, fileName = "New Valuable")] public class ValuableContent : Content { [SerializeField] private ValuableObject _prefab; [SerializeField] private string[] _valuablePresets = new string[1] { "Valuables - Generic" }; public ValuableObject Prefab => _prefab; public IReadOnlyList<string> ValuablePresets => _valuablePresets; public override string Name { get { ValuableObject prefab = Prefab; return ((prefab != null) ? ((Object)prefab).name : null) ?? string.Empty; } } public override void Initialize(Mod mod) { Valuables.RegisterValuable(((Component)Prefab).gameObject, ValuablePresets.ToList()); } } } namespace REPOLib.Modules { public static class Enemies { internal static int SpawnNextEnemiesNotDespawned = 0; private static readonly List<EnemySetup> _enemiesToRegister = new List<EnemySetup>(); private static readonly List<EnemySetup> _enemiesRegistered = new List<EnemySetup>(); private static bool _initialEnemiesRegistered; public static IReadOnlyList<EnemySetup> AllEnemies => GetEnemies(); public static IReadOnlyList<EnemySetup> RegisteredEnemies => _enemiesRegistered; internal static void RegisterInitialEnemies() { if (_initialEnemiesRegistered) { return; } foreach (EnemySetup item in _enemiesToRegister) { RegisterEnemyWithGame(item); } _enemiesToRegister.Clear(); _initialEnemiesRegistered = true; } private static void RegisterEnemyWithGame(EnemySetup enemy) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!_enemiesRegistered.Contains(enemy) && enemy.TryGetEnemyParent(out EnemyParent enemyParent)) { if (EnemyDirector.instance.AddEnemy(enemy)) { _enemiesRegistered.Add(enemy); Logger.LogInfo($"Added enemy \"{enemyParent.enemyName}\" to difficulty {enemyParent.difficulty}", extended: true); } else { Logger.LogWarning($"Failed to add enemy \"{enemyParent.enemyName}\" to difficulty {enemyParent.difficulty}", extended: true); } } } public static void RegisterEnemy(EnemySetup enemySetup) { if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null || enemySetup.spawnObjects.Count == 0) { throw new ArgumentException("Failed to register enemy. EnemySetup or spawnObjects list is empty."); } EnemyParent enemyParent = enemySetup.GetEnemyParent(); if ((Object)(object)enemyParent == (Object)null) { Logger.LogError("Failed to register enemy \"" + ((Object)enemySetup).name + "\". No enemy prefab found in spawnObjects list."); return; } if (ResourcesHelper.HasEnemyPrefab(enemySetup)) { Logger.LogError("Failed to register enemy \"" + enemyParent.enemyName + "\". Enemy prefab already exists in Resources with the same name."); return; } if (_enemiesToRegister.Contains(enemySetup)) { Logger.LogError("Failed to register enemy \"" + enemyParent.enemyName + "\". Enemy is already registered!"); return; } foreach (GameObject distinctSpawnObject in enemySetup.GetDistinctSpawnObjects()) { foreach (EnemySetup item in _enemiesToRegister) { if (item.AnySpawnObjectsNameEqualsThatIsNotTheSameObject(distinctSpawnObject)) { Logger.LogError("Failed to register enemy \"" + enemyParent.enemyName + "\". Enemy \"" + ((Object)item).name + "\" already has a spawn object called \"" + ((Object)distinctSpawnObject).name + "\""); return; } } } foreach (GameObject distinctSpawnObject2 in enemySetup.GetDistinctSpawnObjects()) { string enemyPrefabPath = ResourcesHelper.GetEnemyPrefabPath(distinctSpawnObject2); if (!NetworkPrefabs.HasNetworkPrefab(enemyPrefabPath)) { NetworkPrefabs.RegisterNetworkPrefab(enemyPrefabPath, distinctSpawnObject2); } Utilities.FixAudioMixerGroups(distinctSpawnObject2); } if (_initialEnemiesRegistered) { RegisterEnemyWithGame(enemySetup); } else { _enemiesToRegister.Add(enemySetup); } } public static List<EnemyParent>? SpawnEnemy(EnemySetup enemySetup, Vector3 position, Quaternion rotation, bool spawnDespawned = true) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemySetup == (Object)null) { Logger.LogError("Failed to spawn enemy. EnemySetup is null."); return null; } if (!enemySetup.TryGetEnemyParent(out EnemyParent enemyParent)) { Logger.LogError("Failed to spawn enemy. EnemyParent is null."); return null; } if ((Object)(object)LevelGenerator.Instance == (Object)null) { Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\". EnemySetup instance is null."); return null; } if ((Object)(object)RunManager.instance == (Object)null) { Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\". RunManager instance is null."); return null; } if ((Object)(object)EnemyDirector.instance == (Object)null) { Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\". EnemyDirector instance is null."); return null; } List<EnemyParent> list = new List<EnemyParent>(); EnemyParent val2 = default(EnemyParent); foreach (GameObject sortedSpawnObject in enemySetup.GetSortedSpawnObjects()) { if ((Object)(object)sortedSpawnObject == (Object)null) { Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\" spawn object. GameObject is null."); continue; } string enemyPrefabPath = ResourcesHelper.GetEnemyPrefabPath(sortedSpawnObject); GameObject val = NetworkPrefabs.SpawnNetworkPrefab(enemyPrefabPath, position, rotation, 0); if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to spawn enemy \"" + enemyParent.enemyName + "\" spawn object \"" + ((Object)sortedSpawnObject).name + "\""); } else if (val.TryGetComponent<EnemyParent>(ref val2)) { list.Add(val2); if (!spawnDespawned) { SpawnNextEnemiesNotDespawned++; } val2.SetupDone = true; Enemy componentInChildren = val.GetComponentInChildren<Enemy>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.EnemyTeleported(position); } else { Logger.LogError("Enemy \"" + enemyParent.enemyName + "\" spawn object \"" + ((Object)sortedSpawnObject).name + "\" does not have an enemy component."); } LevelGenerator instance = LevelGenerator.Instance; instance.EnemiesSpawnTarget++; EnemyDirector.instance.FirstSpawnPointAdd(val2); } } if (list.Count == 0) { Logger.LogInfo("Failed to spawn enemy \"" + enemyParent.enemyName + "\". No spawn objects where spawned.", extended: true); return list; } Logger.LogInfo($"Spawned enemy \"{enemyParent.enemyName}\" at position {position}", extended: true); RunManager.instance.EnemiesSpawnedRemoveEnd(); return list; } public static IReadOnlyList<EnemySetup> GetEnemies() { if ((Object)(object)EnemyDirector.instance == (Object)null) { return Array.Empty<EnemySetup>(); } return EnemyDirector.instance.GetEnemies(); } public static bool TryGetEnemyByName(string name, [NotNullWhen(true)] out EnemySetup? enemySetup) { enemySetup = GetEnemyByName(name); return (Object)(object)enemySetup != (Object)null; } public static EnemySetup? GetEnemyByName(string name) { return EnemyDirector.instance?.GetEnemyByName(name); } public static bool TryGetEnemyThatContainsName(string name, [NotNullWhen(true)] out EnemySetup? enemySetup) { enemySetup = GetEnemyThatContainsName(name); return (Object)(object)enemySetup != (Object)null; } public static EnemySetup? GetEnemyThatContainsName(string name) { return EnemyDirector.instance?.GetEnemyThatContainsName(name); } } public static class Items { private static readonly List<Item> _itemsToRegister = new List<Item>(); private static readonly List<Item> _itemsRegistered = new List<Item>(); private static bool _initialItemsRegistered; public static IReadOnlyList<Item> AllItems => GetItems(); public static IReadOnlyList<Item> RegisteredItems => _itemsRegistered; internal static void RegisterItems() { if ((Object)(object)StatsManager.instance == (Object)null) { Logger.LogError("Failed to register items. StatsManager instance is null."); return; } Logger.LogInfo("Adding items."); foreach (Item item in _itemsToRegister) { RegisterItemWithGame(item); } _initialItemsRegistered = true; } private static void RegisterItemWithGame(Item item) { Utilities.FixAudioMixerGroups(item.prefab); if (StatsManager.instance.AddItem(item)) { if (!_itemsRegistered.Contains(item)) { _itemsRegistered.Add(item); } Logger.LogInfo("Added item \"" + item.itemName + "\"", extended: true); } else { Logger.LogWarning("Failed to add item \"" + item.itemName + "\"", extended: true); } } public static void RegisterItem(Item item) { Item item2 = item; if ((Object)(object)item2 == (Object)null) { throw new ArgumentException("Failed to register item. Item is null."); } if ((Object)(object)item2.prefab == (Object)null) { Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item prefab is null."); return; } if (item2.itemAssetName != ((Object)item2.prefab).name) { Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item itemAssetName does not match the prefab name."); return; } if (ResourcesHelper.HasItemPrefab(item2)) { Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item prefab already exists in Resources with the same name."); return; } if (_itemsToRegister.Any((Item x) => x.itemAssetName == item2.itemAssetName)) { Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item prefab already exists with the same name."); return; } if (_itemsToRegister.Contains(item2)) { Logger.LogError("Failed to register item \"" + item2.itemName + "\". Item is already registered!"); return; } string itemPrefabPath = ResourcesHelper.GetItemPrefabPath(item2); NetworkPrefabs.RegisterNetworkPrefab(itemPrefabPath, item2.prefab); _itemsToRegister.Add(item2); if (_initialItemsRegistered) { RegisterItemWithGame(item2); } } public static GameObject? SpawnItem(Item item, Vector3 position, Quaternion rotation) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null) { Logger.LogError("Failed to spawn item. Item is null."); return null; } if ((Object)(object)item.prefab == (Object)null) { Logger.LogError("Failed to spawn item. Prefab is null."); return null; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { Logger.LogError("Failed to spawn item \"" + item.itemName + "\". You are not the host."); return null; } string itemPrefabPath = ResourcesHelper.GetItemPrefabPath(item); GameObject val = NetworkPrefabs.SpawnNetworkPrefab(itemPrefabPath, position, rotation, 0); if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to spawn item \"" + item.itemName + "\""); return null; } Logger.LogInfo($"Spawned item \"{item.itemName}\" at position {position}, rotation: {((Quaternion)(ref rotation)).eulerAngles}", extended: true); return val; } public static IReadOnlyList<Item> GetItems() { if ((Object)(object)StatsManager.instance == (Object)null) { return Array.Empty<Item>(); } return StatsManager.instance.GetItems(); } public static bool TryGetItemByName(string name, [NotNullWhen(true)] out Item? item) { item = GetItemByName(name); return (Object)(object)item != (Object)null; } public static Item? GetItemByName(string name) { return StatsManager.instance?.GetItemByName(name); } public static bool TryGetItemThatContainsName(string name, [NotNullWhen(true)] out Item? item) { item = GetItemThatContainsName(name); return (Object)(object)item != (Object)null; } public static Item? GetItemThatContainsName(string name) { return StatsManager.instance?.GetItemThatContainsName(name); } } public static class Levels { private static readonly List<Level> _levelsToRegister = new List<Level>(); private static readonly List<Level> _levelsRegistered = new List<Level>(); private static bool _initialLevelsRegistered; public static IReadOnlyList<Level> AllLevels => GetLevels(); public static IReadOnlyList<Level> RegisteredLevels => _levelsRegistered; internal static void RegisterInitialLevels() { if (_initialLevelsRegistered) { return; } ValuablePresets.CacheValuablePresets(); Logger.LogInfo("Adding levels."); foreach (Level item in _levelsToRegister) { RegisterLevelWithGame(item); } _levelsToRegister.Clear(); _initialLevelsRegistered = true; } private static void RegisterLevelWithGame(Level level) { if (_levelsRegistered.Contains(level)) { return; } if (level.ValuablePresets.Count == 0) { Logger.LogWarning("Level \"" + ((Object)level).name + "\" does not have any valuable presets! Adding generic preset."); level.ValuablePresets.Add(ValuablePresets.GenericPreset); } for (int i = 0; i < level.ValuablePresets.Count; i++) { LevelValuables val = level.ValuablePresets[i]; if (ValuablePresets.AllValuablePresets.Values.Contains(val)) { continue; } if (ValuablePresets.AllValuablePresets.TryGetValue(((Object)val).name, out LevelValuables value)) { if (val.GetCombinedList().Count > 0) { Logger.LogWarning("Proxy preset \"" + ((Object)val).name + "\" in level \"" + ((Object)level).name + "\" contains valuables! This likely caused duplicate valuables to load!"); } level.ValuablePresets[i] = value; Logger.LogInfo("Replaced proxy preset \"" + ((Object)val).name + "\" in level \"" + ((Object)level).name + "\".", extended: true); } else { ValuablePresets.RegisterValuablePreset(val); Logger.LogInfo("Registered valuable preset \"" + ((Object)val).name + "\" from \"" + ((Object)level).name + "\".", extended: true); } } RunManager.instance.levels.Add(level); Logger.LogInfo("Added level \"" + ((Object)level).name + "\"", extended: true); _levelsRegistered.Add(level); } public static void RegisterLevel(Level level) { Level level2 = level; if ((Object)(object)level2 == (Object)null) { Logger.LogError("Failed to register level. Level is null."); return; } if (_levelsToRegister.Any((Level x) => ((Object)x).name.Equals(((Object)level2).name, StringComparison.OrdinalIgnoreCase))) { Logger.LogError("Failed to register level \"" + ((Object)level2).name + "\". Level already exists with the same name."); return; } if (_levelsToRegister.Contains(level2)) { Logger.LogWarning("Failed to register level \"" + ((Object)level2).name + "\". Level is already registered!"); return; } List<(GameObject, ResourcesHelper.LevelPrefabType)> list2 = (from prefab in new List<GameObject>[12] { level2.ModulesExtraction1, level2.ModulesExtraction2, level2.ModulesExtraction3, level2.ModulesNormal1, level2.ModulesNormal2, level2.ModulesNormal3, level2.ModulesPassage1, level2.ModulesPassage2, level2.ModulesPassage3, level2.ModulesDeadEnd1, level2.ModulesDeadEnd2, level2.ModulesDeadEnd3 }.SelectMany((List<GameObject> list) => list) select (prefab, ResourcesHelper.LevelPrefabType.Module)).ToList(); foreach (GameObject startRoom in level2.StartRooms) { list2.Add((startRoom, ResourcesHelper.LevelPrefabType.StartRoom)); } if ((Object)(object)level2.ConnectObject != (Object)null) { list2.Add((level2.ConnectObject, ResourcesHelper.LevelPrefabType.Other)); } if ((Object)(object)level2.BlockObject != (Object)null) { list2.Add((level2.BlockObject, ResourcesHelper.LevelPrefabType.Other)); } foreach (var item3 in list2) { GameObject item = item3.Item1; ResourcesHelper.LevelPrefabType item2 = item3.Item2; string levelPrefabPath = ResourcesHelper.GetLevelPrefabPath(level2, item, item2); if (!ResourcesHelper.HasPrefab(levelPrefabPath)) { NetworkPrefabs.RegisterNetworkPrefab(levelPrefabPath, item); Utilities.FixAudioMixerGroups(item); } } if (_initialLevelsRegistered) { RegisterLevelWithGame(level2); } else { _levelsToRegister.Add(level2); } } public static IReadOnlyList<Level> GetLevels() { if ((Object)(object)RunManager.instance == (Object)null) { return Array.Empty<Level>(); } return RunManager.instance.levels; } public static bool TryGetLevelByName(string name, [NotNullWhen(true)] out Level? level) { level = GetLevelByName(name); return (Object)(object)level != (Object)null; } public static Level? GetLevelByName(string name) { foreach (Level level in GetLevels()) { if (((Object)level).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2] { name, "Level - " + name }), StringComparison.OrdinalIgnoreCase)) { return level; } } return null; } public static bool TryGetLevelThatContainsName(string name, [NotNullWhen(true)] out Level? level) { level = GetLevelThatContainsName(name); return (Object)(object)level != (Object)null; } public static Level? GetLevelThatContainsName(string name) { foreach (Level level in GetLevels()) { if (((Object)level).name.Contains(name, StringComparison.OrdinalIgnoreCase)) { return level; } } return null; } } public static class NetworkingEvents { public static readonly byte[] ReservedEventCodes = new byte[3] { 0, 1, 2 }; private static readonly List<NetworkedEvent> _customEvents = new List<NetworkedEvent>(); public static readonly RaiseEventOptions RaiseAll = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; public static readonly RaiseEventOptions RaiseOthers = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; public static readonly RaiseEventOptions RaiseMasterClient = new RaiseEventOptions { Receivers = (ReceiverGroup)2 }; public static IReadOnlyList<NetworkedEvent> CustomEvents => _customEvents; internal static void Initialize() { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; Application.quitting += delegate { PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; }; } internal static void AddCustomEvent(NetworkedEvent networkedEvent) { if (!_customEvents.Contains(networkedEvent)) { _customEvents.Add(networkedEvent); } } private static void OnEvent(EventData photonEvent) { EventData photonEvent2 = photonEvent; _customEvents.FirstOrDefault((NetworkedEvent e) => e.EventCode == photonEvent2.Code)?.EventAction?.Invoke(photonEvent2); } internal static bool TryGetUniqueEventCode(out byte eventCode) { eventCode = 0; while (IsEventCodeTaken(eventCode) && eventCode < 200) { eventCode++; } if (eventCode > 200 || (eventCode == 200 && IsEventCodeTaken(eventCode))) { eventCode = 0; return false; } return true; } public static bool IsEventCodeTaken(byte eventCode) { if (ReservedEventCodes.Any((byte x) => x == eventCode)) { return true; } if (_customEvents.Any((NetworkedEvent x) => x.EventCode == eventCode)) { return true; } return false; } } public class NetworkedEvent { public string Name { get; private set; } public byte EventCode { get; private set; } public Action<EventData> EventAction { get; private set; } public NetworkedEvent(string name, Action<EventData> eventAction) { Name = name; EventAction = eventAction; if (NetworkingEvents.TryGetUniqueEventCode(out var eventCode)) { EventCode = eventCode; NetworkingEvents.AddCustomEvent(this); Logger.LogInfo($"Registered NetworkedEvent \"{Name}\" with event code: {EventCode}", extended: true); } else { Logger.LogError("Failed to register NetworkedEvent \"" + Name + "\". Could not get unique event code."); } } public void RaiseEvent(object eventContent, RaiseEventOptions raiseEventOptions, SendOptions sendOptions) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer()) { PhotonNetwork.RaiseEvent(EventCode, eventContent, raiseEventOptions, sendOptions); } else if ((int)raiseEventOptions.Receivers != 0) { RaiseEventSingleplayer(eventContent); } } private void RaiseEventSingleplayer(object eventContent) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (!SemiFunc.IsMultiplayer()) { EventData val = new EventData { Code = EventCode }; val.Parameters[val.CustomDataKey] = eventContent; val.Parameters[val.SenderKey] = 1; EventAction?.Invoke(val); } } } public static class NetworkPrefabs { private static CustomPrefabPool? _customPrefabPool; internal static CustomPrefabPool CustomPrefabPool { get { if (_customPrefabPool == null) { _customPrefabPool = new CustomPrefabPool(); } return _customPrefabPool; } private set { _customPrefabPool = value; } } internal static void Initialize() { if (PhotonNetwork.PrefabPool is CustomPrefabPool) { Logger.LogWarning("NetworkPrefabs failed to initialize. PhotonNetwork.PrefabPool is already a CustomPrefabPool."); return; } Logger.LogInfo("Initializing NetworkPrefabs."); Logger.LogDebug($"PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}"); IPunPrefabPool prefabPool = PhotonNetwork.PrefabPool; DefaultPool val = (DefaultPool)(object)((prefabPool is DefaultPool) ? prefabPool : null); if (val != null) { CustomPrefabPool.DefaultPool = val; } else if (!(PhotonNetwork.PrefabPool is CustomPrefabPool)) { Logger.LogWarning($"PhotonNetwork has an unknown prefab pool assigned. PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}"); } PhotonNetwork.PrefabPool = (IPunPrefabPool)(object)CustomPrefabPool; Logger.LogInfo("Replaced PhotonNetwork.PrefabPool with CustomPrefabPool."); Logger.LogDebug($"PhotonNetwork.PrefabPool = {((object)PhotonNetwork.PrefabPool).GetType()}"); Logger.LogInfo("Finished initializing NetworkPrefabs."); } public static void RegisterNetworkPrefab(GameObject prefab) { RegisterNetworkPrefab((prefab != null) ? ((Object)prefab).name : null, prefab); } public static void RegisterNetworkPrefab(string prefabId, GameObject prefab) { CustomPrefabPool.RegisterPrefab(prefabId, prefab); } public static bool HasNetworkPrefab(string prefabId) { return CustomPrefabPool.HasPrefab(prefabId); } public static GameObject? SpawnNetworkPrefab(string prefabId, Vector3 position, Quaternion rotation, byte group = 0, object[]? data = null) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(prefabId)) { Logger.LogError("Failed to spawn network prefab. PrefabId is null."); return null; } if (!HasNetworkPrefab(prefabId)) { Logger.LogError("Failed to spawn network prefab \"" + prefabId + "\". PrefabId is not registered as a network prefab."); return null; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { Logger.LogError("Failed to spawn network prefab \"" + prefabId + "\". You are not the host."); return null; } if (SemiFunc.IsMultiplayer()) { return PhotonNetwork.InstantiateRoomObject(prefabId, position, rotation, group, data); } return Object.Instantiate<GameObject>(CustomPrefabPool.GetPrefab(prefabId), position, rotation); } } public static class ResourcesHelper { public enum LevelPrefabType { Module, Other, StartRoom } public static string GetValuablesFolderPath(Type volumeType) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, but got Unknown return "Valuables/" + (int)volumeType switch { 0 => "01 Tiny", 1 => "02 Small", 2 => "03 Medium", 3 => "04 Big", 4 => "05 Wide", 5 => "06 Tall", 6 => "07 Very Tall", _ => string.Empty, }; } public static string GetItemsFolderPath() { return "Items"; } public static string GetEnemiesFolderPath() { return "Enemies"; } public static string GetLevelPrefabsFolderPath(Level level, LevelPrefabType type) { string text = type switch { LevelPrefabType.Module => "Modules", LevelPrefabType.Other => "Other", LevelPrefabType.StartRoom => "Start Room", _ => string.Empty, }; return "Level/" + level.ResourcePath + "/" + text; } public static string GetValuablePrefabPath(ValuableObject valuableObject) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)valuableObject == (Object)null) { return string.Empty; } string valuablesFolderPath = GetValuablesFolderPath(valuableObject.volumeType); return valuablesFolderPath + "/" + ((Object)((Component)valuableObject).gameObject).name; } public static string GetValuablePrefabPath(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { return string.Empty; } ValuableObject valuableObject = default(ValuableObject); if (prefab.TryGetComponent<ValuableObject>(ref valuableObject)) { return GetValuablePrefabPath(valuableObject); } return string.Empty; } public static string GetItemPrefabPath(Item item) { if ((Object)(object)item == (Object)null) { return string.Empty; } return GetItemPrefabPath(item.prefab); } public static string GetItemPrefabPath(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { return string.Empty; } string itemsFolderPath = GetItemsFolderPath(); return itemsFolderPath + "/" + ((Object)prefab).name; } public static string GetEnemyPrefabPath(EnemySetup enemySetup) { if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null) { return string.Empty; } GameObject mainSpawnObject = enemySetup.GetMainSpawnObject(); if ((Object)(object)mainSpawnObject == (Object)null) { return string.Empty; } string enemiesFolderPath = GetEnemiesFolderPath(); return enemiesFolderPath + "/" + ((Object)mainSpawnObject).name; } public static string GetEnemyPrefabPath(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { return string.Empty; } string enemiesFolderPath = GetEnemiesFolderPath(); return enemiesFolderPath + "/" + ((Object)prefab).name; } public static string GetLevelPrefabPath(Level level, GameObject prefab, LevelPrefabType type) { if ((Object)(object)prefab == (Object)null) { return string.Empty; } string levelPrefabsFolderPath = GetLevelPrefabsFolderPath(level, type); return levelPrefabsFolderPath + "/" + ((Object)prefab).name; } public static bool HasValuablePrefab(ValuableObject valuableObject) { if ((Object)(object)valuableObject == (Object)null) { return false; } string valuablePrefabPath = GetValuablePrefabPath(valuableObject); return (Object)(object)Resources.Load<GameObject>(valuablePrefabPath) != (Object)null; } public static bool HasItemPrefab(Item item) { if ((Object)(object)item == (Object)null) { return false; } string itemPrefabPath = GetItemPrefabPath(item); return (Object)(object)Resources.Load<GameObject>(itemPrefabPath) != (Object)null; } public static bool HasEnemyPrefab(EnemySetup enemySetup) { if ((Object)(object)enemySetup == (Object)null) { return false; } foreach (GameObject distinctSpawnObject in enemySetup.GetDistinctSpawnObjects()) { string enemyPrefabPath = GetEnemyPrefabPath(distinctSpawnObject); if ((Object)(object)Resources.Load<GameObject>(enemyPrefabPath) != (Object)null) { return true; } } return false; } public static bool HasPrefab(GameObject prefab) { return (Object)(object)Resources.Load<GameObject>((prefab != null) ? ((Object)prefab).name : null) != (Object)null; } public static bool HasPrefab(string prefabId) { return (Object)(object)Resources.Load<GameObject>(prefabId) != (Object)null; } } public static class Utilities { private static readonly List<GameObject> _prefabsToFix = new List<GameObject>(); private static readonly List<GameObject> _fixedPrefabs = new List<GameObject>(); internal static void FixAudioMixerGroupsOnPrefabs() { foreach (GameObject item in _prefabsToFix) { item.FixAudioMixerGroups(); _fixedPrefabs.Add(item); } _prefabsToFix.Clear(); } public static void FixAudioMixerGroups(GameObject prefab) { if (!((Object)(object)prefab == (Object)null) && !_prefabsToFix.Contains(prefab) && !_fixedPrefabs.Contains(prefab)) { if ((Object)(object)AudioManager.instance == (Object)null) { _prefabsToFix.Add(prefab); return; } prefab.FixAudioMixerGroups(); _fixedPrefabs.Add(prefab); } } internal static void SafeInvokeEvent(Action? action) { try { action?.Invoke(); } catch (Exception arg) { Logger.LogError($"Exception occured while invoking event: {arg}"); } } } public static class ValuablePresets { private static readonly Dictionary<string, LevelValuables> _valuablePresets = new Dictionary<string, LevelValuables>(); public const string GenericValuablePresetName = "Valuables - Generic"; public static IReadOnlyDictionary<string, LevelValuables> AllValuablePresets => _valuablePresets; public static LevelValuables GenericPreset => AllValuablePresets["Valuables - Generic"]; public static void CacheValuablePresets() { if ((Object)(object)RunManager.instance == (Object)null) { Logger.LogError("Failed to cache LevelValuables. RunManager instance is null."); return; } foreach (Level level in RunManager.instance.levels) { foreach (LevelValuables valuablePreset in level.ValuablePresets) { _valuablePresets.TryAdd(((Object)valuablePreset).name, valuablePreset); } } } internal static void RegisterValuablePreset(LevelValuables valuablePreset) { _valuablePresets.Add(((Object)valuablePreset).name, valuablePreset); } } public static class Valuables { private static readonly Dictionary<GameObject, List<string>> _valuablesToRegister = new Dictionary<GameObject, List<string>>(); private static readonly List<GameObject> _valuablesRegistered = new List<GameObject>(); private static bool _initialValuablesRegistered; public static IReadOnlyList<GameObject> AllValuables => GetValuables(); public static IReadOnlyList<GameObject> RegisteredValuables => _valuablesRegistered; private static IEnumerable<GameObject> PendingAndRegisteredValuables => _valuablesToRegister.Keys.Concat(_valuablesRegistered); internal static void RegisterInitialValuables() { if (_initialValuablesRegistered) { return; } Logger.LogInfo("Adding valuables to valuable presets."); foreach (GameObject key in _valuablesToRegister.Keys) { RegisterValuableWithGame(key); } _valuablesToRegister.Clear(); _initialValuablesRegistered = true; } private static void RegisterValuableWithGame(GameObject valuable) { if (_valuablesRegistered.Contains(valuable)) { return; } List<string> list = _valuablesToRegister[valuable]; if (!list.Any((string x) => ValuablePresets.AllValuablePresets.Keys.Any((string y) => x == y))) { Logger.LogWarning("Valuable \"" + ((Object)valuable).name + "\" does not have any valid valuable preset names set. Adding generic valuable preset name."); list.Add("Valuables - Generic"); } foreach (string item in list) { if (item == null || !ValuablePresets.AllValuablePresets.ContainsKey(item)) { Logger.LogWarning("Failed to add valuable \"" + ((Object)valuable).name + "\" to valuable preset \"" + item + "\". The valuable preset does not exist."); } else if (ValuablePresets.AllValuablePresets[item].AddValuable(valuable)) { _valuablesRegistered.Add(valuable); Logger.LogDebug("Added valuable \"" + ((Object)valuable).name + "\" to valuable preset \"" + item + "\""); } else { Logger.LogWarning("Failed to add valuable \"" + ((Object)valuable).name + "\" to valuable preset \"" + item + "\"", extended: true); } } } public static void RegisterValuable(GameObject prefab) { RegisterValuable(prefab, new List<string>()); } public static void RegisterValuable(GameObject prefab, List<LevelValuables> presets) { RegisterValuable(prefab, presets.Select((LevelValuables preset) => ((Object)preset).name).ToList()); } public static void RegisterValuable(GameObject prefab, List<string> presetNames) { ValuableObject valuableObject = default(ValuableObject); if ((Object)(object)prefab == (Object)null) { Logger.LogError("Failed to register valuable. Prefab is null."); } else if (!prefab.TryGetComponent<ValuableObject>(ref valuableObject)) { Logger.LogError("Failed to register valuable. Prefab does not have a ValuableObject component."); } else { RegisterValuable(valuableObject, presetNames); } } public static void RegisterValuable(ValuableObject valuableObject) { RegisterValuable(valuableObject, new List<string>()); } public static void RegisterValuable(ValuableObject valuableObject, List<LevelValuables> presets) { RegisterValuable(valuableObject, presets.Select((LevelValuables preset) => ((Object)preset).name).ToList()); } public static void RegisterValuable(ValuableObject valuableObject, List<string> presetNames) { if ((Object)(object)valuableObject == (Object)null) { Logger.LogError("Failed to register valuable. ValuableObject is null."); return; } GameObject prefab = ((Component)valuableObject).gameObject; if (presetNames == null || presetNames.Count == 0) { Logger.LogWarning("Valuable \"" + ((Object)valuableObject).name + "\" does not have any valid valuable preset names set. Adding generic valuable preset name.", extended: true); presetNames = new List<string>(1) { "Valuables - Generic" }; } if (ResourcesHelper.HasValuablePrefab(valuableObject)) { Logger.LogError("Failed to register valuable \"" + ((Object)prefab).name + "\". Valuable prefab already exists in Resources with the same name."); return; } if (PendingAndRegisteredValuables.Any((GameObject x) => ((Object)x).name.Equals(((Object)prefab).name, StringComparison.OrdinalIgnoreCase))) { Logger.LogError("Failed to register valuable \"" + ((Object)prefab).name + "\". Valuable prefab already exists with the same name."); return; } if (PendingAndRegisteredValuables.Contains(prefab)) { Logger.LogWarning("Failed to register valuable \"" + ((Object)prefab).name + "\". Valuable is already registered!"); return; } string valuablePrefabPath = ResourcesHelper.GetValuablePrefabPath(valuableObject); NetworkPrefabs.RegisterNetworkPrefab(valuablePrefabPath, prefab); Utilities.FixAudioMixerGroups(prefab); _valuablesToRegister.Add(prefab, presetNames); if (_initialValuablesRegistered) { RegisterValuableWithGame(((Component)valuableObject).gameObject); } } public static GameObject? SpawnValuable(ValuableObject valuableObject, Vector3 position, Quaternion rotation) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)valuableObject == (Object)null) { Logger.LogError("Failed to spawn valuable. ValuableObject is null."); return null; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { Logger.LogError("Failed to spawn valuable \"" + ((Object)((Component)valuableObject).gameObject).name + "\". You are not the host."); return null; } string valuablePrefabPath = ResourcesHelper.GetValuablePrefabPath(valuableObject); GameObject val = NetworkPrefabs.SpawnNetworkPrefab(valuablePrefabPath, position, rotation, 0); if ((Object)(object)val == (Object)null) { Logger.LogError("Failed to spawn valuable \"" + ((Object)((Component)valuableObject).gameObject).name + "\""); return null; } Logger.LogInfo($"Spawned valuable \"{((Object)val).name}\" at position {position}, rotation: {((Quaternion)(ref rotation)).eulerAngles}", extended: true); return val; } public static IReadOnlyList<GameObject> GetValuables() { if ((Object)(object)RunManager.instance == (Object)null) { return Array.Empty<GameObject>(); } return ValuablePresets.AllValuablePresets.Values.Select((LevelValuables levelValuables) => levelValuables.GetCombinedList()).SelectMany((List<GameObject> list) => list).Distinct() .ToList(); } public static bool TryGetValuableByName(string name, [NotNullWhen(true)] out ValuableObject? valuableObject) { valuableObject = GetValuableByName(name); return (Object)(object)valuableObject != (Object)null; } public static ValuableObject? GetValuableByName(string name) { ValuableObject result = default(ValuableObject); foreach (GameObject valuable in GetValuables()) { if (valuable.TryGetComponent<ValuableObject>(ref result) && ((Object)valuable).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2] { name, "Valuable " + name }), StringComparison.OrdinalIgnoreCase)) { return result; } } return null; } public static bool TryGetValuableThatContainsName(string name, [NotNullWhen(true)] out ValuableObject? valuableObject) { valuableObject = GetValuableThatContainsName(name); return (Object)(object)valuableObject != (Object)null; } public static ValuableObject? GetValuableThatContainsName(string name) { ValuableObject result = default(ValuableObject); foreach (GameObject valuable in GetValuables()) { if (valuable.TryGetComponent<ValuableObject>(ref result) && ((Object)valuable).name.Contains(name, StringComparison.OrdinalIgnoreCase)) { return result; } } return null; } [Obsolete("prefabId is no longer supported", true)] public static void RegisterValuable(string prefabId, GameObject prefab) { RegisterValuable(prefab); } [Obsolete("prefabId is no longer supported", true)] public static void RegisterValuable(string prefabId, GameObject prefab, List<LevelValuables> presets) { RegisterValuable(prefab, presets); } [Obsolete("prefabId is no longer supported", true)] public static void RegisterValuable(string prefabId, GameObject prefab, List<string> presetNames) { RegisterValuable(prefab, presetNames); } } } namespace REPOLib.Extensions { public static class AudioSourceExtensions { public static void FixAudioMixerGroup(this AudioSource audioSource) { audioSource.FixAudioMixerGroup(((Component)audioSource).gameObject); } public static void FixAudioMixerGroup(this AudioSource audioSource, GameObject parentObject) { if ((Object)(object)audioSource == (Object)null) { return; } string text = ((!((Object)(object)parentObject == (Object)(object)((Component)audioSource).gameObject)) ? (((Object)parentObject).name + "/" + ((Object)((Component)audioSource).gameObject).name) : ((Object)((Component)audioSource).gameObject).name); if ((Object)(object)AudioManager.instance == (Object)null) { Logger.LogWarning("Failed to fix AudioMixerGroup on GameObject \"" + text + "\". AudioManager instance is null."); return; } if ((Object)(object)audioSource.outputAudioMixerGroup == (Object)null) { Logger.LogWarning("Failed to fix AudioMixerGroup on GameObject \"" + text + "\". No AudioMixerGroup is assigned."); return; } AudioMixer val = (AudioMixer)(((Object)audioSource.outputAudioMixerGroup.audioMixer).name switch { "Master" => AudioManager.instance.MasterMixer, "Music" => AudioManager.instance.MusicMasterGroup.audioMixer, "Sound" => AudioManager.instance.SoundMasterGroup.audioMixer, "Spectate" => AudioManager.instance.MicrophoneSpectateGroup.audioMixer, _ => AudioManager.instance.SoundMasterGroup.audioMixer, }); AudioMixerGroup[] array = val.FindMatchingGroups(((Object)audioSource.outputAudioMixerGroup).name); AudioMixerGroup val2; if (array.Length >= 1) { val2 = array[0]; } else { val = AudioManager.instance.SoundMasterGroup.audioMixer; val2 = val.FindMatchingGroups("Sound Effects")[0]; Logger.LogWarning("Could not find matching AudioMixerGroup for GameObject \"" + text + "\". Using default AudioMixerGroup \"" + ((Object)val).name + "/" + ((Object)val2).name + "\"", extended: true); } audioSource.outputAudioMixerGroup = val2; Logger.LogDebug("Fixed AudioMixerGroup on GameObject \"" + text + "\". AudioMixerGroup \"" + ((Object)val).name + "/" + ((Object)val2).name + "\""); } } public static class DictionaryExtensions { public static bool TryGetKey<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value, [NotNullWhen(true)] out TKey? key) { foreach (KeyValuePair<TKey, TValue> item in dictionary) { if (object.Equals(item.Value, value)) { key = item.Key; return true; } } key = default(TKey); return false; } public static TKey? GetKeyOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value) { if (dictionary.TryGetKey(value, out TKey key)) { return key; } return default(TKey); } public static TKey? GetKeyOrDefault<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value, TKey defaultKey) { if (dictionary.TryGetKey(value, out TKey key)) { return key; } return defaultKey; } public static bool ContainsKey<T>(this Dictionary<string, T> dictionary, string key, bool ignoreKeyCase) { if (!ignoreKeyCase) { return dictionary.ContainsKey(key); } foreach (KeyValuePair<string, T> item in dictionary) { if (string.Equals(item.Key, key, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } public static bool TryGetValue<T>(this Dictionary<string, T> dictionary, string key, [NotNullWhen(true)] out T? value, bool ignoreKeyCase) { if (!ignoreKeyCase) { return dictionary.TryGetValue(key, out value); } foreach (KeyValuePair<string, T> item in dictionary) { if (string.Equals(item.Key, key, StringComparison.OrdinalIgnoreCase)) { value = item.Value; return true; } } value = default(T); return false; } public static T? GetValueOrDefault<T>(this Dictionary<string, T> dictionary, string key, bool ignoreKeyCase) { if (dictionary.TryGetValue(key, out T value, ignoreKeyCase)) { return value; } return default(T); } public static T? GetValueOrDefault<T>(this Dictionary<string, T> dictionary, string key, T defaultValue, bool ignoreKeyCase) { if (dictionary.TryGetValue(key, out T value, ignoreKeyCase)) { return value; } return defaultValue; } } public static class EnemyDirectorExtensions { public static bool HasEnemy(this EnemyDirector enemyDirector, EnemySetup enemySetup) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects.Count == 0) { return false; } EnemyParent val = default(EnemyParent); foreach (GameObject spawnObject in enemySetup.spawnObjects) { if (spawnObject.TryGetComponent<EnemyParent>(ref val) && enemyDirector.TryGetList(val.difficulty, out List<EnemySetup> list)) { return list.Contains(enemySetup); } } return false; } internal static bool AddEnemy(this EnemyDirector enemyDirector, EnemySetup enemySetup) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)enemySetup == (Object)null) { return false; } EnemyParent val = default(EnemyParent); foreach (GameObject spawnObject in enemySetup.spawnObjects) { if (spawnObject.TryGetComponent<EnemyParent>(ref val) && enemyDirector.TryGetList(val.difficulty, out List<EnemySetup> list) && !list.Contains(enemySetup)) { list.Add(enemySetup); return true; } } return false; } public static bool TryGetList(this EnemyDirector enemyDirector, Difficulty difficultyType, [NotNullWhen(true)] out List<EnemySetup>? list) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected I4, but got Unknown list = (int)difficultyType switch { 0 => enemyDirector.enemiesDifficulty1, 1 => enemyDirector.enemiesDifficulty2, 2 => enemyDirector.enemiesDifficulty3, _ => null, }; return list != null; } public static List<EnemySetup> GetEnemies(this EnemyDirector enemyDirector) { List<EnemySetup> enemiesDifficulty = enemyDirector.enemiesDifficulty1; List<EnemySetup> enemiesDifficulty2 = enemyDirector.enemiesDifficulty2; List<EnemySetup> enemiesDifficulty3 = enemyDirector.enemiesDifficulty3; List<EnemySetup> list = new List<EnemySetup>(enemiesDifficulty.Count + enemiesDifficulty2.Count + enemiesDifficulty3.Count); list.AddRange(enemiesDifficulty); list.AddRange(enemiesDifficulty2); list.AddRange(enemiesDifficulty3); return list; } public static bool TryGetEnemyByName(this EnemyDirector enemyDirector, string name, [NotNullWhen(true)] out EnemySetup? enemySetup) { enemySetup = enemyDirector.GetEnemyByName(name); return (Object)(object)enemySetup != (Object)null; } public static EnemySetup? GetEnemyByName(this EnemyDirector enemyDirector, string name) { string name2 = name; return ((IEnumerable<EnemySetup>)enemyDirector.GetEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => x.NameEquals(name2))); } public static bool TryGetEnemyThatContainsName(this EnemyDirector enemyDirector, string name, out EnemySetup enemySetup) { enemySetup = enemyDirector.GetEnemyThatContainsName(name); return (Object)(object)enemySetup != (Object)null; } public static EnemySetup GetEnemyThatContainsName(this EnemyDirector enemyDirector, string name) { string name2 = name; return ((IEnumerable<EnemySetup>)enemyDirector.GetEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => x.NameContains(name2))); } } public static class EnemySetupExtensions { public static List<GameObject> GetDistinctSpawnObjects(this EnemySetup enemySetup) { if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null) { return new List<GameObject>(); } return enemySetup.spawnObjects.Where((GameObject x) => (Object)(object)x != (Object)null).Distinct(new UnityObjectNameComparer<GameObject>()).ToList(); } public static List<GameObject> GetSortedSpawnObjects(this EnemySetup enemySetup) { if ((Object)(object)enemySetup == (Object)null || enemySetup.spawnObjects == null) { return new List<GameObject>(); } EnemyParent val = default(EnemyParent); return (from x in enemySetup.spawnObjects where (Object)(object)x != (Object)null orderby x.TryGetComponent<EnemyParent>(ref val) descending select x).ToList(); } public static GameObject? GetMainSpawnObject(this EnemySetup enemySetup) { EnemyParent? enemyParent = enemySetup.GetEnemyParent(); if (enemyParent == null) { return null; } return ((Component)enemyParent).gameObject; } public static EnemyParent? GetEnemyParent(this EnemySetup enemySetup) { EnemyParent result = default(EnemyParent); foreach (GameObject distinctSpawnObject in enemySetup.GetDistinctSpawnObjects()) { if (distinctSpawnObject.TryGetComponent<EnemyParent>(ref result)) { return result; } } return null; } public static bool TryGetEnemyParent(this EnemySetup enemySetup, [NotNullWhen(true)] out EnemyParent? enemyParent) { enemyParent = enemySetup.GetEnemyParent(); return (Object)(object)enemyParent != (Object)null; } public static bool AnySpawnObjectsNameEquals(this EnemySetup enemySetup, string name) { string name2 = name; if ((Object)(object)enemySetup == (Object)null) { return false; } return enemySetup.GetDistinctSpawnObjects().Any((GameObject x) => ((Object)x).name.Equals(name2, StringComparison.OrdinalIgnoreCase)); } public static bool AnySpawnObjectsNameEqualsThatIsNotTheSameObject(this EnemySetup enemySetup, GameObject gameObject) { GameObject gameObject2 = gameObject; if ((Object)(object)enemySetup == (Object)null || (Object)(object)gameObject2 == (Object)null) { return false; } return enemySetup.GetDistinctSpawnObjects().Any((GameObject x) => ((Object)x).name.Equals(((Object)gameObject2).name, StringComparison.OrdinalIgnoreCase) && (Object)(object)x != (Object)(object)gameObject2); } public static bool NameEquals(this EnemySetup enemySetup, string name) { if ((Object)(object)enemySetup == (Object)null) { return false; } if (((Object)enemySetup).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2] { name, "Enemy - " + name }), StringComparison.OrdinalIgnoreCase)) { return true; } if (enemySetup.TryGetEnemyParent(out EnemyParent enemyParent)) { if (enemyParent.enemyName.Equals(name, StringComparison.OrdinalIgnoreCase)) { return true; } if (((Object)((Component)enemyParent).gameObject).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2] { name, "Enemy - " + name }), StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } public static bool NameContains(this EnemySetup enemySetup, string name) { if ((Object)(object)enemySetup == (Object)null) { return false; } if (((Object)enemySetup).name.Contains(name, StringComparison.OrdinalIgnoreCase)) { return true; } if (enemySetup.TryGetEnemyParent(out EnemyParent enemyParent)) { if (enemyParent.enemyName.Contains(name, StringComparison.OrdinalIgnoreCase)) { return true; } if (((Object)((Component)enemyParent).gameObject).name.Contains(name, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } } public static class GameObjectExtensions { public static void FixAudioMixerGroups(this GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { return; } if ((Object)(object)AudioManager.instance == (Object)null) { Logger.LogWarning("Failed to fix audio mixer groups on GameObject \"" + ((Object)gameObject).name + "\". AudioManager instance is null."); return; } AudioSource[] componentsInChildren = gameObject.GetComponentsInChildren<AudioSource>(); foreach (AudioSource audioSource in componentsInChildren) { audioSource.FixAudioMixerGroup(gameObject); } } } internal static class ItemExtensions { public static bool NameEquals(this Item item, string name) { if ((Object)(object)item == (Object)null) { return false; } if (((Object)item).name.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2] { name, "Item " + name }), StringComparison.OrdinalIgnoreCase)) { return true; } if (item.itemAssetName.EqualsAny(new <>z__ReadOnlyArray<string>(new string[2] { name, "Item " + name }), StringComparison.OrdinalIgnoreCase)) { return true; } if (item.itemName.Equals(name, StringComparison.OrdinalIgnoreCase)) { return true; } return false; } public static bool NameContains(this Item item, string name) { if ((Object)(object)item == (Object)null) { return false; } if (((Object)item).name.Contains(name, StringComparison.OrdinalIgnoreCase)) { return true; } if (item.itemAssetName.Contains(name, StringComparison.OrdinalIgnoreCase)) { return true; } if (item.itemName.Contains(name, StringComparison.OrdinalIgnoreCase)) { return true; } return false; } } public static class LevelValuablesExtensions { public static bool HasValuable(this LevelValuables levelValuables, GameObject prefab) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) ValuableObject val = default(ValuableObject); if (!prefab.TryGetComponent<ValuableObject>(ref val)) { return false; } if (!levelValuables.TryGetList(val.volumeType, out List<GameObject> list)) { return false; } return list.Contains(prefab); } internal static bool AddValuable(this LevelValuables levelValuables, GameObject prefab) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) ValuableObject val = default(ValuableObject); if (!prefab.TryGetComponent<ValuableObject>(ref val)) { return false; } if (!levelValuables.TryGetList(val.volumeType, out List<GameObject> list)) { return false; } if (list.Contains(prefab)) { return false; } list.Add(prefab); return true; } public static bool TryGetList(this LevelValuables levelValuables, Type volumeType, [NotNullWhen(true)] out List<GameObject>? list) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected I4, but got Unknown list = (int)volumeType switch { 0 => levelValuables.tiny, 1 => levelValuables.small, 2 => levelValuables.medium, 3 => levelValuables.big, 4 => levelValuables.wide, 5 => levelValuables.tall, 6 => levelValuables.veryTall, _ => null, }; return list != null; } public static bool TryGetCombinedList(this LevelValuables levelValuables, out List<GameObject> list) { List<List<GameObject>> source = new List<List<GameObject>> { levelValuables.tiny, levelValuables.small, levelValuables.medium, levelValuables.big, levelValuables.wide, levelValuables.tall, levelValuables.veryTall }; list = (from x in source.SelectMany((List<GameObject> valuables) => valuables) where (Object)(object)x != (Object)null select x).Distinct().ToList(); return list != null; } public static List<GameObject> GetCombinedList(this LevelValuables levelValuables) { if (levelValuables.TryGetCombinedList(out List<GameObject> list)) { return list; } return new List<GameObject>(); } } internal static class ReflectionExtensions { public static IEnumerable<MethodInfo> SafeGetMethods(this Type type) { try { return type.GetMethods(); } catch { return Array.Empty<MethodInfo>(); } } public static T? SafeGetCustomAttribute<T>(this MethodInfo method) where T : Attribute { try { return method.GetCustomAttribute<T>(); } catch { return null; } } public static bool HasCustomAttribute<T>(this MethodInfo method) where T : Attribute { try { return method.GetCustomAttribute<T>() != null; } catch { return false; } } } public static class StatsManagerExtensions { public static bool HasItem(this StatsManager statsManager, Item item) { if ((Object)(object)item == (Object)null) { return false; } return statsManager.itemDictionary.ContainsKey(item.itemAssetName); } internal static bool AddItem(this StatsManager statsManager, Item item) { if (!statsManager.itemDictionary.ContainsKey(item.itemAssetName)) { statsManager.itemDictionary.Add(item.itemAssetName, item); } foreach (Dictionary<string, int> item2 in statsManager.AllDictionariesWithPrefix("item")) { item2[item.itemAssetName] = 0; } return true; } public static List<Item> GetItems(this StatsManager statsManager) { return statsManager.itemDictionary.Values.ToList(); } public static bool TryGetItemByName(this StatsManager statsManager, string name, out Item item) { item = statsManager.GetItemByName(name); return (Object)(object)item != (Object)null; } public static Item GetItemByName(this StatsManager statsManager, string name) { string name2 = name; return ((IEnumerable<Item>)statsManager.GetItems()).FirstOrDefault((Func<Item, bool>)((Item x) => x.NameEquals(name2))); } public static bool TryGetItemThatContainsName(this StatsManager statsManager, string name, out Item item) { item = statsManager.GetItemThatContainsName(name); return (Object)(object)item != (Object)null; } public static Item GetItemThatContainsName(this StatsManager statsManager, string name) { string name2 = name; return ((IEnumerable<Item>)statsManager.GetItems()).FirstOrDefault((Func<Item, bool>)((Item x) => x.NameContains(name2))); } } public static class StringExtensions { public static bool EqualsAny(this string value, IReadOnlyCollection<string> inputs, StringComparison comparisonType = StringComparison.Ordinal) { if (value == null || inputs == null) { return false; } return inputs.Contains<string>(value, StringComparer.FromComparison(comparisonType)); } } } namespace REPOLib.Commands { [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] public class CommandExecutionAttribute : Attribute { public bool RequiresDeveloperMode { get; private set; } public bool EnabledByDefault { get; private set; } public string Name { get; private set; } public string Description { get; private set; } public CommandExecutionAttribute(string? name = null, string? description = null, bool enabledByDefault = true, bool requiresDeveloperMode = false) { RequiresDeveloperMode = requiresDeveloperMode; EnabledByDefault = enabledByDefault; Name = name ?? ""; Description = description ?? ""; } } [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] public class CommandInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] public class CommandAliasAttribute : Attribute { public string Alias { get; private set; } public CommandAliasAttribute(string alias) { Alias = alias; } } internal static class CommandManager { private static List<MethodInfo> _commandExecutionMethodCache = new List<MethodInfo>(); public static Dictionary<string, MethodInfo> CommandExecutionMethods { get; private set; } = new Dictionary<string, MethodInfo>(); public static List<MethodInfo> CommandInitializerMethods { get; private set; } = new List<MethodInfo>(); public static Dictionary<string, bool> CommandsEnabled { get; private set; } = new Dictionary<string, bool>(); public static void Initialize() { Logger.LogInfo("CommandManager initializing.", extended: true); CommandInitializerMethods = (from method in AccessTools.AllTypes().SelectMany((Type type) => type.SafeGetMethods()) where method.HasCustomAttribute<CommandInitializerAttribute>() select method).ToList(); foreach (MethodInfo commandInitializerMethod in CommandInitializerMethods) { try { Logger.LogDebug($"Initializing command initializer on method {commandInitializerMethod.DeclaringType}.{commandInitializerMethod.Name}"); if (!commandInitializerMethod.IsStatic) { Logger.LogWarning($"Command initializer {commandInitializerMethod.DeclaringType}.{commandInitializerMethod.Name} is not static!"); } commandInitializerMethod.Invoke(null, null); } catch (Exception arg) { Logger.LogError($"Failed to initialize command: {arg}"); } } FindAllCommandMethods(); foreach (KeyValuePair<string, MethodInfo> commandExecutionMethod in CommandExecutionMethods) { if (!commandExecutionMethod.Value.IsStatic) { Logger.LogWarning("Command execution method for command \"" + commandExecutionMethod.Key + "\" is not static!"); } } BindConfigs(); Logger.LogInfo("Finished initializing custom commands."); } public static void FindAllCommandMethods() { _commandExecutionMethodCache = (from method in AccessTools.AllTypes().SelectMany((Type type) => type.SafeGetMethods()) where method.HasCustomAttribute<CommandExecutionAttribute>() select method).ToList(); foreach (MethodInfo item in _commandExecutionMethodCache) { ParameterInfo[] parameters = item.GetParameters(); if (parameters.Length > 1) { Logger.LogError("Command \"" + item.GetCustomAttribute<CommandExecutionAttribute>().Name + "\" execution method \"" + item.Name + "\" has too many parameters! Should only have 1 string parameter or none."); break; } if (parameters.Length == 1 && parameters[0].ParameterType != typeof(string)) { Logger.LogError("Command \"" + item.GetCustomAttribute<CommandExecutionAttribute>().Name + "\" execution method \"" + item.Name + "\" has parameter of the wrong type! Should be string."); break; } IEnumerable<CommandAliasAttribute> customAttributes = item.GetCustomAttributes<CommandAliasAttribute>(); bool flag = false; if (customAttributes == null || customAttributes.Count() == 0) { Logger.LogWarning("Command " + item.Name + " has no alias attributes!"); continue; } foreach (CommandAliasAttribute item2 in customAttributes) { if (CommandExecutionMethods.TryAdd(item2.Alias, item)) { Logger.LogDebug($"Registered command alias \"{item2.Alias}\" for method \"{item.DeclaringType}.{item.Name}\"."); flag = true; } } if (!flag) { Logger.LogWarning("Failed to add any command aliases for method \"" + item.Name + "\"."); } } } public static void BindConfigs() { foreach (MethodInfo item in _commandExecutionMethodCache) { CommandExecutionAttribute customAttribute = item.GetCustomAttribute<CommandExecutionAttribute>(); BepInPlugin customAttribute2 = ((MemberInfo)(from type in AccessTools.GetTypesFromAssembly(item.Module.Assembly) where ((MemberInfo)type).GetCustomAttribute<BepInPlugin>() != null select type).ToList()[0]).GetCustomAttribute<BepInPlugin>(); string text = ((customAttribute2 != null) ? customAttribute2.GUID : null) ?? "Unknown"; string text2 = item.DeclaringType.ToString() ?? "Unknown"; List<string> list = new List<string>(); foreach (CommandAliasAttribute customAttribute3 in item.GetCustomAttributes<CommandAliasAttribute>()) {
plugins/REPOPresents.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Commands; using REPOLib.Modules; using REPOPresents.Chance; using REPOPresents.Chance.Impl; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("REPOPresents")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.3.0.0")] [assembly: AssemblyInformationalVersion("1.3.0")] [assembly: AssemblyProduct("REPOPresents")] [assembly: AssemblyTitle("REPOPresents")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPOPresents { public static class ConfigValues { internal static ConfigEntry<int> PresentSpawnRate; internal static ConfigEntry<bool> EnableMonsterPresents; internal static ConfigEntry<int> TallMonsterPresentSpawnRate; internal static ConfigEntry<bool> EnableChancePresents; internal static ConfigEntry<int> BigChancePresentSpawnRate; internal static ConfigEntry<bool> EnableOnlyGoodOutcomes; internal static ConfigEntry<bool> EnableDebug; internal static ConfigEntry<bool> EnableDebugLogs; public static void Configure(BaseUnityPlugin plugin) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown PresentSpawnRate = plugin.Config.Bind<int>("General", "Present Spawn Rate", 70, new ConfigDescription("The spawn rate of presents in %, can be used to reduce the spawning compared to other valuables at same volume type. (Recommended value = 70%)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); EnableMonsterPresents = plugin.Config.Bind<bool>("Monster Presents", "Enable Monster Presents", true, new ConfigDescription("Enable monster variants of specific presents. (Recommended value = true)", (AcceptableValueBase)null, Array.Empty<object>())); TallMonsterPresentSpawnRate = plugin.Config.Bind<int>("Monster Presents", "Tall Monster Present Spawn Rate", 50, new ConfigDescription("The spawn rate of the tall monster present in %. (Recommended value = 50%)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); EnableChancePresents = plugin.Config.Bind<bool>("Chance Presents", "Enable Chance Presents", true, new ConfigDescription("Enable chance variants of specific presents. (Recommended value = true)", (AcceptableValueBase)null, Array.Empty<object>())); BigChancePresentSpawnRate = plugin.Config.Bind<int>("Chance Presents", "Big Chance Present Spawn Rate", 50, new ConfigDescription("The spawn rate of the big chance present in %. (Recommended value = 50%)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); EnableOnlyGoodOutcomes = plugin.Config.Bind<bool>("Chance Presents", "Enable Good Outcomes Only", false, new ConfigDescription("Enable chance present to roll only good outcomes. (Recommended value = false)", (AcceptableValueBase)null, Array.Empty<object>())); EnableDebug = plugin.Config.Bind<bool>("Debug", "Enable Debug Mode", false, new ConfigDescription("Will replace all valuables with presents for testing :) (Recommended value = false)", (AcceptableValueBase)null, Array.Empty<object>())); EnableDebugLogs = plugin.Config.Bind<bool>("Debug", "Enable Debug Logs", false, new ConfigDescription("Log debug messages (Recommended value = false)", (AcceptableValueBase)null, Array.Empty<object>())); } } public class GoofyEyes : MonoBehaviour { private static Vector3 CROUCH_EYE_MODIFIER = new Vector3(0f, -0.85f, 0f); private static Vector3 TUMBLE_EYE_MODIFIER = new Vector3(0f, -1.85f, 0f); public Transform eyeLeft; public Transform eyeRight; public Transform pupilLeft; public Transform pupilRight; [Space] public MeshRenderer[] eyeRenderers; public MeshRenderer[] pupilRenderers; [Space] public Transform lookAt; [Space] public SpringQuaternion springQuaternionLeft; public SpringQuaternion springQuaternionRight; private Vector3 lookAtIdle; private PlayerAvatar lockedInAvatar; private float coolDownClosestPlayer = 1f; private float pupilSizeMultiplierTarget = 1f; private float pupilSizeMultiplierTimer = 0f; private float pupilSizeMultiplierTimerStart = 0f; private float pupilSizeMultiplierPreviousTarget = 1f; private float pupilSizeMultiplier = 1f; private Material eyeMaterial; private Material pupilMaterial; private int materialHurtAmount; private int materialHurtColor; private void Awake() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] array = eyeRenderers; foreach (MeshRenderer val in array) { if (!Object.op_Implicit((Object)(object)eyeMaterial)) { eyeMaterial = ((Renderer)val).material; } ((Renderer)val).material = eyeMaterial; } MeshRenderer[] array2 = pupilRenderers; foreach (MeshRenderer val2 in array2) { if (!Object.op_Implicit((Object)(object)pupilMaterial)) { pupilMaterial = ((Renderer)val2).material; } ((Renderer)val2).material = pupilMaterial; } lookAtIdle = lookAt.position; materialHurtColor = Shader.PropertyToID("_ColorOverlay"); materialHurtAmount = Shader.PropertyToID("_ColorOverlayAmount"); } private void Update() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) if (coolDownClosestPlayer > 0f) { coolDownClosestPlayer -= Time.deltaTime; } else { PlayerAvatar val = null; float num = float.MaxValue; foreach (PlayerAvatar item in SemiFunc.PlayerGetAllPlayerAvatarWithinRange(10f, ((Component)this).gameObject.transform.position, false, default(LayerMask))) { float num2 = Vector3.Distance(((Component)this).gameObject.transform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; val = item; } } lockedInAvatar = val; coolDownClosestPlayer = 3f; } if ((Object)(object)lockedInAvatar != (Object)null) { Vector3 val2 = Vector3.zero; if (lockedInAvatar.isCrouching || lockedInAvatar.isCrawling) { val2 = CROUCH_EYE_MODIFIER; } else if (lockedInAvatar.isTumbling) { val2 = TUMBLE_EYE_MODIFIER; } ((Component)lookAt).transform.position = Vector3.Lerp(((Component)lockedInAvatar.playerAvatarVisuals.playerEyes.eyeLeft).transform.position + val2, ((Component)lockedInAvatar.playerAvatarVisuals.playerEyes.eyeRight).transform.position + val2, 0.5f); } else { ((Component)lookAt).transform.position = lookAtIdle; } if (pupilSizeMultiplierTimer > 0f) { pupilSizeMultiplierTimer = Mathf.Max(pupilSizeMultiplierTimer - Time.fixedDeltaTime, 0f); pupilSizeMultiplier = Mathf.Lerp(pupilSizeMultiplierPreviousTarget, pupilSizeMultiplierTarget, (pupilSizeMultiplierTimerStart - pupilSizeMultiplierTimer) / pupilSizeMultiplierTimerStart); } else { pupilSizeMultiplier = pupilSizeMultiplierTarget; } pupilLeft.localScale = Vector3.one * pupilSizeMultiplier; pupilRight.localScale = Vector3.one * pupilSizeMultiplier; EyeLookAt(ref eyeRight, ref springQuaternionRight, _useSpring: true, 50f, 30f); EyeLookAt(ref eyeLeft, ref springQuaternionLeft, _useSpring: true, 50f, 30f); } private void EyeLookAt(ref Transform _eyeTransform, ref SpringQuaternion _springQuaternion, bool _useSpring, float _clampX, float _clamY) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) Quaternion localRotation = _eyeTransform.localRotation; Vector3 val = SemiFunc.ClampDirection(lookAt.position - ((Component)_eyeTransform).transform.position, lookAt.forward, _clampX); _eyeTransform.rotation = Quaternion.LookRotation(val); float num = _eyeTransform.localEulerAngles.y; if (num > _clamY && num < 180f) { num = _clamY; } else if (num < 360f - _clamY && num > 180f) { num = 360f - _clamY; } else if (num < 0f - _clamY) { num = 0f - _clamY; } _eyeTransform.localEulerAngles = new Vector3(_eyeTransform.localEulerAngles.x, num, _eyeTransform.localEulerAngles.z); Quaternion localRotation2 = _eyeTransform.localRotation; _eyeTransform.localRotation = localRotation; if (_useSpring) { _eyeTransform.localRotation = SemiFunc.SpringQuaternionGet(_springQuaternion, localRotation2, -1f); } else { _eyeTransform.localRotation = localRotation2; } } public void SetPupilSizeMultiplierTarget(float target, float time) { pupilSizeMultiplierPreviousTarget = pupilSizeMultiplierTarget; pupilSizeMultiplierTarget = target; pupilSizeMultiplierTimer = time; pupilSizeMultiplierTimerStart = time; } public void SetEyeColor(Color eyeColor, float num) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) eyeMaterial.SetFloat(materialHurtAmount, num); eyeMaterial.SetColor(materialHurtColor, eyeColor); } public void SetPupilColor(Color pupilColor, float num) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) pupilMaterial.SetFloat(materialHurtAmount, num); pupilMaterial.SetColor(materialHurtColor, pupilColor); } } [BepInPlugin("REPOPresents", "REPOPresents", "1.3.0")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(ValuableDirector), "Spawn")] internal static class ValuableDirectorSpawnPatch { private static bool Prefix(ref GameObject _valuable, ValuableVolume _volume, string _path) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) if (ConfigValues.EnableDebug.Value) { GameObject debugObjectForType = Instance.GetDebugObjectForType(_volume.VolumeType); if ((Object)(object)debugObjectForType != (Object)null) { _valuable = debugObjectForType; return true; } } ValuablePresent component = _valuable.GetComponent<ValuablePresent>(); ValuablePresentEnemy component2 = _valuable.GetComponent<ValuablePresentEnemy>(); ValuablePresentChance component3 = _valuable.GetComponent<ValuablePresentChance>(); if ((Object)(object)component != (Object)null || (Object)(object)component2 != (Object)null || (Object)(object)component3 != (Object)null) { int value = ConfigValues.PresentSpawnRate.Value; if ((Object)(object)component2 != (Object)null) { value = ConfigValues.TallMonsterPresentSpawnRate.Value; } else if ((Object)(object)component3 != (Object)null) { value = ConfigValues.BigChancePresentSpawnRate.Value; } float num = 1f - (float)value / 100f; if (Random.value < num) { List<GameObject> valuablesByVolumeType = ValuableUtil.GetValuablesByVolumeType(RunManager.instance.levelCurrent, _volume.VolumeType); if (valuablesByVolumeType.Count > 0) { GameObject val = valuablesByVolumeType[Random.Range(0, valuablesByVolumeType.Count)]; if ((Object)(object)val != (Object)null) { DebugLog("Replaced " + ((Object)_valuable).name + " with " + ((Object)val).name); _valuable = val; } } } } return true; } private static void Postfix(GameObject _valuable) { DebugLog("Spawned : " + ((Object)_valuable).name); } } private static readonly string ENEMY_VALUABLE = "Valuable Present Tall (Enemy)"; private static readonly string CHANCE_VALUABLE = "Valuable Present Big (Chance)"; private static readonly string[] BUNDLED_VALUABLES = new string[7] { "Valuable Present Tiny", "Valuable Present Small", "Valuable Present Medium", "Valuable Present Big", "Valuable Present Tall", CHANCE_VALUABLE, ENEMY_VALUABLE }; private readonly Harmony _harmony = new Harmony("REPOPresents"); internal static ManualLogSource Logger; private Dictionary<string, GameObject> registeredPrefabs = new Dictionary<string, GameObject>(); private Dictionary<Type, GameObject> debugVolumeTypes = new Dictionary<Type, GameObject>(); internal static Plugin Instance { get; private set; } private void Awake() { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; ConfigValues.Configure((BaseUnityPlugin)(object)this); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "presents_assets.file")); string[] bUNDLED_VALUABLES = BUNDLED_VALUABLES; foreach (string text in bUNDLED_VALUABLES) { if ((!(text == ENEMY_VALUABLE) || ConfigValues.EnableMonsterPresents.Value) && (!(text == CHANCE_VALUABLE) || ConfigValues.EnableChancePresents.Value)) { GameObject val2 = val.LoadAsset<GameObject>(text); Valuables.RegisterValuable(val2); ValuableObject component = val2.GetComponent<ValuableObject>(); if ((Object)(object)component != (Object)null && !debugVolumeTypes.ContainsKey(component.volumeType)) { debugVolumeTypes.Add(component.volumeType, val2); } registeredPrefabs.Add(text, val2); Logger.LogInfo((object)("Registered: " + text)); } } _harmony.PatchAll(typeof(ValuableDirectorSpawnPatch)); Logger.LogInfo((object)"Plugin REPOPresents is loaded!"); } public bool WasRegisteredBySelf(GameObject gameObject) { return registeredPrefabs.ContainsValue(gameObject); } public GameObject GetDebugObjectForType(Type type) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!debugVolumeTypes.ContainsKey(type)) { return null; } return debugVolumeTypes[type]; } public static void DebugLog(object data) { if (ConfigValues.EnableDebugLogs.Value) { Logger.LogInfo(data); } } } public class ValuablePresent : MonoBehaviour { private PhysGrabObject physGrabObject; private ValuableObject valuableObject; private ParticleSystem particles; private bool particlesPlaying; private List<GameObject> potentialItems; private bool wasReplaced = false; private void Awake() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) valuableObject = ((Component)this).GetComponent<ValuableObject>(); physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); particles = ((Component)this).GetComponentInChildren<ParticleSystem>(); potentialItems = ValuableUtil.GetValuablesByVolumeType(RunManager.instance.levelCurrent, valuableObject.volumeType); } private void Update() { if ((Object)(object)particles != (Object)null) { if (physGrabObject.grabbed) { if (!particlesPlaying) { particles.Play(); particlesPlaying = true; } } else if (particlesPlaying) { particles.Stop(); particlesPlaying = false; } } if (physGrabObject.grabbedLocal) { PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance != (Object)null) { instance.OverridePupilSize(3f, 4, 1f, 1f, 5f, 0.5f, 0.1f); } } } public GameObject FindReplacement() { if (potentialItems == null) { return null; } int num = 0; GameObject val = null; while ((Object)(object)val == (Object)null && potentialItems.Count > 0 && num < 5) { GameObject val2 = potentialItems[Random.Range(0, potentialItems.Count)]; if (!Plugin.Instance.WasRegisteredBySelf(val2)) { val = val2; } num++; } return val; } public void OnDestroy() { //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_00f4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)particles != (Object)null && particlesPlaying) { particles.Stop(); particlesPlaying = false; } if (!SemiFunc.IsMasterClientOrSingleplayer() || wasReplaced) { return; } wasReplaced = true; GameObject val = FindReplacement(); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)"Failed to find suitable item"); return; } ValuableObject val2 = Valuables.GetValuableByName(((Object)val).name); if ((Object)(object)val2 == (Object)null) { val2 = val.GetComponent<ValuableObject>(); if ((Object)(object)val2 == (Object)null) { Plugin.Logger.LogError((object)("Item is missing ValuableObject: " + ((Object)val).name)); return; } } if (!SemiFunc.IsMultiplayer()) { Object.Instantiate<GameObject>(val, ((Component)this).gameObject.transform.position, ((Component)this).gameObject.transform.rotation); } else { Valuables.SpawnValuable(val2, ((Component)this).gameObject.transform.position, ((Component)this).gameObject.transform.rotation); } } } public class ValuablePresentChance : MonoBehaviour { private static int MAX_ENTRY_ATTEMPTS = 5; private PhysGrabObject physGrabObject; private ValuablePresentChanceNetwork network; private ValuableObject valuableObject; private Type overriddenChanceEntry = null; private bool wasReplaced = false; [HideInInspector] public PlayerAvatar lastPlayerGrabbed; private void Awake() { physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); network = ((Component)this).GetComponent<ValuablePresentChanceNetwork>(); valuableObject = ((Component)this).GetComponent<ValuableObject>(); } private void Update() { if (physGrabObject.grabbedLocal) { PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance != (Object)null) { instance.OverridePupilSize(3f, 4, 1f, 1f, 5f, 0.5f, 0.1f); } } if ((Object)(object)physGrabObject.lastPlayerGrabbing != (Object)null && (Object)(object)physGrabObject.lastPlayerGrabbing != (Object)(object)lastPlayerGrabbed) { lastPlayerGrabbed = physGrabObject.lastPlayerGrabbing; } } public void OnDestroy() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || wasReplaced) { return; } wasReplaced = true; if (valuableObject.dollarValueCurrent >= valuableObject.dollarValueOriginal * 0.15f) { Plugin.DebugLog("Not rolling chance due to not fully broken"); return; } PlayerAvatar val = lastPlayerGrabbed; if ((Object)(object)val == (Object)null) { List<PlayerAvatar> list = SemiFunc.PlayerGetAllPlayerAvatarWithinRange(10f, ((Component)this).gameObject.transform.position, false, default(LayerMask)); if (list.Count == 0) { Plugin.Logger.LogWarning((object)"Last player grab is null and no players within range"); return; } val = list[0]; if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)"Last player grab is null and no players within range"); return; } Plugin.DebugLog("Using roller from range " + val.playerName); } if ((Object)(object)network == (Object)null) { Plugin.Logger.LogError((object)"Network is null"); return; } for (int i = 0; i < MAX_ENTRY_ATTEMPTS; i++) { IChanceEntry chanceEntry = ((!(overriddenChanceEntry != null)) ? GetRandomChanceEntry() : ((IChanceEntry)Activator.CreateInstance(overriddenChanceEntry))); if (chanceEntry == null) { Plugin.Logger.LogError((object)$"Failed to find chance entry (attempt {i})"); continue; } if (!chanceEntry.Execute(val, network)) { Plugin.Logger.LogWarning((object)$"Failed to execute chance entry {chanceEntry.GetType().Name} (attempt {i})"); continue; } var (text, chatID, color) = chanceEntry.GetChatMessage(); if (text != null) { network.PossessChat(val, chatID, text, color); } break; } } public void OverrideChanceEntry(Type chanceEntry) { overriddenChanceEntry = chanceEntry; } private static IChanceEntry GetRandomChanceEntry() { Dictionary<(ChanceRegistry.Outcome, Type), int> availableEntries = ChanceRegistry.GetAvailableEntries(); int num = availableEntries.Values.Sum(); int num2 = Random.Range(0, num); int num3 = 0; foreach (KeyValuePair<(ChanceRegistry.Outcome, Type), int> item in availableEntries) { num3 += item.Value; if (num2 < num3) { return (IChanceEntry)Activator.CreateInstance(item.Key.Item2); } } return null; } } public class ValuablePresentChanceNetwork : MonoBehaviour { private PhotonView photonView; private void Awake() { photonView = ((Component)this).GetComponent<PhotonView>(); } public void PossessChat(PlayerAvatar player, PossessChatID chatID, string message, Color color) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && !player.photonView.IsMine) { photonView.RPC("PossessChatRPC", player.photonView.Owner, new object[5] { chatID, message, color.r, color.g, color.b }); } else { PossessChatRPC(chatID, message, color.r, color.g, color.b); } } [PunRPC] public void PossessChatRPC(PossessChatID chatID, string message, float r, float g, float b) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) ChatManager.instance.PossessChatScheduleStart(10); ChatManager.instance.PossessChat(chatID, message, 1f, new Color(r, g, b), 0f, false, 0, (UnityEvent)null); ChatManager.instance.PossessChatScheduleEnd(); } public void Teleport(PlayerAvatar player, Vector3 position) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && !player.photonView.IsMine) { photonView.RPC("TeleportRPC", player.photonView.Owner, new object[1] { position }); } else { TeleportRPC(position); } } [PunRPC] public void TeleportRPC(Vector3 position) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Component)PlayerController.instance).transform.position = position; } public void SetScale(int viewID, Vector3 scale) { //IL_0003: 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) SetScaleRPC(viewID, scale); if (SemiFunc.IsMultiplayer()) { photonView.RPC("SetScaleRPC", (RpcTarget)1, new object[2] { viewID, scale }); } } [PunRPC] public void SetScaleRPC(int viewID, Vector3 scale) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) PhotonView val = PhotonView.Find(viewID); if ((Object)(object)val != (Object)null) { ((Component)val).transform.localScale = new Vector3(((Component)val).transform.localScale.x * scale.x, ((Component)val).transform.localScale.y * scale.y, ((Component)val).transform.localScale.z * scale.z); } } } public class ValuablePresentChanceVariant : MonoBehaviour { public string valuableName; } public class ValuablePresentEnemy : MonoBehaviour { [CompilerGenerated] private sealed class <SpawnEnemyAfterTime>d__22 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EnemySetup enemySetup; public Vector3 position; public TimeSpan timeSpan; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnEnemyAfterTime>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds((float)timeSpan.TotalSeconds); <>1__state = 1; return true; case 1: <>1__state = -1; Enemies.SpawnEnemy(enemySetup, position, Quaternion.identity, false); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const float PUPIL_SIZE_INTERVAL = 0.5f; private const float AGGRESSIVE_INTERVAL = 10f; private const float GRAB_INTERVAL = 45f; public Sound aggressive; private PhysGrabObject physGrabObject; private PhysGrabObjectImpactDetector physGrabObjectImpactDetector; private ValuableObject valuableObject; private GoofyEyes[] eyes; private Rigidbody rb; private bool isGrabActive = false; private bool isAggressive = false; private bool wasAggressiveDestroyed = false; private bool wasReplaced = false; private float grabTimer = 0f; private float timeToApplyForce = 0f; private List<EnemySetup> potentialEnemies; private void Awake() { physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); physGrabObjectImpactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>(); valuableObject = ((Component)this).GetComponent<ValuableObject>(); eyes = ((Component)this).GetComponentsInChildren<GoofyEyes>(true); rb = ((Component)this).GetComponent<Rigidbody>(); potentialEnemies = FindPotentialEnemies(); } private void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) GoofyEyes[] array = eyes; foreach (GoofyEyes goofyEyes in array) { goofyEyes.SetEyeColor(Color.white, 1f); } } private void Update() { //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) if (physGrabObject.grabbed) { if (!isGrabActive && grabTimer <= 0f) { isGrabActive = true; grabTimer = 45f; GoofyEyes[] array = eyes; foreach (GoofyEyes goofyEyes in array) { goofyEyes.SetPupilSizeMultiplierTarget(3f, 0.5f); } } grabTimer = Mathf.Max(grabTimer - Time.fixedDeltaTime, 0f); if (isGrabActive && grabTimer <= 10f) { if (!isAggressive) { isAggressive = true; GoofyEyes[] array2 = eyes; foreach (GoofyEyes goofyEyes2 in array2) { goofyEyes2.SetPupilSizeMultiplierTarget(1f, 5f); goofyEyes2.SetEyeColor(Color.red, 1f); } } if (isAggressive) { GameDirector.instance.CameraImpact.ShakeDistance(1.5f, 1f, 6f, ((Component)this).transform.position, 0.02f); } if (grabTimer <= 0f) { isGrabActive = false; isAggressive = false; wasAggressiveDestroyed = true; grabTimer = 0f; GoofyEyes[] array3 = eyes; foreach (GoofyEyes goofyEyes3 in array3) { goofyEyes3.SetPupilSizeMultiplierTarget(1f, 0f); goofyEyes3.SetEyeColor(Color.white, 1f); } if (SemiFunc.IsMasterClientOrSingleplayer()) { physGrabObjectImpactDetector.DestroyObject(true); } } } } else if (grabTimer > 0f) { isGrabActive = false; isAggressive = false; grabTimer = 0f; GoofyEyes[] array4 = eyes; foreach (GoofyEyes goofyEyes4 in array4) { goofyEyes4.SetPupilSizeMultiplierTarget(1f, 0.5f); goofyEyes4.SetEyeColor(Color.white, 1f); } } if (physGrabObject.grabbedLocal) { PlayerAvatar instance = PlayerAvatar.instance; if ((Object)(object)instance != (Object)null) { instance.OverridePupilSize(3f, 4, 1f, 1f, 5f, 0.5f, 0.1f); } } aggressive.PlayLoop(isAggressive, 1f, 1f, 1f); } private void FixedUpdate() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && isAggressive) { if (timeToApplyForce > 0f) { timeToApplyForce -= Time.deltaTime; return; } timeToApplyForce = 1f; float num = Random.Range(0.8f, 2f); rb.AddForce(Vector3.up * num, (ForceMode)1); Vector3 insideUnitSphere = Random.insideUnitSphere; Vector3 normalized = ((Vector3)(ref insideUnitSphere)).normalized; rb.AddTorque(normalized * 6f, (ForceMode)1); } } private List<EnemySetup> FindPotentialEnemies() { List<EnemySetup> list = new List<EnemySetup>(); foreach (EnemySetup item in EnemyDirector.instance.enemiesDifficulty3) { if (!((Object)item).name.Contains("Group")) { list.Add(item); } } return list; } public void OnDestroy() { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || wasReplaced) { return; } wasReplaced = true; if (valuableObject.dollarValueCurrent >= valuableObject.dollarValueOriginal * 0.15f && !wasAggressiveDestroyed) { Plugin.DebugLog("Not spawning enemy due to not fully broken"); return; } if (potentialEnemies.Count == 0) { Plugin.Logger.LogError((object)"No valid enemies to spawn"); return; } EnemySetup val = potentialEnemies[Random.Range(0, potentialEnemies.Count)]; if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)"Failed to find suitable enemy"); } else { ((MonoBehaviour)EnemyDirector.instance).StartCoroutine(SpawnEnemyAfterTime(val, ((Component)this).gameObject.transform.position, TimeSpan.FromSeconds(3.0))); } } [IteratorStateMachine(typeof(<SpawnEnemyAfterTime>d__22))] private static IEnumerator SpawnEnemyAfterTime(EnemySetup enemySetup, Vector3 position, TimeSpan timeSpan) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpawnEnemyAfterTime>d__22(0) { enemySetup = enemySetup, position = position, timeSpan = timeSpan }; } } public class ValuablePresentEnemyVariant : MonoBehaviour { public string valuableName; } public static class ValuableUtil { public static List<GameObject> GetValuablesByVolumeType(Level level, Type volumeType) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_004a: Expected I4, but got Unknown List<GameObject> list = new List<GameObject>(); foreach (LevelValuables valuablePreset in level.ValuablePresets) { Type val = volumeType; Type val2 = val; switch ((int)val2) { case 0: list.AddRange(valuablePreset.tiny); break; case 1: list.AddRange(valuablePreset.small); break; case 2: list.AddRange(valuablePreset.medium); break; case 3: list.AddRange(valuablePreset.big); break; case 4: list.AddRange(valuablePreset.wide); break; case 5: list.AddRange(valuablePreset.tall); break; case 6: list.AddRange(valuablePreset.veryTall); break; default: Plugin.Logger.LogError((object)("Unhandled volume type: " + ((object)(Type)(ref volumeType)).ToString())); break; } } return list; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "REPOPresents"; public const string PLUGIN_NAME = "REPOPresents"; public const string PLUGIN_VERSION = "1.3.0"; } } namespace REPOPresents.Chance { internal static class ChanceRegistry { public enum Outcome { Good, Bad } public static readonly Dictionary<(Outcome, Type), int> MULTIPLAYER = new Dictionary<(Outcome, Type), int> { { (Outcome.Good, typeof(HealRandomPlayer)), 4 }, { (Outcome.Bad, typeof(HurtRandomPlayer)), 4 }, { (Outcome.Bad, typeof(TeleportRandomPlayer)), 4 }, { (Outcome.Good, typeof(ReviveRandomPlayer)), 4 }, { (Outcome.Good, typeof(ReviveAllPlayers)), 3 } }; public static readonly Dictionary<(Outcome, Type), int> SINGLEPLAYER = new Dictionary<(Outcome, Type), int>(); public static readonly Dictionary<(Outcome, Type), int> SHARED = new Dictionary<(Outcome, Type), int> { { (Outcome.Good, typeof(HealRoller)), 4 }, { (Outcome.Bad, typeof(HurtRoller)), 4 }, { (Outcome.Bad, typeof(TeleportRoller)), 4 }, { (Outcome.Good, typeof(SpawnRandomValuable)), 4 }, { (Outcome.Bad, typeof(BreakRandomValuable)), 3 }, { (Outcome.Good, typeof(IncreaseValuableWorth)), 4 }, { (Outcome.Good, typeof(IncreaseAllValuableWorthTenPercent)), 3 }, { (Outcome.Good, typeof(IncreaseAllValuableWorthTwentyPercent)), 1 }, { (Outcome.Bad, typeof(DecreaseAllValuableWorthTenPercent)), 3 }, { (Outcome.Bad, typeof(SpawnEnemy)), 2 }, { (Outcome.Bad, typeof(SpawnMiniEnemy)), 2 }, { (Outcome.Good, typeof(SpawnRandomUpgradeItem)), 3 }, { (Outcome.Good, typeof(SpawnRandomHealthPack)), 3 }, { (Outcome.Good, typeof(SpawnRandomDroneItem)), 1 } }; public static readonly Dictionary<string, Type> NAME_TO_TYPED_ENTRY = new Dictionary<string, Type> { { "heal roller", typeof(HealRoller) }, { "hurt roller", typeof(HurtRoller) }, { "teleport roller", typeof(TeleportRoller) }, { "heal random player", typeof(HealRandomPlayer) }, { "hurt random player", typeof(HurtRandomPlayer) }, { "teleport random player", typeof(TeleportRandomPlayer) }, { "revive random player", typeof(ReviveRandomPlayer) }, { "spawn random valuable", typeof(SpawnRandomValuable) }, { "break random valuable", typeof(BreakRandomValuable) }, { "increase valuable worth", typeof(IncreaseValuableWorth) }, { "increase all valuable worth", typeof(IncreaseAllValuableWorthTenPercent) }, { "increase all valuable worth 20", typeof(IncreaseAllValuableWorthTwentyPercent) }, { "decrease all valuable worth", typeof(DecreaseAllValuableWorthTenPercent) }, { "spawn enemy", typeof(SpawnEnemy) }, { "spawn mini enemy", typeof(SpawnMiniEnemy) }, { "nothing", typeof(Nothing) }, { "spawn random upgrade", typeof(SpawnRandomUpgradeItem) }, { "spawn random drone", typeof(SpawnRandomDroneItem) }, { "spawn random health", typeof(SpawnRandomHealthPack) }, { "revive all players", typeof(ReviveAllPlayers) } }; public static Dictionary<(Outcome, Type), int> GetAvailableEntries() { Dictionary<(Outcome, Type), int> dictionary = SINGLEPLAYER; if (SemiFunc.IsMultiplayer() && PhotonNetwork.PlayerList.Length > 1) { dictionary = MULTIPLAYER; } Dictionary<(Outcome, Type), int> dictionary2 = new Dictionary<(Outcome, Type), int>(); foreach (KeyValuePair<(Outcome, Type), int> item in dictionary) { if (!ConfigValues.EnableOnlyGoodOutcomes.Value || item.Key.Item1 == Outcome.Good) { dictionary2.Add(item.Key, item.Value); } } foreach (KeyValuePair<(Outcome, Type), int> item2 in SHARED) { if (!ConfigValues.EnableOnlyGoodOutcomes.Value || item2.Key.Item1 == Outcome.Good) { dictionary2.Add(item2.Key, item2.Value); } } return dictionary2; } } internal class ChanceUtil { public static PlayerAvatar GetRandomAlivePlayer() { List<PlayerAvatar> list = GameDirector.instance.PlayerList.Where((PlayerAvatar x) => (float)x.playerHealth.health > 0f).ToList(); if (list.Count == 0) { return null; } int index = Random.Range(0, list.Count); return list[index]; } public static PlayerAvatar GetRandomAlivePlayerButExclude(PlayerAvatar exclude) { List<PlayerAvatar> list = GameDirector.instance.PlayerList.Where((PlayerAvatar x) => (float)x.playerHealth.health > 0f && (Object)(object)x != (Object)(object)exclude).ToList(); if (list.Count == 0) { return null; } int index = Random.Range(0, list.Count); return list[index]; } public static PlayerAvatar GetRandomDeadPlayer() { List<PlayerAvatar> list = GameDirector.instance.PlayerList.Where((PlayerAvatar x) => (float)x.playerHealth.health <= 0f).ToList(); if (list.Count == 0) { return null; } int index = Random.Range(0, list.Count); return list[index]; } public static Item GetRandomItemOfType(itemType itemType) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) List<Item> list = StatsManager.instance.itemDictionary.Values.Where((Item i) => i.itemType == itemType).ToList(); if (list.Count == 0) { return null; } return list[Random.Range(0, list.Count)]; } public static string RemoveSuffix(string original, string suffix) { if (original != null && suffix != null && original.EndsWith(suffix)) { return original.Substring(0, original.Length - suffix.Length); } return original; } } internal interface IChanceEntry { bool Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network); (string, PossessChatID, Color) GetChatMessage(); } public static class TestCommand { [CommandExecution("Test Chance Entry", "Test a specific chance entry by name.", true, true)] [CommandAlias("testchanceentry")] [CommandAlias("testchance")] [CommandAlias("tce")] public static void Execute(string args) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(args)) { Plugin.Logger.LogWarning((object)"No args provided to command."); return; } if (!SemiFunc.IsMasterClientOrSingleplayer()) { Plugin.Logger.LogWarning((object)"Only the host can test!"); return; } Type chanceEntry = ChanceRegistry.NAME_TO_TYPED_ENTRY[args]; if (chanceEntry == null) { Plugin.Logger.LogWarning((object)"Unable to find chance type"); return; } Vector3 val = ((Component)PlayerAvatar.instance).transform.position + new Vector3(0f, 1f, 0f) + ((Component)PlayerAvatar.instance).transform.forward * 1f; ValuableObject val2 = default(ValuableObject); if (!Valuables.TryGetValuableThatContainsName("Valuable Present Big (Chance)", ref val2)) { Plugin.Logger.LogWarning((object)"Spawn valuable failed."); return; } ChatManager.instance.ClearAllChatBatches(); ChatManager.instance.ChatReset(); GameObject gameObject = Valuables.SpawnValuable(val2, val, Quaternion.identity); Task.Delay(500).ContinueWith(delegate { ValuablePresentChance component = gameObject.GetComponent<ValuablePresentChance>(); component.OverrideChanceEntry(chanceEntry); component.lastPlayerGrabbed = PlayerAvatar.instance; PhysGrabObject component2 = gameObject.GetComponent<PhysGrabObject>(); component2.lastPlayerGrabbing = PlayerAvatar.instance; component2.grabbedTimer = 10f; PhysGrabObjectImpactDetector component3 = gameObject.GetComponent<PhysGrabObjectImpactDetector>(); component3.DestroyObject(true); }); } } } namespace REPOPresents.Chance.Impl { internal class BreakRandomValuable : IChanceEntry { private string destroyedName = null; bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { List<ValuableObject> valuableList = ValuableDirector.instance.valuableList; if (valuableList == null || valuableList.Count == 0) { return false; } ValuableObject val = valuableList[Random.Range(0, valuableList.Count)]; if ((Object)(object)val == (Object)null) { return false; } destroyedName = ((Object)val).name; PhysGrabObjectImpactDetector component = ((Component)val).GetComponent<PhysGrabObjectImpactDetector>(); component.DestroyObject(true); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (destroyedName == null) { return ("Broken a random item!", (PossessChatID)3, Color.red); } return ("Broken a " + ChanceUtil.RemoveSuffix(destroyedName, "(Clone)").ToLower(), (PossessChatID)3, Color.red); } } internal class DecreaseAllValuableWorthTenPercent : IChanceEntry { bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { List<ValuableObject> valuableList = ValuableDirector.instance.valuableList; if (valuableList == null || valuableList.Count == 0) { return false; } foreach (ValuableObject item in valuableList) { float num = item.dollarValueCurrent * 0.9f; item.dollarValueCurrent = Mathf.Round(num / 100f) * 100f; if (SemiFunc.IsMultiplayer()) { item.photonView.RPC("DollarValueSetRPC", (RpcTarget)1, new object[1] { item.dollarValueCurrent }); } } return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("Decreased all valuables by 10%!", (PossessChatID)4, Color.red); } } internal class HealRandomPlayer : IChanceEntry { private PlayerAvatar selected; bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) selected = ChanceUtil.GetRandomAlivePlayerButExclude(roller); if ((Object)(object)selected == (Object)null) { return false; } selected.playerHealth.HealOther(selected.playerHealth.maxHealth, true); network.PossessChat(selected, (PossessChatID)0, roller.playerName + " has healed me!", Color.green); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) return (selected.playerName + " has been healed!", (PossessChatID)0, Color.green); } } internal class HealRoller : IChanceEntry { bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { roller.playerHealth.HealOther(roller.playerHealth.maxHealth, true); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("I have been healed!", (PossessChatID)0, Color.green); } } internal class HurtRandomPlayer : IChanceEntry { private PlayerAvatar selected; private int damage; bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) damage = Random.Range(10, 50); selected = ChanceUtil.GetRandomAlivePlayerButExclude(roller); if ((Object)(object)selected == (Object)null) { return false; } selected.playerHealth.HurtOther(damage, new Vector3(0f, 0f), false, -1); network.PossessChat(selected, (PossessChatID)3, $"-{damage} health from {roller.playerName}", Color.red); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) return ($"-{damage} health for {selected.playerName}", (PossessChatID)4, Color.red); } } internal class HurtRoller : IChanceEntry { private int damage; bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) damage = Random.Range(10, 50); roller.playerHealth.HurtOther(damage, new Vector3(0f, 0f), false, -1); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) return ($"-{damage} health", (PossessChatID)3, Color.red); } } internal class IncreaseAllValuableWorthTenPercent : IChanceEntry { bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { List<ValuableObject> valuableList = ValuableDirector.instance.valuableList; if (valuableList == null || valuableList.Count == 0) { return false; } foreach (ValuableObject item in valuableList) { float num = item.dollarValueCurrent * 1.1f; item.dollarValueCurrent = Mathf.Round(num / 100f) * 100f; item.dollarValueOriginal = Mathf.Max(item.dollarValueCurrent, item.dollarValueOriginal); if (SemiFunc.IsMultiplayer()) { item.photonView.RPC("DollarValueSetRPC", (RpcTarget)1, new object[1] { item.dollarValueCurrent }); } } return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("Increased all valuables by 10%!", (PossessChatID)0, Color.green); } } internal class IncreaseAllValuableWorthTwentyPercent : IChanceEntry { bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { List<ValuableObject> valuableList = ValuableDirector.instance.valuableList; if (valuableList == null || valuableList.Count == 0) { return false; } foreach (ValuableObject item in valuableList) { float num = item.dollarValueCurrent * 1.2f; item.dollarValueCurrent = Mathf.Round(num / 100f) * 100f; item.dollarValueOriginal = Mathf.Max(item.dollarValueCurrent, item.dollarValueOriginal); if (SemiFunc.IsMultiplayer()) { item.photonView.RPC("DollarValueSetRPC", (RpcTarget)1, new object[1] { item.dollarValueCurrent }); } } return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("Increased all valuables by 20%!", (PossessChatID)0, Color.green); } } internal class IncreaseValuableWorth : IChanceEntry { private const int MAX_VALUE = 10000; private const int MIN_VALUE = 2000; private string selectedName = null; private int increasedValue = 0; bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { List<ValuableObject> valuableList = ValuableDirector.instance.valuableList; if (valuableList == null || valuableList.Count == 0) { return false; } ValuableObject val = valuableList[Random.Range(0, valuableList.Count)]; if ((Object)(object)val == (Object)null) { return false; } increasedValue = Random.Range(2000, 10000); selectedName = ((Object)val).name; val.dollarValueCurrent += (float)increasedValue; val.DollarValueSetLogic(); if (SemiFunc.IsMultiplayer()) { val.photonView.RPC("DollarValueSetRPC", (RpcTarget)1, new object[1] { val.dollarValueCurrent }); } return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (selectedName == null) { return ($"Increased a random item by ${increasedValue}!", (PossessChatID)0, Color.green); } return (string.Format("Increased {0} by ${1}", ChanceUtil.RemoveSuffix(selectedName, "(Clone)").ToLower(), increasedValue), (PossessChatID)0, Color.green); } } internal class Nothing : IChanceEntry { bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return (null, (PossessChatID)0, Color.white); } } internal class ReviveAllPlayers : IChanceEntry { bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if ((float)player.playerHealth.health <= 0f) { player.Revive(false); } } return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("Revived all dead players!", (PossessChatID)0, Color.green); } } internal class ReviveRandomPlayer : IChanceEntry { private PlayerAvatar selected; bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { selected = ChanceUtil.GetRandomDeadPlayer(); if ((Object)(object)selected == (Object)null) { return false; } selected.Revive(false); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) return (selected.playerName + " has been revived!", (PossessChatID)0, Color.green); } } internal class SpawnEnemy : IChanceEntry { [CompilerGenerated] private sealed class <SpawnEnemyAfterTime>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EnemySetup enemySetup; public Vector3 position; public TimeSpan timeSpan; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnEnemyAfterTime>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds((float)timeSpan.TotalSeconds); <>1__state = 1; return true; case 1: <>1__state = -1; Enemies.SpawnEnemy(enemySetup, position, Quaternion.identity, false); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) List<EnemySetup> list = new List<EnemySetup>(); foreach (EnemySetup item in EnemyDirector.instance.enemiesDifficulty3) { if (!((Object)item).name.Contains("Group")) { list.Add(item); } } if (list.Count == 0) { return false; } EnemySetup val = list[Random.Range(0, list.Count)]; if ((Object)(object)val == (Object)null) { return false; } ((MonoBehaviour)EnemyDirector.instance).StartCoroutine(SpawnEnemyAfterTime(val, ((Component)network).gameObject.transform.position, TimeSpan.FromSeconds(3.0))); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("RUN! NOW!", (PossessChatID)3, Color.red); } [IteratorStateMachine(typeof(<SpawnEnemyAfterTime>d__2))] private static IEnumerator SpawnEnemyAfterTime(EnemySetup enemySetup, Vector3 position, TimeSpan timeSpan) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpawnEnemyAfterTime>d__2(0) { enemySetup = enemySetup, position = position, timeSpan = timeSpan }; } } internal class SpawnMiniEnemy : IChanceEntry { [CompilerGenerated] private sealed class <SpawnEnemyAfterTime>d__3 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EnemySetup enemySetup; public Vector3 position; public TimeSpan timeSpan; public ValuablePresentChanceNetwork network; private List<EnemyParent> <parts>5__1; private List<EnemyParent>.Enumerator <>s__2; private EnemyParent <item>5__3; private PhotonView <photonView>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnEnemyAfterTime>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <parts>5__1 = null; <>s__2 = default(List<EnemyParent>.Enumerator); <item>5__3 = null; <photonView>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds((float)timeSpan.TotalSeconds); <>1__state = 1; return true; case 1: <>1__state = -1; <parts>5__1 = Enemies.SpawnEnemy(enemySetup, position, Quaternion.identity, false); <>s__2 = <parts>5__1.GetEnumerator(); try { while (<>s__2.MoveNext()) { <item>5__3 = <>s__2.Current; <photonView>5__4 = ((Component)<item>5__3).GetComponent<PhotonView>(); if ((Object)(object)<photonView>5__4 != (Object)null) { network.SetScale(<photonView>5__4.ViewID, new Vector3(0.5f, 0.5f, 0.5f)); } <photonView>5__4 = null; <item>5__3 = null; } } finally { ((IDisposable)<>s__2).Dispose(); } <>s__2 = default(List<EnemyParent>.Enumerator); 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 readonly List<string> SPAWNABLES = new List<string> { "Head", "Robe", "Huntsman", "Reaper" }; bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) string text = SPAWNABLES[Random.Range(0, SPAWNABLES.Count)]; EnemySetup enemyThatContainsName = Enemies.GetEnemyThatContainsName(text); if ((Object)(object)enemyThatContainsName == (Object)null) { return false; } ((MonoBehaviour)EnemyDirector.instance).StartCoroutine(SpawnEnemyAfterTime(enemyThatContainsName, ((Component)network).gameObject.transform.position, TimeSpan.FromSeconds(3.0), network)); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("RUN! SMALL!", (PossessChatID)3, Color.red); } [IteratorStateMachine(typeof(<SpawnEnemyAfterTime>d__3))] private static IEnumerator SpawnEnemyAfterTime(EnemySetup enemySetup, Vector3 position, TimeSpan timeSpan, ValuablePresentChanceNetwork network) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpawnEnemyAfterTime>d__3(0) { enemySetup = enemySetup, position = position, timeSpan = timeSpan, network = network }; } } internal class SpawnRandomDroneItem : IChanceEntry { bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Item randomItemOfType = ChanceUtil.GetRandomItemOfType((itemType)0); if ((Object)(object)randomItemOfType == (Object)null) { return false; } Items.SpawnItem(randomItemOfType, ((Component)network).gameObject.transform.position, Quaternion.identity); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("A drone", (PossessChatID)0, Color.blue); } } internal class SpawnRandomHealthPack : IChanceEntry { bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Item randomItemOfType = ChanceUtil.GetRandomItemOfType((itemType)8); if ((Object)(object)randomItemOfType == (Object)null) { return false; } Items.SpawnItem(randomItemOfType, ((Component)network).gameObject.transform.position, Quaternion.identity); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("Some health", (PossessChatID)0, Color.green); } } internal class SpawnRandomUpgradeItem : IChanceEntry { bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Item randomItemOfType = ChanceUtil.GetRandomItemOfType((itemType)3); if ((Object)(object)randomItemOfType == (Object)null) { return false; } Items.SpawnItem(randomItemOfType, ((Component)network).gameObject.transform.position, Quaternion.identity); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("Shiny upgrade", (PossessChatID)0, Color.cyan); } } internal class SpawnRandomValuable : IChanceEntry { private static readonly List<Type> TYPES = new List<Type> { (Type)2, (Type)3, (Type)5 }; private Type type; bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) type = TYPES[Random.Range(0, TYPES.Count)]; List<GameObject> valuablesByVolumeType = ValuableUtil.GetValuablesByVolumeType(RunManager.instance.levelCurrent, type); if (valuablesByVolumeType.Count == 0) { return false; } GameObject val = valuablesByVolumeType[Random.Range(0, valuablesByVolumeType.Count)]; if ((Object)(object)val == (Object)null) { return false; } ValuableObject component = val.GetComponent<ValuableObject>(); if ((Object)(object)component == (Object)null) { return false; } Valuables.SpawnValuable(component, ((Component)network).gameObject.transform.position, ((Component)network).gameObject.transform.rotation); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) return ("A " + ((object)(Type)(ref type)).ToString().ToLower() + " item!", (PossessChatID)0, Color.white); } } internal class TeleportRandomPlayer : IChanceEntry { private PlayerAvatar selected; bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) selected = ChanceUtil.GetRandomAlivePlayerButExclude(roller); if ((Object)(object)selected == (Object)null) { return false; } List<LevelPoint> list = SemiFunc.LevelPointsGetAll(); if (list.Count == 0) { return false; } LevelPoint val = list[Random.Range(0, list.Count)]; if ((Object)(object)val == (Object)null) { return false; } network.Teleport(selected, ((Component)val).transform.position); network.PossessChat(selected, (PossessChatID)3, roller.playerName + " has teleported me!", Color.red); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) return (selected.playerName + " has been teleported!", (PossessChatID)4, Color.red); } } internal class TeleportRoller : IChanceEntry { bool IChanceEntry.Execute(PlayerAvatar roller, ValuablePresentChanceNetwork network) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) List<LevelPoint> list = SemiFunc.LevelPointsGetAll(); if (list.Count == 0) { return false; } LevelPoint val = list[Random.Range(0, list.Count)]; if ((Object)(object)val == (Object)null) { return false; } network.Teleport(roller, ((Component)val).transform.position); return true; } (string, PossessChatID, Color) IChanceEntry.GetChatMessage() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ("Teleported :(", (PossessChatID)0, Color.red); } } }
plugins/REPO_Shop_Items_in_Level.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("REPO_Shop_Items_in_Level")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.7.17.0")] [assembly: AssemblyInformationalVersion("1.7.17+0d02449db4ec8c43c6d4851309972bf4e9351e70")] [assembly: AssemblyProduct("Shop Items spawn in Level")] [assembly: AssemblyTitle("REPO_Shop_Items_in_Level")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.7.17.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace REPO_Shop_Items_in_Level { public class UsedVolumeTracker : MonoBehaviour { } public class SpawnedItemTracker : MonoBehaviour { } [BepInPlugin("REPO_Shop_Items_in_Level", "Shop Items spawn in Level", "1.7.17")] [BepInProcess("REPO.exe")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; internal static ConfigEntry<bool> SpawnUpgradeItems; internal static ConfigEntry<bool> MapHideUpgradeItems; internal static ConfigEntry<float> UpgradeItemSpawnChance; internal static ConfigEntry<bool> UseShopPriceForUpgradeItems; internal static ConfigEntry<bool> SpawnDroneItems; internal static ConfigEntry<bool> MapHideDroneItems; internal static ConfigEntry<float> DroneItemSpawnChance; internal static ConfigEntry<bool> UseShopPriceForDroneItems; internal static List<ConfigEntry<bool>> DisallowedItems; private Harmony harmony; public static Plugin Instance { get; private set; } private void Awake() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown Instance = this; Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin REPO_Shop_Items_in_Level is loaded!"); harmony = new Harmony("REPO_Shop_Items_in_Level"); harmony.PatchAll(typeof(Plugin)); Logger.LogInfo((object)"Harmony patches applied!"); SpawnUpgradeItems = ((BaseUnityPlugin)this).Config.Bind<bool>("UpgradeItems", "SpawnUpgradeItems", true, new ConfigDescription("Whether upgrade items can spawn in levels", (AcceptableValueBase)null, Array.Empty<object>())); MapHideUpgradeItems = ((BaseUnityPlugin)this).Config.Bind<bool>("UpgradeItems", "MapHideShopUpgradeItems", true, new ConfigDescription("(Client) Whether upgrade items are hidden on the map", (AcceptableValueBase)null, Array.Empty<object>())); UpgradeItemSpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("UpgradeItems", "UpgradeItemSpawnChance", 2.5f, new ConfigDescription("% chance for an upgrade item to spawn", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); UseShopPriceForUpgradeItems = ((BaseUnityPlugin)this).Config.Bind<bool>("UpgradeItems", "UseShopPriceForItemSelection", true, new ConfigDescription("If ON: Cheaper upgrade items appear more often. If OFF: All upgrade items have equal chance.", (AcceptableValueBase)null, Array.Empty<object>())); SpawnDroneItems = ((BaseUnityPlugin)this).Config.Bind<bool>("DroneItems", "SpawnDroneItems", true, new ConfigDescription("Whether drone items can spawn in levels", (AcceptableValueBase)null, Array.Empty<object>())); MapHideDroneItems = ((BaseUnityPlugin)this).Config.Bind<bool>("DroneItems", "MapHideDroneItems", true, new ConfigDescription("(Client) Whether drone items are hidden on the map", (AcceptableValueBase)null, Array.Empty<object>())); DroneItemSpawnChance = ((BaseUnityPlugin)this).Config.Bind<float>("DroneItems", "DroneItemsSpawnChance", 0.95f, new ConfigDescription("% chance for a drone item to spawn", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); UseShopPriceForDroneItems = ((BaseUnityPlugin)this).Config.Bind<bool>("DroneItems", "UseShopPriceForItemSelection", true, new ConfigDescription("If ON: Cheaper drone items appear more often. If OFF: All drone items have equal chance.", (AcceptableValueBase)null, Array.Empty<object>())); } [HarmonyPatch(typeof(MainMenuOpen), "Awake")] [HarmonyPostfix] public static void MainMenuOpen_Awake_Postfix(StatsManager __instance) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Invalid comparison between Unknown and I4 //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown if (DisallowedItems != null) { return; } Logger.LogInfo((object)"Initializing disallowed items list"); DisallowedItems = new List<ConfigEntry<bool>>(); foreach (Item value in StatsManager.instance.itemDictionary.Values) { itemType itemType = value.itemType; itemType val = itemType; ConfigEntry<bool> val2; if ((int)val != 0) { if ((int)val != 3) { continue; } val2 = ((BaseUnityPlugin)Instance).Config.Bind<bool>("AllowedItems Upgrades", ((Object)value).name, true, new ConfigDescription("Whether this upgrade item can spawn in levels", (AcceptableValueBase)null, Array.Empty<object>())); } else { val2 = ((BaseUnityPlugin)Instance).Config.Bind<bool>("AllowedItems Drones", ((Object)value).name, true, new ConfigDescription("Whether this drone item can spawn in levels", (AcceptableValueBase)null, Array.Empty<object>())); } if (!val2.Value) { DisallowedItems.Add(val2); } } } private static bool GetRandomItemOfType(itemType itemType, out Item item) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) item = null; List<Item> list = (from i in StatsManager.instance.itemDictionary.Values where i.itemType == itemType where (Object)(object)i.value != (Object)null && i.value.valueMin > 0f where !DisallowedItems.Any((ConfigEntry<bool> cfg) => ((ConfigEntryBase)cfg).Definition.Key == ((Object)i).name && !cfg.Value) select i).ToList(); if (list.Count == 0) { Logger.LogWarning((object)$"GetRandomItemOfType: No valid items found for type {itemType} after filtering."); return false; } bool flag = false; itemType val = itemType; itemType val2 = val; if ((int)val2 != 0) { if ((int)val2 == 3) { flag = UseShopPriceForUpgradeItems.Value; } } else { flag = UseShopPriceForDroneItems.Value; } if (flag) { float num = list.Sum((Item i) => 1f / i.value.valueMin); if (num <= 0f || float.IsNaN(num) || float.IsInfinity(num)) { Logger.LogWarning((object)($"GetRandomItemOfType: Invalid total weight {num} for type {itemType}. " + "This may indicate an issue with item values or weights.")); return false; } float num2 = Random.Range(0f, num); foreach (Item item2 in list) { float num3 = 1f / item2.value.valueMin; num2 -= num3; if (num2 <= 0f) { item = item2; break; } } if ((Object)(object)item == (Object)null) { Logger.LogWarning((object)($"GetRandomItemOfType: Weighted selection loop for type {itemType} completed unexpectedly " + "without selecting an item. This may indicate a precision issue.")); return false; } float num4 = 1f / item.value.valueMin / num * 100f; Logger.LogInfo((object)$"Selecting {((Object)item).name} at a chance of {num4:F2}% compared to others of type {itemType} (based on shop price)"); } else { int index = Random.Range(0, list.Count); item = list[index]; Logger.LogInfo((object)$"Selecting {((Object)item).name} at a chance of {100f / (float)list.Count:F2}% compared to others of type {itemType} (equal chance)"); } return true; } private static bool HasValuablePropSwitch(ValuableVolume volume) { return (Object)(object)((Component)((Component)volume).transform).GetComponentInParent<ValuablePropSwitch>() != (Object)null; } private static bool ShouldSpawnItem(ValuableVolume volume, out itemType? itemType, out bool hasSwitch) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 itemType = null; hasSwitch = HasValuablePropSwitch(volume); if (hasSwitch) { return false; } Type volumeType = volume.VolumeType; Type val = volumeType; if ((int)val != 0) { if ((int)val == 1) { if (!SpawnDroneItems.Value) { return false; } itemType = (itemType)0; return Random.Range(0f, 100f) <= DroneItemSpawnChance.Value; } return false; } if (!SpawnUpgradeItems.Value) { return false; } itemType = (itemType)3; return Random.Range(0f, 100f) <= UpgradeItemSpawnChance.Value; } private static GameObject SpawnItem(Item item, Vector3 position, Quaternion rotation) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) GameObject val = ((!SemiFunc.IsMultiplayer()) ? Object.Instantiate<GameObject>(item.prefab, position, rotation) : PhotonNetwork.Instantiate("Items/" + ((Object)item).name, position, rotation, (byte)0, (object[])null)); val.AddComponent<SpawnedItemTracker>(); return val; } private static bool RandomItemSpawn(ValuableVolume volume) { //IL_002e: 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_005a: Unknown result type (might be due to invalid IL or missing references) if (!ShouldSpawnItem(volume, out var itemType, out var _)) { return false; } if (!itemType.HasValue) { return false; } if (!GetRandomItemOfType(itemType.Value, out var item)) { return false; } SpawnItem(item, ((Component)volume).transform.position, ((Component)volume).transform.rotation); return true; } [HarmonyPatch(typeof(ValuableDirector), "Spawn")] [HarmonyPrefix] public static void ValuableDirector_Spawn_Prefix(GameObject _valuable, ValuableVolume _volume, string _path) { ((Component)_volume).gameObject.AddComponent<UsedVolumeTracker>(); } [HarmonyPatch(typeof(ValuableDirector), "VolumesAndSwitchSetup")] [HarmonyPostfix] public static void ValuableDirector_VolumesAndSwitchSetup_Postfix(ValuableDirector __instance) { if (!SemiFunc.RunIsLevel()) { return; } IEnumerable<ValuableVolume> enumerable = from volume in Object.FindObjectsOfType<ValuableVolume>(false).ToList() where (Object)(object)((Component)volume).gameObject.GetComponent<UsedVolumeTracker>() == (Object)null where !HasValuablePropSwitch(volume) select volume; Logger.LogInfo((object)$"Found {enumerable.Count()} potential volumes to spawn items in"); Logger.LogInfo((object)$"Upgrade item spawn chance: {UpgradeItemSpawnChance.Value}% on {enumerable.Where((ValuableVolume volume) => (int)volume.VolumeType == 0).Count()} tiny volumes"); Logger.LogInfo((object)$"Drone item spawn chance: {DroneItemSpawnChance.Value}% on {enumerable.Where((ValuableVolume volume) => (int)volume.VolumeType == 1).Count()} small volumes"); int num = 0; foreach (ValuableVolume item in enumerable) { if (RandomItemSpawn(item)) { num++; } } Logger.LogInfo((object)$"Spawned {num} items in total"); } [HarmonyPatch(typeof(Map), "AddCustom")] [HarmonyPostfix] public static void Map_AddCustom_Postfix(MapCustom mapCustom) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 ItemAttributes val = default(ItemAttributes); if (!SemiFunc.RunIsLevel() || !((Component)mapCustom).gameObject.TryGetComponent<ItemAttributes>(ref val)) { return; } itemType itemType = val.item.itemType; itemType val2 = itemType; if ((int)val2 != 0) { if ((int)val2 != 3 || !MapHideUpgradeItems.Value) { return; } } else if (!MapHideDroneItems.Value) { return; } ((Component)mapCustom.mapCustomEntity).gameObject.SetActive(false); } [HarmonyPatch(typeof(ExtractionPoint), "DestroyAllPhysObjectsInHaulList")] [HarmonyPostfix] public static void ExtractionPoint_DestroyAllPhysObjectsInHaulList_Postfix(ExtractionPoint __instance) { if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } List<GameObject> list = (from tracker in Object.FindObjectsOfType<SpawnedItemTracker>(false) select ((Component)tracker).gameObject).ToList(); foreach (GameObject item in list) { RoomVolumeCheck component = item.GetComponent<RoomVolumeCheck>(); if (!((Object)(object)component == (Object)null) && component.CurrentRooms.Any((RoomVolume room) => room.Extraction)) { ItemAttributes component2 = item.GetComponent<ItemAttributes>(); Logger.LogInfo((object)("Adding item " + ((Object)item).name + " to purchased items")); StatsManager.instance.ItemPurchase(component2.item.itemAssetName); Logger.LogInfo((object)("Destroying spawned item " + ((Object)item).name + " in extraction point " + ((Object)__instance).name)); item.GetComponent<PhysGrabObject>().DestroyPhysGrabObject(); } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "REPO_Shop_Items_in_Level"; public const string PLUGIN_NAME = "Shop Items spawn in Level"; public const string PLUGIN_VERSION = "1.7.17"; } }