Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Paroxysm V01 v1.0.1
plugins/CustomGrabColour.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CustomGrabColour.Config; using CustomGrabColour.PlayerGrabBeam; using HarmonyLib; using MenuLib; using MenuLib.MonoBehaviors; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".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("Enchanted_Games")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("2.2.0.0")] [assembly: AssemblyInformationalVersion("2.2.0+fbbbd91b05114a40601b8f1c56741df7998c23bd")] [assembly: AssemblyProduct("CustomGrabColour")] [assembly: AssemblyTitle("CustomGrabColour")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.2.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 CustomGrabColour { public static class PluginInfo { public const string PluginID = "CustomGrabColour"; public const string PluginName = "CustomGrabColour"; public const string PluginVersion = "2.2.0"; public const string PluginGuid = "games.enchanted.CustomGrabColour"; } [BepInPlugin("games.enchanted.CustomGrabColour", "CustomGrabColour", "2.2.0")] public class Plugin : BaseUnityPlugin { private ManualLogSource _pluginLogger; public static Plugin Instance { get; private set; } public static void LogMessageIfDebug(object message) { if (CustomGrabColourConfig.EnableDebugLogs.Value) { Instance._pluginLogger.LogMessage((object)("CustomGrabColour Debug: " + message)); } } public static void LogMessage(object message) { Instance._pluginLogger.LogMessage((object)("CustomGrabColour: " + message)); } public static void LogError(object message) { Instance._pluginLogger.LogError((object)("CustomGrabColour Debug: " + message)); } public static void LogErrorIfDebug(object message) { if (CustomGrabColourConfig.EnableDebugLogs.Value) { Instance._pluginLogger.LogError((object)("CustomGrabColour: " + message)); } } public static void LogWarning(object message) { Instance._pluginLogger.LogWarning((object)("CustomGrabColour: " + message)); } private void Awake() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown Instance = this; _pluginLogger = ((BaseUnityPlugin)this).Logger; _pluginLogger.LogInfo((object)"Loading plugin CustomGrabColour! (games.enchanted.CustomGrabColour)"); CustomGrabColourConfig.Init(((BaseUnityPlugin)this).Config); Harmony val = new Harmony("games.enchanted.CustomGrabColour"); val.PatchAll(); ConfigMenu.Init(); _pluginLogger.LogInfo((object)"Loading finished for CustomGrabColour! (games.enchanted.CustomGrabColour)"); } } } namespace CustomGrabColour.PlayerGrabBeam { public class CustomGrabBeamColour : MonoBehaviour, IPunObservable { internal static GrabBeamColourSettings LocalNeutralColour; internal static GrabBeamColourSettings LocalHealingColour; internal static GrabBeamColourSettings LocalRotatingColour; internal GrabBeamColourSettings CurrentNeutralColour; internal GrabBeamColourSettings CurrentHealingColour; internal GrabBeamColourSettings CurrentRotatingColour; internal bool SentInitialColourUpdate = false; public PlayerAvatar player; private Material _bodyMaterialInternal; public Material BodyMaterial { get { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if ((Object)(object)_bodyMaterialInternal == (Object)null) { try { FieldInfo field = ((object)player.playerHealth).GetType().GetField("bodyMaterial", BindingFlags.Instance | BindingFlags.NonPublic); _bodyMaterialInternal = (Material)field.GetValue(player.playerHealth); } catch (Exception) { Plugin.LogMessageIfDebug("Failed to get value of PlayerHealth bodyMaterial field"); return null; } } return _bodyMaterialInternal; } set { _bodyMaterialInternal = value; } } public static GrabBeamColourSettings LocalBeamColour { get { throw new NotImplementedException("Tried to get field LocalBeamColour, call GetLocalSettingsForBeamType instead"); } set { switch (value.CurrentBeamType) { case GrabBeamColourSettings.BeamType.Neutral: LocalNeutralColour = value; break; case GrabBeamColourSettings.BeamType.Heal: LocalHealingColour = value; break; case GrabBeamColourSettings.BeamType.Rotate: LocalRotatingColour = value; break; } } } public GrabBeamColourSettings CurrentBeamColour { get { throw new NotImplementedException("Tried to get field CurrentBeamColour, call GetSettingsForBeamType instead"); } set { switch (value.CurrentBeamType) { case GrabBeamColourSettings.BeamType.Neutral: CurrentNeutralColour = value; break; case GrabBeamColourSettings.BeamType.Heal: CurrentHealingColour = value; break; case GrabBeamColourSettings.BeamType.Rotate: CurrentRotatingColour = value; break; } } } public static GrabBeamColourSettings GetLocalSettingsForBeamType(GrabBeamColourSettings.BeamType beamType) { return beamType switch { GrabBeamColourSettings.BeamType.Heal => LocalHealingColour, GrabBeamColourSettings.BeamType.Rotate => LocalRotatingColour, _ => LocalNeutralColour, }; } public GrabBeamColourSettings GetSettingsForBeamType(GrabBeamColourSettings.BeamType beamType) { return beamType switch { GrabBeamColourSettings.BeamType.Heal => CurrentNeutralColour, GrabBeamColourSettings.BeamType.Rotate => CurrentHealingColour, _ => CurrentRotatingColour, }; } private void Awake() { player = ((Component)this).gameObject.GetComponent<PlayerAvatar>(); } public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { throw new NotImplementedException(); } public static void SaveLocalColoursToConfig() { CustomGrabColourConfig.SaveColour(LocalNeutralColour); CustomGrabColourConfig.SaveColour(LocalHealingColour); CustomGrabColourConfig.SaveColour(LocalRotatingColour); } public static void ResetBeamColours() { //IL_0001: 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_0049: Unknown result type (might be due to invalid IL or missing references) LocalNeutralColour = new GrabBeamColourSettings(CustomGrabColourConfig.NeutralDefaultColour, (bool)((ConfigEntryBase)CustomGrabColourConfig.NeutralGrabBeam.MatchSkin).DefaultValue, GrabBeamColourSettings.BeamType.Neutral); LocalHealingColour = new GrabBeamColourSettings(CustomGrabColourConfig.HealingDefaultColour, (bool)((ConfigEntryBase)CustomGrabColourConfig.HealingGrabBeam.MatchSkin).DefaultValue, GrabBeamColourSettings.BeamType.Heal); LocalRotatingColour = new GrabBeamColourSettings(CustomGrabColourConfig.RotatingDefaultColour, (bool)((ConfigEntryBase)CustomGrabColourConfig.RotatingGrabBeam.MatchSkin).DefaultValue, GrabBeamColourSettings.BeamType.Rotate); UpdateBeamColourForAllBeams(); } public static void UpdateBeamColour(GrabBeamColourSettings newColour) { newColour.a = Mathf.Clamp(newColour.a, 0f, 0.5f); LocalBeamColour = newColour; UpdateBeamColour(newColour.CurrentBeamType); } public static void UpdateBeamColourForAllBeams() { foreach (GrabBeamColourSettings.BeamType value in Enum.GetValues(typeof(GrabBeamColourSettings.BeamType))) { UpdateBeamColour(value); } } public static void UpdateBeamColour(GrabBeamColourSettings.BeamType beamType) { GrabBeamColourSettings localSettingsForBeamType = GetLocalSettingsForBeamType(beamType); if (GameManager.Multiplayer()) { PlayerAvatar.instance.photonView.RPC("SetBeamColourRPC", (RpcTarget)3, GrabBeamColourSettings.ToRPCBuffer(localSettingsForBeamType)); } else { ((Component)PlayerAvatar.instance).GetComponent<CustomGrabBeamColour>().SetBeamColourRPC(GrabBeamColourSettings.ToRPCBuffer(localSettingsForBeamType)); } } [PunRPC] public void SetBeamColourRPC(object[] beamColourParts) { GrabBeamColourSettings currentBeamColour = GrabBeamColourSettings.FromRPCBuffer(beamColourParts); Plugin.LogMessageIfDebug("SetBeamColourRPC called with values: r:" + currentBeamColour.r + ", g:" + currentBeamColour.g + ", b:" + currentBeamColour.b + ", a:" + currentBeamColour.a + ", matchSkin:" + currentBeamColour.MatchSkin + ", beamType:" + currentBeamColour.CurrentBeamType); currentBeamColour.a = Mathf.Clamp(currentBeamColour.a, 0f, 0.5f); CurrentBeamColour = currentBeamColour; if (currentBeamColour.CurrentBeamType != 0) { return; } Type type = ((object)player.physGrabber).GetType(); try { FieldInfo field = type.GetField("prevColorState", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(player.physGrabber, -1); } } catch (Exception ex) { Plugin.LogErrorIfDebug("Error while setting field 'prevColorState', this is probably harmless.\n" + ex); } try { MethodInfo method = type.GetMethod("ColorStates", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { method.Invoke(player.physGrabber, null); } } catch (Exception ex2) { Plugin.LogErrorIfDebug("Error while calling method 'ColorStates', this is probably harmless.\n" + ex2); } } public Color GetBodyColour(Color fallbackColour) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Color color = BodyMaterial.GetColor(Shader.PropertyToID("_AlbedoColor")); bool flag = false; return color; } public static Color GetLocalBodyColour(Color fallbackColour) { //IL_0055: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //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_0062: 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_005f: Unknown result type (might be due to invalid IL or missing references) Color color; try { FieldInfo field = ((object)PlayerAvatar.instance.playerHealth).GetType().GetField("bodyMaterial", BindingFlags.Instance | BindingFlags.NonPublic); Material val = (Material)field.GetValue(PlayerAvatar.instance.playerHealth); color = val.GetColor(Shader.PropertyToID("_AlbedoColor")); } catch (Exception) { Plugin.LogMessageIfDebug("Failed to get value of PlayerHealth bodyMaterial field in GetLocalBodyColour"); return fallbackColour; } bool flag = false; return color; } } public struct GrabBeamColourSettings { public enum BeamType : byte { Neutral, Heal, Rotate } public Color Colour; public bool MatchSkin; public readonly BeamType CurrentBeamType; public float r { get { return Colour.r; } set { Colour.r = value; } } public float g { get { return Colour.g; } set { Colour.g = value; } } public float b { get { return Colour.b; } set { Colour.b = value; } } public float a { get { return Colour.a; } set { Colour.a = value; } } public GrabBeamColourSettings(Color colour, bool matchSkin, BeamType currentBeamType) { //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) Colour = colour; MatchSkin = matchSkin; CurrentBeamType = currentBeamType; } public static object[] ToRPCBuffer(GrabBeamColourSettings beamColour) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_002c: 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) Color colour = beamColour.Colour; return new object[6] { colour.r, colour.g, colour.b, colour.a, beamColour.MatchSkin, (byte)beamColour.CurrentBeamType }; } public static GrabBeamColourSettings FromRPCBuffer(object[] rpcBuffer) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (!(rpcBuffer[0] is float) || !(rpcBuffer[1] is float) || !(rpcBuffer[2] is float) || !(rpcBuffer[3] is float) || !(rpcBuffer[4] is bool) || !(rpcBuffer[5] is byte)) { throw new ArgumentException("FromRPCBuffer recieved incorrect parameters"); } Color colour = default(Color); ((Color)(ref colour))..ctor((float)rpcBuffer[0], (float)rpcBuffer[1], (float)rpcBuffer[2], (float)rpcBuffer[3]); return new GrabBeamColourSettings(colour, (bool)rpcBuffer[4], (BeamType)rpcBuffer[5]); } } public static class GrabBeamUtil { private static void TrySendBeamColourUpdate(PlayerAvatar player, GrabBeamColourSettings.BeamType beamType) { CustomGrabBeamColour component = ((Component)player).GetComponent<CustomGrabBeamColour>(); if ((Object)(object)component != (Object)null) { CustomGrabBeamColour.UpdateBeamColour(beamType); } } public static void TrySendBeamColourUpdateForAllBeams(PlayerAvatar player) { foreach (GrabBeamColourSettings.BeamType value in Enum.GetValues(typeof(GrabBeamColourSettings.BeamType))) { TrySendBeamColourUpdate(player, value); } } } } namespace CustomGrabColour.Patch { internal abstract class PhysGrabberPatches { [HarmonyPatch(typeof(PhysGrabber))] [HarmonyPatch("ColorStateSetColor")] private class PhysGrabber_ColorState_Patch { private static readonly FieldRef<PhysGrabber, int> PrevColorStateRef = AccessTools.FieldRefAccess<PhysGrabber, int>("prevColorState"); private static void Prefix(PhysGrabber __instance, ref Color mainColor, ref Color emissionColor) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00c6: 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_00ea: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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) int num = PrevColorStateRef.Invoke(__instance); bool flag = false; CustomGrabBeamColour currentGrabBeamColour = GetCurrentGrabBeamColour(__instance); if (!Object.op_Implicit((Object)(object)currentGrabBeamColour)) { Plugin.LogMessageIfDebug("Player has no custom beam colour"); ResetRotateBeamGridsColour(__instance); return; } GrabBeamColourSettings grabBeamColourSettings; switch (num) { case 0: grabBeamColourSettings = currentGrabBeamColour.CurrentNeutralColour; break; case 1: grabBeamColourSettings = currentGrabBeamColour.CurrentHealingColour; break; case 2: grabBeamColourSettings = currentGrabBeamColour.CurrentRotatingColour; break; default: ResetRotateBeamGridsColour(__instance); return; } Color val; if (grabBeamColourSettings.MatchSkin) { val = currentGrabBeamColour.GetBodyColour(grabBeamColourSettings.Colour); val.a = grabBeamColourSettings.Colour.a; } else { val = grabBeamColourSettings.Colour; } mainColor.r = val.r / 3.5f; mainColor.g = val.g / 4f; mainColor.b = val.b / 3.5f; mainColor.a = val.a; emissionColor.r = val.r / 3.5f; emissionColor.g = val.g / 4f; emissionColor.b = val.b / 3.5f; emissionColor.a = 0.3f; Plugin.LogMessageIfDebug("Set player beam to: (" + mainColor.r + ", " + mainColor.g + ", " + mainColor.b + ", " + mainColor.a + "). colour state is " + num); SetRotateBeamGridsColour(__instance, val); } } [HarmonyPatch(typeof(PhysGrabber))] [HarmonyPatch("ChangeBeamAlpha")] private class PhysGrabber_ChangeBeamAlpha_Patch { private static bool Prefix() { return false; } } [HarmonyPatch(typeof(PhysGrabber))] [HarmonyPatch("PhysGrabBeamActivate")] private class PhysGrabber_PhysGrabBeamActivate_Patch { private static async void Prefix(PhysGrabber __instance) { CustomGrabBeamColour grabBeamColour = GetCurrentGrabBeamColour(__instance); if (!grabBeamColour.SentInitialColourUpdate) { bool grabBeamActive = true; try { FieldInfo grabBeamActiveField = ((object)__instance).GetType().GetField("physGrabBeamActive", BindingFlags.Instance | BindingFlags.NonPublic); grabBeamActive = (bool)grabBeamActiveField.GetValue(__instance); } catch (Exception) { Plugin.LogMessageIfDebug("Failed to get value of PhysGrabber physGrabBeamActive field"); } if (!grabBeamActive) { await Task.Delay(100); Plugin.LogMessageIfDebug("PhysGrabBeamActivate called"); GrabBeamUtil.TrySendBeamColourUpdateForAllBeams(__instance.playerAvatar); grabBeamColour.SentInitialColourUpdate = true; } } } } private static readonly FieldRef<PhysGrabber, List<GameObject>> PhysGrabPointVisualGridObjectsRef = AccessTools.FieldRefAccess<PhysGrabber, List<GameObject>>("physGrabPointVisualGridObjects"); private static readonly int EmissionColor = Shader.PropertyToID("_EmissionColor"); private static CustomGrabBeamColour GetCurrentGrabBeamColour(PhysGrabber grabber) { return ((Component)grabber.playerAvatar).gameObject.GetComponent<CustomGrabBeamColour>(); } private static void ResetRotateBeamGridsColour(PhysGrabber __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SetRotateBeamGridsColour(__instance, CustomGrabColourConfig.RotatingDefaultColour); } private static void SetRotateBeamGridsColour(PhysGrabber __instance, Color gridColour) { //IL_0046: 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_005e: 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_0076: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_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) List<GameObject> list = PhysGrabPointVisualGridObjectsRef.Invoke(__instance); Color color = default(Color); Color val = default(Color); foreach (GameObject item in list) { Material material = ((Renderer)item.GetComponent<MeshRenderer>()).material; if (Object.op_Implicit((Object)(object)material)) { ((Color)(ref color))..ctor(gridColour.r / 3.5f, gridColour.g / 4f, gridColour.b / 3.5f, gridColour.a); material.color = color; ((Color)(ref val))..ctor(gridColour.r / 3.5f, gridColour.g / 4f, gridColour.b / 3.5f, 0.3f); material.SetColor(EmissionColor, val); Plugin.LogMessageIfDebug("Set grid mesh to: (" + material.color.r + ", " + material.color.g + ", " + material.color.b + ", " + material.color.a + ")"); } } } } internal abstract class PlayerAvatarPatches { [HarmonyPatch(typeof(PlayerAvatar))] [HarmonyPatch("Awake")] private class PlayerAvatar_Awake_Patch { public static void Postfix(PlayerAvatar __instance) { ((Component)__instance).gameObject.AddComponent<CustomGrabBeamColour>(); } } [HarmonyPatch(typeof(PlayerAvatar))] [HarmonyPatch("PlayerAvatarSetColor")] private class PlayerAvatar_PlayerAvatarSetColor_Patch { public static void Postfix(PlayerAvatar __instance, int colorIndex) { GrabBeamUtil.TrySendBeamColourUpdateForAllBeams(__instance); } } } } namespace CustomGrabColour.Config { internal static class ConfigMenu { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static BuilderDelegate <>9__7_0; public static BuilderDelegate <>9__7_1; public static BuilderDelegate <>9__7_2; public static BuilderDelegate <>9__8_0; public static ScrollViewBuilderDelegate <>9__8_1; public static Action<float> <>9__8_20; public static ScrollViewBuilderDelegate <>9__8_2; public static Action<float> <>9__8_21; public static ScrollViewBuilderDelegate <>9__8_3; public static Action<float> <>9__8_22; public static ScrollViewBuilderDelegate <>9__8_4; public static Action<float> <>9__8_23; public static ScrollViewBuilderDelegate <>9__8_5; public static Action<bool> <>9__8_24; public static ScrollViewBuilderDelegate <>9__8_6; public static ScrollViewBuilderDelegate <>9__8_7; public static Action<float> <>9__8_25; public static ScrollViewBuilderDelegate <>9__8_8; public static Action<float> <>9__8_26; public static ScrollViewBuilderDelegate <>9__8_9; public static Action<float> <>9__8_27; public static ScrollViewBuilderDelegate <>9__8_10; public static Action<float> <>9__8_28; public static ScrollViewBuilderDelegate <>9__8_11; public static Action<bool> <>9__8_29; public static ScrollViewBuilderDelegate <>9__8_12; public static ScrollViewBuilderDelegate <>9__8_13; public static Action<float> <>9__8_30; public static ScrollViewBuilderDelegate <>9__8_14; public static Action<float> <>9__8_31; public static ScrollViewBuilderDelegate <>9__8_15; public static Action<float> <>9__8_32; public static ScrollViewBuilderDelegate <>9__8_16; public static Action<float> <>9__8_33; public static ScrollViewBuilderDelegate <>9__8_17; public static Action<bool> <>9__8_34; public static ScrollViewBuilderDelegate <>9__8_18; internal void <Init>b__7_0(Transform parent) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f)); } internal void <Init>b__7_1(Transform parent) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f)); } internal void <Init>b__7_2(Transform parent) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f)); } internal void <OpenPopup>b__8_0(Transform parent) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_0106: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) float verticalPos = GetVerticalPos(0); REPOLabel val = MenuAPI.CreateREPOLabel("Neutral Colour Preview", parent, new Vector2(452f, verticalPos - 60f)); ((Component)val).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); if (!Object.op_Implicit((Object)(object)_neutralGrabColourPreviewParent)) { CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos), out _neutralGrabColourPreviewParent, out _neutralGrabColourPreviewImage); } float verticalPos2 = GetVerticalPos(1); REPOLabel val2 = MenuAPI.CreateREPOLabel("Rotating Colour Preview", parent, new Vector2(452f, verticalPos2 - 60f)); ((Component)val2).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); if (!Object.op_Implicit((Object)(object)_rotatingGrabColourPreviewParent)) { CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos2), out _rotatingGrabColourPreviewParent, out _rotatingGrabColourPreviewImage); } float verticalPos3 = GetVerticalPos(2); REPOLabel val3 = MenuAPI.CreateREPOLabel("Healing Colour Preview", parent, new Vector2(452f, verticalPos3 - 60f)); ((Component)val3).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); if (!Object.op_Implicit((Object)(object)_healingGrabColourPreviewParent)) { CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos3), out _healingGrabColourPreviewParent, out _healingGrabColourPreviewImage); } } internal RectTransform <OpenPopup>b__8_1(Transform parent) { //IL_0012: 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) REPOLabel val = MenuAPI.CreateREPOLabel("Neutral Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(0))); ((Component)val).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); return ((REPOElement)val).rectTransform; } internal RectTransform <OpenPopup>b__8_2(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Red", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.r = f; if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin) { Color color = ((Graphic)_neutralGrabColourPreviewImage).color; color.r = f; ((Graphic)_neutralGrabColourPreviewImage).color = color; } }, CustomGrabBeamColour.LocalNeutralColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(1))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_20(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.r = f; if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin) { Color color = ((Graphic)_neutralGrabColourPreviewImage).color; color.r = f; ((Graphic)_neutralGrabColourPreviewImage).color = color; } } internal RectTransform <OpenPopup>b__8_3(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Green", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.g = f; if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin) { Color color = ((Graphic)_neutralGrabColourPreviewImage).color; color.g = f; ((Graphic)_neutralGrabColourPreviewImage).color = color; } }, CustomGrabBeamColour.LocalNeutralColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(2))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_21(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.g = f; if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin) { Color color = ((Graphic)_neutralGrabColourPreviewImage).color; color.g = f; ((Graphic)_neutralGrabColourPreviewImage).color = color; } } internal RectTransform <OpenPopup>b__8_4(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Blue", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.b = f; if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin) { Color color = ((Graphic)_neutralGrabColourPreviewImage).color; color.b = f; ((Graphic)_neutralGrabColourPreviewImage).color = color; } }, CustomGrabBeamColour.LocalNeutralColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(3))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_22(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.b = f; if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin) { Color color = ((Graphic)_neutralGrabColourPreviewImage).color; color.b = f; ((Graphic)_neutralGrabColourPreviewImage).color = color; } } internal RectTransform <OpenPopup>b__8_5(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Opacity", "", delegate(float f) { //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_0025: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.a = f; Color color = ((Graphic)_neutralGrabColourPreviewImage).color; color.a = f; ((Graphic)_neutralGrabColourPreviewImage).color = color; }, CustomGrabBeamColour.LocalNeutralColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(4))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_23(float f) { //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_0025: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.a = f; Color color = ((Graphic)_neutralGrabColourPreviewImage).color; color.a = f; ((Graphic)_neutralGrabColourPreviewImage).color = color; } internal RectTransform <OpenPopup>b__8_6(Transform parent) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) REPOToggle val2 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val) { CustomGrabBeamColour.LocalNeutralColour.MatchSkin = val; HandleNeutralSkinMatchChange(); }, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(5)), "Yes", "No", CustomGrabBeamColour.LocalNeutralColour.MatchSkin); return ((REPOElement)val2).rectTransform; } internal void <OpenPopup>b__8_24(bool val) { CustomGrabBeamColour.LocalNeutralColour.MatchSkin = val; HandleNeutralSkinMatchChange(); } internal RectTransform <OpenPopup>b__8_7(Transform parent) { //IL_0012: 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) REPOLabel val = MenuAPI.CreateREPOLabel("Rotating Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(6))); ((Component)val).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); return ((REPOElement)val).rectTransform; } internal RectTransform <OpenPopup>b__8_8(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Red", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.r = f; if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin) { Color color = ((Graphic)_rotatingGrabColourPreviewImage).color; color.r = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color; HandleRotatingSkinMatchChange(); } }, CustomGrabBeamColour.LocalRotatingColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(7))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_25(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.r = f; if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin) { Color color = ((Graphic)_rotatingGrabColourPreviewImage).color; color.r = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color; HandleRotatingSkinMatchChange(); } } internal RectTransform <OpenPopup>b__8_9(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Green", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.g = f; if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin) { Color color = ((Graphic)_rotatingGrabColourPreviewImage).color; color.g = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color; HandleRotatingSkinMatchChange(); } }, CustomGrabBeamColour.LocalRotatingColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(8))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_26(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.g = f; if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin) { Color color = ((Graphic)_rotatingGrabColourPreviewImage).color; color.g = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color; HandleRotatingSkinMatchChange(); } } internal RectTransform <OpenPopup>b__8_10(Transform parent) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Blue", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.b = f; if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin) { Color color = ((Graphic)_rotatingGrabColourPreviewImage).color; color.b = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color; HandleRotatingSkinMatchChange(); } }, CustomGrabBeamColour.LocalRotatingColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(9))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_27(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.b = f; if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin) { Color color = ((Graphic)_rotatingGrabColourPreviewImage).color; color.b = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color; HandleRotatingSkinMatchChange(); } } internal RectTransform <OpenPopup>b__8_11(Transform parent) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Opacity", "", delegate(float f) { //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_0025: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.a = f; Color color = ((Graphic)_rotatingGrabColourPreviewImage).color; color.a = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color; HandleRotatingSkinMatchChange(); }, CustomGrabBeamColour.LocalRotatingColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(10))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_28(float f) { //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_0025: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.a = f; Color color = ((Graphic)_rotatingGrabColourPreviewImage).color; color.a = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color; HandleRotatingSkinMatchChange(); } internal RectTransform <OpenPopup>b__8_12(Transform parent) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) REPOToggle val2 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val) { CustomGrabBeamColour.LocalRotatingColour.MatchSkin = val; HandleRotatingSkinMatchChange(); }, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(11)), "Yes", "No", CustomGrabBeamColour.LocalRotatingColour.MatchSkin); return ((REPOElement)val2).rectTransform; } internal void <OpenPopup>b__8_29(bool val) { CustomGrabBeamColour.LocalRotatingColour.MatchSkin = val; HandleRotatingSkinMatchChange(); } internal RectTransform <OpenPopup>b__8_13(Transform parent) { //IL_0012: 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) REPOLabel val = MenuAPI.CreateREPOLabel("Healing Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(6))); ((Component)val).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); return ((REPOElement)val).rectTransform; } internal RectTransform <OpenPopup>b__8_14(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Red", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.r = f; if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin) { Color color = ((Graphic)_healingGrabColourPreviewImage).color; color.r = f; ((Graphic)_healingGrabColourPreviewImage).color = color; HandleHealingSkinMatchChange(); } }, CustomGrabBeamColour.LocalHealingColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(7))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_30(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.r = f; if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin) { Color color = ((Graphic)_healingGrabColourPreviewImage).color; color.r = f; ((Graphic)_healingGrabColourPreviewImage).color = color; HandleHealingSkinMatchChange(); } } internal RectTransform <OpenPopup>b__8_15(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Green", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.g = f; if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin) { Color color = ((Graphic)_healingGrabColourPreviewImage).color; color.g = f; ((Graphic)_healingGrabColourPreviewImage).color = color; HandleHealingSkinMatchChange(); } }, CustomGrabBeamColour.LocalHealingColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(8))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_31(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.g = f; if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin) { Color color = ((Graphic)_healingGrabColourPreviewImage).color; color.g = f; ((Graphic)_healingGrabColourPreviewImage).color = color; HandleHealingSkinMatchChange(); } } internal RectTransform <OpenPopup>b__8_16(Transform parent) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Blue", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.b = f; if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin) { Color color = ((Graphic)_healingGrabColourPreviewImage).color; color.b = f; ((Graphic)_healingGrabColourPreviewImage).color = color; HandleHealingSkinMatchChange(); } }, CustomGrabBeamColour.LocalHealingColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(9))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_32(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.b = f; if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin) { Color color = ((Graphic)_healingGrabColourPreviewImage).color; color.b = f; ((Graphic)_healingGrabColourPreviewImage).color = color; HandleHealingSkinMatchChange(); } } internal RectTransform <OpenPopup>b__8_17(Transform parent) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) REPOSlider val = CreateColourSlider("Opacity", "", delegate(float f) { //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_0025: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.a = f; Color color = ((Graphic)_healingGrabColourPreviewImage).color; color.a = f; ((Graphic)_healingGrabColourPreviewImage).color = color; HandleHealingSkinMatchChange(); }, CustomGrabBeamColour.LocalHealingColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(10))); return ((REPOElement)val).rectTransform; } internal void <OpenPopup>b__8_33(float f) { //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_0025: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.a = f; Color color = ((Graphic)_healingGrabColourPreviewImage).color; color.a = f; ((Graphic)_healingGrabColourPreviewImage).color = color; HandleHealingSkinMatchChange(); } internal RectTransform <OpenPopup>b__8_18(Transform parent) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) REPOToggle val2 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val) { CustomGrabBeamColour.LocalHealingColour.MatchSkin = val; HandleHealingSkinMatchChange(); }, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(11)), "Yes", "No", CustomGrabBeamColour.LocalHealingColour.MatchSkin); return ((REPOElement)val2).rectTransform; } internal void <OpenPopup>b__8_34(bool val) { CustomGrabBeamColour.LocalHealingColour.MatchSkin = val; HandleHealingSkinMatchChange(); } } private static Image _neutralGrabColourPreviewImage; private static GameObject _neutralGrabColourPreviewParent; private static Image _rotatingGrabColourPreviewImage; private static GameObject _rotatingGrabColourPreviewParent; private static Image _healingGrabColourPreviewImage; private static GameObject _healingGrabColourPreviewParent; private const float HorizontalPos = 70f; public static void Init() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //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_0045: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown object obj = <>c.<>9__7_0; if (obj == null) { BuilderDelegate val = delegate(Transform parent) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f)); }; <>c.<>9__7_0 = val; obj = (object)val; } MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj); object obj2 = <>c.<>9__7_1; if (obj2 == null) { BuilderDelegate val2 = delegate(Transform parent) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f)); }; <>c.<>9__7_1 = val2; obj2 = (object)val2; } MenuAPI.AddElementToColorMenu((BuilderDelegate)obj2); if (!CustomGrabColourConfig.DebugAddButtonToMainMenu.Value) { return; } object obj3 = <>c.<>9__7_2; if (obj3 == null) { BuilderDelegate val3 = delegate(Transform parent) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Change Grab Colour", (Action)OpenPopup, parent, new Vector2(28.3f, 350f)); }; <>c.<>9__7_2 = val3; obj3 = (object)val3; } MenuAPI.AddElementToMainMenu((BuilderDelegate)obj3); } private static void OpenPopup() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown //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_0281: Expected O, but got Unknown //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Expected O, but got Unknown //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_0355: Expected O, but got Unknown //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Expected O, but got Unknown //IL_03b4: 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_03bf: Expected O, but got Unknown //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Expected O, but got Unknown //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Expected O, but got Unknown REPOPopupPage changeGrabColourPage = MenuAPI.CreateREPOPopupPage("Change Grab Beam Colour", (PresetSide)0, false, true, 1.5f); REPOPopupPage obj = changeGrabColourPage; object obj2 = <>c.<>9__8_0; if (obj2 == null) { BuilderDelegate val2 = delegate(Transform parent) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_0106: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) float verticalPos = GetVerticalPos(0); REPOLabel val41 = MenuAPI.CreateREPOLabel("Neutral Colour Preview", parent, new Vector2(452f, verticalPos - 60f)); ((Component)val41).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); if (!Object.op_Implicit((Object)(object)_neutralGrabColourPreviewParent)) { CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos), out _neutralGrabColourPreviewParent, out _neutralGrabColourPreviewImage); } float verticalPos2 = GetVerticalPos(1); REPOLabel val42 = MenuAPI.CreateREPOLabel("Rotating Colour Preview", parent, new Vector2(452f, verticalPos2 - 60f)); ((Component)val42).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); if (!Object.op_Implicit((Object)(object)_rotatingGrabColourPreviewParent)) { CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos2), out _rotatingGrabColourPreviewParent, out _rotatingGrabColourPreviewImage); } float verticalPos3 = GetVerticalPos(2); REPOLabel val43 = MenuAPI.CreateREPOLabel("Healing Colour Preview", parent, new Vector2(452f, verticalPos3 - 60f)); ((Component)val43).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); if (!Object.op_Implicit((Object)(object)_healingGrabColourPreviewParent)) { CreateBeamPreviewColourRectangle(parent, new Vector2(515f, verticalPos3), out _healingGrabColourPreviewParent, out _healingGrabColourPreviewImage); } }; <>c.<>9__8_0 = val2; obj2 = (object)val2; } obj.AddElement((BuilderDelegate)obj2); REPOPopupPage obj3 = changeGrabColourPage; object obj4 = <>c.<>9__8_1; if (obj4 == null) { ScrollViewBuilderDelegate val3 = delegate(Transform parent) { //IL_0012: 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) REPOLabel val40 = MenuAPI.CreateREPOLabel("Neutral Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(0))); ((Component)val40).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); return ((REPOElement)val40).rectTransform; }; <>c.<>9__8_1 = val3; obj4 = (object)val3; } obj3.AddElementToScrollView((ScrollViewBuilderDelegate)obj4, 0f, 0f); REPOPopupPage obj5 = changeGrabColourPage; object obj6 = <>c.<>9__8_2; if (obj6 == null) { ScrollViewBuilderDelegate val4 = delegate(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val39 = CreateColourSlider("Red", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.r = f; if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin) { Color color12 = ((Graphic)_neutralGrabColourPreviewImage).color; color12.r = f; ((Graphic)_neutralGrabColourPreviewImage).color = color12; } }, CustomGrabBeamColour.LocalNeutralColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(1))); return ((REPOElement)val39).rectTransform; }; <>c.<>9__8_2 = val4; obj6 = (object)val4; } obj5.AddElementToScrollView((ScrollViewBuilderDelegate)obj6, 0f, 0f); REPOPopupPage obj7 = changeGrabColourPage; object obj8 = <>c.<>9__8_3; if (obj8 == null) { ScrollViewBuilderDelegate val5 = delegate(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val38 = CreateColourSlider("Green", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.g = f; if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin) { Color color11 = ((Graphic)_neutralGrabColourPreviewImage).color; color11.g = f; ((Graphic)_neutralGrabColourPreviewImage).color = color11; } }, CustomGrabBeamColour.LocalNeutralColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(2))); return ((REPOElement)val38).rectTransform; }; <>c.<>9__8_3 = val5; obj8 = (object)val5; } obj7.AddElementToScrollView((ScrollViewBuilderDelegate)obj8, 0f, 0f); REPOPopupPage obj9 = changeGrabColourPage; object obj10 = <>c.<>9__8_4; if (obj10 == null) { ScrollViewBuilderDelegate val6 = delegate(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val37 = CreateColourSlider("Blue", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.b = f; if (!CustomGrabBeamColour.LocalNeutralColour.MatchSkin) { Color color10 = ((Graphic)_neutralGrabColourPreviewImage).color; color10.b = f; ((Graphic)_neutralGrabColourPreviewImage).color = color10; } }, CustomGrabBeamColour.LocalNeutralColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(3))); return ((REPOElement)val37).rectTransform; }; <>c.<>9__8_4 = val6; obj10 = (object)val6; } obj9.AddElementToScrollView((ScrollViewBuilderDelegate)obj10, 0f, 0f); REPOPopupPage obj11 = changeGrabColourPage; object obj12 = <>c.<>9__8_5; if (obj12 == null) { ScrollViewBuilderDelegate val7 = delegate(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val36 = CreateColourSlider("Opacity", "", delegate(float f) { //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_0025: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalNeutralColour.a = f; Color color9 = ((Graphic)_neutralGrabColourPreviewImage).color; color9.a = f; ((Graphic)_neutralGrabColourPreviewImage).color = color9; }, CustomGrabBeamColour.LocalNeutralColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(4))); return ((REPOElement)val36).rectTransform; }; <>c.<>9__8_5 = val7; obj12 = (object)val7; } obj11.AddElementToScrollView((ScrollViewBuilderDelegate)obj12, 0f, 0f); REPOPopupPage obj13 = changeGrabColourPage; object obj14 = <>c.<>9__8_6; if (obj14 == null) { ScrollViewBuilderDelegate val8 = delegate(Transform parent) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) REPOToggle val35 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val) { CustomGrabBeamColour.LocalNeutralColour.MatchSkin = val; HandleNeutralSkinMatchChange(); }, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(5)), "Yes", "No", CustomGrabBeamColour.LocalNeutralColour.MatchSkin); return ((REPOElement)val35).rectTransform; }; <>c.<>9__8_6 = val8; obj14 = (object)val8; } obj13.AddElementToScrollView((ScrollViewBuilderDelegate)obj14, 0f, 0f); REPOPopupPage obj15 = changeGrabColourPage; object obj16 = <>c.<>9__8_7; if (obj16 == null) { ScrollViewBuilderDelegate val9 = delegate(Transform parent) { //IL_0012: 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) REPOLabel val34 = MenuAPI.CreateREPOLabel("Rotating Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(6))); ((Component)val34).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); return ((REPOElement)val34).rectTransform; }; <>c.<>9__8_7 = val9; obj16 = (object)val9; } obj15.AddElementToScrollView((ScrollViewBuilderDelegate)obj16, 0f, 0f); REPOPopupPage obj17 = changeGrabColourPage; object obj18 = <>c.<>9__8_8; if (obj18 == null) { ScrollViewBuilderDelegate val10 = delegate(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val33 = CreateColourSlider("Red", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.r = f; if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin) { Color color8 = ((Graphic)_rotatingGrabColourPreviewImage).color; color8.r = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color8; HandleRotatingSkinMatchChange(); } }, CustomGrabBeamColour.LocalRotatingColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(7))); return ((REPOElement)val33).rectTransform; }; <>c.<>9__8_8 = val10; obj18 = (object)val10; } obj17.AddElementToScrollView((ScrollViewBuilderDelegate)obj18, 0f, 0f); REPOPopupPage obj19 = changeGrabColourPage; object obj20 = <>c.<>9__8_9; if (obj20 == null) { ScrollViewBuilderDelegate val11 = delegate(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val32 = CreateColourSlider("Green", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.g = f; if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin) { Color color7 = ((Graphic)_rotatingGrabColourPreviewImage).color; color7.g = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color7; HandleRotatingSkinMatchChange(); } }, CustomGrabBeamColour.LocalRotatingColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(8))); return ((REPOElement)val32).rectTransform; }; <>c.<>9__8_9 = val11; obj20 = (object)val11; } obj19.AddElementToScrollView((ScrollViewBuilderDelegate)obj20, 0f, 0f); REPOPopupPage obj21 = changeGrabColourPage; object obj22 = <>c.<>9__8_10; if (obj22 == null) { ScrollViewBuilderDelegate val12 = delegate(Transform parent) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) REPOSlider val31 = CreateColourSlider("Blue", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.b = f; if (!CustomGrabBeamColour.LocalRotatingColour.MatchSkin) { Color color6 = ((Graphic)_rotatingGrabColourPreviewImage).color; color6.b = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color6; HandleRotatingSkinMatchChange(); } }, CustomGrabBeamColour.LocalRotatingColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(9))); return ((REPOElement)val31).rectTransform; }; <>c.<>9__8_10 = val12; obj22 = (object)val12; } obj21.AddElementToScrollView((ScrollViewBuilderDelegate)obj22, 0f, 0f); REPOPopupPage obj23 = changeGrabColourPage; object obj24 = <>c.<>9__8_11; if (obj24 == null) { ScrollViewBuilderDelegate val13 = delegate(Transform parent) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) REPOSlider val30 = CreateColourSlider("Opacity", "", delegate(float f) { //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_0025: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalRotatingColour.a = f; Color color5 = ((Graphic)_rotatingGrabColourPreviewImage).color; color5.a = f; ((Graphic)_rotatingGrabColourPreviewImage).color = color5; HandleRotatingSkinMatchChange(); }, CustomGrabBeamColour.LocalRotatingColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(10))); return ((REPOElement)val30).rectTransform; }; <>c.<>9__8_11 = val13; obj24 = (object)val13; } obj23.AddElementToScrollView((ScrollViewBuilderDelegate)obj24, 0f, 0f); REPOPopupPage obj25 = changeGrabColourPage; object obj26 = <>c.<>9__8_12; if (obj26 == null) { ScrollViewBuilderDelegate val14 = delegate(Transform parent) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) REPOToggle val29 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val) { CustomGrabBeamColour.LocalRotatingColour.MatchSkin = val; HandleRotatingSkinMatchChange(); }, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(11)), "Yes", "No", CustomGrabBeamColour.LocalRotatingColour.MatchSkin); return ((REPOElement)val29).rectTransform; }; <>c.<>9__8_12 = val14; obj26 = (object)val14; } obj25.AddElementToScrollView((ScrollViewBuilderDelegate)obj26, 0f, 0f); REPOPopupPage obj27 = changeGrabColourPage; object obj28 = <>c.<>9__8_13; if (obj28 == null) { ScrollViewBuilderDelegate val15 = delegate(Transform parent) { //IL_0012: 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) REPOLabel val28 = MenuAPI.CreateREPOLabel("Healing Beam Colour", parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(6))); ((Component)val28).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); return ((REPOElement)val28).rectTransform; }; <>c.<>9__8_13 = val15; obj28 = (object)val15; } obj27.AddElementToScrollView((ScrollViewBuilderDelegate)obj28, 0f, 0f); REPOPopupPage obj29 = changeGrabColourPage; object obj30 = <>c.<>9__8_14; if (obj30 == null) { ScrollViewBuilderDelegate val16 = delegate(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val27 = CreateColourSlider("Red", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.r = f; if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin) { Color color4 = ((Graphic)_healingGrabColourPreviewImage).color; color4.r = f; ((Graphic)_healingGrabColourPreviewImage).color = color4; HandleHealingSkinMatchChange(); } }, CustomGrabBeamColour.LocalHealingColour.r, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(7))); return ((REPOElement)val27).rectTransform; }; <>c.<>9__8_14 = val16; obj30 = (object)val16; } obj29.AddElementToScrollView((ScrollViewBuilderDelegate)obj30, 0f, 0f); REPOPopupPage obj31 = changeGrabColourPage; object obj32 = <>c.<>9__8_15; if (obj32 == null) { ScrollViewBuilderDelegate val17 = delegate(Transform parent) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) REPOSlider val26 = CreateColourSlider("Green", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.g = f; if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin) { Color color3 = ((Graphic)_healingGrabColourPreviewImage).color; color3.g = f; ((Graphic)_healingGrabColourPreviewImage).color = color3; HandleHealingSkinMatchChange(); } }, CustomGrabBeamColour.LocalHealingColour.g, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(8))); return ((REPOElement)val26).rectTransform; }; <>c.<>9__8_15 = val17; obj32 = (object)val17; } obj31.AddElementToScrollView((ScrollViewBuilderDelegate)obj32, 0f, 0f); REPOPopupPage obj33 = changeGrabColourPage; object obj34 = <>c.<>9__8_16; if (obj34 == null) { ScrollViewBuilderDelegate val18 = delegate(Transform parent) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) REPOSlider val25 = CreateColourSlider("Blue", "", delegate(float f) { //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_0035: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.b = f; if (!CustomGrabBeamColour.LocalHealingColour.MatchSkin) { Color color2 = ((Graphic)_healingGrabColourPreviewImage).color; color2.b = f; ((Graphic)_healingGrabColourPreviewImage).color = color2; HandleHealingSkinMatchChange(); } }, CustomGrabBeamColour.LocalHealingColour.b, 1f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(9))); return ((REPOElement)val25).rectTransform; }; <>c.<>9__8_16 = val18; obj34 = (object)val18; } obj33.AddElementToScrollView((ScrollViewBuilderDelegate)obj34, 0f, 0f); REPOPopupPage obj35 = changeGrabColourPage; object obj36 = <>c.<>9__8_17; if (obj36 == null) { ScrollViewBuilderDelegate val19 = delegate(Transform parent) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) REPOSlider val24 = CreateColourSlider("Opacity", "", delegate(float f) { //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_0025: Unknown result type (might be due to invalid IL or missing references) CustomGrabBeamColour.LocalHealingColour.a = f; Color color = ((Graphic)_healingGrabColourPreviewImage).color; color.a = f; ((Graphic)_healingGrabColourPreviewImage).color = color; HandleHealingSkinMatchChange(); }, CustomGrabBeamColour.LocalHealingColour.a, 0.5f, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(10))); return ((REPOElement)val24).rectTransform; }; <>c.<>9__8_17 = val19; obj36 = (object)val19; } obj35.AddElementToScrollView((ScrollViewBuilderDelegate)obj36, 0f, 0f); REPOPopupPage obj37 = changeGrabColourPage; object obj38 = <>c.<>9__8_18; if (obj38 == null) { ScrollViewBuilderDelegate val20 = delegate(Transform parent) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) REPOToggle val23 = MenuAPI.CreateREPOToggle("Match Skin Colour", (Action<bool>)delegate(bool val) { CustomGrabBeamColour.LocalHealingColour.MatchSkin = val; HandleHealingSkinMatchChange(); }, parent, new Vector2(0f, GetVerticalOffsetForScrollChildren(11)), "Yes", "No", CustomGrabBeamColour.LocalHealingColour.MatchSkin); return ((REPOElement)val23).rectTransform; }; <>c.<>9__8_18 = val20; obj38 = (object)val20; } obj37.AddElementToScrollView((ScrollViewBuilderDelegate)obj38, 0f, 0f); changeGrabColourPage.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_0030: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) REPOButton val21 = MenuAPI.CreateREPOButton("Done", (Action)delegate { changeGrabColourPage.ClosePage(true); CustomGrabBeamColour.UpdateBeamColourForAllBeams(); CustomGrabBeamColour.SaveLocalColoursToConfig(); }, parent, new Vector2(70f, 30f)); REPOButton val22 = MenuAPI.CreateREPOButton("Reset", (Action)delegate { changeGrabColourPage.ClosePage(true); CustomGrabBeamColour.ResetBeamColours(); CustomGrabBeamColour.UpdateBeamColourForAllBeams(); CustomGrabBeamColour.SaveLocalColoursToConfig(); }, parent, new Vector2(590f, 30f)); val22.overrideButtonSize = val22.GetLabelSize() / 2f; ((Component)val22).transform.localScale = Vector2.op_Implicit(new Vector2(0.5f, 0.5f)); }); SetupPreviewRectangleColours(CustomGrabBeamColour.LocalNeutralColour.Colour, CustomGrabBeamColour.LocalHealingColour.Colour, CustomGrabBeamColour.LocalRotatingColour.Colour); changeGrabColourPage.OpenPage(false); } private static void SetupPreviewRectangleColours(Color neutralColour, Color healingColour, Color rotatingColour) { //IL_0006: 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_001e: Unknown result type (might be due to invalid IL or missing references) ((Graphic)_neutralGrabColourPreviewImage).color = neutralColour; ((Graphic)_healingGrabColourPreviewImage).color = healingColour; ((Graphic)_rotatingGrabColourPreviewImage).color = rotatingColour; HandleNeutralSkinMatchChange(); HandleRotatingSkinMatchChange(); HandleHealingSkinMatchChange(); } private static void HandleNeutralSkinMatchChange() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) ((Graphic)_neutralGrabColourPreviewImage).color = (CustomGrabBeamColour.LocalNeutralColour.MatchSkin ? CustomGrabBeamColour.GetLocalBodyColour(Color.black) : CustomGrabBeamColour.LocalNeutralColour.Colour); Color color = ((Graphic)_neutralGrabColourPreviewImage).color; color.a = CustomGrabBeamColour.LocalNeutralColour.Colour.a; ((Graphic)_neutralGrabColourPreviewImage).color = color; } private static void HandleRotatingSkinMatchChange() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) ((Graphic)_rotatingGrabColourPreviewImage).color = (CustomGrabBeamColour.LocalRotatingColour.MatchSkin ? CustomGrabBeamColour.GetLocalBodyColour(Color.black) : CustomGrabBeamColour.LocalRotatingColour.Colour); Color color = ((Graphic)_rotatingGrabColourPreviewImage).color; color.a = CustomGrabBeamColour.LocalRotatingColour.Colour.a; ((Graphic)_rotatingGrabColourPreviewImage).color = color; } private static void HandleHealingSkinMatchChange() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) ((Graphic)_healingGrabColourPreviewImage).color = (CustomGrabBeamColour.LocalHealingColour.MatchSkin ? CustomGrabBeamColour.GetLocalBodyColour(Color.black) : CustomGrabBeamColour.LocalHealingColour.Colour); Color color = ((Graphic)_healingGrabColourPreviewImage).color; color.a = CustomGrabBeamColour.LocalHealingColour.Colour.a; ((Graphic)_healingGrabColourPreviewImage).color = color; } private static void CreateBeamPreviewColourRectangle(Transform parent, Vector2 position, out GameObject colourPreviewParent, out Image colourPreviewImage) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_00ad: 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_00c5: 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) colourPreviewParent = new GameObject(); ((Object)colourPreviewParent).name = "Grab Beam Colour Preview Rectangle Parent"; colourPreviewParent.transform.SetParent(parent); Canvas val = colourPreviewParent.AddComponent<Canvas>(); ((Component)val).transform.SetParent(colourPreviewParent.gameObject.transform.parent); GameObject val2 = new GameObject(); val2.transform.SetParent(((Component)val).gameObject.transform.parent); colourPreviewImage = val2.AddComponent<Image>(); ((Object)colourPreviewImage).name = "Grab Beam Colour Preview Rectangle Image"; ((Component)colourPreviewImage).transform.SetParent(val2.gameObject.transform.parent); ((Graphic)colourPreviewImage).color = new Color(1f, 0f, 0f); ((Component)colourPreviewImage).gameObject.transform.position = Vector2.op_Implicit(position); ((Component)colourPreviewImage).gameObject.transform.localScale = new Vector3(0.85f, 0.85f, 1f); } private static REPOSlider CreateColourSlider(string name, string desc, Action<float> onChange, float initial, float max, Transform parent, Vector2 localPosition) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return MenuAPI.CreateREPOSlider(name, desc, onChange, parent, localPosition, 0f, max, 2, initial, "", "", (BarBehavior)0); } private static float GetVerticalOffsetForScrollChildren(int index) { return 40 * index; } private static float GetVerticalPos(int offset) { int num = -Math.Abs(-offset); num += 3; return -12f + (float)(110 * num); } } public static class ConfigUtil { public static string ColorToString(Color color) { return color.r + ", " + color.g + ", " + color.b + ", " + color.a; } public static Color StringToColor(string color, Color defaultColour) { //IL_0050: 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_00b5: 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_00ec: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) string[] array = color.Split(','); switch (array.Length) { case 3: { float[] array3 = new float[3]; for (int j = 0; j < array.Length; j++) { try { array3.SetValue(float.Parse(array[j].Trim()), j); } catch { return defaultColour; } } return new Color(array3[0], array3[1], array3[2], 0.2f); } case 4: { float[] array2 = new float[4]; for (int i = 0; i < array.Length; i++) { try { array2.SetValue(float.Parse(array[i].Trim()), i); } catch { return defaultColour; } } return new Color(array2[0], array2[1], array2[2], array2[3]); } default: return defaultColour; } } } public static class CustomGrabColourConfig { public struct BeamConfigEntries { public readonly ConfigEntry<string> BeamColour; public readonly ConfigEntry<bool> MatchSkin; public BeamConfigEntries(ConfigEntry<string> beamColour, ConfigEntry<bool> matchSkin) { BeamColour = beamColour; MatchSkin = matchSkin; } } private static readonly Dictionary<GrabBeamColourSettings.BeamType, BeamConfigEntries> BeamTypeToConfigEntries = new Dictionary<GrabBeamColourSettings.BeamType, BeamConfigEntries>(); public const float DefaultOpacity = 0.2f; public const float MaxOpacity = 0.5f; public static readonly Color NeutralDefaultColour = new Color(1f, 0.58f, 0.19f, 0.35f); public static readonly Color HealingDefaultColour = new Color(0.17f, 1f, 0.17f, 0.2f); public static readonly Color RotatingDefaultColour = new Color(0.65f, 0.06f, 0.8f, 0.2f); public static BeamConfigEntries NeutralGrabBeam; public static BeamConfigEntries HealingGrabBeam; public static BeamConfigEntries RotatingGrabBeam; public static ConfigEntry<bool> EnableDebugLogs; public static ConfigEntry<bool> DebugAddButtonToMainMenu; private const string ColourNotes = "\nStored as R,G,B,A values in 0-1 range"; public static void Init(ConfigFile config) { //IL_000c: 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_00b4: Unknown result type (might be due to invalid IL or missing references) ConfigEntry<string> beamColour = config.Bind<string>("General", "NeutralGrabBeamColour", ConfigUtil.ColorToString(NeutralDefaultColour), "The default colour of the grab beam when holding an item.\nStored as R,G,B,A values in 0-1 range"); ConfigEntry<bool> matchSkin = config.Bind<bool>("General", "NeutralGrabBeamMatchSkin", true, "Should the neutral grab beam match the colour of your skin?"); NeutralGrabBeam = new BeamConfigEntries(beamColour, matchSkin); BeamTypeToConfigEntries.Add(GrabBeamColourSettings.BeamType.Neutral, NeutralGrabBeam); ConfigEntry<string> beamColour2 = config.Bind<string>("General", "RotatingGrabBeamColour", ConfigUtil.ColorToString(RotatingDefaultColour), "The colour of the grab beam when rotating an item or monster.\nStored as R,G,B,A values in 0-1 range"); ConfigEntry<bool> matchSkin2 = config.Bind<bool>("General", "RotatingGrabBeamMatchSkin", false, "Should the rotating grab beam match the colour of your skin?"); RotatingGrabBeam = new BeamConfigEntries(beamColour2, matchSkin2); BeamTypeToConfigEntries.Add(GrabBeamColourSettings.BeamType.Rotate, RotatingGrabBeam); ConfigEntry<string> beamColour3 = config.Bind<string>("General", "HealingGrabBeamColour", ConfigUtil.ColorToString(HealingDefaultColour), "The colour of the grab beam when healing another player.\nStored as R,G,B,A values in 0-1 range"); ConfigEntry<bool> matchSkin3 = config.Bind<bool>("General", "HealingGrabBeamMatchSkin", false, "Should the healing grab beam match the colour of your skin?"); HealingGrabBeam = new BeamConfigEntries(beamColour3, matchSkin3); BeamTypeToConfigEntries.Add(GrabBeamColourSettings.BeamType.Heal, HealingGrabBeam); EnableDebugLogs = config.Bind<bool>("Debug", "EnableDebugLogs", false, "Outputs additional debugging information to the log"); DebugAddButtonToMainMenu = config.Bind<bool>("Debug", "AddConfigToMainMenu", false, "Adds the config menu button to the main menu"); LoadValuesFromConfig(); } private static void LoadValuesFromConfig() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00d9: Unknown result type (might be due to invalid IL or missing references) Color val = ConfigUtil.StringToColor(NeutralGrabBeam.BeamColour.Value, NeutralDefaultColour); val.a = Mathf.Clamp(val.a, 0f, 0.5f); CustomGrabBeamColour.LocalNeutralColour = new GrabBeamColourSettings(val, NeutralGrabBeam.MatchSkin.Value, GrabBeamColourSettings.BeamType.Neutral); Color val2 = ConfigUtil.StringToColor(RotatingGrabBeam.BeamColour.Value, RotatingDefaultColour); val2.a = Mathf.Clamp(val2.a, 0f, 0.5f); CustomGrabBeamColour.LocalRotatingColour = new GrabBeamColourSettings(val2, RotatingGrabBeam.MatchSkin.Value, GrabBeamColourSettings.BeamType.Rotate); Color val3 = ConfigUtil.StringToColor(HealingGrabBeam.BeamColour.Value, HealingDefaultColour); val3.a = Mathf.Clamp(val3.a, 0f, 0.5f); CustomGrabBeamColour.LocalHealingColour = new GrabBeamColourSettings(val3, HealingGrabBeam.MatchSkin.Value, GrabBeamColourSettings.BeamType.Heal); } public static void SaveColour(GrabBeamColourSettings beamColourSettings) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) Plugin.LogMessageIfDebug("Saving colour to config file: " + beamColourSettings); beamColourSettings.a = Mathf.Clamp(beamColourSettings.a, 0f, 0.5f); if (!BeamTypeToConfigEntries.TryGetValue(beamColourSettings.CurrentBeamType, out var value)) { Plugin.LogWarning("Unable to save colour value for beam type: " + beamColourSettings.CurrentBeamType); } value.BeamColour.Value = ConfigUtil.ColorToString(beamColourSettings.Colour); value.MatchSkin.Value = beamColourSettings.MatchSkin; } } }
plugins/dev.bw.nametag_colour.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; 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("dev.bw.nametag_colour")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.9.0")] [assembly: AssemblyInformationalVersion("1.0.9+82260e9d0a36ac47a26cbda02f447736e2934fef")] [assembly: AssemblyProduct("NametagColour")] [assembly: AssemblyTitle("dev.bw.nametag_colour")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.9.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 NametagColour { [BepInPlugin("dev.bw.nametag_colour", "NametagColour", "1.0.9")] [BepInProcess("REPO.exe")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private static Harmony _hi; private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin dev.bw.nametag_colour is loaded!"); _hi = new Harmony("dev.bw.nametag_colour"); _hi.PatchAll(); } private void OnDestroy() { _hi.UnpatchSelf(); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "dev.bw.nametag_colour"; public const string PLUGIN_NAME = "NametagColour"; public const string PLUGIN_VERSION = "1.0.9"; } } namespace NametagColour.Patches { [HarmonyPatch(typeof(MenuPlayerListed), "Update")] public class MenuPlayerPatch { private static void Postfix(MenuPlayerListed __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar playerAvatar = __instance.playerAvatar; ((Graphic)__instance.playerName).color = playerAvatar.playerAvatarVisuals.color; ((TMP_Text)__instance.playerName).alpha = (playerAvatar.voiceChat.isTalking ? 1f : 0.5f); } } [HarmonyPatch(typeof(SpectateNameUI), "SetName")] public class SpectatePatch { private static void Postfix(SpectateNameUI __instance, string name) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = GameDirector.instance.PlayerList.Find((PlayerAvatar x) => x.playerName == name); ((Graphic)__instance.Text).color = val.playerAvatarVisuals.color; ((TMP_Text)__instance.Text).alpha = (val.voiceChat.isTalking ? 1f : 0.5f); } } [HarmonyPatch(typeof(WorldSpaceUIPlayerName), "Update")] public class WorldUIPatch { private static void Postfix(WorldSpaceUIPlayerName __instance) { //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0058: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI text = __instance.text; PlayerAvatar playerAvatar = __instance.playerAvatar; if (!((Object)(object)text == (Object)null) && !((Object)(object)playerAvatar?.playerAvatarVisuals == (Object)null)) { Color color = ((Graphic)text).color; Color color2 = playerAvatar.playerAvatarVisuals.color; ((Graphic)text).color = new Color(color2.r, color2.g, color2.b, color.a); } } } }
plugins/Eggs.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Eggs")] [assembly: AssemblyTitle("Eggs")] [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 Omni.WalkieTalkie { [BepInPlugin("omni.repo.walkietalkie", "Omni Walkie-Talkie", "1.2.0")] public class WalkieTalkiePlugin : BaseUnityPlugin { [HarmonyPatch] internal static class Patch_AttachController { [HarmonyPatch(typeof(PlayerVoiceChat), "Awake")] [HarmonyPostfix] private static void Postfix(PlayerVoiceChat __instance) { WalkieController walkieController = default(WalkieController); if (!((Component)__instance).gameObject.TryGetComponent<WalkieController>(ref walkieController)) { ((Component)__instance).gameObject.AddComponent<WalkieController>(); } } } [HarmonyPatch(typeof(PlayerAvatarRightArm), "Update")] internal static class Patch_RightArmPose { private static bool Prefix(PlayerAvatarRightArm __instance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) try { if (WalkieController.PlayersTalking.Contains(__instance.playerAvatar.photonView.ViewID)) { __instance.SetPose(WalkieController.WalkiePose); __instance.HeadAnimate(false); __instance.AnimatePose(); return false; } } catch { } return true; } } public class WalkieController : MonoBehaviourPun { [CompilerGenerated] private sealed class <StopTalkingAfter>d__37 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; public WalkieController <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StopTalkingAfter>d__37(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this._canToggle = false; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; ((MonoBehaviourPun)<>4__this).photonView.RPC("RPC_SetVoiceRangeAndFilters", (RpcTarget)0, new object[2] { 25, false }); if ((Object)(object)<>4__this._talkieLocal != (Object)null) { <>4__this._talkieLocal.SetActive(false); } <>4__this._canToggle = true; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static readonly HashSet<int> PlayersTalking = new HashSet<int>(); public static readonly Vector3 WalkiePose = new Vector3(0f, -30f, 0f); private const string BundleBase = "walky"; private const string PrefabName = "Talky"; private const string SfxOnName = "OnSound"; private const string SfxOffName = "OffSound"; private const string SfxIdleName = "IdleOnSound"; private static readonly Vector3 TalkiePos = new Vector3(-0.1f, -0.05f, 0.3f); private static readonly Quaternion TalkieRotation = Quaternion.Euler(350f, 179f, 45f); private static readonly Vector3 RemoteTalkiePos = new Vector3(-0.15f, -0.25f, 0.65f); private static readonly Quaternion RemoteTalkieRotation = Quaternion.Euler(15f, 215f, 345f); private bool _bootstrapped; private PlayerAvatar _localAvatar; private float _maxBattery; private float _battery; private bool _recharge; private float _rechargeRatePerSec; private bool _enemiesHear; private KeyCode _pushKey = (KeyCode)118; private WalkieBatteryUI _batteryUi; private Transform _localParent; private GameObject _talkieLocal; private GameObject _talkieRemote; private AudioSource _sfxOn; private AudioSource _sfxOff; private AudioSource _sfxIdle; private bool _usingRadio; private bool _canToggle = true; private void OnEnable() { SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDisable() { SceneManager.sceneLoaded -= OnSceneLoaded; } private void OnSceneLoaded(Scene s, LoadSceneMode m) { if (IsInGame()) { return; } _bootstrapped = false; if (IsMasterOrSingle()) { MaxBattery = CFG_MaxBattery.Value; Recharge = CFG_Recharge.Value; RechargeRatePerSec = CFG_RechargeRatePerSec.Value; EnemiesHear = CFG_EnemiesHear.Value; ((MonoBehaviourPun)this).photonView.RPC("RPC_SyncSettings", (RpcTarget)0, new object[4] { MaxBattery, Recharge, EnemiesHear, RechargeRatePerSec }); ManualLogSource log = Log; if (log != null) { log.LogInfo((object)string.Format("[{0}] Sync settings → max={1}, recharge={2}, enemiesHear={3}, rechargeRate={4:0.##}", "Omni Walkie-Talkie", MaxBattery, Recharge, EnemiesHear, RechargeRatePerSec)); } } } private void Start() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) TryResolveKey(CFG_TalkKey.Value); ManualLogSource log = Log; if (log != null) { log.LogInfo((object)$"[Walkie] Push-to-talk = {_pushKey}"); } } private void Update() { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) if (!((MonoBehaviourPun)this).photonView.IsMine) { return; } bool flag = IsInGame(); if (flag && !_bootstrapped) { _bootstrapped = true; Bootstrap(); } if (!flag || (Object)(object)_localAvatar == (Object)null || _localAvatar.spectating) { if (_usingRadio) { ForceStopTalking(); } if ((Object)(object)_batteryUi != (Object)null && ((Component)_batteryUi).gameObject.activeSelf) { ((Component)_batteryUi).gameObject.SetActive(false); } return; } if ((Object)(object)_batteryUi != (Object)null && !((Component)_batteryUi).gameObject.activeSelf) { ((Component)_batteryUi).gameObject.SetActive(true); } if (Input.GetKey(_pushKey)) { BeginTalking(); } else if (Input.GetKeyUp(_pushKey)) { EndTalking(); } TickBattery(); UpdateSfxVisibility(); } private void Bootstrap() { _maxBattery = MaxBattery; _battery = Mathf.Max(0f, _maxBattery); _recharge = Recharge; _rechargeRatePerSec = RechargeRatePerSec; _enemiesHear = EnemiesHear; PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val in array) { if (val.photonView.IsMine) { _localAvatar = val; break; } } if ((Object)(object)_localAvatar == (Object)null) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)"[Walkie] No local PlayerAvatar yet."); } return; } _localParent = FindGrabberTarget(((Component)_localAvatar).transform); if ((Object)(object)_localParent == (Object)null) { Transform parent = ((Component)_localAvatar).transform.parent; _localParent = ((parent != null) ? parent.Find("Local Camera") : null); if ((Object)(object)_localParent == (Object)null) { ManualLogSource log2 = Log; if (log2 != null) { log2.LogWarning((object)"[Walkie] Neither [RIG]/Grabber Target nor Local Camera found — skipping local talkie mesh."); } } } TryCreateBatteryUi(); TryCreateLocalTalkie(); ((MonoBehaviourPun)this).photonView.RPC("RPC_CreateRemoteTalkieOnRightArm", (RpcTarget)4, new object[1] { _localAvatar.photonView.ViewID }); ((MonoBehaviourPun)this).photonView.RPC("RPC_SetLocalAvatarViewId", (RpcTarget)0, new object[1] { _localAvatar.photonView.ViewID }); } private void BeginTalking() { if (!_usingRadio && _canToggle && !(_battery <= 1f)) { _usingRadio = true; SetVoiceTransmit(enable: true); if ((Object)(object)_talkieLocal != (Object)null && !_talkieLocal.activeSelf) { _talkieLocal.SetActive(true); } ((MonoBehaviourPun)this).photonView.RPC("RPC_SetVoiceRangeAndFilters", (RpcTarget)0, new object[2] { 100, true }); ((MonoBehaviourPun)this).photonView.RPC("RPC_SetTalkingFlag", (RpcTarget)0, new object[2] { _localAvatar.photonView.ViewID, true }); ((MonoBehaviourPun)this).photonView.RPC("RPC_ShowRemoteTalkie", (RpcTarget)1, new object[1] { true }); } } private void EndTalking() { if (_usingRadio) { _usingRadio = false; SetVoiceTransmit(enable: false); ((MonoBehaviourPun)this).photonView.RPC("RPC_ShowRemoteTalkie", (RpcTarget)1, new object[1] { false }); ((MonoBehaviourPun)this).photonView.RPC("RPC_SetTalkingFlag", (RpcTarget)0, new object[2] { _localAvatar.photonView.ViewID, false }); ((MonoBehaviour)this).StartCoroutine(StopTalkingAfter(0.4f)); } } private void ForceStopTalking() { _usingRadio = false; SetVoiceTransmit(enable: false); ((MonoBehaviourPun)this).photonView.RPC("RPC_ShowRemoteTalkie", (RpcTarget)1, new object[1] { false }); ((MonoBehaviourPun)this).photonView.RPC("RPC_SetVoiceRangeAndFilters", (RpcTarget)0, new object[2] { 25, false }); ((MonoBehaviourPun)this).photonView.RPC("RPC_SetTalkingFlag", (RpcTarget)0, new object[2] { _localAvatar.photonView.ViewID, false }); if ((Object)(object)_talkieLocal != (Object)null) { _talkieLocal.SetActive(false); } } [IteratorStateMachine(typeof(<StopTalkingAfter>d__37))] private IEnumerator StopTalkingAfter(float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StopTalkingAfter>d__37(0) { <>4__this = this, delay = delay }; } private void SetVoiceTransmit(bool enable) { try { Component val = ((Component)this).GetComponent(Type.GetType("Photon.Voice.PUN.PhotonVoiceView, PhotonVoice.PUN")) ?? ((Component)this).GetComponent(Type.GetType("Photon.Voice.Unity.PhotonVoiceView, PhotonVoice.Unity")); if (!((Object)(object)val == (Object)null)) { object obj = ((object)val).GetType().GetProperty("RecorderInUse")?.GetValue(val, null); obj?.GetType().GetProperty("TransmitEnabled")?.SetValue(obj, enable, null); } } catch { } } private void TickBattery() { if (_usingRadio) { _battery -= Time.deltaTime * 3f; if (_battery <= 0f) { _battery = 0f; EndTalking(); } } else if (_recharge) { _battery += Time.deltaTime * _rechargeRatePerSec; if (_battery > _maxBattery) { _battery = _maxBattery; } } if ((Object)(object)_batteryUi != (Object)null) { _batteryUi.Set(_battery, _maxBattery); } } private void TryCreateBatteryUi() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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) GameObject val = GameObject.Find("Energy"); if ((Object)(object)val == (Object)null) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)"[Walkie] 'Energy' UI not found; skipping battery HUD."); } return; } GameObject val2 = Object.Instantiate<GameObject>(val, val.transform.parent); ((Object)val2).name = "WalkieEnergy"; Transform transform = val2.transform; transform.localPosition += new Vector3(0f, -33f, 0f); EnergyUI component = val2.GetComponent<EnergyUI>(); if (Object.op_Implicit((Object)(object)component)) { Object.DestroyImmediate((Object)(object)component); } TextMeshProUGUI[] componentsInChildren = val2.GetComponentsInChildren<TextMeshProUGUI>(true); foreach (TextMeshProUGUI val3 in componentsInChildren) { ((Graphic)val3).color = new Color(0.88f, 0.69f, 1f, 1f); } Image componentInChildren = val2.GetComponentInChildren<Image>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { ((Behaviour)componentInChildren).enabled = false; } _batteryUi = val2.AddComponent<WalkieBatteryUI>(); _batteryUi.Set(_maxBattery, _maxBattery); } private void TryCreateLocalTalkie() { //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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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_00e0: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = AssetLoader.GetPrefab("Talky", "walky"); if ((Object)(object)prefab == (Object)null) { ManualLogSource log = Log; if (log != null) { log.LogError((object)"[Walkie] Prefab not found in bundle. Place bundle next to DLL. (bundle='walky', prefab='Talky')"); } } else if (!((Object)(object)_localParent == (Object)null)) { _talkieLocal = Object.Instantiate<GameObject>(prefab, _localParent); bool flag = string.Equals(((Object)_localParent).name, "Grabber Target", StringComparison.OrdinalIgnoreCase) || ((Object)_localParent).name.IndexOf("Grabber", StringComparison.OrdinalIgnoreCase) >= 0; float num = Mathf.Abs(CFG_RollDegrees.Value); Quaternion localRotation = Quaternion.AngleAxis(num, Vector3.forward); if (flag) { _talkieLocal.transform.localPosition = Vector3.zero; _talkieLocal.transform.localRotation = localRotation; } else { _talkieLocal.transform.localPosition = TalkiePos; _talkieLocal.transform.localRotation = TalkieRotation; } SetWorldScale(_talkieLocal.transform, CFG_WorldScale.Value); _talkieLocal.SetActive(false); _sfxOn = FindChildAudio(_talkieLocal, "OnSound"); _sfxOff = FindChildAudio(_talkieLocal, "OffSound"); _sfxIdle = FindChildAudio(_talkieLocal, "IdleOnSound"); SetGoActive((Component)(object)_sfxOn, active: false); SetGoActive((Component)(object)_sfxOff, active: false); SetGoActive((Component)(object)_sfxIdle, active: false); } } [PunRPC] private void RPC_CreateRemoteTalkieOnRightArm(int ownerAvatarViewId) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = null; PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val2 in array) { if ((Object)(object)val2.photonView != (Object)null && val2.photonView.ViewID == ownerAvatarViewId) { val = val2; break; } } if ((Object)(object)val == (Object)null) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)$"[Walkie] Remote avatar (ViewID={ownerAvatarViewId}) not found; remote prop skipped."); } return; } GameObject prefab = AssetLoader.GetPrefab("Talky", "walky"); if ((Object)(object)prefab == (Object)null) { return; } Transform val3 = FindGrabberTarget(((Component)val).transform); float num = Mathf.Abs(CFG_RollDegrees.Value); Quaternion localRotation = Quaternion.AngleAxis(num, Vector3.forward); if ((Object)(object)val3 != (Object)null) { _talkieRemote = Object.Instantiate<GameObject>(prefab, val3); _talkieRemote.transform.localPosition = Vector3.zero; _talkieRemote.transform.localRotation = localRotation; } else { Transform parent = ((Component)val).transform.parent; PlayerAvatarRightArm val4 = ((parent != null) ? ((Component)parent).GetComponentInChildren<PlayerAvatarRightArm>() : null); if ((Object)(object)val4 == (Object)null) { ManualLogSource log2 = Log; if (log2 != null) { log2.LogWarning((object)"[Walkie] PlayerAvatarRightArm not found; remote prop skipped."); } return; } _talkieRemote = Object.Instantiate<GameObject>(prefab, val4.rightArmTransform); _talkieRemote.transform.localPosition = RemoteTalkiePos; _talkieRemote.transform.localRotation = RemoteTalkieRotation; } SetWorldScale(_talkieRemote.transform, CFG_WorldScale.Value); _talkieRemote.SetActive(false); ManualLogSource log3 = Log; if (log3 != null) { log3.LogInfo((object)"[Walkie] Remote talkie created."); } } [PunRPC] private void RPC_ShowRemoteTalkie(bool show) { if ((Object)(object)_talkieRemote != (Object)null) { _talkieRemote.SetActive(show); } } private void UpdateSfxVisibility() { float num = GetGameVolumeScalar() * 0.3f; if (Object.op_Implicit((Object)(object)_sfxOn)) { _sfxOn.volume = num * 0.5f; } if (Object.op_Implicit((Object)(object)_sfxOff)) { _sfxOff.volume = num * 0.5f; } if (Object.op_Implicit((Object)(object)_sfxIdle)) { _sfxIdle.volume = num; } if (_usingRadio) { SetGoActive((Component)(object)_sfxOn, active: true); SetGoActive((Component)(object)_sfxOff, active: false); SetGoActive((Component)(object)_sfxIdle, active: true); } else { SetGoActive((Component)(object)_sfxOn, active: false); SetGoActive((Component)(object)_sfxOff, active: true); SetGoActive((Component)(object)_sfxIdle, active: false); } } private float GetGameVolumeScalar() { float num = 1f; float num2 = 1f; try { Type typeFromHandle = typeof(Setting); int num3 = TryGetEnumIndex(typeFromHandle, new string[4] { "MasterVolume", "Master_Volume", "MasterSound", "Master" }, 1); int num4 = TryGetEnumIndex(typeFromHandle, new string[6] { "SFXVolume", "SfxVolume", "SoundFXVolume", "EffectsVolume", "SoundEffects", "Effects" }, 13); num = 0.01f * Convert.ToSingle(DataDirector.instance.SettingValueFetch((Setting)num3)); num2 = 0.01f * Convert.ToSingle(DataDirector.instance.SettingValueFetch((Setting)num4)); } catch { } return Mathf.Clamp01(num * num2); } private static int TryGetEnumIndex(Type enumType, IEnumerable<string> names, int fallback) { foreach (string name in names) { try { if (Enum.IsDefined(enumType, name)) { return Convert.ToInt32(Enum.Parse(enumType, name)); } } catch { } } return fallback; } [PunRPC] private void RPC_SetVoiceRangeAndFilters(int maxDistance, bool talking) { AudioSource component = ((Component)this).GetComponent<AudioSource>(); AudioLowPassLogic component2 = ((Component)this).GetComponent<AudioLowPassLogic>(); if ((Object)(object)component2 != (Object)null) { component2.LogicActive = !talking; if (Object.op_Implicit((Object)(object)component2.AudioLowpassFilter)) { component2.AudioLowpassFilter.cutoffFrequency = (talking ? component2.LowPassMax : 0f); } } AudioHighPassFilter val = ((Component)this).GetComponent<AudioHighPassFilter>() ?? ((Component)this).gameObject.AddComponent<AudioHighPassFilter>(); val.cutoffFrequency = (talking ? 1000 : 10); if (Object.op_Implicit((Object)(object)component)) { component.maxDistance = maxDistance; } } [PunRPC] private void RPC_SetTalkingFlag(int viewId, bool isTalking) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_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 (isTalking) { PlayersTalking.Add(viewId); if (((MonoBehaviourPun)this).photonView.IsMine || !_enemiesHear) { return; } WalkieController[] array = Object.FindObjectsOfType<WalkieController>(); foreach (WalkieController walkieController in array) { if (((MonoBehaviourPun)walkieController).photonView.IsMine && (Object)(object)walkieController._localAvatar != (Object)null) { try { EnemyDirector.instance.SetInvestigate(((Component)walkieController._localAvatar).transform.position + Vector3.up * 0.2f, 5f, false); break; } catch { break; } } } } else { PlayersTalking.Remove(viewId); } } [PunRPC] private void RPC_SyncSettings(int maxBattery, bool recharge, bool enemiesHear, float rechargeRatePerSec) { MaxBattery = maxBattery; Recharge = recharge; EnemiesHear = enemiesHear; RechargeRatePerSec = rechargeRatePerSec; _maxBattery = maxBattery; _recharge = recharge; _enemiesHear = enemiesHear; _rechargeRatePerSec = rechargeRatePerSec; if (_battery > _maxBattery) { _battery = _maxBattery; } if (Object.op_Implicit((Object)(object)_batteryUi)) { _batteryUi.Set(_battery, _maxBattery); } } [PunRPC] private void RPC_SetLocalAvatarViewId(int viewId) { } private static bool IsMasterOrSingle() { try { return SemiFunc.IsMasterClientOrSingleplayer(); } catch { return PhotonNetwork.IsMasterClient || !PhotonNetwork.InRoom; } } private static bool IsInGame() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 try { return (Object)(object)GameDirector.instance != (Object)null && (int)GameDirector.instance.currentState == 2 && SemiFunc.RunIsLevel(); } catch { return Object.FindObjectsOfType<PlayerAvatar>().Length != 0; } } private void TryResolveKey(string cfg) { //IL_001a: 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_0010: Unknown result type (might be due to invalid IL or missing references) if (Enum.TryParse<KeyCode>(cfg, ignoreCase: true, out KeyCode result)) { _pushKey = result; } else { _pushKey = (KeyCode)118; } } private static AudioSource FindChildAudio(GameObject root, string childName) { if (!Object.op_Implicit((Object)(object)root)) { return null; } Transform val = root.transform.Find(childName); return ((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<AudioSource>() : null; } private static void SetGoActive(Component c, bool active) { if (!((Object)(object)c == (Object)null)) { c.gameObject.SetActive(active); } } private static void SetWorldScale(Transform t, float worldScale) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)t == (Object)null)) { float num = Mathf.Clamp(worldScale, 0.001f, 5f); Transform parent = t.parent; float num2 = (Object.op_Implicit((Object)(object)parent) ? parent.lossyScale.x : 1f); if (Mathf.Approximately(num2, 0f)) { num2 = 1f; } float num3 = (Object.op_Implicit((Object)(object)parent) ? parent.lossyScale.y : 1f); if (Mathf.Approximately(num3, 0f)) { num3 = 1f; } float num4 = (Object.op_Implicit((Object)(object)parent) ? parent.lossyScale.z : 1f); if (Mathf.Approximately(num4, 0f)) { num4 = 1f; } t.localScale = new Vector3(num / num2, num / num3, num / num4); } } private static Transform FindGrabberTarget(Transform avatarRoot) { if ((Object)(object)avatarRoot == (Object)null) { return null; } Transform val = avatarRoot.Find("[RIG]"); Transform val2 = ((val != null) ? val.Find("Grabber Target") : null); if ((Object)(object)val2 != (Object)null) { return val2; } return FindDeepChildByName(avatarRoot, "Grabber Target"); } private static Transform FindDeepChildByName(Transform parent, string name) { if ((Object)(object)parent == (Object)null) { return null; } for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (string.Equals(((Object)child).name, name, StringComparison.OrdinalIgnoreCase)) { return child; } Transform val = FindDeepChildByName(child, name); if ((Object)(object)val != (Object)null) { return val; } } return null; } } public class WalkieBatteryUI : MonoBehaviour { private TextMeshProUGUI _cur; private TextMeshProUGUI _max; private void Awake() { _cur = ((Component)this).GetComponent<TextMeshProUGUI>(); Transform obj = ((Component)this).transform.Find("EnergyMax"); _max = ((obj != null) ? ((Component)obj).GetComponent<TextMeshProUGUI>() : null); } public void Set(float value, float max) { if (Object.op_Implicit((Object)(object)_cur)) { ((TMP_Text)_cur).text = Mathf.Ceil(value).ToString(); } if (Object.op_Implicit((Object)(object)_max)) { ((TMP_Text)_max).text = "<b>/</b>" + Mathf.Ceil(max); } } } internal static class AssetLoader { private static AssetBundle _bundle; private static string _loadedFor; public static GameObject GetPrefab(string prefabName, string bundleBase) { if ((Object)(object)_bundle == (Object)null || _loadedFor != bundleBase) { TryLoadBundle(bundleBase); } if ((Object)(object)_bundle == (Object)null) { return null; } GameObject val = _bundle.LoadAsset<GameObject>(prefabName); if ((Object)(object)val == (Object)null) { ManualLogSource log = Log; if (log != null) { log.LogError((object)("[Walkie] Prefab '" + prefabName + "' not found in bundle '" + bundleBase + "'.")); } } return val; } private static void TryLoadBundle(string baseName) { Unload(); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string[] array = new string[4] { Path.Combine(directoryName, baseName), Path.Combine(directoryName, baseName + ".assetbundle"), Path.Combine(directoryName, baseName + ".unity3d"), Path.Combine(directoryName, baseName + ".bundle") }; string[] array2 = array; foreach (string text in array2) { if (!File.Exists(text)) { continue; } try { _bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_bundle != (Object)null) { _loadedFor = baseName; ManualLogSource log = Log; if (log != null) { log.LogInfo((object)("[Walkie] Loaded AssetBundle: " + Path.GetFileName(text))); } return; } } catch (Exception arg) { ManualLogSource log2 = Log; if (log2 != null) { log2.LogWarning((object)$"[Walkie] Failed to load bundle '{text}': {arg}"); } } } ManualLogSource log3 = Log; if (log3 != null) { log3.LogError((object)("[Walkie] Could not find bundle '" + baseName + "' beside the DLL.")); } } public static void Unload() { if ((Object)(object)_bundle != (Object)null) { try { _bundle.Unload(false); } catch { } } _bundle = null; _loadedFor = null; } } public const string PluginGuid = "omni.repo.walkietalkie"; public const string PluginName = "Omni Walkie-Talkie"; public const string PluginVersion = "1.2.0"; internal static ManualLogSource Log; internal static ConfigEntry<string> CFG_TalkKey; internal static ConfigEntry<int> CFG_MaxBattery; internal static ConfigEntry<bool> CFG_Recharge; internal static ConfigEntry<float> CFG_RechargeRatePerSec; internal static ConfigEntry<bool> CFG_EnemiesHear; internal static ConfigEntry<float> CFG_WorldScale; internal static ConfigEntry<float> CFG_RollDegrees; internal static int MaxBattery = 40; internal static bool Recharge = true; internal static float RechargeRatePerSec = 1f; internal static bool EnemiesHear = true; private Harmony _harmony; private void Awake() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; CFG_TalkKey = ((BaseUnityPlugin)this).Config.Bind<string>("Controls", "PushToTalkKey", "V", "Key to hold for radio talk. Example: V, F, Mouse4, LeftShift"); CFG_MaxBattery = ((BaseUnityPlugin)this).Config.Bind<int>("Battery (host only)", "MaxBattery", 50, new ConfigDescription("Walkie battery capacity.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(5, 200), Array.Empty<object>())); CFG_Recharge = ((BaseUnityPlugin)this).Config.Bind<bool>("Battery (host only)", "RechargeDuringLevel", true, "Recharge slowly when not transmitting."); CFG_RechargeRatePerSec = ((BaseUnityPlugin)this).Config.Bind<float>("Battery (host only)", "RechargeRatePerSec", 1f, new ConfigDescription("Units recovered per second when not transmitting (if RechargeDuringLevel=true).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>())); CFG_EnemiesHear = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemies (host only)", "EnemiesHearRadio", true, "If true, enemy AI will get an investigate ping when a player transmits."); CFG_WorldScale = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "WorldScale", 0.05f, new ConfigDescription("World size of the radio model (meters). Compensates for parent scaling.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.005f, 1f), Array.Empty<object>())); CFG_RollDegrees = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "RollDegrees", 0f, new ConfigDescription("Roll (Z) degrees: local +roll, remote -roll. Set 0 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 45f), Array.Empty<object>())); MaxBattery = CFG_MaxBattery.Value; Recharge = CFG_Recharge.Value; RechargeRatePerSec = CFG_RechargeRatePerSec.Value; EnemiesHear = CFG_EnemiesHear.Value; _harmony = new Harmony("omni.repo.walkietalkie"); _harmony.PatchAll(typeof(Patch_AttachController)); _harmony.PatchAll(typeof(Patch_RightArmPose)); Log.LogInfo((object)"[Omni Walkie-Talkie] Loaded."); } private void OnDestroy() { try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } } } } namespace Eggs { [BepInPlugin("Omniscye.Eggs", "Eggs", "1.0")] public class Eggs : BaseUnityPlugin { internal static Eggs 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() { } } }
plugins/EnemyOverhaul.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.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; using UnityEngine.AI; 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("EnemyOverhaul")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.11.0")] [assembly: AssemblyInformationalVersion("1.0.11+a0453f343c0322aa6c1b71ab6f30bbb330f4c32b")] [assembly: AssemblyProduct("EnemyOverhaul")] [assembly: AssemblyTitle("EnemyOverhaul")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.11.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 Ardot.REPO.EnemyOverhaul { public static class Debug { public static void PrintTree(Transform root, bool printComponents = true, int maxDepth = -1, IEnumerable<MonoBehaviour> forceInclude = null) { List<char> message = new List<char>(); Utils.ForObjectsInTree(root, delegate(Transform branch, int depth) { message.Add('\n'); for (int i = 0; i < depth; i++) { message.AddRange(" |"); } message.AddRange("- " + ((Object)((Component)branch).gameObject).name); if (printComponents) { message.AddRange(" -"); int componentCount = ((Component)branch).gameObject.GetComponentCount(); for (int j = 0; j < componentCount; j++) { message.AddRange($" {((object)((Component)branch).gameObject.GetComponentAtIndex(j)).GetType()},"); } message.RemoveAt(message.Count - 1); } }, maxDepth, forceInclude); Plugin.Logger.LogInfo((object)new string(new ReadOnlySpan<char>(message.ToArray()))); } } public class PlayerAggro { public PlayerAvatar Player; public float Aggro; } public class AggroHandler { public List<PlayerAggro> AggroList = new List<PlayerAggro>(); public PlayerAggro GetHighestAggro() { PlayerAggro playerAggro = null; for (int i = 0; i < AggroList.Count; i++) { PlayerAggro playerAggro2 = AggroList[i]; if (playerAggro == null || playerAggro2.Aggro > playerAggro.Aggro) { playerAggro = playerAggro2; } } return playerAggro; } public void LoseAggro(float amount) { for (int i = 0; i < AggroList.Count; i++) { AggroList[i].Aggro = Mathf.Max(AggroList[i].Aggro - amount, 0f); } } public PlayerAggro GetAggro(PlayerAvatar playerAvatar) { int num = -1; for (int i = 0; i < AggroList.Count; i++) { if ((Object)(object)AggroList[i].Player == (Object)(object)playerAvatar) { num = i; break; } } if (num == -1) { num = AggroList.Count; AggroList.Add(new PlayerAggro { Player = playerAvatar, Aggro = 0f }); } return AggroList[num]; } } public class OverhaulDirector : MonoBehaviour { [CompilerGenerated] private sealed class <GameOverCoroutine>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OverhaulDirector <>4__this; private int <x>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GameOverCoroutine>d__12(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_0034: 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_0069: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; SemiFunc.UIBigMessage("ESSENTIAL ASSETS DAMAGED", "{!}", 30f, Color.red, Color.red); BigMessageUI.instance.Set<BigMessageUI>("bigMessageTimer", 3f); <>2__current = (object)new WaitForSeconds(6f); <>1__state = 1; return true; case 1: <>1__state = -1; <x>5__1 = 0; while (<x>5__1 < GameDirector.instance.PlayerList.Count) { GameDirector.instance.PlayerList[<x>5__1].PlayerDeath(-1); <x>5__1++; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static OverhaulDirector Instance; public bool ExtractionCompletedImpulse = false; public bool ExtractionUnlockedImpulse = false; public bool AllExtractionPointsCompleted = false; public int ExtractionOverflow = 0; public ExtractionPoint CurrentExtraction = null; public static void Init() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown Plugin.Harmony.Patch((MethodBase)AccessTools.Method(typeof(GameDirector), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(OverhaulDirector), "AwakePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void AwakePostfix(GameDirector __instance) { ((Component)__instance).gameObject.AddComponent<OverhaulDirector>(); } public void Awake() { Instance = this; } public void Update() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Invalid comparison between Unknown and I4 ExtractionUnlockedImpulse = false; ExtractionCompletedImpulse = false; ExtractionPoint val = (ExtractionPoint)RoundDirector.instance.Get<RoundDirector>("extractionPointCurrent"); if ((Object)(object)val != (Object)(object)CurrentExtraction && (!((Object)(object)val != (Object)null) || ((int)(State)val.Get<ExtractionPoint>("currentState") == 2 && !(bool)val.Get<ExtractionPoint>("stateStart")))) { if ((Object)(object)CurrentExtraction == (Object)null) { ExtractionUnlockedImpulse = true; } else { ExtractionCompletedImpulse = true; } CurrentExtraction = val; AllExtractionPointsCompleted = (bool)RoundDirector.instance.Get<RoundDirector>("allExtractionPointsCompleted"); } if (ExtractionUnlockedImpulse) { AccessTools.Method(typeof(ExtractionPoint), "HaulGoalSet", (Type[])null, (Type[])null).Invoke(CurrentExtraction, new object[1] { (int)RoundDirector.instance.Get<RoundDirector>("haulGoal") / (int)RoundDirector.instance.Get<RoundDirector>("extractionPoints") + ExtractionOverflow * 12 / 10 }); AccessTools.Method(typeof(ExtractionPoint), "SetHaulText", (Type[])null, (Type[])null).Invoke(CurrentExtraction, null); ExtractionOverflow = 0; } } public void DestroyExtractionPoint(ExtractionPoint extraction) { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)extraction).enabled = false; ExtractionOverflow += extraction.haulGoal; RoundDirector.instance.Set<RoundDirector>("extractionPointActive", false); RoundDirector.instance.ExtractionPointsUnlock(); RoundDirector.instance.ExtractionCompleted(); SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() - 5); ((SemiUI)CurrencyUI.instance).Show(); CurrencyUI.instance.Set<CurrencyUI>("showTimer", 2f); int num = (int)RoundDirector.instance.Get<RoundDirector>("extractionPoints"); int num2 = (int)RoundDirector.instance.Get<RoundDirector>("extractionPointsCompleted"); if (num - num2 <= 0) { GameOver(); return; } SemiFunc.UIBigMessage($"EXTRACTION DESTROYED\n${5000} FINED", "{!}", 25f, Color.red, Color.red); BigMessageUI.instance.Set<BigMessageUI>("bigMessageTimer", 3f); } public void GameOver() { ((MonoBehaviour)this).StartCoroutine(GameOverCoroutine()); } [IteratorStateMachine(typeof(<GameOverCoroutine>d__12))] public IEnumerator GameOverCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GameOverCoroutine>d__12(0) { <>4__this = this }; } } public static class GnomeOverhaul { public static ConfigEntry<bool> OverhaulItemDamage; public static void Init() { OverhaulItemDamage = Plugin.BindConfig("Gnome", "OverhaulItemDamage", defaultValue: true, "If true, significantly reduces the damage that Gnomes do to items", delegate { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown Plugin.SetPatch(OverhaulItemDamage.Value, AccessTools.Method(typeof(EnemyGnome), "Start", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(GnomeOverhaul), "StartPostfix", (Type[])null)); }); } public static void StartPostfix(EnemyGnome __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) List<HurtCollider> hurtColliders = Utils.GetHurtColliders(((Component)((Component)__instance.enemy).GetComponentInParent<EnemyParent>()).transform); for (int i = 0; i < hurtColliders.Count; i++) { HurtCollider val = hurtColliders[i]; val.physImpact = (BreakImpact)1; } } } public static class HeadmanOverhaul { private enum HeadmanState { Roaming, Interested, Annoyed, VeryAnnoyed, Pissed } private const int VisionTimerMeta = 0; private const int LastVisionTime = 1; private const int State = 2; private const int Started = 3; private const int HurtColliders = 4; public static ConfigEntry<bool> OverhaulAI; public static void Init() { OverhaulAI = Plugin.BindConfig("Headman", "OverhaulAI", defaultValue: true, "If true, Headman AI is overhauled", delegate { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyHeadController), "VisionTriggered", (Type[])null, (Type[])null), new HarmonyMethod(typeof(HeadmanOverhaul), "VisionTriggeredPrefix", (Type[])null)); Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyHeadController), "Update", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(HeadmanOverhaul), "UpdatePostfix", (Type[])null)); }); } public static void Start(EnemyHeadController instance, Enemy enemy) { ((MonoBehaviour)(object)instance).SetMetadata(4, Utils.GetHurtColliders(((Component)enemy.Get<EnemyParent, Enemy>("EnemyParent")).transform)); } public static void UpdatePostfix(EnemyHeadController __instance, Enemy ___Enemy) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) if (!((MonoBehaviour)(object)__instance).GetMetadata(3, defaultValue: false)) { ((MonoBehaviour)(object)__instance).SetMetadata(3, true); Start(__instance, ___Enemy); } HeadmanState headmanState = ((MonoBehaviour)(object)__instance).GetMetadata(2, HeadmanState.Roaming); float metadata = ((MonoBehaviour)(object)__instance).GetMetadata(0, 0f); EnemyVision obj = (EnemyVision)___Enemy.Get<Enemy>("Vision"); PlayerAvatar val = obj.Get<PlayerAvatar, EnemyVision>("onVisionTriggeredPlayer"); EnemyStateInvestigate component = ((Component)__instance).GetComponent<EnemyStateInvestigate>(); if ((int)___Enemy.CurrentState == 4 || (int)___Enemy.CurrentState == 5) { List<HurtCollider> metadata2 = ((MonoBehaviour)(object)__instance).GetMetadata<List<HurtCollider>>(4); for (int i = 0; i < metadata2.Count; i++) { metadata2[i].playerDamage = 80; } SetMovement(__instance, ___Enemy, 12f, 20f); } else { SetMovement(__instance, ___Enemy, 6f, 10f); } switch (headmanState) { case HeadmanState.Roaming: if (metadata > 0.1f) { component.Set(Vector3.Lerp(((Component)__instance).transform.position, val.playerTransform.position, 0.2f)); headmanState = HeadmanState.Interested; } break; case HeadmanState.Interested: if (metadata > 0.2f) { component.Set(Vector3.Lerp(((Component)__instance).transform.position, val.playerTransform.position, 0.2f)); AccessTools.Method(typeof(EnemyHeadAnimationSystem), "IdleTeeth", (Type[])null, (Type[])null).Invoke(__instance.AnimationSystem, Array.Empty<object>()); headmanState = HeadmanState.Annoyed; } if (metadata < 0.1f) { headmanState = HeadmanState.Roaming; } break; case HeadmanState.Annoyed: if (metadata > 0.4f) { component.Set(Vector3.Lerp(((Component)__instance).transform.position, val.playerTransform.position, 0.2f)); AccessTools.Method(typeof(EnemyHeadAnimationSystem), "IdleTeeth", (Type[])null, (Type[])null).Invoke(__instance.AnimationSystem, Array.Empty<object>()); headmanState = HeadmanState.VeryAnnoyed; } if (metadata < 0.2f) { headmanState = HeadmanState.Interested; } break; case HeadmanState.VeryAnnoyed: if (metadata > 0.7f) { headmanState = HeadmanState.Pissed; } if (metadata < 0.4f) { headmanState = HeadmanState.Annoyed; } break; case HeadmanState.Pissed: if (metadata < 0.5f) { headmanState = HeadmanState.Roaming; } break; } ((MonoBehaviour)(object)__instance).SetMetadata(2, headmanState); float metadata3 = ((MonoBehaviour)(object)__instance).GetMetadata(1, 0f); if (!(Time.time - metadata3 < 0.5f)) { metadata = Mathf.Max(metadata - 0.2f * Time.deltaTime, 0f); ((MonoBehaviour)(object)__instance).SetMetadata(0, metadata); } } public static bool VisionTriggeredPrefix(EnemyHeadController __instance, Enemy ___Enemy) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Invalid comparison between Unknown and I4 //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Invalid comparison between Unknown and I4 //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Invalid comparison between Unknown and I4 //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Invalid comparison between Unknown and I4 //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Invalid comparison between Unknown and I4 //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Invalid comparison between Unknown and I4 //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Invalid comparison between Unknown and I4 //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Invalid comparison between Unknown and I4 //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) EnemyVision obj = (EnemyVision)___Enemy.Get<Enemy>("Vision"); PlayerAvatar val = obj.Get<PlayerAvatar, EnemyVision>("onVisionTriggeredPlayer"); ___Enemy.Set<Enemy>("TargetPlayerViewID", val.photonView.ViewID); ___Enemy.Set<Enemy>("TargetPlayerAvatar", val); PhysGrabber physGrabber = val.physGrabber; Rigidbody val2 = physGrabber.Get<Rigidbody, PhysGrabber>("grabbedObject"); if ((Object)(object)val2 == (Object)null || (float)___Enemy.Get<Enemy>("DisableChaseTimer") > 0f) { return false; } HeadmanState metadata = ((MonoBehaviour)(object)__instance).GetMetadata(2, HeadmanState.Roaming); float metadata2 = ((MonoBehaviour)(object)__instance).GetMetadata(0, 0f); float num = (float)obj.Get<EnemyVision>("VisionCheckTime"); float num2 = 0f; ValuableObject component = ((Component)val2).GetComponent<ValuableObject>(); if (component != null) { num2 = component.dollarValueCurrent / 1500f; } else { ItemAttributes component2 = ((Component)val2).GetComponent<ItemAttributes>(); if (component2 != null && ((int)component2.item.itemType == 6 || (int)component2.item.itemType == 7 || (int)component2.item.itemType == 9 || (int)component2.item.itemType == 11)) { num2 = 4f; } } metadata2 = Mathf.Min(metadata2 + num * num2 / Vector3.Distance(val.playerTransform.position, ((Component)__instance).transform.position), 1f); ((MonoBehaviour)(object)__instance).SetMetadata(1, Time.time); ((MonoBehaviour)(object)__instance).SetMetadata(0, metadata2); if (metadata != HeadmanState.Pissed) { return false; } if ((int)___Enemy.CurrentState != 4 && (int)___Enemy.CurrentState != 10) { if ((int)___Enemy.CurrentState == 5) { ___Enemy.CurrentState = (EnemyState)4; } else if ((bool)obj.Get<EnemyVision>("onVisionTriggeredCulled") && !(bool)obj.Get<EnemyVision>("onVisionTriggeredNear")) { if ((int)___Enemy.CurrentState != 8) { if (Random.Range(0f, 100f) <= 30f) { ___Enemy.CurrentState = (EnemyState)3; } else { ___Enemy.CurrentState = (EnemyState)8; } } } else if ((float)obj.Get<EnemyVision>("onVisionTriggeredDistance") >= 7f) { ___Enemy.CurrentState = (EnemyState)4; ___Enemy.Get<EnemyStateChase, Enemy>("StateChase").ChaseCanReach = true; } else { ___Enemy.CurrentState = (EnemyState)3; } } return false; } public static void SetMovement(EnemyHeadController instance, Enemy enemy, float speed, float acceleration) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown EnemyRigidbody val = (EnemyRigidbody)enemy.Get<Enemy>("Rigidbody"); EnemyStateChase component = ((Component)instance).GetComponent<EnemyStateChase>(); val.OverrideFollowPosition(1f, speed, -1f); component.Speed = speed; component.Acceleration = acceleration; instance.Visual.PositionFollowChasing = speed; } } public static class HuntsmanOverhaul { public static ConfigEntry<bool> OverhaulAI; public static ConfigEntry<bool> OverhaulDamageFalloff; public static ConfigEntry<bool> OverhaulTargetPlayerItems; public static void Init() { OverhaulAI = Plugin.BindConfig("Huntsman", "OverhaulAI", defaultValue: true, "If true, Huntsman AI is overhauled", delegate { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyHunter), "Awake", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(HuntsmanOverhaul), "AwakePostfix", (Type[])null)); Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyHunter), "OnInvestigate", (Type[])null, (Type[])null), new HarmonyMethod(typeof(HuntsmanOverhaul), "OnInvestigatePrefix", (Type[])null)); Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyHunter), "StateAim", (Type[])null, (Type[])null), new HarmonyMethod(typeof(HuntsmanOverhaul), "StateAimPrefix", (Type[])null)); Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyHunter), "Update", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(HuntsmanOverhaul), "UpdatePostfix", (Type[])null)); Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyHunter), "UpdateState", (Type[])null, (Type[])null), new HarmonyMethod(typeof(HuntsmanOverhaul), "UpdateStatePrefix", (Type[])null)); }); OverhaulDamageFalloff = Plugin.BindConfig("Huntsman", "OverhaulDamageFalloff", defaultValue: true, "If true, Huntsman damage reduces over long distances and increases at short range", delegate { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown Plugin.SetPatch(OverhaulDamageFalloff.Value, AccessTools.Method(typeof(EnemyHunter), "ShootRPC", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(HuntsmanOverhaul), "HunterShootRPCPostFix", (Type[])null)); }); OverhaulTargetPlayerItems = Plugin.BindConfig("Huntsman", "OverhaulTargetPlayerItems", defaultValue: true, "If true, Huntsman shoot directly at valuables that touch it, not the players holding those valuables.", delegate { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown Plugin.SetPatch(OverhaulTargetPlayerItems.Value, AccessTools.Method(typeof(EnemyHunter), "OnTouchPlayerGrabbedObject", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(HuntsmanOverhaul), "HunterOnTouchPlayerGrabbedObjectPostfix", (Type[])null)); Plugin.SetPatch(OverhaulTargetPlayerItems.Value, AccessTools.Method(typeof(EnemyRigidbody), "OnCollisionStay", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(HuntsmanOverhaul), "EnemyOnCollisionStayPostfix", (Type[])null)); }); } public static void AwakePostfix(EnemyHunter __instance) { HuntsmanOverhaulState huntsmanOverhaulState = ((Component)__instance).gameObject.AddComponent<HuntsmanOverhaulState>(); huntsmanOverhaulState.Hunter = __instance; } public static void UpdateStatePrefix(EnemyHunter __instance, State _state) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 HuntsmanOverhaulState component = ((Component)__instance).GetComponent<HuntsmanOverhaulState>(); if ((int)_state != 3 && (int)__instance.currentState != 3) { component.InvestigateFrames = 0; } } public static void UpdatePostfix(EnemyHunter __instance) { HuntsmanOverhaulState component = ((Component)__instance).GetComponent<HuntsmanOverhaulState>(); component.InvestigateFrames--; } public static void OnInvestigatePrefix(EnemyHunter __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_009d: 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) HuntsmanOverhaulState component = ((Component)__instance).GetComponent<HuntsmanOverhaulState>(); if (!SemiFunc.IsMasterClientOrSingleplayer() || !((float)component.EnemyRigidbody.Get<EnemyRigidbody>("timeSinceStun") > 1.5f)) { return; } component.InvestigateFrames = 2; if ((int)__instance.currentState == 5 && component.InvestigateCooldown <= 0f) { component.InvestigateTriggeredImpulse = true; Vector3 val = (Vector3)component.StateInvestigate.Get<EnemyStateInvestigate>("onInvestigateTriggeredPosition"); __instance.Set<EnemyHunter>("investigatePoint", val); __instance.Set<EnemyHunter>("shootFast", Vector3.Distance(val, ((Component)component).transform.position) < 4f); component.InvestigateTransformGet(); if (SemiFunc.IsMultiplayer()) { component.PhotonView.RPC("UpdateInvestigationPoint", (RpcTarget)1, new object[1] { val }); } } } public static bool StateAimPrefix(EnemyHunter __instance) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) HuntsmanOverhaulState component = ((Component)__instance).GetComponent<HuntsmanOverhaulState>(); if (component.InvestigateFrames <= 0) { return true; } float num = (float)__instance.Get<EnemyHunter>("stateTimer"); component.InvestigateFrames = 2; if ((bool)__instance.Get<EnemyHunter>("stateImpulse")) { component.EnemyNavAgent.Warp(((Component)component.EnemyRigidbody).transform.position); component.EnemyNavAgent.ResetPath(); __instance.Set<EnemyHunter>("stateImpulse", false); num = 5f; component.InvestigateCooldown = 1f; __instance.Set<EnemyHunter>("investigatePointTransform", null); __instance.Set<EnemyHunter>("investigatePointHasTransform", false); } if (component.InvestigateTriggeredImpulse && !component.Aiming) { component.InvestigateTriggeredImpulse = false; component.Aiming = true; component.InvestigateCooldown = 0.5f; num = 0.5f; __instance.Set<EnemyHunter>("investigatePointSpread", Vector3.zero); __instance.Set<EnemyHunter>("investigatePointSpreadTarget", Vector3.zero); __instance.Set<EnemyHunter>("investigatePointSpreadTimer", 0f); } num -= Time.deltaTime; if (num <= 0f) { if (component.Aiming) { component.Aiming = false; component.UpdateState((State)6); } else { component.Animator.CrossFade("Leave Start", 1f); component.UpdateState((State)8); } } __instance.Set<EnemyHunter>("stateTimer", num); return false; } public static void HunterOnTouchPlayerGrabbedObjectPostfix(EnemyHunter __instance) { AccessTools.Field(typeof(EnemyHunter), "investigatePointHasTransform").SetValue(__instance, false); } public static void HunterShootRPCPostFix(EnemyHunter __instance, Vector3 _hitPosition) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(2f / Mathf.Pow(Vector3.Distance(_hitPosition, __instance.gunTipTransform.position), 1.5f), 0.5f); __instance.hurtCollider.playerDamage = (int)(300f * num); __instance.hurtCollider.playerTumbleForce = 30f * num; __instance.hurtCollider.playerTumbleTorque = 30f * num; __instance.hurtCollider.playerHitForce = 30f * num; __instance.hurtCollider.playerTumbleTime = 6f * num; __instance.hurtCollider.enemyDamage = (int)(300f * num); __instance.hurtCollider.enemyHitForce = 30f * num; __instance.hurtCollider.enemyHitTorque = 60f * num; } public static void EnemyOnCollisionStayPostfix(EnemyRigidbody __instance, Collision other) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (other.gameObject.CompareTag("Phys Grab Object")) { PhysGrabObject val = other.gameObject.GetComponent<PhysGrabObject>(); if (!Object.op_Implicit((Object)(object)val)) { val = other.gameObject.GetComponentInParent<PhysGrabObject>(); } if (Object.op_Implicit((Object)(object)val) && !__instance.enemy.CheckChase() && val.playerGrabbing.Count > 0) { __instance.Set<EnemyRigidbody>("onTouchPlayerGrabbedObjectPosition", other.transform.position); } } } } public class HuntsmanOverhaulState : MonoBehaviour { public EnemyHunter Hunter; public EnemyHunterAnim EnemyAnim; public Animator Animator; public Enemy Enemy; public EnemyNavMeshAgent EnemyNavAgent; public EnemyRigidbody EnemyRigidbody; public EnemyStateInvestigate StateInvestigate; public PhotonView PhotonView; public Action<State> UpdateState; public Action InvestigateTransformGet; public bool InvestigateTriggeredImpulse; public float InvestigateCooldown; public bool Aiming; public int InvestigateFrames; public void Awake() { EnemyNavAgent = ((Component)this).GetComponent<EnemyNavMeshAgent>(); PhotonView = ((Component)this).GetComponent<PhotonView>(); StateInvestigate = ((Component)this).GetComponent<EnemyStateInvestigate>(); Enemy = ((Component)this).GetComponent<Enemy>(); } public void Start() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown UpdateState = (Action<State>)AccessTools.Method(typeof(EnemyHunter), "UpdateState", (Type[])null, (Type[])null).CreateDelegate(typeof(Action<State>), Hunter); InvestigateTransformGet = (Action)AccessTools.Method(typeof(EnemyHunter), "InvestigateTransformGet", (Type[])null, (Type[])null).CreateDelegate(typeof(Action), Hunter); EnemyAnim = Hunter.enemyHunterAnim; Animator = (Animator)EnemyAnim.Get<EnemyHunterAnim>("animator"); EnemyRigidbody = (EnemyRigidbody)Enemy.Get<Enemy>("Rigidbody"); } public void Update() { InvestigateCooldown -= Time.deltaTime; } } public static class PitOverhaul { public const int MapHurtColliderMeta = 0; public static ConfigEntry<bool> OverhaulPlayers; public static ConfigEntry<bool> OverhaulEnemies; public static ConfigEntry<bool> OverhaulItems; public static void Init() { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown OverhaulPlayers = Plugin.BindConfig("Pits", "OverhaulPlayers", defaultValue: true, "If true, pit overhauled mechanics are applied to players", delegate { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown Plugin.SetPatch(OverhaulPlayers.Value, AccessTools.Method(typeof(HurtCollider), "PlayerHurt", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PitOverhaul), "PlayerHurtPrefix", (Type[])null)); }); OverhaulEnemies = Plugin.BindConfig("Pits", "OverhaulEnemies", defaultValue: true, "If true, pit overhauled mechanics are applied to enemies", delegate { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown Plugin.SetPatch(OverhaulEnemies.Value, AccessTools.Method(typeof(HurtCollider), "EnemyHurt", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PitOverhaul), "EnemyHurtPrefix", (Type[])null)); }); OverhaulItems = Plugin.BindConfig("Pits", "OverhaulItems", defaultValue: true, "If true, pit overhauled mechanics are applied to items", delegate { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown Plugin.SetPatch(OverhaulItems.Value, AccessTools.Method(typeof(HurtCollider), "PhysObjectHurt", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PitOverhaul), "PhysObjectHurtPrefix", (Type[])null)); }); Plugin.Harmony.Patch((MethodBase)AccessTools.Method(typeof(LevelGenerator), "GenerateDone", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(PitOverhaul), "GenerateDonePostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void GenerateDonePostfix(LevelGenerator __instance) { if ((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelArena) { return; } List<HurtCollider> hurtColliders = Utils.GetHurtColliders(__instance.LevelParent.transform); for (int i = 0; i < hurtColliders.Count; i++) { HurtCollider val = hurtColliders[i]; if (((Object)val).name.Contains("Kill Box")) { ((MonoBehaviour)(object)val).SetMetadata(0, true); } } } public static bool PlayerHurtPrefix(HurtCollider __instance, PlayerAvatar _player) { //IL_0036: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_009a: 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) if (!((MonoBehaviour)(object)__instance).GetMetadata(0, defaultValue: false)) { return true; } __instance.onImpactAny.Invoke(); __instance.onImpactPlayer.Invoke(); LevelPoint val = Utils.ChooseLevelPoint(((Component)_player).transform.position, 40f, 1f); Vector3 val2 = ((Component)val).transform.position + new Vector3(0f, 1f, 0f); _player.Spawn(val2, ((Component)_player).transform.rotation); Rigidbody val3 = (Rigidbody)_player.tumble.Get<PlayerTumble>("rb"); val3.position = val2; ((Component)val3).transform.position = val2; PlayerController.instance.CollisionController.Set<PlayerCollisionController>("fallDistance", 0); _player.tumble.TumbleRequest(true, false); _player.tumble.TumbleOverrideTime(3f); _player.tumble.ImpactHurtSet(float.PositiveInfinity, Random.Range(35, 45)); return false; } public static bool EnemyHurtPrefix(HurtCollider __instance, Enemy _enemy) { //IL_0038: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (!((MonoBehaviour)(object)__instance).GetMetadata(0, defaultValue: false)) { return true; } __instance.onImpactAny.Invoke(); __instance.onImpactEnemy.Invoke(); LevelPoint val = Utils.ChooseLevelPoint(((Component)_enemy).transform.position, 30f, 1f); Vector3 val2 = ((Component)val).transform.position + new Vector3(0f, 1f, 0f); _enemy.EnemyTeleported(val2); EnemyHealth val3 = (EnemyHealth)_enemy.Get<Enemy>("Health"); if ((Object)(object)val3 != (Object)null) { val3.Hurt(Random.Range(100, 145), ((Component)__instance).transform.forward); } else if ((bool)_enemy.Get<Enemy>("HasStateDespawn")) { _enemy.Get<EnemyParent, Enemy>("EnemyParent").SpawnedTimerSet(0f); _enemy.CurrentState = (EnemyState)11; } EnemyStateStunned val4 = (EnemyStateStunned)_enemy.Get<Enemy>("StateStunned"); if ((Object)(object)val4 != (Object)null) { val4.Set(5f); } return false; } public static bool PhysObjectHurtPrefix(ref bool __result, HurtCollider __instance, PhysGrabObject physGrabObject) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //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_0053: 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_005c: Unknown result type (might be due to invalid IL or missing references) if (!((MonoBehaviour)(object)__instance).GetMetadata(0, defaultValue: false)) { return true; } LevelPoint val = Utils.ChooseLevelPoint(((Component)physGrabObject).transform.position, 20f, 1f); Vector3 val2 = ((Component)val).transform.position + new Vector3(0f, 1f, 0f); physGrabObject.Teleport(val2, ((Component)physGrabObject).transform.rotation); __result = true; return false; } } public static class ReaperOverhaul { public static ConfigEntry<bool> OverhaulAI; public static void Init() { OverhaulAI = Plugin.BindConfig("Reaper", "OverhaulAI", defaultValue: true, "If true, overhauls the AI of the Reaper", delegate { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyRunner), "StateAttackPlayer", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ReaperOverhaul), "StateAttackPlayerPrefix", (Type[])null)); Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyRunner), "Awake", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(ReaperOverhaul), "AwakePostfix", (Type[])null)); Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyRunner), "OnHurt", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(ReaperOverhaul), "OnHurtPostfix", (Type[])null)); Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyRunner), "StateLeave", (Type[])null, (Type[])null), null, new HarmonyMethod(typeof(ReaperOverhaul), "StateLeavePostfix", (Type[])null)); }); } public static void StateLeavePostfix(EnemyRunner __instance) { ReaperOverhaulState component = ((Component)__instance).GetComponent<ReaperOverhaulState>(); if (component.RunningTimer > 0f) { component.OverrideMovement(3f, 5f, 6f, 0.2f); } } public static void AwakePostfix(EnemyRunner __instance) { ReaperOverhaulState reaperOverhaulState = ((Component)__instance).gameObject.AddComponent<ReaperOverhaulState>(); reaperOverhaulState.Reaper = __instance; reaperOverhaulState.Enemy = ((Component)__instance).GetComponent<Enemy>(); reaperOverhaulState.UpdateState = (Action<State>)AccessTools.Method(typeof(EnemyRunner), "UpdateState", (Type[])null, (Type[])null).CreateDelegate(typeof(Action<State>), __instance); reaperOverhaulState.VisionBlocked = (Func<bool>)AccessTools.Method(typeof(EnemyRunner), "VisionBlocked", (Type[])null, (Type[])null).CreateDelegate(typeof(Func<bool>), __instance); } public static void OnHurtPostfix(EnemyRunner __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_000e: Invalid comparison between Unknown and I4 //IL_0095: Unknown result type (might be due to invalid IL or missing references) State currentState = __instance.currentState; State val = currentState; if (val - 7 <= 2) { ReaperOverhaulState component = ((Component)__instance).GetComponent<ReaperOverhaulState>(); int num = component.PrevHealth - (int)component.EnemyHealth.Get<EnemyHealth>("healthCurrent"); component.Aggro -= num; if (component.Aggro <= 0f) { component.UpdateState((State)16); component.HurtAggroCooldown = 3f; component.RunningTimer = 5f; component.EnemyAnim.sfxJump.Play(((Component)__instance).transform.position, 1.5f, 1f, 1f, 1f); } } } public static bool StateAttackPlayerPrefix(EnemyRunner __instance) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_01e7: 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_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: 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_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) ReaperOverhaulState component = ((Component)__instance).GetComponent<ReaperOverhaulState>(); if (component.HurtAggroCooldown > 0f) { component.UpdateState((State)16); return false; } PlayerAvatar val = (PlayerAvatar)__instance.Get<EnemyRunner>("targetPlayer"); bool flag = (bool)__instance.Get<EnemyRunner>("stateImpulse"); float num = (float)__instance.Get<EnemyRunner>("stateTimer"); if (flag) { __instance.Set<EnemyRunner>("stateImpulse", false); __instance.Set<EnemyRunner>("stateTimer", 2f); num = 2f; component.RetargetTimer = 0f; component.ChaseTime = 0f; } component.Aggro += Time.deltaTime; component.ChaseTime += Time.deltaTime; component.RetargetTimer -= Time.deltaTime; if (component.RetargetTimer <= 0f) { component.RetargetTimer = 0.2f; if ((bool)val.tumble.Get<PlayerTumble>("isTumbling")) { component.SetPlayerDamage((int)component.ChaseTime); } else { component.SetPlayerDamage((int)component.ChaseTime + 10); } float num2 = 1f + component.ChaseTime / 5f; component.OverrideMovement(num2, num2 * 3f, num2 * 3f, 0.25f); component.EnemyNavAgent.SetDestination(((Component)val).transform.position); } if (!component.EnemyNavAgent.CanReach(((Component)val).transform.position, 0.25f) && Vector3.Distance(((Component)component.EnemyRigidbody).transform.position, component.EnemyNavAgent.GetPoint()) < 2f && ((Component)val).transform.position.y > ((Component)component.EnemyRigidbody).transform.position.y - 0.8f) { component.EnemyJump.StuckTrigger(((Component)val).transform.position - component.EnemyVision.VisionTransform.position); } if (!(bool)component.EnemyJump.Get<EnemyJump>("jumping") && (float)component.EnemyRigidbody.Get<EnemyRigidbody>("notMovingTimer") > 2f) { component.EnemyJump.StuckTrigger(((Component)val).transform.position - component.FeetTransform.position); } if (num > 1.5f && (bool)val.Get<PlayerAvatar>("isCrawling") && !(bool)val.Get<PlayerAvatar>("isTumbling") && (double)Vector3.Distance(component.EnemyNavAgent.GetPoint(), ((Component)val).transform.position) > 0.5 && Vector3.Distance(((Component)val).transform.position, (Vector3)val.Get<PlayerAvatar>("LastNavmeshPosition")) < 2f) { component.SetPlayerDamage(20); component.UpdateState((State)12); return false; } if (num <= 0f) { component.UpdateState((State)1); } return false; } } public class ReaperOverhaulState : MonoBehaviour { public Action<State> UpdateState; public Func<bool> VisionBlocked; public EnemyRunner Reaper; public EnemyRunnerAnim EnemyAnim; public Enemy Enemy; public Transform FeetTransform; public PhotonView PhotonView; public EnemyHealth EnemyHealth; public EnemyVision EnemyVision; public EnemyJump EnemyJump; public EnemyNavMeshAgent EnemyNavAgent; public EnemyRigidbody EnemyRigidbody; public float RetargetTimer = 0f; public float ChaseTime = 0f; public float HurtAggroCooldown = 0f; public float Aggro = 0f; public float RunningTimer = 0f; public int PrevHealth = 0; public int PlayerDamage = 0; public void Awake() { PhotonView = ((Component)this).GetComponent<PhotonView>(); } public void Start() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown FeetTransform = Reaper.feetTransform; EnemyAnim = Reaper.animator; EnemyVision = (EnemyVision)Enemy.Get<Enemy>("Vision"); EnemyJump = (EnemyJump)Enemy.Get<Enemy>("Jump"); EnemyNavAgent = (EnemyNavMeshAgent)Enemy.Get<Enemy>("NavMeshAgent"); EnemyRigidbody = (EnemyRigidbody)Enemy.Get<Enemy>("Rigidbody"); EnemyHealth = (EnemyHealth)Enemy.Get<Enemy>("Health"); Reaper.hurtCollider.physHitForce = 3f; Reaper.hurtCollider.physHitTorque = 10f; Reaper.hurtCollider.playerTumbleForce = 2f; } public void Update() { PrevHealth = (int)EnemyHealth.Get<EnemyHealth>("healthCurrent"); HurtAggroCooldown -= Time.deltaTime; RunningTimer -= Time.deltaTime; Reaper.hurtCollider.playerDamage = PlayerDamage; } public void OverrideMovement(float speed, float acceleration, float rigidbodyAcceleration, float time) { EnemyNavAgent.OverrideAgent(speed, acceleration, time); EnemyRigidbody.OverrideFollowPosition(time, rigidbodyAcceleration, -1f); } [PunRPC] public void SetPlayerDamage(int damage) { if (SemiFunc.IsMasterClient()) { PhotonView.RPC("SetPlayerDamage", (RpcTarget)1, new object[1] { damage }); } PlayerDamage = damage; } } public static class RobeOverhaul { public static ConfigEntry<bool> OverhaulAI; public static void Init() { OverhaulAI = Plugin.BindConfig("Robe", "OverhaulAI", defaultValue: true, "If true, Robe AI is overhauled", delegate { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemyRobe), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(typeof(RobeOverhaul), "AwakePrefix", (Type[])null)); }); } public static bool AwakePrefix(EnemyRobe __instance) { RobeOverride robeOverride = ((Component)__instance).gameObject.AddComponent<RobeOverride>(); robeOverride.RotationSpring = __instance.rotationSpring; robeOverride.Animator = ((Component)__instance.robeAnim).GetComponent<Animator>(); robeOverride.deathParticles = __instance.robeAnim.deathParticles; robeOverride.spawnParticles = __instance.robeAnim.spawnParticles; robeOverride.sfxTargetPlayerLoop = __instance.robeAnim.sfxTargetPlayerLoop; robeOverride.sfxIdleBreak = __instance.robeAnim.sfxIdleBreak; robeOverride.sfxAttack = __instance.robeAnim.sfxAttack; robeOverride.sfxAttackGlobal = __instance.robeAnim.sfxAttackGlobal; robeOverride.sfxHurt = __instance.robeAnim.sfxHurt; robeOverride.sfxHandIdle = __instance.robeAnim.sfxHandIdle; robeOverride.sfxHandAggressive = __instance.robeAnim.sfxHandAggressive; robeOverride.sfxStunStart = __instance.robeAnim.sfxStunStart; robeOverride.sfxStunLoop = __instance.robeAnim.sfxStunLoop; robeOverride.sfxAttackUnder = __instance.robeAnim.sfxAttackUnder; robeOverride.sfxAttackUnderGlobal = __instance.robeAnim.sfxAttackUnderGlobal; Object.Destroy((Object)(object)__instance.robeAnim); Object.Destroy((Object)(object)__instance); return false; } } public class RobeOverride : MonoBehaviour { public enum RobeState { Spawn, Idle, Investigate, Shifty, Roam, FollowPlayer, HelpPlayer, ChaseBegin, Chase, Attack, AttackUnderBegin, AttackUnder, GiveSpace } public enum RobeAggroMode { None, All } public enum RobeFocusMode { None, Player } public record struct TrackedValuable(ValuableObject Valuable, UnityAction BreakListener); public StateMachine<RobeState> State; public float LastFocusedPlayerVisionTimer = float.PositiveInfinity; public float ItemBreakLogicTimer = 0f; public RobeAggroMode AggroMode = RobeAggroMode.All; public RobeFocusMode FocusMode = RobeFocusMode.Player; public Enemy Enemy; public EnemyParent EnemyParent; public PhotonView PhotonView; public EnemyVision Vision; public EnemyRigidbody Rigidbody; public Animator Animator; public HurtCollider HurtCollider; public EnemyNavMeshAgent EnemyAgent; public PlayerAvatar FocusedPlayer; public AggroHandler Aggro = new AggroHandler(); public SpringQuaternion RotationSpring; private EnemyStateInvestigate StateInvestigate; public ValuableObject TargetValuable; public List<TrackedValuable> TrackedValuables = new List<TrackedValuable>(); public Quaternion RotationTarget; public ParticleSystem[] deathParticles; public ParticleSystem spawnParticles; public Sound sfxTargetPlayerLoop; public Sound sfxIdleBreak; public Sound sfxAttack; public Sound sfxAttackGlobal; public Sound sfxHurt; public Sound sfxHandIdle; public Sound sfxHandAggressive; public Sound sfxStunStart; public Sound sfxStunLoop; public Sound sfxAttackUnder; public Sound sfxAttackUnderGlobal; [PunRPC] public void SetState(RobeState state, float stateTimer) { if (State.SetState(state, stateTimer) && SemiFunc.IsMasterClient() && SemiFunc.IsMultiplayer()) { PhotonView.RPC("SetState", (RpcTarget)1, new object[2] { state, stateTimer }); } } public void SyncFields() { if (GameManager.Multiplayer()) { PhotonView.RPC("SyncFieldsRPC", (RpcTarget)1, new object[2] { Object.op_Implicit((Object)(object)FocusedPlayer) ? FocusedPlayer.photonView.ViewID : (-1), Object.op_Implicit((Object)(object)TargetValuable) ? ((Component)TargetValuable).GetComponent<PhotonView>().ViewID : (-1) }); } } [PunRPC] private void SyncFieldsRPC(int focusedPlayerID, int targetValuableID) { FocusedPlayer = ((focusedPlayerID == -1) ? null : ((Component)PhotonView.Find(focusedPlayerID)).GetComponent<PlayerAvatar>()); TargetValuable = ((targetValuableID == -1) ? null : ((Component)PhotonView.Find(targetValuableID)).GetComponent<ValuableObject>()); } public void Awake() { Enemy = ((Component)this).GetComponent<Enemy>(); PhotonView = ((Component)this).GetComponent<PhotonView>(); State = new StateMachine<RobeState>(StateMachine); State.State = RobeState.Spawn; } public void Start() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown HurtCollider = Utils.GetHurtColliders(((Component)this).transform.parent)[0]; Rigidbody = (EnemyRigidbody)Enemy.Get<Enemy>("Rigidbody"); EnemyAgent = (EnemyNavMeshAgent)Enemy.Get<Enemy>("NavMeshAgent"); Vision = (EnemyVision)Enemy.Get<Enemy>("Vision"); EnemyParent = (EnemyParent)Enemy.Get<Enemy>("EnemyParent"); ((Behaviour)((Component)EnemyParent).GetComponentInChildren<EnemyRobePersistent>()).enabled = false; if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } EnemyHealth health = ((Component)this).GetComponent<EnemyHealth>(); EnemyStateSpawn component = ((Component)this).GetComponent<EnemyStateSpawn>(); EnemyStateDespawn component2 = ((Component)this).GetComponent<EnemyStateDespawn>(); EnemyStateStunned component3 = ((Component)this).GetComponent<EnemyStateStunned>(); StateInvestigate = ((Component)this).GetComponent<EnemyStateInvestigate>(); Vision.onVisionTriggered.AddListener((UnityAction)delegate { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Invalid comparison between Unknown and I4 //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Invalid comparison between Unknown and I4 //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Invalid comparison between Unknown and I4 //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Invalid comparison between Unknown and I4 if (FocusMode == RobeFocusMode.Player) { PlayerAvatar val = (PlayerAvatar)Vision.Get<EnemyVision>("onVisionTriggeredPlayer"); if ((Object)(object)FocusedPlayer == (Object)null) { FocusedPlayer = val; LastFocusedPlayerVisionTimer = 0f; } else if ((Object)(object)FocusedPlayer == (Object)(object)val) { LastFocusedPlayerVisionTimer = 0f; } } else { LastFocusedPlayerVisionTimer = float.PositiveInfinity; } if (AggroMode == RobeAggroMode.All) { PlayerAvatar val2 = (PlayerAvatar)Vision.Get<EnemyVision>("onVisionTriggeredPlayer"); if (val2.physGrabber.grabbed) { ItemAttributes component4 = ((Component)val2.physGrabber.Get<PhysGrabObject, PhysGrabber>("grabbedPhysGrabObject")).GetComponent<ItemAttributes>(); if (component4 != null && ((int)component4.item.itemType == 6 || (int)component4.item.itemType == 7 || (int)component4.item.itemType == 9 || (int)component4.item.itemType == 11)) { Aggro.GetAggro(val2).Aggro += (float)Vision.Get<EnemyVision>("VisionCheckTime") * 6f; } } } }); Rigidbody.onGrabbed.AddListener((UnityAction)delegate { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (AggroMode == RobeAggroMode.All) { Aggro.GetAggro((PlayerAvatar)Rigidbody.Get<EnemyRigidbody>("onGrabbedPlayerAvatar")).Aggro += Time.deltaTime * 5f; } }); Rigidbody.onTouchPlayer.AddListener((UnityAction)delegate { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (AggroMode == RobeAggroMode.All) { Aggro.GetAggro((PlayerAvatar)Rigidbody.Get<EnemyRigidbody>("onTouchPlayerAvatar")).Aggro += Time.deltaTime * 5f; } }); Rigidbody.onTouchPlayerGrabbedObject.AddListener((UnityAction)delegate { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (AggroMode == RobeAggroMode.All) { Aggro.GetAggro((PlayerAvatar)Rigidbody.Get<EnemyRigidbody>("onTouchPlayerGrabbedObjectAvatar")).Aggro += Time.deltaTime * 5f; } }); health.onHurt.AddListener((UnityAction)delegate { //IL_0017: Unknown result type (might be due to invalid IL or missing references) sfxHurt.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); if (AggroMode == RobeAggroMode.All) { for (int j = 0; j < Aggro.AggroList.Count; j++) { Aggro.AggroList[j].Aggro += 15f; } } }); health.onObjectHurt.AddListener((UnityAction)delegate { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown if (AggroMode == RobeAggroMode.All) { Aggro.GetAggro((PlayerAvatar)health.Get<EnemyHealth>("onObjectHurtPlayer")).Aggro += 15f; } }); health.onDeath.AddListener((UnityAction)delegate { Animator.SetTrigger("Death"); ParticleSystem[] array = deathParticles; for (int i = 0; i < array.Length; i++) { array[i].Play(); } if (Utils.IsHost()) { EnemyParent.Despawn(); } }); component.OnSpawn.AddListener((UnityAction)delegate { Aggro.LoseAggro(float.PositiveInfinity); if (SemiFunc.IsMasterClientOrSingleplayer()) { SetState(RobeState.Spawn, 0.5f); } }); component2.OnDespawn.AddListener((UnityAction)delegate { Animator.SetTrigger("despawn"); }); component3.onStunnedStart.AddListener((UnityAction)delegate { Animator.SetTrigger("Stun"); Animator.SetBool("Stunned", true); sfxStunLoop.PlayLoop(true, 2f, 2f, 1f); }); component3.onStunnedEnd.AddListener((UnityAction)delegate { Animator.SetBool("Stunned", false); sfxStunLoop.PlayLoop(false, 2f, 2f, 1f); }); StateInvestigate.onInvestigateTriggered.AddListener((UnityAction)delegate { RobeState state = State.State; RobeState robeState = state; if ((uint)robeState <= 1u || robeState == RobeState.Roam) { SetState(RobeState.Investigate, Random.Range(4f, 6f)); } }); } public void Update() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) EnemyParent.SpawnedTimerPause(float.PositiveInfinity); if ((int)Enemy.CurrentState != 9) { LastFocusedPlayerVisionTimer += Time.deltaTime; if (SemiFunc.IsMasterClientOrSingleplayer()) { ItemBreakTrackingLogic(); ExtractionAggroLogic(); } AggroLogic(); State.Update(Time.deltaTime); Aggro.LoseAggro(Time.deltaTime); ((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(RotationSpring, RotationTarget, -1f); } } public void StateMachine() { //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_0ea7: Unknown result type (might be due to invalid IL or missing references) //IL_0ed2: Unknown result type (might be due to invalid IL or missing references) //IL_0fdd: Unknown result type (might be due to invalid IL or missing references) //IL_0fe2: Unknown result type (might be due to invalid IL or missing references) //IL_0fec: Unknown result type (might be due to invalid IL or missing references) //IL_0ff1: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0d71: Unknown result type (might be due to invalid IL or missing references) //IL_0e31: Unknown result type (might be due to invalid IL or missing references) //IL_1013: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_0862: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_0884: Expected O, but got Unknown //IL_088a: Unknown result type (might be due to invalid IL or missing references) //IL_089a: Unknown result type (might be due to invalid IL or missing references) //IL_0a76: Unknown result type (might be due to invalid IL or missing references) //IL_0f51: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_08e2: Unknown result type (might be due to invalid IL or missing references) //IL_0c07: Unknown result type (might be due to invalid IL or missing references) //IL_0c17: Unknown result type (might be due to invalid IL or missing references) //IL_0bbf: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0be4: Unknown result type (might be due to invalid IL or missing references) //IL_093d: Unknown result type (might be due to invalid IL or missing references) //IL_0948: Unknown result type (might be due to invalid IL or missing references) //IL_0958: Unknown result type (might be due to invalid IL or missing references) //IL_095d: Unknown result type (might be due to invalid IL or missing references) //IL_0962: Unknown result type (might be due to invalid IL or missing references) //IL_0966: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Unknown result type (might be due to invalid IL or missing references) //IL_0975: Unknown result type (might be due to invalid IL or missing references) //IL_0992: Unknown result type (might be due to invalid IL or missing references) Vector3 val; float num5; switch (State.State) { case RobeState.Spawn: if (State.ConsumeStateImpulse()) { SemiFunc.EnemySpawn(Enemy); AggroMode = RobeAggroMode.All; Animator.Play("Robe Spawn", 0, 0f); spawnParticles.Play(); } if (!SemiFunc.IsMasterClientOrSingleplayer()) { } if (State.StateTimer <= 0f) { SetState(RobeState.Idle, 1f); } break; case RobeState.Idle: if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.All; EnemyAgent.ResetPath(); } if ((Object)(object)FocusedPlayer != (Object)null) { LookAt(((Component)FocusedPlayer).transform.position); } if (!SemiFunc.IsMasterClientOrSingleplayer() || LosePlayerLogic() || !(State.StateTimer <= 0f)) { break; } if ((Object)(object)FocusedPlayer != (Object)null) { float num4 = Utils.WeightedDistance(((Component)this).transform.position, ((Component)FocusedPlayer).transform.position, 1f, 0.2f); if (FocusedPlayer.physGrabber.grabbed) { object obj = FocusedPlayer.physGrabber.Get<PhysGrabber>("grabbedPhysGrabObject"); PhysGrabObject val4 = (PhysGrabObject)((obj is PhysGrabObject) ? obj : null); if (val4 != null && (Object)(object)(TargetValuable = ((Component)val4).GetComponent<ValuableObject>()) != (Object)null) { SetState(RobeState.HelpPlayer, Random.Range(40f, 70f)); SyncFields(); break; } } if (num4 > 5f || num4 < 2.5f) { SetState(RobeState.FollowPlayer, Random.Range(10f, 12f)); } else { SetState(RobeState.Shifty, 3f); } } else { SetState(RobeState.Roam, Random.Range(4f, 9f)); } break; case RobeState.Investigate: if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.All; if (Utils.FindNavPosition((Vector3)StateInvestigate.Get<EnemyStateInvestigate>("onInvestigateTriggeredPosition"), out var navPosition5)) { EnemyAgent.SetDestination(navPosition5); } else { State.StateStartImpulse = true; } } NormalRotationLogic(); if (Utils.IsHost() && State.StateTimer <= 0f) { SetState(RobeState.Idle, 1f); } break; case RobeState.Shifty: { if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.All; LevelPoint val2 = SemiFunc.LevelPointGet(((Component)this).transform.position, 1f, 4f); if (val2 != null && Utils.FindNavPosition(((Component)val2).transform.position + Random.insideUnitSphere, out var navPosition3)) { EnemyAgent.SetDestination(navPosition3); } OverrideMovement(0.75f, 1f, 1f); } if (State.StateEndImpulse) { EndMovementOverride(); } NormalRotationLogic(); float num = (Object.op_Implicit((Object)(object)FocusedPlayer) ? Utils.WeightedDistance(((Component)this).transform.position, ((Component)FocusedPlayer).transform.position, 1f, 0.2f) : 3f); if (SemiFunc.IsMasterClientOrSingleplayer()) { if (LosePlayerLogic()) { SetState(RobeState.Idle, Random.Range(0.25f, 0.5f)); } else if (num < 2f || num > 5f || State.StateTimer <= 0f) { SetState(RobeState.Idle, 1f); } } break; } case RobeState.Roam: if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.All; LevelPoint val5 = SemiFunc.LevelPointGet(((Component)this).transform.position, 3f, 10f); if (val5 != null && Utils.FindNavPosition(((Component)val5).transform.position + Random.insideUnitSphere, out var navPosition7)) { EnemyAgent.SetDestination(navPosition7); } } NormalRotationLogic(); if (SemiFunc.IsMasterClientOrSingleplayer()) { if ((Object)(object)FocusedPlayer != (Object)null) { SetState(RobeState.FollowPlayer, 3f); } else if (!EnemyAgent.HasPath() || State.StateTimer <= 0f) { SetState(RobeState.Idle, Random.Range(1f, 2f)); } } break; case RobeState.FollowPlayer: if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.All; if ((Object)(object)FocusedPlayer != (Object)null) { Vector3 position = ((Component)FocusedPlayer).transform.position; val = ((Component)this).transform.position - ((Component)FocusedPlayer).transform.position; if (Utils.FindNavPosition(position + ((Vector3)(ref val)).normalized * 3f + Random.insideUnitSphere * 0.5f, out var navPosition2)) { EnemyAgent.SetDestination(navPosition2); goto IL_0651; } } State.StateStartImpulse = true; goto IL_0651; } goto IL_0668; case RobeState.HelpPlayer: if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.All; sfxHandIdle.PlayLoop(true, 2f, 2f, 0.4f); OverrideMovement(1f, 2f, 3f); EnemyAgent.ResetPath(); State.SetStateTimer(0, 0f); } if (State.StateEndImpulse) { sfxHandIdle.PlayLoop(false, 2f, 2f, 0.4f); EndMovementOverride(); } if ((Object)(object)TargetValuable != (Object)null) { LookAt(((Component)TargetValuable).transform.position); Rigidbody val3 = (Rigidbody)TargetValuable.Get<ValuableObject>("rb"); float num3 = Utils.WeightedDistance(((Component)this).transform.position, ((Component)FocusedPlayer).transform.position, 1f, 0.2f); if (num3 < 4.5f) { val3.AddForce(new Vector3(0f, Mathf.Min(val3.mass, 5f), 0f), (ForceMode)0); } if ((num3 < 1.8f || num3 > 2.6f) && State.GetStateTimer(0) <= 0f) { State.SetStateTimer(0, 0.1f); Vector3 position2 = ((Component)TargetValuable).transform.position; val = ((Component)this).transform.position - ((Component)TargetValuable).transform.position; Utils.FindNavPosition(position2 + ((Vector3)(ref val)).normalized * 1.5f, out var navPosition6, 3f); EnemyAgent.SetDestination(navPosition6); } } if (SemiFunc.IsMasterClientOrSingleplayer() && (State.StateTimer <= 0f || ((Object)(object)FocusedPlayer != (Object)null && !FocusedPlayer.physGrabber.grabbed))) { SetState(RobeState.Idle, 1f); } break; case RobeState.ChaseBegin: if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.None; ((Behaviour)HurtCollider).enabled = false; EnemyAgent.ResetPath(); AttackAnimation(); } if (State.StateEndImpulse) { ((Behaviour)HurtCollider).enabled = true; } if ((Object)(object)FocusedPlayer != (Object)null) { LookAt(((Component)FocusedPlayer).transform.position); } if (SemiFunc.IsMasterClientOrSingleplayer() && State.StateTimer <= 0f) { SetState(RobeState.Chase, Random.Range(10f, 14f)); } break; case RobeState.Chase: { if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.None; sfxTargetPlayerLoop.PlayLoop(true, 2f, 2f, 2f); OverrideMovement(6f, 10f, 20f); State.SetStateTimer(0, 0f); } if (State.StateEndImpulse) { EndMovementOverride(); sfxTargetPlayerLoop.PlayLoop(false, 2f, 2f, 2f); Aggro.LoseAggro(float.PositiveInfinity); } NormalRotationLogic(); if (State.GetStateTimer(0) <= 0f) { State.SetStateTimer(0, 0.1f); if ((Object)(object)FocusedPlayer != (Object)null && Utils.FindNavPosition(((Component)FocusedPlayer).transform.position, out var navPosition4)) { EnemyAgent.SetDestination(navPosition4); } } float num2 = (Object.op_Implicit((Object)(object)FocusedPlayer) ? Utils.WeightedDistance(((Component)this).transform.position, ((Component)FocusedPlayer).transform.position, 1f, 0.2f) : 10f); bool flag = Object.op_Implicit((Object)(object)FocusedPlayer) && (bool)FocusedPlayer.Get<PlayerAvatar>("isCrawling"); if (SemiFunc.IsMasterClientOrSingleplayer()) { if (LastFocusedPlayerVisionTimer > 8f) { FocusedPlayer = null; SyncFields(); SetState(RobeState.GiveSpace, 2f); } else if (num2 < 1.5f && !flag) { SetState(RobeState.Attack, 1f); } else if (num2 < 2f && flag) { SetState(RobeState.AttackUnderBegin, 0.5f); } else if (State.StateTimer <= 0f) { SetState(RobeState.GiveSpace, 2f); } } break; } case RobeState.Attack: if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.None; AttackAnimation(); EnemyAgent.ResetPath(); } HurtCollider.playerDamage = 120; if ((Object)(object)FocusedPlayer != (Object)null) { LookAt(((Component)FocusedPlayer).transform.position); } if (SemiFunc.IsMasterClientOrSingleplayer() && State.StateTimer <= 0f) { SetState(RobeState.GiveSpace, 2f); } break; case RobeState.AttackUnderBegin: if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.None; EnemyAgent.ResetPath(); Animator.SetTrigger("LookUnder"); Animator.SetBool("LookingUnder", true); } HurtCollider.playerDamage = 80; if ((Object)(object)FocusedPlayer != (Object)null) { LookAt(((Component)FocusedPlayer).transform.position); } if (!SemiFunc.IsMasterClientOrSingleplayer()) { } if (State.StateTimer <= 0f) { SetState(RobeState.AttackUnder, 0.5f); } break; case RobeState.AttackUnder: if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.None; AttackShake(); sfxAttackUnder.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); sfxAttackUnderGlobal.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); Animator.SetTrigger("LookUnderAttack"); } if (State.StateEndImpulse) { Animator.SetBool("LookingUnder", false); } HurtCollider.playerDamage = 80; if ((Object)(object)FocusedPlayer != (Object)null) { LookAt(((Component)FocusedPlayer).transform.position); } if (SemiFunc.IsMasterClientOrSingleplayer() && State.StateTimer <= 0f) { SetState(RobeState.GiveSpace, 2f); } break; case RobeState.GiveSpace: { if (State.ConsumeStateImpulse()) { AggroMode = RobeAggroMode.All; sfxTargetPlayerLoop.PlayLoop(true, 2f, 2f, 2f); if (Utils.FindNavPosition(((Component)EnemyAgent).transform.position + Random.onUnitSphere * 4f, out var navPosition)) { EnemyAgent.SetDestination(navPosition); } else { State.StateStartImpulse = true; } } if (State.StateEndImpulse) { sfxTargetPlayerLoop.PlayLoop(false, 2f, 2f, 2f); } NormalRotationLogic(); if (SemiFunc.IsMasterClientOrSingleplayer() && State.StateTimer <= 0f) { SetState(RobeState.Idle, 2f); } break; } IL_0651: OverrideMovement(2f, 6f, 20f); goto IL_0668; IL_0668: if (State.StateEndImpulse) { EndMovementOverride(); } if ((Object)(object)FocusedPlayer != (Object)null) { LookAt(((Component)FocusedPlayer).transform.position); } num5 = (Object.op_Implicit((Object)(object)FocusedPlayer) ? Utils.WeightedDistance(((Component)this).transform.position, ((Component)FocusedPlayer).transform.position, 1f, 0.2f) : 3f); if (SemiFunc.IsMasterClientOrSingleplayer()) { if (LosePlayerLogic()) { SetState(RobeState.Idle, Random.Range(0.25f, 0.5f)); } else if (num5 > 10f) { SetState(RobeState.ChaseBegin, Random.Range(0.25f, 0.5f)); } else if ((num5 < 3.5f && num5 > 2.5f) || !EnemyAgent.HasPath() || State.StateTimer <= 0f) { SetState(RobeState.Idle, 0f); } } break; } } public void ItemBreakTrackingLogic() { //IL_00c1: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown ItemBreakLogicTimer += Time.deltaTime; if (ItemBreakLogicTimer < 1f) { return; } ItemBreakLogicTimer = 0f; for (int i = 0; i < TrackedValuables.Count; i++) { _ = TrackedValuables[i]; if (false) { TrackedValuables.RemoveAt(i); } } for (int j = 0; j < ValuableDirector.instance.valuableList.Count; j++) { ValuableObject valuable = ValuableDirector.instance.valuableList[j]; if ((Object)(object)valuable == (Object)null) { continue; } float num = Vector3.Distance(((Component)valuable).transform.position, ((Component)this).transform.position); int num2 = -1; for (int k = 0; k < TrackedValuables.Count; k++) { if ((Object)(object)TrackedValuables[k].Valuable == (Object)(object)valuable) { num2 = k; } } if (num > 6f && num2 != -1) { PhysGrabObjectImpactDetector val = (PhysGrabObjectImpactDetector)valuable.Get<PhysGrabObject, ValuableObject>("physGrabObject").Get<PhysGrabObject>("impactDetector"); val.onAllBreaks.RemoveListener(TrackedValuables[num2].BreakListener); TrackedValuables.RemoveAt(num2); } else { if (!(num <= 4f) || num2 != -1) { continue; } PhysGrabObject physGrabObject = (PhysGrabObject)valuable.Get<ValuableObject>("physGrabObject"); PhysGrabObjectImpactDetector impactDetector = (PhysGrabObjectImpactDetector)physGrabObject.Get<PhysGrabObject>("impactDetector"); UnityAction val2 = (UnityAction)delegate { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown if (AggroMode == RobeAggroMode.All && !(bool)impactDetector.Get<PhysGrabObjectImpactDetector>("isIndestructible") && !impactDetector.destroyDisable && !((float)physGrabObject.Get<PhysGrabObject>("grabbedTimer") <= 0f)) { PlayerAggro aggro = Aggro.GetAggro((PlayerAvatar)physGrabObject.Get<PhysGrabObject>("lastPlayerGrabbing")); aggro.Aggro += (physGrabObject.dead ? (valuable.dollarValueOriginal / 100f) : ((valuable.dollarValueOriginal - valuable.dollarValueCurrent) / 100f)); } }; TrackedValuables.Add(new TrackedValuable(valuable, val2)); impactDetector.onAllBreaks.AddListener(val2); } } } public void AggroLogic() { if (AggroMode == RobeAggroMode.None) { return; } PlayerAggro playerAggro = null; for (int i = 0; i < Aggro.AggroList.Count; i++) { PlayerAggro playerAggro2 = Aggro.AggroList[i]; if (playerAggro == null || playerAggro2.Aggro > playerAggro.Aggro) { playerAggro = playerAggro2; } } if (playerAggro == null) { sfxTargetPlayerLoop.PlayLoop(false, 1f, 1f, 1f); return; } if (playerAggro.Aggro > 5f) { sfxTargetPlayerLoop.PlayLoop(true, 1f, 1f, 1f); } else { sfxTargetPlayerLoop.PlayLoop(false, 1f, 1f, 1f); } if (!(playerAggro.Aggro < 10f)) { sfxTargetPlayerLoop.PlayLoop(false, 1f, 1f, 1f); if (Utils.IsHost() && State.State != RobeState.ChaseBegin) { LastFocusedPlayerVisionTimer = 0f; FocusedPlayer = playerAggro.Player; SyncFields(); SetState(RobeState.ChaseBegin, 1f); } } } public void ExtractionAggroLogic() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //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) if ((Object)(object)FocusedPlayer != (Object)null) { object obj = RoundDirector.instance.Get<RoundDirector>("extractionPointCurrent"); ExtractionPoint val = (ExtractionPoint)((obj is ExtractionPoint) ? obj : null); if (val != null && (int)val.Get<State, ExtractionPoint>("currentState") == 4 && Vector3.Distance(((Component)val).transform.position, ((Component)this).transform.position) < 5f) { Aggro.GetAggro(FocusedPlayer).Aggro += Time.deltaTime * 10f; } } } public bool LosePlayerLogic() { if ((Object)(object)FocusedPlayer != (Object)null && LastFocusedPlayerVisionTimer > 10f) { FocusedPlayer = null; SyncFields(); return true; } return false; } public void NormalRotationLogic() { //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_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_002d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = EnemyAgent.Get<Vector3, EnemyNavMeshAgent>("AgentVelocity"); Vector3 normalized = ((Vector3)(ref val)).normalized; if (((Vector3)(ref normalized)).magnitude > 0.1f) { LookInDirection(normalized); } } public void LookAt(Vector3 point) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - ((Component)this).transform.position; LookInDirection(((Vector3)(ref val)).normalized); } public void LookInDirection(Vector3 point) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_002d: Unknown result type (might be due to invalid IL or missing references) RotationTarget = Quaternion.LookRotation(point); ((Quaternion)(ref RotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref RotationTarget)).eulerAngles.y, 0f); } public void AttackShake() { //IL_0020: 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) GameDirector.instance.CameraShake.ShakeDistance(5f, 3f, 8f, ((Component)this).transform.position, 0.5f); GameDirector.instance.CameraImpact.ShakeDistance(5f, 3f, 8f, ((Component)this).transform.position, 0.1f); } public void AttackSounds() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) sfxAttack.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); sfxAttackGlobal.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); } public void AttackAnimation() { AttackSounds(); AttackShake(); Animator.SetTrigger("attack"); } public void OverrideMovement(float speed, float acceleration, float rigidbodyAcceleration) { EnemyAgent.OverrideAgent(speed, acceleration, float.PositiveInfinity); Rigidbody.OverrideFollowPosition(float.PositiveInfinity, rigidbodyAcceleration, -1f); } public void EndMovementOverride() { EnemyAgent.OverrideAgent(0f, 0f, 0.001f); Rigidbody.OverrideFollowPosition(0.001f, 0f, -1f); } } public class StateMachine<TState> where TState : Enum { public enum StateSetMode { None, SetThisUpdate, Set } public TState State; public TState FutureState; public float StateTimer; public bool StateStartImpulse = false; public bool StateEndImpulse = false; public StateSetMode SetMode = StateSetMode.None; public Action StateMachineAction; public List<object> StateData; public List<float> StateTimers; public StateMachine(Action stateMachineAction) { StateMachineAction = stateMachineAction; StateData = new List<object>(); StateTimers = new List<float>(); base..ctor(); } public void Update(float deltaTime) { StateTimer -= deltaTime; for (int i = 0; i < StateTimers.Count; i++) { StateTimers[i] -= deltaTime; } if (SetMode == StateSetMode.Set) { StateEndImpulse = true; } StateMachineAction(); if (SetMode == StateSetMode.Set) { State = FutureState; StateStartImpulse = true; SetMode = StateSetMode.None; StateData.Clear(); StateTimers.Clear(); } if (SetMode == StateSetMode.SetThisUpdate) { SetMode = StateSetMode.Set; } StateEndImpulse = false; } public bool SetState(TState state, float time) { if (SetMode != 0) { return false; } StateTimer = time; FutureState = state; SetMode = StateSetMode.SetThisUpdate; return true; } public bool ConsumeStateImpulse() { if (StateStartImpulse) { StateStartImpulse = false; return true; } return false; } public T GetStateData<T>(int index) { return (T)StateData[index]; } public void SetStateData<T>(int index, T value) { while (StateData.Count <= index) { StateData.Add(null); } StateData[index] = value; } public float GetStateTimer(int index) { return StateTimers[index]; } public void SetStateTimer(int index, float time) { while (StateTimers.Count <= index) { StateTimers.Add(0f); } StateTimers[index] = time; } } public static class TrudgeOverhaul { public static ConfigEntry<bool> OverhaulAI; public static void Init() { OverhaulAI = Plugin.BindConfig("Trudge", "OverhaulAI", defaultValue: true, "If true, Trudge AI is overhauled", delegate { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown Plugin.SetPatch(OverhaulAI.Value, AccessTools.Method(typeof(EnemySlowWalker), "Start", (Type[])null, (Type[])null), new HarmonyMethod(typeof(TrudgeOverhaul), "StartPrefix", (Type[])null)); }); } public static bool StartPrefix(EnemySlowWalker __instance) { TrudgeOverride trudgeOverride = ((Component)__instance).gameObject.AddComponent<TrudgeOverride>(); EnemySlowWalkerAnim animator = __instance.animator; ((Behaviour)animator).enabled = false; trudgeOverride.ParticleDeathImpact = __instance.particleDeathImpact; trudgeOverride.ParticleDeathBitsFar = __instance.particleDeathBitsFar; trudgeOverride.ParticleDeathBitsShort = __instance.particleDeathBitsShort; trudgeOverride.ParticleDeathSmoke = __instance.particleDeathSmoke; trudgeOverride.FeetTransform = __instance.feetTransform; trudgeOverride.LookAtTransform = __instance.lookAtTransform; trudgeOverride.EnemyAnimator = animator; trudgeOverride.RotationSpring = __instance.horizontalRotationSpring; Object.Destroy((Object)(object)__instance); return false; } } public class TrudgeOverride : MonoBehaviour { public enum TrudgeState { Invalid, Spawn, Idle, ApproachTarget, Notice, ChargeBegin, Charge, Attack, StuckAttack, DestroyTarget } public PhotonView PhotonView; public Enemy Enemy; public EnemyParent EnemyParent; public EnemyVision Vision; public EnemyNavMeshAgent EnemyNavAgent; public NavMeshAgent NavAgent; public EnemyRigidbody EnemyRigidbody; public Rigidbody Rigidbody; public EnemySlowWalkerAnim EnemyAnimator; public EnemyStateInvestigate StateInvestigate; public Animator Animator; public SpringQuaternion RotationSpring; public Transform LookAtTransform; public Transform FeetTransform; public MonoBehaviour Target; public StateMachine<TrudgeState> State; public float PrevAggro = 0f; public float Aggro = 0f; public Quaternion RotationTarget; public float DefaultRotationSpeed; public float TargetClosestApproach = float.PositiveInfinity; public bool HandleAggro = true; public int AnimMoving = Animator.StringToHash("moving"); public int AnimStunned = Animator.StringToHash("stunned"); public int AnimDespawning = Animator.StringToHash("despawning"); public int AnimFalling = Animator.StringToHash("falling"); public int AnimLookingUnder = Animator.StringToHash("lookingUnder"); public int AnimStun = Animator.StringToHash("Stun"); public int AnimNotice = Animator.StringToHash("Notice"); public int AnimAttack = Animator.StringToHash("Attack"); public int AnimJump = Animator.StringToHash("Jump"); public int AnimLand = Animator.StringToHash("Land"); public int AnimLookUnder = Animator.StringToHash("LookUnder"); public int AnimLookUnderAttack = Animator.StringToHash("LookUnderAttack"); public int AnimStuckAttack = Animator.StringToHash("StuckAttack"); public ParticleSystem ParticleDeathImpact; public ParticleSystem ParticleDeathBitsFar; public ParticleSystem ParticleDeathBitsShort; public ParticleSystem ParticleDeathSmoke; public void Awake() { Enemy = ((Component)this).GetComponent<Enemy>(); PhotonView = ((Component)this).GetComponent<PhotonView>(); EnemyNavAgent = ((Component)this).GetComponent<EnemyNavMeshAgent>(); NavAgent = ((Component)this).GetComponent<NavMeshAgent>(); StateInvestigate = ((Component)this).GetComponent<EnemyStateInvestigate>(); State = new StateMachine<TrudgeState>(StateMachine); } public void Start() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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 //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00e1: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown Vision = (EnemyVision)Enemy.Get<Enemy>("Vision"); EnemyRigidbody = (EnemyRigidbody)Enemy.Get<Enemy>("Rigidbody"); Animator = (Animator)EnemyAnimator.Get<EnemySlowWalkerAnim>("animator"); EnemyParent = (EnemyParent)Enemy.Get<Enemy>("EnemyParent"); Rigidbody = (Rigidbody)EnemyRigidbody.Get<EnemyRigidbody>("rb"); EnemyStateSpawn component = ((Component)this).GetComponent<EnemyStateSpawn>(); EnemyHealth val = (EnemyHealth)Enemy.Get<Enemy>("Health"); ((Behaviour)StateInvestigate).enabled = false; DefaultRotationSpeed = RotationSpring.speed; NavAgent.areaMask = -1; Transform vacuumSphere = EnemyAnimator.slowWalkerAttack.vacuumSphere; vacuumSphere.localScale *= 1.7f; List<HurtCollider> hurtColliders = Utils.GetHurtColliders(EnemyAnimator.slowWalkerAttack.attackImpactHurtColliders.transform); for (int i = 0; i < hurtColliders.Count; i++) { HurtCollider val2 = hurtColliders[i]; val2.playerKill = false; val2.playerDamage = 30; } EnemyRigidbody.onGrabbed.AddListener((UnityAction)delegate { if (HandleAggro) { Aggro += Time.deltaTime * 5f; } }); EnemyRigidbody.onTouchPlayer.AddListener((UnityAction)delegate { if (HandleAggro) { Aggro += Time.deltaTime * 5f; } }); EnemyRigidbody.onTouchPlayerGrabbedObject.AddListener((UnityAction)delegate { if (HandleAggro) { Aggro += Time.deltaTime * 5f; } }); StateInvestigate.onInvestigateTriggered.AddListener((UnityAction)delegate { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (HandleAggro) { Aggro += 2f / Vector3.Distance(((Component)this).transform.position, (Vector3)StateInvestigate.Get<EnemyStateInvestigate>("onInvestigateTriggeredPosition")); } }); component.OnSpawn.AddListener((UnityAction)delegate { if (Utils.IsHost()) { SetState(TrudgeState.Spawn, 1f); } }); val.onDeath.AddListener((UnityAction)delegate { //IL_0017: 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_0071: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) ((Component)ParticleDeathImpact).transform.position = Enemy.CenterTransform.position; ParticleDeathImpact.Play(); ((Component)ParticleDeathBitsFar).transform.position = Enemy.CenterTransform.position; ParticleDeathBitsFar.Play(); ((Component)ParticleDeathBitsShort).transform.position = Enemy.CenterTransform.position; ParticleDeathBitsShort.Play(); ((Component)ParticleDeathSmoke).transform.position = Enemy.CenterTransform.position; ParticleDeathSmoke.Play(); EnemyAnimator.sfxDeath.Play(((Component)EnemyAnimator).transform.position, 1f, 1f, 1f, 1f); 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 (Utils.IsHost()) { EnemyParent.Despawn(); SetState(TrudgeState.Spawn, 1f); } }); val.onHurt.AddListener((UnityAction)delegate { if (HandleAggro) { Aggro += 15f; } }); } public void Update() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if (Utils.IsHost() && State.State != TrudgeState.DestroyTarget && (OverhaulDirector.Instance.ExtractionCompletedImpulse || OverhaulDirector.Instance.ExtractionUnlockedImpulse)) { TargetClosestApproach = float.PositiveInfinity; SetState(TrudgeState.Idle, 0f); } EnemyParent.SpawnedTimerPause(float.PositiveInfinity); if ((int
plugins/Frogpocalypse.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Frogpocalypse")] [assembly: AssemblyTitle("Frogpocalypse")] [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; } } } [HarmonyPatch] public class FrogChaosPatch { private static Dictionary<FrogTrap, float> frogDuplicationTimers = new Dictionary<FrogTrap, float>(); private static Dictionary<FrogTrap, float> frogJumpTimers = new Dictionary<FrogTrap, float>(); private static List<FrogTrap> allFrogs = new List<FrogTrap>(); [HarmonyPatch(typeof(FrogTrap), "Start")] [HarmonyPostfix] private static void InitializeFrogChaos(FrogTrap __instance) { if (!allFrogs.Contains(__instance)) { allFrogs.Add(__instance); frogDuplicationTimers[__instance] = 3f; frogJumpTimers[__instance] = 1f; Debug.Log((object)"Frog Chaos initialized!"); } } [HarmonyPatch(typeof(FrogTrap), "Update")] [HarmonyPostfix] private static void UpdateFrogChaos(FrogTrap __instance) { allFrogs.RemoveAll((FrogTrap f) => (Object)(object)f == (Object)null); if (!allFrogs.Contains(__instance)) { allFrogs.Add(__instance); frogDuplicationTimers[__instance] = 3f; frogJumpTimers[__instance] = 1f; } if (__instance.everPickedUp) { if (!((Trap)__instance).trapActive) { ((Trap)__instance).trapActive = true; ((Trap)__instance).trapStart = true; ((Trap)__instance).trapTriggered = true; } ((Trap)__instance).enemyInvestigate = true; if (frogJumpTimers.TryGetValue(__instance, out var value)) { frogJumpTimers[__instance] = value - Time.deltaTime; if (frogJumpTimers[__instance] <= 0f) { frogJumpTimers[__instance] = Random.Range(1f, 2.5f); __instance.FrogJump(); } } if (frogDuplicationTimers.TryGetValue(__instance, out var value2)) { frogDuplicationTimers[__instance] = value2 - Time.deltaTime; if (frogDuplicationTimers[__instance] <= 0f) { Debug.Log((object)"Cloning frog..."); frogDuplicationTimers[__instance] = 0.5f; SpawnPhysicsOnlyFrog(__instance); } } } else { ((Trap)__instance).trapActive = false; ((Trap)__instance).trapStart = false; ((Trap)__instance).trapTriggered = false; } } private static void SpawnPhysicsOnlyFrog(FrogTrap originalFrog) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_024c: 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_0287: 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_029f: Unknown result type (might be due to invalid IL or missing references) try { Vector3 val = ((Component)originalFrog).transform.position + new Vector3(Random.Range(-3f, 3f), Random.Range(1f, 2f), Random.Range(-3f, 3f)); GameObject val2 = Object.Instantiate<GameObject>(((Component)originalFrog).gameObject, val, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f)); PhotonView component = val2.GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } Component[] componentsInChildren = val2.GetComponentsInChildren<Component>(true); Component[] array = componentsInChildren; foreach (Component val3 in array) { if ((Object)(object)val3 == (Object)null) { continue; } string name = ((object)val3).GetType().Name; if (val3 is Transform || val3 is MeshRenderer || val3 is SkinnedMeshRenderer || val3 is MeshFilter || val3 is Collider || val3 is Rigidbody) { continue; } if (name == "AudioLowPassFilter") { Behaviour val4 = (Behaviour)(object)((val3 is Behaviour) ? val3 : null); if (val4 != null) { val4.enabled = false; } continue; } AudioSource val5 = (AudioSource)(object)((val3 is AudioSource) ? val3 : null); if (val5 != null) { val5.volume = 0f; ((Behaviour)val5).enabled = false; continue; } if (name.Contains("Photon") || name.Contains("RPC") || name.Contains("Interact") || name.Contains("Valuable") || name.Contains("Grab") || name.Contains("Discover")) { Object.DestroyImmediate((Object)(object)val3); continue; } MonoBehaviour val6 = (MonoBehaviour)(object)((val3 is MonoBehaviour) ? val3 : null); if (val6 != null) { ((Behaviour)val6).enabled = false; continue; } try { Object.DestroyImmediate((Object)(object)val3); } catch { } } Rigidbody val7 = val2.GetComponent<Rigidbody>() ?? val2.AddComponent<Rigidbody>(); val7.isKinematic = false; val7.useGravity = true; val7.mass = 1f; val7.AddForce(Vector3.up * 1.5f, (ForceMode)1); val7.AddForce(new Vector3(Random.Range(-0.5f, 0.5f), 0f, Random.Range(-0.5f, 0.5f)), (ForceMode)1); val7.AddTorque(Random.insideUnitSphere * 3f, (ForceMode)1); Debug.Log((object)"Cloned frog dropped (physics-only)"); } catch (Exception ex) { Debug.LogError((object)("Frog clone spawn failed: " + ex.Message)); } } } namespace Frogpocalypse { [BepInPlugin("Omniscye.Frogpocalypse", "Frogpocalypse", "1.0")] public class Frogpocalypse : BaseUnityPlugin { internal static Frogpocalypse 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() { } } }
plugins/Krild_CCTV_Stalk_Ur_Friends.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; 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 TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Krild_CCTV_Stalk_Ur_Friends")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Krild_CCTV_Stalk_Ur_Friends")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f9a19156-27fa-4b94-a2ba-7e6aa68056c5")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace Krild_CCTV_Stalk_Ur_Friends { [BepInPlugin("KrildCCTV", "CCTV_Stalk_Ur_Friends", "1.0.0.0")] public class KrildPatcher : BaseUnityPlugin { private const string modGUID = "KrildCCTV"; private const string modName = "CCTV_Stalk_Ur_Friends"; private const string modVersion = "1.0.0.0"; public ConfigEntry<Vector3> _CameraPlayerLocalPositionOverview; public ConfigEntry<float> _CameraPlayerLocalPositionX; public ConfigEntry<float> _CameraPlayerLocalPositionY; public ConfigEntry<float> _CameraPlayerLocalPositionZ; public Vector3 _CameraPlayerLocalPosition; public ConfigEntry<float> _CameraPlayerClippingPlaneNear; public ConfigEntry<float> _CameraFOV; internal Harmony harmony = new Harmony("KrildCCTV"); internal static KrildPatcher current; internal ManualLogSource log; private void Awake() { //IL_0068: 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_00b5: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown if ((Object)(object)current == (Object)null) { current = this; } log = Logger.CreateLogSource("KrildCCTV"); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; _CameraPlayerLocalPositionOverview = ((BaseUnityPlugin)this).Config.Bind<Vector3>("PlayerLocalCameraPosition", "CameraPlayerLocalPosition", new Vector3(0f, 0f, 0.3f), "Local Camera Offset, when switched to a Player. Position (0,0,0) is in the middle of the Head. So there is a offset needed, to not render the head itselfs (eg. The Eyes or cosmetics)."); _CameraPlayerLocalPositionX = ((BaseUnityPlugin)this).Config.Bind<float>("PlayerLocalCameraPosition", "CameraPlayerLocalPositionX", 0f, new ConfigDescription("Vector X", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1f), Array.Empty<object>())); _CameraPlayerLocalPositionY = ((BaseUnityPlugin)this).Config.Bind<float>("PlayerLocalCameraPosition", "CameraPlayerLocalPositionY", 0f, new ConfigDescription("Vector Y", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1f), Array.Empty<object>())); _CameraPlayerLocalPositionZ = ((BaseUnityPlugin)this).Config.Bind<float>("PlayerLocalCameraPosition", "CameraPlayerLocalPositionZ", 0.3f, new ConfigDescription("Vector Z", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 1f), Array.Empty<object>())); _CameraPlayerLocalPosition = new Vector3(_CameraPlayerLocalPositionX.Value, _CameraPlayerLocalPositionY.Value, _CameraPlayerLocalPositionZ.Value); _CameraPlayerClippingPlaneNear = ((BaseUnityPlugin)this).Config.Bind<float>("PlayerLocalCamera", "CameraPlayerClippingPlaneNear", 0.01f, new ConfigDescription("The distance from the Camera where rendering starts. Higher Value means u can look throw walls.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 1f), Array.Empty<object>())); _CameraFOV = ((BaseUnityPlugin)this).Config.Bind<float>("LocalCamera", "CameraFOV", 90f, new ConfigDescription("Camera FOV", (AcceptableValueBase)(object)new AcceptableValueRange<float>(30f, 150f), Array.Empty<object>())); Patch(); log.LogInfo((object)"Krildig geladen :3 You can stalk ur friends now!"); } internal void Patch() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (harmony == null) { Harmony val = (harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID)); } harmony.PatchAll(); } public void WriteLog(string message) { log.LogInfo((object)message); } } } namespace Krild_CCTV_Stalk_Ur_Friends.Behaviours { public class KrildCameraManager : MonoBehaviour { public static KrildCameraManager current; public List<KrildItemCamera> externalCameraItems; private void Awake() { current = this; externalCameraItems = new List<KrildItemCamera>(); } public void AddElement(KrildItemCamera item) { externalCameraItems.Add(item); } public KrildItemCamera GetElement(int index) { return externalCameraItems[index]; } public void RemoveElement(KrildItemCamera item) { externalCameraItems.Remove(item); } } public class KrildItemCamera : MonoBehaviour { [SerializeField] public Transform viewPoint; public string nameCamera; private void Start() { if ((Object)(object)KrildCameraManager.current == (Object)null) { GameObject.Find("Pun Manager").AddComponent<KrildCameraManager>(); } SubscribeToCameraList(); nameCamera = "Item Camera " + KrildCameraManager.current.externalCameraItems.Count; } private void SubscribeToCameraList() { if ((Object)(object)KrildCameraManager.current != (Object)null) { KrildCameraManager.current.externalCameraItems.Add(this); } } } public class KrildItemMonitor : MonoBehaviour { [Serializable] public class CCTVPlayer { public string name; public Transform localCameraTransform; public PlayerAvatar playerAvatar; public Transform localDeathHeadTransform = null; public CCTVPlayer(string value1, Transform value2, PlayerAvatar value3) { name = value1; localCameraTransform = value2; playerAvatar = value3; } public void SetDeadHead(Transform value1) { localDeathHeadTransform = value1; } } [SerializeField] private Camera cameraItem; private Transform cameraTransform; [SerializeField] private Material materialRenderTexture; [SerializeField] private Material materialNoSignal; [SerializeField] private MeshRenderer screenRenderer; [SerializeField] private TMP_Text textCamName; private string defaultTextCamName = "Error :c"; private ItemToggle itemToggle; private bool prevToggleState; private Transform transformShipCam; private KrildItemCamera activeCamera = null; private bool moveCameraSucces = false; private bool noSignal = false; private bool playerAlive = true; private int maxPlayer = 1; private int index; private List<CCTVPlayer> listPlayerSorted; private Vector3 cameraPlayerLocalPosition; private float cameraPlayerClippingPlaneNear; private float cameraFOV; private void Start() { //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) cameraPlayerLocalPosition = KrildPatcher.current._CameraPlayerLocalPositionOverview.Value; cameraPlayerClippingPlaneNear = KrildPatcher.current._CameraPlayerClippingPlaneNear.Value; cameraFOV = KrildPatcher.current._CameraFOV.Value; cameraTransform = ((Component)cameraItem).transform; cameraItem.fieldOfView = cameraFOV; itemToggle = ((Component)this).gameObject.GetComponent<ItemToggle>(); SetCamName(defaultTextCamName); transformShipCam = GameObject.Find("cctv camera").transform; SetShipCam(); SetMaxPlayer(); SortPlayerAvatars(); if ((Object)(object)KrildCameraManager.current == (Object)null) { GameObject.Find("Pun Manager").AddComponent<KrildCameraManager>(); } ((MonoBehaviour)this).StartCoroutine(WaitAndLoadDeadHead()); } private void SortPlayerAvatars() { List<string> list = new List<string>(); listPlayerSorted = new List<CCTVPlayer>(); foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { list.Add(SemiFunc.PlayerGetName(player)); } list.Sort(); foreach (string item in list) { for (int i = 0; i < list.Count; i++) { if (item == SemiFunc.PlayerGetName(GameDirector.instance.PlayerList[i])) { listPlayerSorted.Add(new CCTVPlayer(item, GameDirector.instance.PlayerList[i].localCameraTransform, GameDirector.instance.PlayerList[i])); } } } } private void Update() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if (itemToggle.toggleState == prevToggleState) { return; } moveCameraSucces = false; prevToggleState = itemToggle.toggleState; index = NextIndex(); if (index == 0) { SetShipCam(); } else if (index <= maxPlayer) { MoveCam(listPlayerSorted[index - 1].localCameraTransform, listPlayerSorted[index - 1].name, cameraPlayerClippingPlaneNear); cameraTransform.localPosition = cameraPlayerLocalPosition; } else if ((Object)(object)KrildCameraManager.current.externalCameraItems[index - 1 - maxPlayer] != (Object)null) { activeCamera = KrildCameraManager.current.externalCameraItems[index - 1 - maxPlayer]; if (((Component)activeCamera).transform.localPosition.y < 1000f) { MoveCam(activeCamera.viewPoint, activeCamera.nameCamera, 0.1f); } } if (moveCameraSucces) { ((Renderer)screenRenderer).material = materialRenderTexture; noSignal = false; playerAlive = true; } else { NoSignal(); } } private void SetMaxPlayer() { maxPlayer = GameDirector.instance.PlayerList.Count; } private int NextIndex() { index = (index + 1) % (1 + maxPlayer + KrildCameraManager.current.externalCameraItems.Count); return index; } private void MoveCam(Transform transform, string value, float value2) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) cameraTransform.SetParent(transform); cameraTransform.localPosition = Vector3.zero; cameraTransform.localRotation = Quaternion.identity; cameraItem.nearClipPlane = value2; SetCamName(value); moveCameraSucces = true; } private void SetCamName(string value) { if (value == "") { textCamName.text = "Cam " + (index + 1) + ": " + defaultTextCamName; } else { textCamName.text = "Cam " + (index + 1) + ": " + value; } } private void NoSignal() { ((Renderer)screenRenderer).material = materialNoSignal; SetCamName(""); noSignal = true; } private void SetShipCam() { //IL_0034: 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) index = 0; MoveCam(transformShipCam, "Ship Camera", 0.6f); cameraTransform.localPosition = new Vector3(0.4f, -0.1f, 0f); cameraTransform.localRotation = new Quaternion(0f, 0.757f, 0f, 0.653f); } private IEnumerator WaitAndLoadDeadHead() { yield return (object)new WaitForSeconds(3f); foreach (CCTVPlayer item in listPlayerSorted) { for (int i = 0; i < 20; i++) { if ((Object)(object)item.playerAvatar.playerDeathHead == (Object)null) { yield return (object)new WaitForSeconds(1f); continue; } item.SetDeadHead(((Component)item.playerAvatar.playerDeathHead).transform); break; } } ((MonoBehaviour)this).StartCoroutine(CheckCameraState()); } private IEnumerator CheckCameraState() { if (index > maxPlayer) { if ((Object)(object)activeCamera == (Object)null) { NoSignal(); } else if (((Component)activeCamera).transform.localPosition.y > 1000f) { NoSignal(); } else if (noSignal) { ((Renderer)screenRenderer).material = materialRenderTexture; MoveCam(activeCamera.viewPoint, activeCamera.nameCamera, 0.1f); noSignal = false; } } else if (index > 0 && listPlayerSorted[index - 1] != null && (Object)(object)listPlayerSorted[index - 1].localDeathHeadTransform != (Object)null) { if (listPlayerSorted[index - 1].localDeathHeadTransform.position.y > 1000f) { if (!playerAlive) { MoveCam(listPlayerSorted[index - 1].localCameraTransform, listPlayerSorted[index - 1].name, cameraPlayerClippingPlaneNear); cameraTransform.localPosition = cameraPlayerLocalPosition; playerAlive = true; } } else if (playerAlive) { MoveCam(listPlayerSorted[index - 1].localDeathHeadTransform, listPlayerSorted[index - 1].name, 0.1f); playerAlive = false; } } yield return (object)new WaitForSeconds(0.25f); ((MonoBehaviour)this).StartCoroutine(CheckCameraState()); } } }
plugins/me.loaforc.soundapi.dll
Decompiled 9 months agousing System; using System.Buffers; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; using loaforcsSoundAPI.Core; using loaforcsSoundAPI.Core.Data; using loaforcsSoundAPI.Core.JSON; using loaforcsSoundAPI.Core.Networking; using loaforcsSoundAPI.Core.Patches; using loaforcsSoundAPI.Core.Util; using loaforcsSoundAPI.Core.Util.Extensions; using loaforcsSoundAPI.Reporting; using loaforcsSoundAPI.Reporting.Data; using loaforcsSoundAPI.SoundPacks; using loaforcsSoundAPI.SoundPacks.Data; using loaforcsSoundAPI.SoundPacks.Data.Conditions; [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("me.loaforc.soundapi")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.0.8.0")] [assembly: AssemblyInformationalVersion("2.0.8+02f5b90764ee9441879eaa0c04ef15b7674b7d42")] [assembly: AssemblyProduct("loaforcsSoundAPI")] [assembly: AssemblyTitle("me.loaforc.soundapi")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.8.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 loaforcsSoundAPI { [BepInPlugin("me.loaforc.soundapi", "loaforcsSoundAPI", "2.0.8")] internal class loaforcsSoundAPI : BaseUnityPlugin { private static loaforcsSoundAPI _instance; internal static ManualLogSource Logger { get; private set; } private void Awake() { _instance = this; Logger = Logger.CreateLogSource("me.loaforc.soundapi"); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; Logger.LogInfo((object)"Setting up config"); Debuggers.Bind(((BaseUnityPlugin)this).Config); SoundReportHandler.Bind(((BaseUnityPlugin)this).Config); PatchConfig.Bind(((BaseUnityPlugin)this).Config); PackLoadingConfig.Bind(((BaseUnityPlugin)this).Config); Logger.LogInfo((object)"Running patches"); Harmony harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "me.loaforc.soundapi"); UnityObjectPatch.Init(harmony); Logger.LogInfo((object)"Registering data"); SoundAPI.RegisterAll(Assembly.GetExecutingAssembly()); SoundAPIAudioManager.SpawnManager(); SoundReplacementHandler.Register(); ((BaseUnityPlugin)this).Config.Save(); Logger.LogInfo((object)"me.loaforc.soundapi by loaforc has loaded :3"); } internal static ConfigFile GenerateConfigFile(string name, BepInPlugin metadata) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown return new ConfigFile(Utility.CombinePaths(new string[2] { Paths.ConfigPath, name + ".cfg" }), false, metadata); } } public static class SoundAPI { public const string PLUGIN_GUID = "me.loaforc.soundapi"; internal static NetworkAdapter CurrentNetworkAdapter { get; private set; } public static async Task<AudioClip> LoadAudioFileAsync(string fullPath) { if (!File.Exists(fullPath)) { throw new FileNotFoundException("'" + fullPath + "' not found."); } if (!SoundPackLoadPipeline.audioExtensions.ContainsKey(Path.GetExtension(fullPath))) { throw new NotImplementedException("Audio file extension: '" + Path.GetExtension(fullPath) + "' is not implemented."); } UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(fullPath, SoundPackLoadPipeline.audioExtensions[Path.GetExtension(fullPath)]); await (AsyncOperation)(object)request.SendWebRequest(); AudioClip content = DownloadHandlerAudioClip.GetContent(request); request.Dispose(); return content; } public static void RegisterAll(Assembly assembly) { foreach (Type loadableType in assembly.GetLoadableTypes()) { if (loadableType.IsNested) { continue; } foreach (SoundAPIConditionAttribute conditionAttribute in loadableType.GetCustomAttributes<SoundAPIConditionAttribute>()) { if (!typeof(Condition).IsAssignableFrom(loadableType)) { loaforcsSoundAPI.Logger.LogError((object)("Condition: '" + loadableType.FullName + "' has been marked with [SoundAPICondition] but does not extend Condition!")); continue; } ConstructorInfo info = loadableType.GetConstructor(Array.Empty<Type>()); if (info == null) { loaforcsSoundAPI.Logger.LogError((object)("Condition: '" + loadableType.FullName + "' has no valid constructor! It must have a constructor with no parameters! If you need extra parameters do not mark it with [SoundAPICondition] and register it manually.")); continue; } RegisterCondition(conditionAttribute.ID, delegate { if (conditionAttribute.IsDeprecated) { if (conditionAttribute.DeprecationReason == null) { loaforcsSoundAPI.Logger.LogWarning((object)("Condition: '" + conditionAttribute.ID + "' is deprecated and may be removed in future.")); } else { loaforcsSoundAPI.Logger.LogWarning((object)("Condition: '" + conditionAttribute.ID + "' is deprecated. " + conditionAttribute.DeprecationReason)); } } return (Condition)info.Invoke(Array.Empty<object>()); }); } } } public static void RegisterCondition(string id, Func<Condition> factory) { SoundPackDataHandler.Register(id, factory); } public static void RegisterNetworkAdapter(NetworkAdapter adapter) { CurrentNetworkAdapter = adapter; loaforcsSoundAPI.Logger.LogInfo((object)("Registered network adapter: '" + CurrentNetworkAdapter.Name + "'")); CurrentNetworkAdapter.OnRegister(); } public static void RegisterSoundPack(SoundPack pack) { if (SoundPackDataHandler.LoadedPacks.Contains(pack)) { throw new InvalidOperationException("Already registered sound-pack: '" + pack.Name + "'!"); } SoundPackDataHandler.AddLoadedPack(pack); foreach (SoundReplacementCollection replacementCollection in pack.ReplacementCollections) { foreach (SoundReplacementGroup replacement in replacementCollection.Replacements) { SoundPackDataHandler.AddReplacement(replacement); } } } } internal static class MyPluginInfo { public const string PLUGIN_GUID = "me.loaforc.soundapi"; public const string PLUGIN_NAME = "loaforcsSoundAPI"; public const string PLUGIN_VERSION = "2.0.8"; } } namespace loaforcsSoundAPI.SoundPacks { internal class LoadSoundOperation { public readonly UnityWebRequest WebRequest = webRequest.webRequest; public readonly SoundInstance Sound; public bool IsReady => WebRequest.isDone; public bool IsDone { get; set; } public LoadSoundOperation(SoundInstance soundInstance, UnityWebRequestAsyncOperation webRequest) { Sound = soundInstance; base..ctor(); } } internal static class PackLoadingConfig { internal static bool MetadataSpoofing { get; private set; } internal static void Bind(ConfigFile file) { MetadataSpoofing = file.Bind<bool>("PackLoading", "MetadataSpoofing", true, "Should SoundAPI use a fake BepInPlugin attribute when generating configs? This can fix some issues with mod managers, notably with Gale displaying the config file name, instead of the sound-pack name.").Value; } } internal static class SoundPackDataHandler { private static List<SoundPack> _loadedPacks = new List<SoundPack>(); internal static Dictionary<string, List<SoundReplacementGroup>> SoundReplacements = new Dictionary<string, List<SoundReplacementGroup>>(); internal static Dictionary<string, Func<Condition>> conditionFactories = new Dictionary<string, Func<Condition>>(); internal static List<AudioClip> allLoadedClips = new List<AudioClip>(); internal static IReadOnlyList<SoundPack> LoadedPacks => _loadedPacks.AsReadOnly(); internal static void Register(string id, Func<Condition> factory) { conditionFactories[id] = factory; } public static Condition CreateCondition(string id) { if (conditionFactories.TryGetValue(id, out var value)) { return value(); } return new InvalidCondition(id); } internal static void AddLoadedPack(SoundPack pack) { _loadedPacks.Add(pack); } internal static void AddReplacement(SoundReplacementGroup group) { foreach (string match in group.Matches) { string key = match.Split(":").Last(); if (!SoundReplacements.TryGetValue(key, out var value)) { value = new List<SoundReplacementGroup>(); } if (!value.Contains(group)) { value.Add(group); SoundReplacements[key] = value; } } } } internal static class SoundPackLoadPipeline { private class SkippedResults { public int Collections; public int Groups; public int Sounds; } private static volatile int _activeThreads; private static Dictionary<string, List<string>> mappings; internal static Dictionary<string, AudioType> audioExtensions; internal static event Action OnFinishedPipeline; internal static async void StartPipeline() { Stopwatch completeLoadingTimer = Stopwatch.StartNew(); Stopwatch timer = Stopwatch.StartNew(); List<SoundPack> list = FindAndLoadPacks(); loaforcsSoundAPI.Logger.LogInfo((object)$"(Step 1) Loading Sound-pack definitions took {timer.ElapsedMilliseconds}ms"); if (list.Count == 0) { loaforcsSoundAPI.Logger.LogWarning((object)"No sound-packs were found to load! This can be ignorable if you're doing testing or using SoundAPI for another purpose, but if you expected sound-packs to load you may have set it up incorrectly."); } timer.Restart(); List<LoadSoundOperation> webRequestOperations = new List<LoadSoundOperation>(); foreach (SoundPack item2 in list) { string path = Path.Combine(item2.PackFolder, "soundapi_mappings.json"); if (!File.Exists(path)) { continue; } Dictionary<string, List<string>> dictionary = JSONDataLoader.LoadFromFile<Dictionary<string, List<string>>>(path); foreach (KeyValuePair<string, List<string>> item3 in dictionary) { if (mappings.ContainsKey(item3.Key)) { mappings[item3.Key].AddRange(item3.Value); } else { mappings[item3.Key] = item3.Value; } } } loaforcsSoundAPI.Logger.LogInfo((object)$"(Step 2) Loading Sound-pack mappings ('{mappings.Count}') took {timer.ElapsedMilliseconds}ms"); timer.Restart(); SkippedResults skippedStats = new SkippedResults(); foreach (SoundPack item4 in list) { foreach (SoundReplacementCollection item5 in LoadSoundReplacementCollections(item4, ref skippedStats)) { foreach (SoundReplacementGroup replacement in item5.Replacements) { SoundPackDataHandler.AddReplacement(replacement); foreach (SoundInstance sound in replacement.Sounds) { if (sound.Condition is ConstantCondition constantCondition && !constantCondition.Value) { Debuggers.SoundReplacementLoader?.Log("skipping a sound in '" + LogFormats.FormatFilePath(item5.FilePath) + "' because sound is marked as constant and has a value of false."); skippedStats.Sounds++; } else { webRequestOperations.Add(StartWebRequestOperation(item4, sound, audioExtensions[Path.GetExtension(sound.Sound)])); } } } } } int amountOfOperations = webRequestOperations.Count; loaforcsSoundAPI.Logger.LogInfo((object)$"(Step 3) Skipped {skippedStats.Collections} collection(s), {skippedStats.Groups} replacement(s), {skippedStats.Sounds} sound(s)"); loaforcsSoundAPI.Logger.LogInfo((object)$"(Step 3) Loading sound replacement collections took {timer.ElapsedMilliseconds}ms"); if (SoundReportHandler.CurrentReport != null) { SoundReportHandler.CurrentReport.AudioClipsLoaded = amountOfOperations; } loaforcsSoundAPI.Logger.LogInfo((object)$"(Step 4) Started loading {amountOfOperations} audio file(s)"); loaforcsSoundAPI.Logger.LogInfo((object)"Waiting for splash screens to complete to continue..."); completeLoadingTimer.Stop(); await Task.Delay(1); loaforcsSoundAPI.Logger.LogInfo((object)"Splash screens done! Continuing pipeline"); loaforcsSoundAPI.Logger.LogWarning((object)"The game will freeze for a moment!"); timer.Restart(); completeLoadingTimer.Start(); bool flag = false; bool threadsShouldExit = false; ConcurrentQueue<LoadSoundOperation> queuedOperations = new ConcurrentQueue<LoadSoundOperation>(); ConcurrentBag<Exception> threadPoolExceptions = new ConcurrentBag<Exception>(); for (int i = 0; i < 16; i++) { new Thread((ThreadStart)delegate { while (queuedOperations.Count == 0 && !threadsShouldExit) { Thread.Yield(); } Interlocked.Increment(ref _activeThreads); Debuggers.SoundReplacementLoader?.Log($"active threads at {_activeThreads}"); LoadSoundOperation result; while (queuedOperations.TryDequeue(out result)) { try { AudioClip content = DownloadHandlerAudioClip.GetContent(result.WebRequest); result.Sound.Clip = content; result.WebRequest.Dispose(); Debuggers.SoundReplacementLoader?.Log("clip generated"); result.IsDone = true; } catch (Exception item) { threadPoolExceptions.Add(item); } } Interlocked.Decrement(ref _activeThreads); }).Start(); } while (webRequestOperations.Count > 0) { foreach (LoadSoundOperation item6 in from operation in webRequestOperations.ToList() where operation.IsReady select operation) { queuedOperations.Enqueue(item6); webRequestOperations.Remove(item6); } if (!flag && webRequestOperations.Count < amountOfOperations / 2) { flag = true; loaforcsSoundAPI.Logger.LogInfo((object)"(Step 5) Queued half of the needed operations!"); } Thread.Yield(); } loaforcsSoundAPI.Logger.LogInfo((object)"(Step 5) All file reads are done, waiting for the audio clips conversions."); threadsShouldExit = true; while (_activeThreads > 0 || webRequestOperations.Any((LoadSoundOperation operation) => !operation.IsDone)) { Thread.Yield(); } loaforcsSoundAPI.Logger.LogInfo((object)$"(Step 6) Took {timer.ElapsedMilliseconds}ms to finish loading audio clips from files"); if (threadPoolExceptions.Count != 0) { loaforcsSoundAPI.Logger.LogError((object)$"(Step 6) {threadPoolExceptions.Count} internal error(s) happened while loading:"); foreach (Exception item7 in threadPoolExceptions) { loaforcsSoundAPI.Logger.LogError((object)item7.ToString()); } } SoundPackLoadPipeline.OnFinishedPipeline(); mappings = null; loaforcsSoundAPI.Logger.LogDebug((object)$"Active Threads that are left over: {_activeThreads}"); loaforcsSoundAPI.Logger.LogInfo((object)$"Entire load process took an effective {completeLoadingTimer.ElapsedMilliseconds}ms"); } private static List<SoundPack> FindAndLoadPacks(string entryPoint = "sound_pack.json") { //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown Dictionary<string, SoundPack> dictionary = new Dictionary<string, SoundPack>(); string[] files = Directory.GetFiles(Paths.PluginPath, entryPoint, SearchOption.AllDirectories); foreach (string text in files) { Debuggers.SoundReplacementLoader?.Log("found entry point: '" + text + "'!"); SoundPack soundPack = JSONDataLoader.LoadFromFile<SoundPack>(text); if (soundPack == null) { continue; } soundPack.PackFolder = Path.GetDirectoryName(text); if (dictionary.TryGetValue(soundPack.Name, out var value)) { IValidatable.LogAndCheckValidationResult("loading '" + text + "'", new List<IValidatable.ValidationResult>(1) { new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "A sound-pack with name '" + soundPack.Name + "' was already loaded from '" + LogFormats.FormatFilePath(Path.Combine(value.PackFolder, "sound_pack.json")) + "'. Skipping loading the duplicate!!") }, soundPack.Logger); continue; } Debuggers.SoundReplacementLoader?.Log("json loaded, validating"); List<IValidatable.ValidationResult> results = soundPack.Validate(); if (IValidatable.LogAndCheckValidationResult("loading '" + text + "'", results, soundPack.Logger)) { ConfigFile val = loaforcsSoundAPI.GenerateConfigFile(metadata: (BepInPlugin)((!PackLoadingConfig.MetadataSpoofing) ? ((object)MetadataHelper.GetMetadata(typeof(loaforcsSoundAPI))) : ((object)new BepInPlugin(soundPack.GUID, soundPack.Name, soundPack.Version ?? "1.0.0"))), name: soundPack.GUID); val.SaveOnConfigSet = false; soundPack.Bind(val); if (val.Count > 0) { val.Save(); } dictionary[soundPack.Name] = soundPack; SoundPackDataHandler.AddLoadedPack(soundPack); Debuggers.SoundReplacementLoader?.Log("pack folder: " + soundPack.PackFolder); } } Debuggers.SoundReplacementLoader?.Log($"loaded '{dictionary.Count}' packs."); return dictionary.Values.ToList(); } private static List<SoundReplacementCollection> LoadSoundReplacementCollections(SoundPack pack, ref SkippedResults skippedStats) { List<SoundReplacementCollection> list = new List<SoundReplacementCollection>(); if (!Directory.Exists(Path.Combine(pack.PackFolder, "replacers"))) { return list; } Debuggers.SoundReplacementLoader?.Log("start loading '" + pack.Name + "'!"); string[] files = Directory.GetFiles(Path.Combine(pack.PackFolder, "replacers"), "*.json", SearchOption.AllDirectories); foreach (string text in files) { Debuggers.SoundReplacementLoader?.Log("found replacer: '" + text + "'!"); SoundReplacementCollection soundReplacementCollection = JSONDataLoader.LoadFromFile<SoundReplacementCollection>(text); if (soundReplacementCollection == null) { continue; } soundReplacementCollection.Pack = pack; if (soundReplacementCollection.Condition is ConstantCondition constantCondition && !constantCondition.Value) { Debuggers.SoundReplacementLoader?.Log("skipping '" + LogFormats.FormatFilePath(soundReplacementCollection.FilePath) + "' because collection is marked as constant and has a value of false."); skippedStats.Collections++; } else { if (!IValidatable.LogAndCheckValidationResult("loading '" + LogFormats.FormatFilePath(text) + "'", soundReplacementCollection.Validate(), pack.Logger)) { continue; } List<IValidatable.ValidationResult> list2 = new List<IValidatable.ValidationResult>(); foreach (SoundReplacementGroup replacement in soundReplacementCollection.Replacements) { replacement.Parent = soundReplacementCollection; if (replacement.Condition is ConstantCondition constantCondition2 && !constantCondition2.Value) { Debuggers.SoundReplacementLoader?.Log("skipping a replacement in '" + LogFormats.FormatFilePath(soundReplacementCollection.FilePath) + "' because group is marked as constant and has a value of false."); skippedStats.Groups++; continue; } List<IValidatable.ValidationResult> list3 = replacement.Validate(); foreach (string item in replacement.Matches.ToList()) { if (item.StartsWith("#")) { replacement.Matches.Remove(item); Dictionary<string, List<string>> dictionary = mappings; string text2 = item; if (dictionary.TryGetValue(text2.Substring(1, text2.Length - 1), out var value)) { replacement.Matches.AddRange(value); } else { list3.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Mapping: '" + item + "' has not been found. If it's part of a soft dependency, make sure to use a 'mod_installed' condition with 'constant' enabled.")); } } } if (list3.Count != 0) { list2.AddRange(list3); continue; } foreach (SoundInstance sound in replacement.Sounds) { sound.Parent = replacement; list3.AddRange(sound.Validate()); } if (list3.Count != 0) { list2.AddRange(list3); continue; } List<string> collection = replacement.Matches.Select((string match) => (match.Split(":").Length != 2) ? match : ("*:" + match)).ToList(); replacement.Matches.Clear(); replacement.Matches.AddRange(collection); } if (IValidatable.LogAndCheckValidationResult("loading '" + LogFormats.FormatFilePath(text) + "'", list2, pack.Logger)) { list.Add(soundReplacementCollection); } } } return list; } private static LoadSoundOperation StartWebRequestOperation(SoundPack pack, SoundInstance sound, AudioType type) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(pack.PackFolder, "sounds", sound.Sound); UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(text, type); return new LoadSoundOperation(sound, audioClip.SendWebRequest()); } static SoundPackLoadPipeline() { SoundPackLoadPipeline.OnFinishedPipeline = delegate { }; mappings = new Dictionary<string, List<string>>(); audioExtensions = new Dictionary<string, AudioType> { { ".ogg", (AudioType)14 }, { ".wav", (AudioType)20 }, { ".mp3", (AudioType)13 } }; } } internal static class SoundReplacementHandler { private const int TOKEN_PARENT_NAME = 0; private const int TOKEN_OBJECT_NAME = 1; private const int TOKEN_CLIP_NAME = 2; private static readonly string[] _suffixesToRemove = new string[1] { "(Clone)" }; private static readonly Dictionary<int, string> _cachedObjectNames = new Dictionary<int, string>(); private static readonly StringBuilder _builder = new StringBuilder(); internal static void Register() { SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode _) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) _cachedObjectNames.Clear(); AudioSource[] array = Object.FindObjectsOfType<AudioSource>(true); foreach (AudioSource val in array) { if (!(((Component)val).gameObject.scene != scene)) { CheckAudioSource(val); } } }; } internal static void CheckAudioSource(AudioSource source) { if (!source.playOnAwake || !((Behaviour)source).enabled) { return; } AudioSourceAdditionalData orCreate = AudioSourceAdditionalData.GetOrCreate(source); if (TryReplaceAudio(source, orCreate.OriginalClip, out var replacement)) { source.Stop(); if (!((Object)(object)replacement == (Object)null)) { orCreate.RealClip = replacement; source.Play(); } } } internal static bool TryReplaceAudio(AudioSource source, AudioClip clip, out AudioClip replacement) { replacement = null; if ((Object)(object)((Component)source).gameObject == (Object)null) { return false; } AudioSourceAdditionalData orCreate = AudioSourceAdditionalData.GetOrCreate(source); if (orCreate.ReplacedWith != null && orCreate.ReplacedWith.Parent.UpdateEveryFrame) { return false; } if (orCreate.DisableReplacing) { return false; } string[] name = ArrayPool<string>.Shared.Rent(3); if (!TryProcessName(ref name, source, clip) || !TryGetReplacementClip(name, out var group, out var clip2, orCreate.CurrentContext ?? DefaultConditionContext.DEFAULT)) { ArrayPool<string>.Shared.Return(name); return false; } ArrayPool<string>.Shared.Return(name); ((Object)clip2).name = ((Object)clip).name; replacement = clip2; orCreate.ReplacedWith = group; if (group.Parent.UpdateEveryFrame) { Debuggers.UpdateEveryFrame?.Log("swapped to a clip that uses update_every_frame !!!"); } return true; } private static string TrimObjectName(GameObject gameObject) { if (_cachedObjectNames.ContainsKey(((object)gameObject).GetHashCode())) { return _cachedObjectNames[((object)gameObject).GetHashCode()]; } _builder.Clear(); _builder.Append(((Object)gameObject).name); string[] suffixesToRemove = _suffixesToRemove; foreach (string oldValue in suffixesToRemove) { _builder.Replace(oldValue, string.Empty); } for (int j = 0; j < _builder.Length; j++) { if (_builder[j] == '(') { int num = j; for (j++; j < _builder.Length && char.IsDigit(_builder[j]); j++) { } if (j < _builder.Length && _builder[j] == ')') { _builder.Remove(num, j - num + 1); j = num - 1; } } } int num2 = _builder.Length; while (num2 > 0 && _builder[num2 - 1] == ' ') { num2--; } _builder.Remove(num2, _builder.Length - num2); string text = _builder.ToString(); _cachedObjectNames[((object)gameObject).GetHashCode()] = text; return text; } private static bool TryProcessName(ref string[] name, AudioSource source, AudioClip clip) { if ((Object)(object)clip == (Object)null) { return false; } if ((Object)(object)((Component)source).transform.parent == (Object)null) { name[0] = "*"; } else { name[0] = TrimObjectName(((Component)((Component)source).transform.parent).gameObject); } name[1] = TrimObjectName(((Component)source).gameObject); name[2] = ((Object)clip).name; if (SoundReportHandler.CurrentReport != null) { string caller; try { caller = new StackTrace(fNeedFileInfo: true).GetFrame(5).GetMethod().DeclaringType.Name; } catch { caller = "unknown caller"; } SoundReport.PlayedSound playedSound = new SoundReport.PlayedSound(name[0] + ":" + name[1] + ":" + name[2], caller, source.playOnAwake); if (!SoundReportHandler.CurrentReport.PlayedSounds.Any(playedSound.Equals)) { SoundReportHandler.CurrentReport.PlayedSounds.Add(playedSound); } } Debuggers.MatchStrings?.Log(name[0] + ":" + name[1] + ":" + name[2]); return true; } private static bool TryGetReplacementClip(string[] name, out SoundReplacementGroup group, out AudioClip clip, IContext context) { group = null; clip = null; if (name == null) { return false; } Debuggers.SoundReplacementHandler?.Log("beginning replacement attempt for " + name[2]); if (!SoundPackDataHandler.SoundReplacements.TryGetValue(name[2], out var value)) { return false; } Debuggers.SoundReplacementHandler?.Log("sound dictionary hit"); value = value.Where((SoundReplacementGroup it) => it.Parent.Evaluate(context) && it.Evaluate(context) && CheckGroupMatches(it, name)).ToList(); if (value.Count == 0) { return false; } Debuggers.SoundReplacementHandler?.Log("sound group that matches"); group = value[Random.Range(0, value.Count)]; List<SoundInstance> list = group.Sounds.Where((SoundInstance it) => it.Evaluate(context)).ToList(); if (list.Count == 0) { return false; } Debuggers.SoundReplacementHandler?.Log("has valid sounds"); int totalWeight = 0; list.ForEach(delegate(SoundInstance replacement) { totalWeight += replacement.Weight; }); int num = Random.Range(0, totalWeight + 1); SoundInstance soundInstance = null; foreach (SoundInstance item in list) { soundInstance = item; num -= soundInstance.Weight; if (num <= 0) { break; } } clip = soundInstance.Clip; Debuggers.SoundReplacementHandler?.Log("done, dumping stack trace!"); Debuggers.SoundReplacementHandler?.Log(string.Join(", ", group.Matches)); Debuggers.SoundReplacementHandler?.Log(((Object)clip).name); Debuggers.SoundReplacementHandler?.Log(new StackTrace(fNeedFileInfo: true).ToString().Trim()); return true; } private static bool CheckGroupMatches(SoundReplacementGroup group, string[] a) { foreach (string match in group.Matches) { if (MatchStrings(a, match)) { return true; } } return false; } private static bool MatchStrings(string[] a, string b) { string[] array = b.Split(":"); if (array[0] != "*" && array[0] != a[0]) { return false; } if (array[1] != "*" && array[1] != a[1]) { return false; } return a[2] == array[2]; } } } namespace loaforcsSoundAPI.SoundPacks.Data { public interface IPackData { SoundPack Pack { get; internal set; } } public class SoundInstance : Conditional { [field: NonSerialized] public SoundReplacementGroup Parent { get; internal set; } public string Sound { get; private set; } public int Weight { get; private set; } [field: NonSerialized] public AudioClip Clip { get; internal set; } public override SoundPack Pack { get { return Parent.Pack; } set { if (Parent.Pack != null) { throw new InvalidOperationException("Pack has already been set."); } Parent.Pack = value; } } [JsonConstructor] internal SoundInstance() { } public SoundInstance(SoundReplacementGroup parent, int weight, AudioClip clip) { Parent = parent; Weight = weight; Clip = clip; parent.AddSoundReplacement(this); } public override List<IValidatable.ValidationResult> Validate() { List<IValidatable.ValidationResult> list = base.Validate(); if (!File.Exists(Path.Combine(Pack.PackFolder, "sounds", Sound))) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Sound '" + Sound + "' couldn't be found or doesn't exist!")); } else if (!SoundPackLoadPipeline.audioExtensions.ContainsKey(Path.GetExtension(Sound))) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Audio type: '" + Path.GetExtension(Sound) + "' is not supported!")); } return list; } } public class SoundPack : IValidatable { [NonSerialized] private readonly Dictionary<string, object> _configData = new Dictionary<string, object>(); private ManualLogSource _logger; [JsonProperty] private Dictionary<string, JObject> config { get; set; } public string Name { get; private set; } public string GUID => "soundpack." + Name; [CanBeNull] public string Version { get; private set; } public string PackFolder { get; internal set; } [field: NonSerialized] public List<SoundReplacementCollection> ReplacementCollections { get; private set; } = new List<SoundReplacementCollection>(); public ManualLogSource Logger { get { if (_logger == null) { _logger = Logger.CreateLogSource(GUID); } return _logger; } } [JsonConstructor] internal SoundPack() { } internal void Bind(ConfigFile file) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Invalid comparison between Unknown and I4 //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Invalid comparison between Unknown and I4 if (config == null || config.Count == 0) { return; } loaforcsSoundAPI.Logger.LogDebug((object)"handling config"); JToken val2 = default(JToken); foreach (KeyValuePair<string, JObject> item in config) { string[] array = item.Key.Split(":"); string text = array[0]; string text2 = array[1]; JToken val = item.Value["default"]; string text3 = (item.Value.TryGetValue("description", ref val2) ? ((object)val2).ToString() : "no description defined!"); JTokenType type = val.Type; if ((int)type != 8) { if ((int)type != 9) { throw new NotImplementedException("WHAT"); } _configData[item.Key] = file.Bind<bool>(text, text2, (bool)val, text3).Value; } else { _configData[item.Key] = file.Bind<string>(text, text2, (string)val, text3).Value; } } } public SoundPack(string name, string packFolder) { Name = name; PackFolder = packFolder; } internal bool TryGetConfigValue(string id, out object returnValue) { returnValue = null; if (!_configData.TryGetValue(id, out var value)) { return false; } returnValue = value; return true; } public List<IValidatable.ValidationResult> Validate() { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Invalid comparison between Unknown and I4 //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Invalid comparison between Unknown and I4 //IL_0154: Unknown result type (might be due to invalid IL or missing references) List<IValidatable.ValidationResult> list = new List<IValidatable.ValidationResult>(); if (string.IsNullOrEmpty(Name)) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "'name' can not be missing or empty!")); return list; } string name = Name; foreach (char c in name) { if (!char.IsLetter(c) && c != '_') { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, $"'name' can not contain special character '{c}'!")); } } if (string.IsNullOrEmpty(Version) && PackLoadingConfig.MetadataSpoofing) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.WARN, "'version' should not be empty, defaulting to '1.0.0' (needed by MetadataSpoofing config)")); } if (config == null) { return list; } JToken val = default(JToken); foreach (KeyValuePair<string, JObject> item in config) { string[] array = item.Key.Split(":"); if (array.Length != 2) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "'" + item.Key + "' is not a valid key for config! It must be 'section:name' with exactly one colon!")); } if (!item.Value.TryGetValue("default", ref val)) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "'" + item.Key + "' does not have a 'default' value! This is needed to get what type the config is!")); } else if ((int)val.Type != 9 && (int)val.Type != 8) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, $"'{item.Key}' is of unsupported type: '{val.Type}'! Only supported types are strings/text or booleans!")); } if (!item.Value.ContainsKey("description")) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.WARN, "'" + item.Key + "' does not have a description.")); } } return list; } } public class SoundReplacementCollection : Conditional, IFilePathAware, IPackData { [field: NonSerialized] public override SoundPack Pack { get; set; } public bool UpdateEveryFrame { get; private set; } public bool Synced { get; private set; } public List<SoundReplacementGroup> Replacements { get; private set; } = new List<SoundReplacementGroup>(); public string FilePath { get; set; } [JsonConstructor] internal SoundReplacementCollection() { } public SoundReplacementCollection(SoundPack pack) { Pack = pack; pack.ReplacementCollections.Add(this); } internal void AddSoundReplacementGroup(SoundReplacementGroup group) { Replacements.Add(group); } } public class SoundReplacementGroup : Conditional { [field: NonSerialized] public SoundReplacementCollection Parent { get; internal set; } public List<string> Matches { get; private set; } public List<SoundInstance> Sounds { get; private set; } = new List<SoundInstance>(); public override SoundPack Pack { get { return Parent.Pack; } set { if (Parent.Pack != null) { throw new InvalidOperationException("Pack has already been set."); } Parent.Pack = value; } } [JsonConstructor] internal SoundReplacementGroup() { } public SoundReplacementGroup(SoundReplacementCollection parent, List<string> matches) { Parent = parent; Matches = matches; if (SoundPackDataHandler.LoadedPacks.Contains(parent.Pack)) { throw new InvalidOperationException("SoundPack has already been registered, trying to add a new SoundReplacementGroup does not work!"); } parent.AddSoundReplacementGroup(this); } internal void AddSoundReplacement(SoundInstance sound) { Sounds.Add(sound); } public override List<IValidatable.ValidationResult> Validate() { List<IValidatable.ValidationResult> list = base.Validate(); foreach (string match in Matches) { if (string.IsNullOrEmpty(match)) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Match string can not be empty!")); continue; } string[] array = match.Split(":"); if (array.Length == 1) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "'" + match + "' is not valid! If you mean to match to all Audio clips with this name you must explicitly do '*:" + match + "'.")); } if (array.Length > 3) { list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.WARN, $"'{match}' has more than 3 parts! SoundAPI will handle this as '{match[0]}:{match[1]}:{match[2]}', discarding the rest!")); } } return list; } } } namespace loaforcsSoundAPI.SoundPacks.Data.Conditions { public abstract class Condition : IValidatable { [field: NonSerialized] public Conditional Parent { get; internal set; } protected SoundPack Pack => Parent.Pack; public bool? Constant { get; private set; } protected internal virtual void OnRegistered() { } public abstract bool Evaluate(IContext context); public virtual List<IValidatable.ValidationResult> Validate() { return new List<IValidatable.ValidationResult>(); } protected bool EvaluateRangeOperator(int number, string condition) { return EvaluateRangeOperator((double)number, condition); } protected bool EvaluateRangeOperator(float number, string condition) { return EvaluateRangeOperator((double)number, condition); } protected bool EvaluateRangeOperator(double value, string condition) { string[] array = condition.Split(".."); if (array.Length == 1) { if (double.TryParse(array[0], out var result)) { return value == result; } return false; } if (array.Length == 2) { double result2; if (array[0] == "") { result2 = double.MinValue; } else if (!double.TryParse(array[0], out result2)) { return false; } double result3; if (array[1] == "") { result3 = double.MaxValue; } else if (!double.TryParse(array[1], out result3)) { return false; } if (value >= result2) { return value <= result3; } return false; } return false; } protected bool ValidateRangeOperator(string condition, out IValidatable.ValidationResult result) { result = null; if (string.IsNullOrEmpty(condition)) { result = new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Range operator can not be missing or empty!"); return false; } string[] array = condition.Split(".."); int num = array.Length; if (num <= 2) { switch (num) { case 1: { if (!double.TryParse(array[0], out var _)) { result = new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Failed to parse: '" + array[0] + "' as a number!"); } break; } case 2: { double num2; if (array[0] == "") { num2 = double.MinValue; } else if (!double.TryParse(array[0], out num2)) { result = new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Failed to parse: '" + array[0] + "' as a number!"); } double num3; if (array[1] == "") { num3 = double.MaxValue; } else if (!double.TryParse(array[1], out num3)) { result = new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Failed to parse: '" + array[1] + "' as a number!"); } break; } } } else { result = new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Range operator: '" + condition + "' uses .. more than once!"); } return result == null; } protected static void LogDebug(string name, object message) { Debuggers.ConditionsInfo?.Log($"({name}) {message}"); } } internal sealed class InvalidCondition : Condition { [CompilerGenerated] private string <type>P; public InvalidCondition(string type) { <type>P = type; base..ctor(); } public override bool Evaluate(IContext context) { return false; } public override List<IValidatable.ValidationResult> Validate() { if (string.IsNullOrEmpty(<type>P)) { return new List<IValidatable.ValidationResult>(1) { new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Condition must have a type!") }; } return new List<IValidatable.ValidationResult>(1) { new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "'" + <type>P + "' is not a valid condition type!") }; } } internal sealed class ConstantCondition : Condition { public static ConstantCondition TRUE = new ConstantCondition(constant: true); public static ConstantCondition FALSE = new ConstantCondition(constant: false); public bool Value { get; private set; } private ConstantCondition(bool constant) { Value = constant; } public override bool Evaluate(IContext context) { return Value; } } public abstract class Condition<TContext> : Condition where TContext : IContext { public override bool Evaluate(IContext context) { if (!(context is TContext context2)) { return EvaluateFallback(context); } return EvaluateWithContext(context2); } protected abstract bool EvaluateWithContext(TContext context); protected virtual bool EvaluateFallback(IContext context) { return false; } } public abstract class Conditional : IValidatable, IPackData { public Condition Condition { get; set; } public abstract SoundPack Pack { get; set; } public bool Evaluate(IContext context) { if (Condition == null) { return true; } return Condition.Evaluate(context); } public virtual List<IValidatable.ValidationResult> Validate() { if (Condition == null) { return new List<IValidatable.ValidationResult>(); } Condition.Parent = this; Condition.OnRegistered(); return Condition.Validate(); } } public interface IContext { } internal class DefaultConditionContext : IContext { internal static readonly DefaultConditionContext DEFAULT = new DefaultConditionContext(); private DefaultConditionContext() { } } [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] [MeansImplicitUse] public class SoundAPIConditionAttribute : Attribute { public string ID { get; private set; } public bool IsDeprecated { get; private set; } public string DeprecationReason { get; private set; } public SoundAPIConditionAttribute(string id, bool deprecated = false, string deprecationReason = null) { ID = id; IsDeprecated = deprecated; DeprecationReason = deprecationReason; base..ctor(); } } } namespace loaforcsSoundAPI.SoundPacks.Conditions { public abstract class LogicGateCondition : Condition { public abstract Condition[] Conditions { get; protected set; } protected abstract string ValidateWarnMessage { get; } protected internal override void OnRegistered() { Condition[] conditions = Conditions; foreach (Condition condition in conditions) { condition.Parent = base.Parent; condition.OnRegistered(); } } public override List<IValidatable.ValidationResult> Validate() { if (Conditions.Length == 0) { return new List<IValidatable.ValidationResult>(1) { new IValidatable.ValidationResult(IValidatable.ResultType.WARN, ValidateWarnMessage) }; } return new List<IValidatable.ValidationResult>(); } protected static bool And(Condition[] conditions, IContext context) { foreach (Condition condition in conditions) { if (condition is InvalidCondition) { return false; } if (!condition.Evaluate(context)) { return false; } } return true; } protected static bool Or(Condition[] conditions, IContext context) { foreach (Condition condition in conditions) { if (condition is InvalidCondition) { return false; } if (condition.Evaluate(context)) { return true; } } return false; } } [SoundAPICondition("and", false, null)] internal class AndCondition : LogicGateCondition { public override Condition[] Conditions { get; protected set; } protected override string ValidateWarnMessage => "'and' condition has no conditions and will always return true!"; public override bool Evaluate(IContext context) { return LogicGateCondition.And(Conditions, context); } } [SoundAPICondition("nand", false, null)] internal class NandCondition : LogicGateCondition { public override Condition[] Conditions { get; protected set; } protected override string ValidateWarnMessage => "'nand' condition has no conditions and will always return false!"; public override bool Evaluate(IContext context) { return !LogicGateCondition.And(Conditions, context); } } [SoundAPICondition("config", false, null)] internal class ConfigCondition : Condition { public string Config { get; private set; } public object Value { get; private set; } public override bool Evaluate(IContext context) { if (!base.Pack.TryGetConfigValue(Config, out var returnValue)) { return false; } if (Value == null) { if (returnValue is bool) { return (bool)returnValue; } if (returnValue is string value) { return string.IsNullOrEmpty(value); } return false; } if (returnValue is bool flag) { return flag == (bool)Value; } if (returnValue is string text) { return text == (string)Value; } return false; } public override List<IValidatable.ValidationResult> Validate() { if (!base.Pack.TryGetConfigValue(Config, out var returnValue)) { List<IValidatable.ValidationResult> list = new List<IValidatable.ValidationResult>(1); list.Add(new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Config '" + Config + "' does not exist on SoundPack '" + base.Pack.Name + "'")); return list; } if (Value != null && returnValue.GetType() != Value.GetType()) { return new List<IValidatable.ValidationResult>(1) { new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, $"Config '{Config}' has a type of: '{returnValue.GetType()}' but the Value type is '{Value.GetType()}'!") }; } return new List<IValidatable.ValidationResult>(); } } [SoundAPICondition("counter", false, null)] public class CounterCondition : Condition { private int _count; public string Value { get; private set; } public int? ResetsAt { get; private set; } public override bool Evaluate(IContext context) { Condition.LogDebug("counter", $"counting: {_count} -> {_count + 1}"); _count++; bool flag = EvaluateRangeOperator(_count, Value); Condition.LogDebug("counter", $"is {_count} in range ({Value})? {flag}"); if (_count >= ResetsAt) { _count = 0; Condition.LogDebug("counter", "reset count to 0."); } return flag; } public override List<IValidatable.ValidationResult> Validate() { if (!ValidateRangeOperator(Value, out var result)) { return new List<IValidatable.ValidationResult>(1) { result }; } return new List<IValidatable.ValidationResult>(); } } [SoundAPICondition("mod_installed", false, null)] internal class ModInstalledCondition : Condition { public string Value { get; private set; } public override bool Evaluate(IContext context) { return Chainloader.PluginInfos.ContainsKey(Value); } public override List<IValidatable.ValidationResult> Validate() { if (string.IsNullOrEmpty(Value)) { return new List<IValidatable.ValidationResult>(1) { new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "Value on 'mod_installed' must be there and must not be empty.") }; } return new List<IValidatable.ValidationResult>(); } } [SoundAPICondition("not", false, null)] internal class NotCondition : Condition { public Condition Condition { get; private set; } protected internal override void OnRegistered() { if (Condition != null) { Condition.Parent = base.Parent; Condition.OnRegistered(); } } public override bool Evaluate(IContext context) { if (Condition is InvalidCondition) { return false; } return !Condition.Evaluate(context); } public override List<IValidatable.ValidationResult> Validate() { if (Condition == null) { return new List<IValidatable.ValidationResult>(1) { new IValidatable.ValidationResult(IValidatable.ResultType.FAIL, "'not' condition has no valid condition to invert!") }; } return new List<IValidatable.ValidationResult>(); } } [SoundAPICondition("or", false, null)] internal class OrCondition : LogicGateCondition { public override Condition[] Conditions { get; protected set; } protected override string ValidateWarnMessage => "'or' condition has no conditions and will always return false!"; public override bool Evaluate(IContext context) { return LogicGateCondition.Or(Conditions, context); } } [SoundAPICondition("nor", false, null)] internal class NorCondition : LogicGateCondition { public override Condition[] Conditions { get; protected set; } protected override string ValidateWarnMessage => "'nor' condition has no conditions and will always return true!"; public override bool Evaluate(IContext context) { return !LogicGateCondition.Or(Conditions, context); } } } namespace loaforcsSoundAPI.Reporting { public static class SoundReportHandler { private const string _datetimeFormat = "dd_MM_yyyy-HH_mm"; private static Action<StreamWriter, SoundReport> _reportSections = delegate { }; public static SoundReport CurrentReport { get; private set; } public static void AddReportSection(string header, Action<StreamWriter, SoundReport> callback) { _reportSections = (Action<StreamWriter, SoundReport>)Delegate.Combine(_reportSections, (Action<StreamWriter, SoundReport>)delegate(StreamWriter stream, SoundReport report) { stream.WriteLine("## " + header); callback(stream, report); stream.WriteLine(""); stream.WriteLine(""); }); } internal static void Register() { Directory.CreateDirectory(GetFolder()); CurrentReport = new SoundReport(); loaforcsSoundAPI.Logger.LogWarning((object)"SoundAPI is generating a report!"); loaforcsSoundAPI.Logger.LogInfo((object)("The report will be located at '" + LogFormats.FormatFilePath(Path.Combine(GetFolder(), GetFileName(CurrentReport, ".md"))))); Application.quitting += delegate { WriteReportToFile(CurrentReport); }; SoundPackLoadPipeline.OnFinishedPipeline += delegate { foreach (SoundPack loadedPack in SoundPackDataHandler.LoadedPacks) { CurrentReport.SoundPackNames.Add(loadedPack.Name); } }; AddReportSection("General Information", delegate(StreamWriter stream, SoundReport report) { stream.WriteLine("SoundAPI version: `2.0.8` <br/><br/>"); stream.WriteLine($"Audio-clips loaded: `{report.AudioClipsLoaded}` <br/>"); stream.WriteLine($"Match strings registered: `{SoundPackDataHandler.SoundReplacements.Values.Sum((List<SoundReplacementGroup> it) => it.Count)}` <br/>"); WriteList("Loaded sound-packs", stream, report.SoundPackNames); }); AddReportSection("Dynamic Data", delegate(StreamWriter stream, SoundReport _) { if (SoundAPI.CurrentNetworkAdapter != null) { stream.WriteLine("Network Adapter: `" + SoundAPI.CurrentNetworkAdapter.Name + "` <br/><br/>"); } WriteList("Registered Conditions", stream, SoundPackDataHandler.conditionFactories.Keys.ToList()); }); AddReportSection("All Played Sounds", delegate(StreamWriter stream, SoundReport report) { WriteList(null, stream, report.PlayedSounds.Select((SoundReport.PlayedSound it) => it.FormatForReport()).ToList()); }); } internal static void Bind(ConfigFile file) { if (file.Bind<bool>("Developer", "GenerateReports", false, "While true SoundAPI will generate a json and markdown file per session that records information SoundAPI and related mods find.").Value) { Register(); } } private static string GetFileName(SoundReport report, string extension) { return "generated_report-" + report.StartedAt.ToString("dd_MM_yyyy-HH_mm") + extension; } private static string GetFolder() { return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "reports"); } private static void WriteReportToFile(SoundReport report) { using StreamWriter streamWriter = new StreamWriter(Path.Combine(GetFolder(), GetFileName(report, ".md"))); streamWriter.WriteLine("# Generated Report"); streamWriter.WriteLine($"At {report.StartedAt} :3"); streamWriter.WriteLine(""); _reportSections(streamWriter, report); streamWriter.Flush(); streamWriter.Close(); using StreamWriter streamWriter2 = new StreamWriter(Path.Combine(GetFolder(), GetFileName(report, ".json"))); streamWriter2.WriteLine(JsonConvert.SerializeObject((object)report, (Formatting)1)); } public static void WriteList(string header, StreamWriter stream, ICollection<string> list) { if (!string.IsNullOrEmpty(header)) { stream.WriteLine($"### {header} (`{list.Count}`)"); } stream.WriteLine(string.Join("<br/>\n", list.Select((string it) => "- " + it))); } public static void WriteEnum<T>(string header, StreamWriter stream) where T : Enum { WriteList(header, stream, (from it in Enum.GetValues(typeof(T)).OfType<T>() select it.ToString().ToLowerInvariant()).ToList()); } } } namespace loaforcsSoundAPI.Reporting.Data { public class SoundReport { public class PlayedSound { public string MatchString { get; private set; } public string Caller { get; private set; } public bool IsPlayOnAwake { get; private set; } public PlayedSound(string matchString, string caller, bool isPlayOnAwake) { MatchString = matchString; Caller = caller; IsPlayOnAwake = isPlayOnAwake; base..ctor(); } public override bool Equals(object obj) { if (!(obj is PlayedSound other)) { return false; } return Equals(other); } protected bool Equals(PlayedSound other) { if (MatchString == other.MatchString && Caller == other.Caller) { return IsPlayOnAwake == other.IsPlayOnAwake; } return false; } public override int GetHashCode() { return HashCode.Combine(MatchString, Caller, IsPlayOnAwake); } public string FormatForReport() { return $"Match String: {MatchString}, Caller: {Caller}, IsPlayOnAwake: {IsPlayOnAwake}"; } } public DateTime StartedAt { get; private set; } = DateTime.Now; public List<PlayedSound> PlayedSounds { get; private set; } = new List<PlayedSound>(); public List<string> SoundPackNames { get; private set; } = new List<string>(); public int AudioClipsLoaded { get; set; } } } namespace loaforcsSoundAPI.Core { public class AudioSourceAdditionalData { private SoundReplacementGroup _replacedWith; public AudioSource Source { get; private set; } public AudioClip OriginalClip { get; internal set; } public AudioClip RealClip { get { using (new SpoofBypassContext()) { if (Debuggers.AudioSourceAdditionalData != null) { string text = "null"; if (Object.op_Implicit((Object)(object)Source.clip)) { text = ((Object)Source.clip).name; } string text2 = "null"; if (Object.op_Implicit((Object)(object)OriginalClip)) { text2 = ((Object)OriginalClip).name; } Debuggers.AudioSourceAdditionalData.Log("(" + ((Object)Source).name + ") Getting real clip: " + text + " (original clip: " + text2 + ")"); } return Source.clip; } } set { using (new SpoofBypassContext()) { if (Debuggers.AudioSourceAdditionalData != null) { string text = "null"; if (Object.op_Implicit((Object)(object)OriginalClip)) { text = ((Object)OriginalClip).name; } Debuggers.AudioSourceAdditionalData?.Log("(" + ((Object)Source).name + ") Setting real clip: " + ((Object)value).name + " (original clip: " + text + ")"); } Source.clip = value; } } } internal SoundReplacementGroup ReplacedWith { get { return _replacedWith; } set { _replacedWith = value; if (RequiresUpdateFunction()) { if (!SoundAPIAudioManager.liveAudioSourceData.Contains(this)) { SoundAPIAudioManager.liveAudioSourceData.Add(this); } } else if (SoundAPIAudioManager.liveAudioSourceData.Contains(this)) { SoundAPIAudioManager.liveAudioSourceData.Remove(this); } } } public bool DisableReplacing { get; private set; } public IContext CurrentContext { get; set; } internal AudioSourceAdditionalData(AudioSource source) { Source = source; } internal void Update() { if (RequiresUpdateFunction() && AudioSourceIsPlaying()) { Debuggers.UpdateEveryFrame?.Log("success: updating every frame for " + ((Object)Source).name); IContext context = CurrentContext ?? DefaultConditionContext.DEFAULT; SoundInstance soundInstance = ReplacedWith.Sounds.FirstOrDefault((SoundInstance x) => x.Evaluate(context)); if (soundInstance != null && !((Object)(object)soundInstance.Clip == (Object)(object)Source.clip)) { Debuggers.UpdateEveryFrame?.Log("new clip found, swapping!!"); float time = Source.time; Source.clip = soundInstance.Clip; Source.Play(); Source.time = time; Debuggers.UpdateEveryFrame?.Log("new clip found, swapped"); } } } private bool RequiresUpdateFunction() { if (ReplacedWith != null) { return ReplacedWith.Parent.UpdateEveryFrame; } return false; } private bool AudioSourceIsPlaying() { if (Object.op_Implicit((Object)(object)Source) && ((Behaviour)Source).enabled) { return Source.isPlaying; } return false; } public static AudioSourceAdditionalData GetOrCreate(AudioSource source) { if (SoundAPIAudioManager.audioSourceData.TryGetValue(source, out var value)) { return value; } value = new AudioSourceAdditionalData(source); value.OriginalClip = value.RealClip; SoundAPIAudioManager.audioSourceData[source] = value; return value; } } internal static class Debuggers { internal static DebugLogSource AudioSourceAdditionalData; internal static DebugLogSource SoundReplacementLoader; internal static DebugLogSource SoundReplacementHandler; internal static DebugLogSource MatchStrings; internal static DebugLogSource ConditionsInfo; internal static DebugLogSource UpdateEveryFrame; internal static DebugLogSource AudioClipSpoofing; internal static void Bind(ConfigFile file) { FieldInfo[] fields = typeof(Debuggers).GetFields(BindingFlags.Static | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (file.Bind<bool>("InternalDebugging", fieldInfo.Name, false, "Enable/Disable this DebugLogSource. Should only be true if you know what you are doing or have been asked to.").Value) { fieldInfo.SetValue(null, new DebugLogSource(fieldInfo.Name)); loaforcsSoundAPI.Logger.LogDebug((object)("created a DebugLogSource for " + fieldInfo.Name + "!")); } else { fieldInfo.SetValue(null, null); loaforcsSoundAPI.Logger.LogDebug((object)("no DebugLogSource for " + fieldInfo.Name + ".")); } } } } internal class DebugLogSource { [CompilerGenerated] private string <title>P; public DebugLogSource(string title) { <title>P = title; base..ctor(); } internal void Log(object message) { loaforcsSoundAPI.Logger.LogDebug((object)$"[Debug-{<title>P}] {message}"); } } internal class SoundAPIAudioManager : MonoBehaviour { internal static readonly Dictionary<AudioSource, AudioSourceAdditionalData> audioSourceData = new Dictionary<AudioSource, AudioSourceAdditionalData>(); internal static readonly List<AudioSourceAdditionalData> liveAudioSourceData = new List<AudioSourceAdditionalData>(); private static SoundAPIAudioManager Instance; private void Awake() { SceneManager.sceneLoaded += delegate { if (!Object.op_Implicit((Object)(object)Instance)) { SpawnManager(); } RunCleanup(); }; } internal static void SpawnManager() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown loaforcsSoundAPI.Logger.LogInfo((object)"Starting AudioManager."); GameObject val = new GameObject("SoundAPI_AudioManager"); Object.DontDestroyOnLoad((Object)(object)val); Instance = val.AddComponent<SoundAPIAudioManager>(); } private void Update() { Debuggers.UpdateEveryFrame?.Log("sanity check: soundapi audio manager is running!"); foreach (AudioSourceAdditionalData liveAudioSourceDatum in liveAudioSourceData) { liveAudioSourceDatum.Update(); } } private void OnDisable() { loaforcsSoundAPI.Logger.LogDebug((object)"manager disabled"); } private void OnDestroy() { loaforcsSoundAPI.Logger.LogDebug((object)"manager destroyed"); } private static void RunCleanup() { loaforcsSoundAPI.Logger.LogDebug((object)"cleaning up old audio source entries"); AudioSource[] array = audioSourceData.Keys.ToArray(); foreach (AudioSource val in array) { if (!Object.op_Implicit((Object)(object)val)) { if (liveAudioSourceData.Contains(audioSourceData[val])) { liveAudioSourceData.Remove(audioSourceData[val]); } audioSourceData.Remove(val); } } } } internal class SpoofBypassContext : IDisposable { public SpoofBypassContext() { AudioSourcePatch.bypassSpoofing = true; } public void Dispose() { AudioSourcePatch.bypassSpoofing = false; } } } namespace loaforcsSoundAPI.Core.Util { public class AdaptiveConfigEntry { public AdaptiveBool State { get; private set; } public bool DefaultValue { get; private set; } public bool? OverrideValue { get; set; } public bool Value => State switch { AdaptiveBool.Enabled => true, AdaptiveBool.Disabled => false, _ => OverrideValue ?? DefaultValue, }; public AdaptiveConfigEntry(AdaptiveBool state, bool defaultValue) { State = state; DefaultValue = defaultValue; } } public enum AdaptiveBool { Automatic, Enabled, Disabled } internal static class LogFormats { internal static string FormatFilePath(string path) { return $"plugins{Path.DirectorySeparatorChar}{Path.Combine(Path.GetRelativePath(Paths.PluginPath, path))}"; } } } namespace loaforcsSoundAPI.Core.Util.Extensions { internal static class AssemblyExtensions { internal static IEnumerable<Type> GetLoadableTypes(this Assembly assembly) { if (assembly == null) { throw new ArgumentNullException("assembly"); } try { return assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type t) => t != null); } } } public static class AsyncOperationExtensions { public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOp) { TaskCompletionSource<AsyncOperation> tcs = new TaskCompletionSource<AsyncOperation>(); asyncOp.completed += delegate(AsyncOperation operation) { tcs.SetResult(operation); }; return ((Task)tcs.Task).GetAwaiter(); } } public static class ConfigFileExtensions { public static AdaptiveConfigEntry BindAdaptive(this ConfigFile file, string section, string key, bool defaultValue, string description) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown AdaptiveBool value = file.Bind<AdaptiveBool>(section, key, AdaptiveBool.Automatic, new ConfigDescription($"{description}\nAutomatic default: {defaultValue}", (AcceptableValueBase)null, Array.Empty<object>())).Value; return new AdaptiveConfigEntry(value, defaultValue); } } public static class ListExtensions { public static void AddUnique<T>(this List<T> list, T item) { if (!list.Contains(item)) { list.Add(item); } } } } namespace loaforcsSoundAPI.Core.Patches { [HarmonyPatch(typeof(AudioSource))] internal static class AudioSourcePatch { internal static bool bypassSpoofing; [HarmonyPrefix] [HarmonyPatch("Play", new Type[] { })] [HarmonyPatch("Play", new Type[] { typeof(ulong) })] [HarmonyPatch("Play", new Type[] { typeof(double) })] private static bool Play(AudioSource __instance) { AudioSourceAdditionalData orCreate = AudioSourceAdditionalData.GetOrCreate(__instance); if (SoundReplacementHandler.TryReplaceAudio(__instance, orCreate.OriginalClip, out var replacement)) { if ((Object)(object)replacement == (Object)null) { return false; } orCreate.RealClip = replacement; } return true; } [HarmonyPrefix] [HarmonyPatch("PlayOneShot", new Type[] { typeof(AudioClip), typeof(float) })] private static bool PlayOneShot(AudioSource __instance, ref AudioClip clip) { if (SoundReplacementHandler.TryReplaceAudio(__instance, clip, out var replacement)) { if ((Object)(object)replacement == (Object)null) { return false; } clip = replacement; } return true; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPriority(0)] [HarmonyPrefix] private static void UpdateOriginalClip(AudioSource __instance, AudioClip value, bool __runOriginal) { if (__runOriginal) { AudioSourceAdditionalData orCreate = AudioSourceAdditionalData.GetOrCreate(__instance); orCreate.OriginalClip = value; Debuggers.AudioClipSpoofing?.Log("(" + ((Object)((Component)__instance).gameObject).name + ") updating original clip to: " + ((Object)value).name); } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static bool PreventClipRestartingWithSpoofed(AudioSource __instance, AudioClip value) { if (!PatchConfig.AudioClipSpoofing || bypassSpoofing) { return true; } AudioSourceAdditionalData orCreate = AudioSourceAdditionalData.GetOrCreate(__instance); if ((Object)(object)orCreate.OriginalClip == (Object)(object)value) { Debuggers.AudioClipSpoofing?.Log("prevented clip from restarting"); } return (Object)(object)orCreate.OriginalClip != (Object)(object)value; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static void SpoofAudioSourceClip(AudioSource __instance, ref AudioClip __result) { if (PatchConfig.AudioClipSpoofing && !bypassSpoofing) { AudioSourceAdditionalData orCreate = AudioSourceAdditionalData.GetOrCreate(__instance); __result = orCreate.OriginalClip; Debuggers.AudioClipSpoofing?.Log("(" + ((Object)((Component)__instance).gameObject).name + ") spoofing result to " + ((Object)orCreate.OriginalClip).name); } } } [HarmonyPatch(typeof(GameObject))] internal static class GameObjectPatch { [HarmonyPostfix] [HarmonyPatch("AddComponent", new Type[] { typeof(Type) })] internal static void NewAudioSource(GameObject __instance, ref Component __result) { Component obj = __result; AudioSource val = (AudioSource)(object)((obj is AudioSource) ? obj : null); if (val != null) { AudioSourceAdditionalData.GetOrCreate(val); } } } [HarmonyPatch(typeof(Logger))] internal static class LoggerPatch { [HarmonyPrefix] [HarmonyPatch("LogMessage")] private static void ReenableAndSaveConfigs(object data) { if (data is string text && text == "Chainloader startup complete") { loaforcsSoundAPI.Logger.LogInfo((object)"Starting Sound-pack loading pipeline"); SoundPackLoadPipeline.StartPipeline(); } } } internal static class PatchConfig { internal static bool AudioClipSpoofing { get; private set; } internal static void Bind(ConfigFile file) { AudioClipSpoofing = file.Bind<bool>("Experiments", "AudioClipSpoofing", false, "Should SoundAPI spoof the return value of AudioSource.clip? This can improve compatibility but is also fairly invasive.").Value; } } internal static class UnityObjectPatch { private static void InstantiatePatch(Object __result) { Debuggers.AudioSourceAdditionalData?.Log("aghuobr: " + __result.name); GameObject val = (GameObject)(object)((__result is GameObject) ? __result : null); if (val != null) { CheckInstantiationRecursively(val); } } internal static void Init(Harmony harmony) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown HarmonyMethod val = new HarmonyMethod(typeof(UnityObjectPatch).GetMethod("InstantiatePatch", BindingFlags.Static | BindingFlags.NonPublic)); MethodInfo[] methods = typeof(Object).GetMethods(); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo.Name != "Instantiate")) { Debuggers.AudioSourceAdditionalData?.Log($"patching {methodInfo}"); if (methodInfo.IsGenericMethod) { harmony.Patch((MethodBase)methodInfo.MakeGenericMethod(typeof(Object)), (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } else { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } } private static void CheckInstantiationRecursively(GameObject gameObject) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown AudioSourceAdditionalData audioSourceAdditionalData = default(AudioSourceAdditionalData); if (gameObject.TryGetComponent<AudioSourceAdditionalData>(ref audioSourceAdditionalData)) { return; } AudioSource[] components = gameObject.GetComponents<AudioSource>(); foreach (AudioSource source in components) { SoundReplacementHandler.CheckAudioSource(source); } foreach (Transform item in gameObject.transform) { Transform val = item; CheckInstantiationRecursively(((Component)val).gameObject); } } } } namespace loaforcsSoundAPI.Core.Networking { public abstract class NetworkAdapter { public abstract string Name { get; } public abstract void OnRegister(); } } namespace loaforcsSoundAPI.Core.JSON { public static class JSONDataLoader { private class MatchesJSONConverter : JsonConverter { public override bool CanConvert(Type objectType) { return objectType == typeof(List<string>); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 JToken val = JToken.Load(reader); if ((int)val.Type == 2) { return val.ToObject<List<string>>(); } return new List<string> { ((object)val).ToString() }; } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { serializer.Serialize(writer, value); } } private class IncludePrivatePropertiesContractResolver : DefaultContractResolver { internal IncludePrivatePropertiesContractResolver() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ((DefaultContractResolver)this).NamingStrategy = (NamingStrategy)new SnakeCaseNamingStrategy(); } protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) JsonProperty val = ((DefaultContractResolver)this).CreateProperty(member, memberSerialization); if (!val.Writable && member is PropertyInfo propertyInfo) { val.Writable = propertyInfo.GetSetMethod(nonPublic: true) != null; } return val; } } private class ConditionConverter : JsonConverter<Condition> { public override Condition ReadJson(JsonReader reader, Type objectType, Condition existingValue, bool hasExistingValue, JsonSerializer serializer) { JObject val = JObject.Load(reader); string text = ((object)val["type"])?.ToString(); if (string.IsNullOrEmpty(text)) { return new InvalidCondition(null); } Condition condition = SoundPackDataHandler.CreateCondition(text); if (condition == null) { return null; } serializer.Populate(((JToken)val).CreateReader(), (object)condition); if (condition.Constant == true) { if (!condition.Evaluate(DefaultConditionContext.DEFAULT)) { return ConstantCondition.FALSE; } return ConstantCondition.TRUE; } return condition; } public override void WriteJson(JsonWriter writer, Condition value, JsonSerializer serializer) { throw new NotImplementedException("no."); } } private static readonly JsonSerializerSettings _settings = new JsonSerializerSettings { ContractResolver = (IContractResolver)(object)new IncludePrivatePropertiesContractResolver(), Converters = new List<JsonConverter>(2) { (JsonConverter)(object)new MatchesJSONConverter(), (JsonConverter)(object)new ConditionConverter() } }; public static T LoadFromFile<T>(string path) { //IL_0061: Expected O, but got Unknown string text = File.ReadAllText(path); try { T val = JsonConvert.DeserializeObject<T>(text, _settings); if ((object)val is IFilePathAware filePathAware) { filePathAware.FilePath = path; } if ((object)val is Conditional conditional && conditional.Condition != null) { conditional.Condition.Parent = conditional; conditional.Condition.OnRegistered(); } return val; } catch (JsonReaderException val2) { JsonReaderException val3 = val2; loaforcsSoundAPI.Logger.LogError((object)$"Failed to read json file: 'plugins{Path.DirectorySeparatorChar}{Path.GetRelativePath(Paths.PluginPath, path)}'"); loaforcsSoundAPI.Logger.LogError((object)((Exception)(object)val3).Message); string[] array = text.Split("\n"); int num = int.MaxValue; for (int i = Mathf.Max(0, val3.LineNumber - 3); i < Mathf.Min(array.Length, val3.LineNumber + 3); i++) { int num2 = array[i].TakeWhile(char.IsWhiteSpace).Count(); num = Mathf.Min(num, num2); } for (int j = Mathf.Max(0, val3.LineNumber - 3); j < Mathf.Min(array.Length, val3.LineNumber + 3); j++) { string text2 = $"{(j + 1).ToString(),-5}| "; string text3 = array[j]; int num3 = Mathf.Min(array[j].Length, num); string text4 = text2 + text3.Substring(num3, text3.Length - num3).TrimEnd(); if (j + 1 == val3.LineNumber) { text4 += " // <- HERE"; } loaforcsSoundAPI.Logger.LogError((object)text4); } } return default(T); } } } namespace loaforcsSoundAPI.Core.Data { public interface IFilePathAware { string FilePath { get; internal set; } } public interface IValidatable { public enum ResultType { WARN, FAIL } public class ValidationResult { public ResultType Status { get; private set; } public string Reason { get; private set; } public ValidationResult(ResultType resultType, string reason = null) { Status = resultType; Reason = reason ?? string.Empty; base..ctor(); } } private static readonly StringBuilder _stringBuilder = new StringBuilder(); List<ValidationResult> Validate(); internal static bool LogAndCheckValidationResult(string context, List<ValidationResult> results, ManualLogSource logger) { if (results.Count == 0) { return true; } int num = 0; int num2 = 0; foreach (ValidationResult result in results) { switch (result.Status) { case ResultType.WARN: num++; break; case ResultType.FAIL: num2++; break; default: throw new ArgumentOutOfRangeException(); } } _stringBuilder.Clear(); if (num2 != 0) { _stringBuilder.Append(num2); _stringBuilder.Append(" fail(s)"); } if (num != 0) { if (num2 != 0) { _stringBuilder.Append(" and "); } _stringBuilder.Append(num); _stringBuilder.Append(" warning(s)"); } _stringBuilder.Append(" while "); _stringBuilder.Append(context); _stringBuilder.Append(": "); if (num2 != 0) { logger.LogError((object)_stringBuilder); } else { logger.LogWarning((object)_stringBuilder); } foreach (ValidationResult result2 in results) { switch (result2.Status) { case ResultType.WARN: logger.LogWarning((object)("WARN: " + result2.Reason)); break; case ResultType.FAIL: logger.LogError((object)("FAIL: " + result2.Reason)); break; default: throw new ArgumentOutOfRangeException(); } } return num2 == 0; } } }
plugins/me.loaforc.soundapi.repo.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("me.loaforc.soundapi.repo")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+48466f205a331bbfbabb327827601bfd154e03d3")] [assembly: AssemblyProduct("loaforcsSoundAPI.REPO")] [assembly: AssemblyTitle("me.loaforc.soundapi.repo")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace loaforcsSoundAPI.REPO { [BepInPlugin("me.loaforc.soundapi.repo", "loaforcsSoundAPI.REPO", "1.0.1")] public class SoundAPIREPO : BaseUnityPlugin { public static SoundAPIREPO Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } private void Awake() { Logger = Logger.CreateLogSource("me.loaforc.soundapi.repo"); Instance = this; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "me.loaforc.soundapi.repo"); Logger.LogInfo((object)"me.loaforc.soundapi.repo has loaded :3"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "me.loaforc.soundapi.repo"; public const string PLUGIN_NAME = "loaforcsSoundAPI.REPO"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace loaforcsSoundAPI.REPO.Patches { [HarmonyPatch(typeof(Sound))] internal static class SoundPatch { [HarmonyTranspiler] [HarmonyPatch("PlayLoop")] private static IEnumerable<CodeInstruction> FixLoopingSounds(IEnumerable<CodeInstruction> instructions) { //IL_0002: 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 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[5] { new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(Sound), "Source"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(Sound), "LoopClip"), (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.PropertySetter(typeof(AudioSource), "clip"), (string)null) }).Insert((CodeInstruction[])(object)new CodeInstruction[3] { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(Sound), "AudioInfoFetched")) }).InstructionEnumeration(); } [HarmonyPrefix] [HarmonyPatch("PlayLoop")] private static void ResetAudioInfoFetched(Sound __instance) { if (!Object.op_Implicit((Object)(object)__instance.Source.clip)) { __instance.AudioInfoFetched = false; } } } }
plugins/MenuLib.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.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.InputSystem; using UnityEngine.InputSystem.Controls; 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.5.0")] [assembly: AssemblyInformationalVersion("1.0.0+8820610107414251d3ab8ae6253536a4dd3fa7c9")] [assembly: AssemblyProduct("MenuLib")] [assembly: AssemblyTitle("MenuLib")] [assembly: AssemblyVersion("2.5.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.5.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<MenuPageRegions>, MenuPageRegions> <4>__MenuPageRegions_StartHook; public static Action<Action<MenuPageServerList>, MenuPageServerList> <5>__MenuPageServerList_StartHook; public static Action<Action<MenuPageLobby>, MenuPageLobby> <6>__MenuPageLobby_StartHook; public static Manipulator <7>__SemiFunc_UIMouseHoverILHook; public static Manipulator <8>__MenuPage_StateClosingILHook; public static Manipulator <9>__MenuScrollBox_UpdateILHook; public static Manipulator <10>__ChatManager_StateInactiveILHook; } 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 MenuPageRegions_StartHook(Action<MenuPageRegions> orig, MenuPageRegions self) { orig(self); MenuAPI.regionSelectionMenuBuilderDelegate?.Invoke(((Component)self).transform); } private static void MenuPageServerList_StartHook(Action<MenuPageServerList> orig, MenuPageServerList self) { orig(self); MenuAPI.serverListMenuBuilderDelegate?.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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) float num3 = SemiFunc.InputMovementY() / 20f; float num4 = SemiFunc.InputScrollY(); float num7; if (MenuAPI.customMenuPages.TryGetValue(menuPage, out var value)) { float? scrollSpeed = value.scrollView.scrollSpeed; if (scrollSpeed.HasValue) { float valueOrDefault = scrollSpeed.GetValueOrDefault(); valueOrDefault *= 10f; float num5 = Mathf.Abs((float)REPOReflection.menuScrollBox_ScrollerEndPosition.GetValue(menuScrollBox) - (float)REPOReflection.menuScrollBox_ScrollerStartPosition.GetValue(menuScrollBox)); float num6 = (num3 + (float)Math.Sign(num4)) * valueOrDefault / num5; Rect rect2 = menuScrollBox.scrollBarBackground.rect; num7 = num6 * ((Rect)(ref rect2)).height; goto IL_00c1; } } float num8 = (float)REPOReflection.menuScrollBox_ScrollHeight.GetValue(menuScrollBox); num7 = num3 / (num8 * 0.01f) + num4 / (num8 * 0.01f); goto IL_00c1; IL_00c1: float num9 = (float)REPOReflection.menuScrollBox_ScrollHandleTargetPosition.GetValue(menuScrollBox); REPOReflection.menuScrollBox_ScrollHandleTargetPosition.SetValue(menuScrollBox, num9 + num7); }); 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); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchStfld<MenuScrollBox>(instruction, "scrollAmount") }); val.Index -= 13; val.RemoveRange(14); val.EmitDelegate<Action<MenuScrollBox>>((Action<MenuScrollBox>)delegate(MenuScrollBox instance) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0060: 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_0075: 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_0032: 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) Rect rect; float num2; if (MenuAPI.customMenuPages.ContainsKey((MenuPage)REPOReflection.menuScrollBox_ParentPage.GetValue(instance))) { float num = ((Transform)instance.scrollHandle).localPosition.y + instance.scrollHandle.sizeDelta.y / 2f; rect = instance.scrollBarBackground.rect; num2 = num / ((Rect)(ref rect)).height; } else { float y = ((Transform)instance.scrollHandle).localPosition.y; rect = instance.scrollBarBackground.rect; num2 = y / ((Rect)(ref rect)).height * 1.1f; } REPOReflection.menuScrollBox_ScrollAmount.SetValue(instance, num2); }); } private static void ChatManager_StateInactiveILHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchStfld<ChatManager>(instruction, "chatActive") }); ILLabel val2 = val.DefineLabel(); val.Emit<REPOInputStringSystem>(OpCodes.Ldsfld, "hasAnyFocus"); val.Emit(OpCodes.Brfalse_S, (object)val2); val.Emit(OpCodes.Ret); val.MarkLabel(val2); } 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_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 //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_02fc: 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_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: 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 `MenuPageRegions.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageRegions), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageRegions>, MenuPageRegions>(MenuPageRegions_StartHook)); logger.LogDebug((object)"Hooking `MenuPageServerList.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageServerList), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageServerList>, MenuPageServerList>(MenuPageServerList_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.<7>__SemiFunc_UIMouseHoverILHook; if (obj == null) { Manipulator val = SemiFunc_UIMouseHoverILHook; <>O.<7>__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.<8>__MenuPage_StateClosingILHook; if (obj2 == null) { Manipulator val2 = MenuPage_StateClosingILHook; <>O.<8>__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.<9>__MenuScrollBox_UpdateILHook; if (obj3 == null) { Manipulator val3 = MenuScrollBox_UpdateILHook; <>O.<9>__MenuScrollBox_UpdateILHook = val3; obj3 = (object)val3; } new ILHook((MethodBase)methodInfo3, (Manipulator)obj3); logger.LogDebug((object)"Hooking `ChatManager.StateInactive`"); MethodInfo methodInfo4 = AccessTools.Method(typeof(ChatManager), "StateInactive", (Type[])null, (Type[])null); object obj4 = <>O.<10>__ChatManager_StateInactiveILHook; if (obj4 == null) { Manipulator val4 = ChatManager_StateInactiveILHook; <>O.<10>__ChatManager_StateInactiveILHook = val4; obj4 = (object)val4; } new ILHook((MethodBase)methodInfo4, (Manipulator)obj4); } } 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 BuilderDelegate regionSelectionMenuBuilderDelegate; internal static BuilderDelegate serverListMenuBuilderDelegate; 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 AddElementToRegionSelectionMenu(BuilderDelegate builderDelegate) { regionSelectionMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(regionSelectionMenuBuilderDelegate, builderDelegate); } public static void AddElementToServerListMenu(BuilderDelegate builderDelegate) { serverListMenuBuilderDelegate = (BuilderDelegate)Delegate.Combine(serverListMenuBuilderDelegate, 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", true); } 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 = "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 = "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 REPOInputField CreateREPOInputField(string labelText, Action<string> onValueChanged, Transform parent, Vector2 localPosition = default(Vector2), bool onlyNotifyOnSubmit = false, string placeholder = "", string defaultValue = "") { //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 = "Input Field - " + labelText; ((Transform)obj).localPosition = Vector2.op_Implicit(localPosition); REPOInputField rEPOInputField = ((Component)obj).gameObject.AddComponent<REPOInputField>(); ((TMP_Text)rEPOInputField.labelTMP).text = labelText; rEPOInputField.inputStringSystem.onValueChanged = onValueChanged; rEPOInputField.inputStringSystem.onlyNotifyOnSubmit = onlyNotifyOnSubmit; rEPOInputField.inputStringSystem.placeholder = placeholder; rEPOInputField.inputStringSystem.SetValue(defaultValue, notify: false); return rEPOInputField; } 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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; 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 menuScrollBox_ScrollAmount = AccessTools.Field(typeof(MenuScrollBox), "scrollAmount"); public static readonly FieldInfo menuScrollBox_ParentPage = AccessTools.Field(typeof(MenuScrollBox), "parentPage"); 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_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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected I4, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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 MenuManager instance = MenuManager.instance; if (!Object.op_Implicit((Object)(object)instance)) { throw new NullReferenceException("Error fetching templates... Ensure you're not creating UI elements too early, use \"MenuAPI.AddElementTo...\""); } foreach (MenuPages menuPage in 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 float previousFontSize; private float previousFontSizeMin; private float previousFontSizeMax; 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_00d8: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (((TMP_Text)labelTMP).text == previousText) { Vector2? val = overrideButtonSize; Vector2? val2 = previousOverrideButtonSize; if (val.HasValue == val2.HasValue && (!val.HasValue || val.GetValueOrDefault() == val2.GetValueOrDefault()) && Math.Abs(((TMP_Text)labelTMP).fontSize - previousFontSize) < float.Epsilon && Math.Abs(((TMP_Text)labelTMP).fontSizeMin - previousFontSizeMin) < float.Epsilon && Math.Abs(((TMP_Text)labelTMP).fontSizeMax - previousFontSizeMax) < float.Epsilon) { return; } } base.rectTransform.sizeDelta = (Vector2)(((??)overrideButtonSize) ?? GetLabelSize()); previousText = ((TMP_Text)labelTMP).text; previousOverrideButtonSize = overrideButtonSize; previousFontSize = ((TMP_Text)labelTMP).fontSize; previousFontSizeMin = ((TMP_Text)labelTMP).fontSizeMin; previousFontSizeMax = ((TMP_Text)labelTMP).fontSizeMax; } 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 REPOInputField : REPOElement { public TextMeshProUGUI labelTMP; public REPOInputStringSystem inputStringSystem; private RectTransform inputAreaRectTransform; private MenuPage menuPage; private MenuSelectableElement menuSelectableElement; 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: 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_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; base.rectTransform = (RectTransform)(object)((transform is RectTransform) ? transform : null); menuPage = ((Component)this).GetComponentInParent<MenuPage>(); menuSelectableElement = ((Component)this).GetComponent<MenuSelectableElement>(); labelTMP = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(); RectTransform obj = ((TMP_Text)labelTMP).rectTransform; obj.sizeDelta -= new Vector2(0f, 10f); Vector3 val = Vector3.right * 100f; Transform obj2 = ((Component)this).transform.Find("SliderBG"); obj2.localPosition += val; Transform obj3 = ((Component)this).transform.Find("RawImage"); obj3.localPosition += val; Transform obj4 = ((Component)this).transform.Find("RawImage (1)"); obj4.localPosition += val; RectTransform obj5 = ((TMP_Text)labelTMP).rectTransform; ((Transform)obj5).localPosition = ((Transform)obj5).localPosition + val; TextMeshProUGUI val2 = null; for (int i = 0; i < ((Component)this).transform.childCount; i++) { Transform child = ((Component)this).transform.GetChild(i); switch (((Object)child).name) { case "Option Box": case "Option Box Behind": case "RawImage (2)": Object.Destroy((Object)(object)((Component)child).gameObject); break; case "Button BUTTON": if (!Object.op_Implicit((Object)(object)val2)) { val2 = ((Component)((Component)child).GetComponent<MenuButton>()).GetComponentInChildren<TextMeshProUGUI>(); ((TMP_Text)val2).transform.SetParent(child.parent); } Object.Destroy((Object)(object)((Component)child).gameObject); break; } } ((TMP_Text)val2).rectTransform.pivot = Vector2.zero; ((TMP_Text)val2).fontStyle = (FontStyles)0; ((TMP_Text)val2).enableAutoSizing = false; ((TMP_Text)val2).alignment = (TextAlignmentOptions)513; ((TMP_Text)val2).margin = new Vector4(2f, 2f, 0f, 0f); TextMeshProUGUI obj6 = val2; TextMeshProUGUI obj7 = val2; float num2 = (((TMP_Text)val2).fontSize = 18f); float fontSizeMax = (((TMP_Text)obj7).fontSizeMin = num2); ((TMP_Text)obj6).fontSizeMax = fontSizeMax; GameObject val3 = new GameObject("Input Area"); val3.transform.parent = ((Component)this).transform; inputAreaRectTransform = val3.AddComponent<RectTransform>(); inputAreaRectTransform.sizeDelta = new Vector2(146.5f, 20f); inputAreaRectTransform.pivot = Vector2.zero; ((Transform)inputAreaRectTransform).localPosition = new Vector3(2f, 2.5f, 0f) + val; ((Component)inputAreaRectTransform).gameObject.AddComponent<RectMask2D>(); ((TMP_Text)val2).transform.SetParent((Transform)(object)inputAreaRectTransform); Transform transform2 = ((TMP_Text)val2).transform; Vector2 val5 = (((TMP_Text)val2).rectTransform.sizeDelta = Vector2.op_Implicit(Vector3.zero)); transform2.localPosition = Vector2.op_Implicit(val5); Object.Destroy((Object)(object)((Component)this).GetComponent<MenuSettingElement>()); Object.Destroy((Object)(object)((Component)this).GetComponent<AudioButtonPushToTalk>()); inputStringSystem = ((Component)this).gameObject.AddComponent<REPOInputStringSystem>(); inputStringSystem.inputTMP = (TMP_Text)(object)val2; inputStringSystem.maskRectTransform = inputAreaRectTransform; } private void Update() { inputStringSystem.SetHovering(SemiFunc.UIMouseHover(menuPage, inputAreaRectTransform, (string)REPOReflection.menuSelectableElement_MenuID.GetValue(menuSelectableElement), 2f, 2f)); if (Mouse.current.leftButton.wasPressedThisFrame) { inputStringSystem.isFocused = inputStringSystem.isHovering; } } } public sealed class REPOInputStringSystem : MonoBehaviour { public struct Colors { public Color focusedColor; public Color hoverColor; public Color unfocusedColor; public Color placeholderColor; public Color characterAddedColor; public Color characterRemovedColor; public Colors() { //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_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_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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) focusedColor = Color.white; hoverColor = Color.white; unfocusedColor = new Color(0.5f, 0.5f, 0.5f); placeholderColor = new Color(1f, 0.6f, 0.4f); characterAddedColor = new Color(0.5f, 1f, 0.5f); characterRemovedColor = new Color(1f, 0.5f, 0.5f); } } public static bool hasAnyFocus; public TMP_Text inputTMP; public RectTransform maskRectTransform; public Action<string> onValueChanged; public Colors colors = new Colors(); public string placeholder = string.Empty; public bool onlyNotifyOnSubmit; public bool disableMovement = true; private string previousValue; private float timeSinceCharacterAdded = 1f; private float timeSinceCharacterRemoved = 1f; private bool pressedSubmit; private bool _isFocused; public string currentValue { get; private set; } public bool isHovering { get; private set; } public bool isFocused { get { return _isFocused; } set { //IL_004f: 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_0065: Unknown result type (might be due to invalid IL or missing references) if (!value) { if (_isFocused) { MoveTMP(reset: true); } } else if (!isFocused) { if (IsTMPInMask()) { MoveTMP(reset: true); } else { float num = 0f - inputTMP.GetPreferredValues(currentValue + "<b>|</b>").x; Rect rect = maskRectTransform.rect; MoveTMP(reset: true, num + ((Rect)(ref rect)).width - 6f); } ((SemiUI)ChatUI.instance).Hide(); } hasAnyFocus = (_isFocused = value); } } private bool shouldUsePlaceholder => string.IsNullOrEmpty(currentValue); public void SetValue(string value, bool notify) { string text2 = (currentValue = value); previousValue = text2; if (notify) { onValueChanged?.Invoke(value); } } public void SetHovering(bool value) { if (value && !isHovering) { MenuManager.instance.MenuEffectHover(SemiFunc.MenuGetPitchFromYPos(inputTMP.rectTransform), -1f); } isHovering = value; } private void Update() { if (!Object.op_Implicit((Object)(object)inputTMP)) { return; } if (disableMovement && isFocused) { InputManager instance = InputManager.instance; if (instance != null) { instance.DisableMovement(); } } HandleInput(); UpdateColors(); if (pressedSubmit) { isFocused = false; pressedSubmit = false; if (onlyNotifyOnSubmit) { onValueChanged?.Invoke(currentValue); } } if (!onlyNotifyOnSubmit && previousValue != currentValue) { onValueChanged?.Invoke(currentValue); } if (isFocused) { inputTMP.text = currentValue; if (timeSinceCharacterAdded < 0.5f || timeSinceCharacterRemoved < 0.5f || Mathf.Sin(Time.time * 10f) > 0f) { TMP_Text obj = inputTMP; obj.text += "<b>|</b>"; } } else { inputTMP.text = (shouldUsePlaceholder ? placeholder : currentValue); } previousValue = currentValue; } private void OnDestroy() { hasAnyFocus = false; } private void HandleInput() { //IL_012b: 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) if (timeSinceCharacterAdded < 1f) { timeSinceCharacterAdded += Time.deltaTime; } if (timeSinceCharacterRemoved < 1f) { timeSinceCharacterRemoved += Time.deltaTime; } if (!isFocused) { return; } string previousText = currentValue; if (Keyboard.current.ctrlKey.isPressed) { if (((ButtonControl)Keyboard.current.cKey).wasPressedThisFrame) { GUIUtility.systemCopyBuffer = currentValue; } else if (((ButtonControl)Keyboard.current.xKey).wasPressedThisFrame) { GUIUtility.systemCopyBuffer = currentValue; currentValue = null; timeSinceCharacterRemoved = 0f; MoveTMP(reset: true); } else if (((ButtonControl)Keyboard.current.vKey).wasPressedThisFrame) { currentValue += GUIUtility.systemCopyBuffer.Replace("\n", string.Empty); timeSinceCharacterAdded = 0f; if (IsTMPInMask()) { MoveTMP(reset: true); return; } float num = 0f - inputTMP.GetPreferredValues(currentValue + "<b>|</b>").x; Rect rect = maskRectTransform.rect; MoveTMP(reset: true, num + ((Rect)(ref rect)).width - 6f); } return; } string inputString = Input.inputString; if (!(inputString == "\b")) { if (inputString == "\r") { pressedSubmit = true; } else if (!string.IsNullOrEmpty(inputString)) { currentValue += inputString; timeSinceCharacterAdded = 0f; if (IsTMPInMask()) { MoveTMP(reset: true); } else { MoveTMP(reset: false, 0f - CalculateTMPDifference(previousText, currentValue)); } } } else if (currentValue.Length > 0) { currentValue = currentValue.Remove(currentValue.Length - 1, 1); timeSinceCharacterRemoved = 0f; if (IsTMPInMask()) { MoveTMP(reset: true); } else { MoveTMP(reset: false, 0f - CalculateTMPDifference(previousText, currentValue)); } } } private void UpdateColors() { //IL_0019: 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_005c: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (timeSinceCharacterAdded < 0.1f) { ((Graphic)inputTMP).color = colors.characterAddedColor; } else if (timeSinceCharacterRemoved < 0.1f) { ((Graphic)inputTMP).color = colors.characterRemovedColor; } else if (isHovering) { ((Graphic)inputTMP).color = colors.hoverColor; } else if (isFocused) { ((Graphic)inputTMP).color = colors.focusedColor; } else { ((Graphic)inputTMP).color = (shouldUsePlaceholder ? colors.placeholderColor : colors.unfocusedColor); } } private void MoveTMP(bool reset, float moveBy = 0f) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (reset) { inputTMP.transform.localPosition = Vector3.zero; } if (moveBy != 0f) { Transform transform = inputTMP.transform; transform.localPosition += Vector3.right * moveBy; } } private float CalculateTMPDifference(string previousText, string newText) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) return inputTMP.GetPreferredValues(newText).x - inputTMP.GetPreferredValues(previousText).x; } private bool IsTMPInMask() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) float x = inputTMP.GetPreferredValues(currentValue).x; Rect rect = maskRectTransform.rect; return x < ((Rect)(ref rect)).width - 6f; } } 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 delegate bool ShouldCloseMenuDelegate(); public RectTransform rectTransform; public RectTransform maskRectTransform; public RectTransform scrollBarRectTransform; public MenuPage menuPage; public TextMeshProUGUI headerTMP; public MenuScrollBox menuScrollBox; public REPOScrollView scrollView; [Obsolete("Use onEscapePressed instead.")] public bool closeMenuOnEscape = true; public ShouldCloseMenuDelegate onEscapePressed; 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>()); MenuAPI.customMenuPages.Add(menuPage, this); } 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); } scrollView.SetScrollPosition(0f); } 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 && (onEscapePressed == null || onEscapePressed())) { ClosePage(closePagesAddedOnTop: false); } } } private void OnDestroy() { MenuAPI.customMenuPages.Remove(menuPage); } 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_015d: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_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 height = ((Rect)(ref rect)).height; rect = menuScrollBox.scrollBarBackground.rect; menuScrollBox_ScrollerStartPosition.SetValue(menuScrollBox, Math.Abs(num5 / (1f - height / ((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.Clam
plugins/MoreHead.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using MenuLib; using Microsoft.CodeAnalysis; using MoreHead; using Photon.Pun; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("MoreHead")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MoreHead")] [assembly: AssemblyTitle("MoreHead")] [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; } } } [BepInPlugin("Mhz.REPOMoreHead", "MoreHead", "1.0.0")] public class Morehead : BaseUnityPlugin { public static ManualLogSource? Logger; public static Morehead? Instance { get; private set; } 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(MenuPlayerVisualsPatch)); val.PatchAll(typeof(GameDirectorUpdatePatch)); val.PatchAll(typeof(PlayerRevivePatch)); Logger.LogInfo((object)"MoreHead 已加载"); HeadDecorationManager.Initialize(); ConfigManager.Initialize(); MoreHeadUI.Initialize(); } catch (Exception ex) { Logger.LogError((object)("Harmony补丁应用失败: " + ex.Message)); } } private void OnApplicationQuit() { ConfigManager.SaveConfig(); } public static bool GetDecorationState(string? name) { return HeadDecorationManager.GetDecorationState(name); } } [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) { //IL_012f: 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_0155: 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) try { if ((Object)(object)playerAvatar?.playerAvatarVisuals == (Object)null) { return; } Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform val = ((Component)playerAvatar.playerAvatarVisuals).transform.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 = ((Component)playerAvatar.playerAvatarVisuals).transform.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 = ((Component)playerAvatar.playerAvatarVisuals).transform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side"); if ((Object)(object)val3 != (Object)null) { dictionary["body"] = val3; } if (dictionary.Count == 0) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogWarning((object)"找不到任何装饰物父级节点"); } return; } foreach (KeyValuePair<string, Transform> item in dictionary) { string key = item.Key; Transform value = item.Value; Transform val4 = value.Find("HeadDecorations"); if ((Object)(object)val4 == (Object)null) { val4 = new GameObject("HeadDecorations").transform; val4.SetParent(value, false); val4.localPosition = Vector3.zero; val4.localRotation = Quaternion.identity; val4.localScale = Vector3.one; } } foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { if (dictionary.TryGetValue(decoration.ParentTag, out var value2)) { Transform val5 = value2.Find("HeadDecorations"); if ((Object)(object)val5 != (Object)null) { UpdateDecoration(val5, decoration.Name, 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 void UpdateDecoration(Transform parent, string? decorationName, bool showDecoration) { Transform val = parent.Find(decorationName); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(showDecoration); } } public static void UpdateMenuPlayerDecorations() { //IL_011f: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) try { PlayerAvatarVisuals val = FindMenuPlayerVisuals(); if ((Object)(object)val == (Object)null) { return; } Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform val2 = ((Component)val).transform.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)val2 != (Object)null) { dictionary["head"] = val2; } Transform val3 = ((Component)val).transform.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)val3 != (Object)null) { dictionary["neck"] = val3; } Transform val4 = ((Component)val).transform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side"); if ((Object)(object)val4 != (Object)null) { dictionary["body"] = val4; } if (dictionary.Count == 0) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogWarning((object)"找不到任何菜单角色装饰物父级节点"); } return; } foreach (KeyValuePair<string, Transform> item in dictionary) { string key = item.Key; Transform value = item.Value; Transform val5 = value.Find("HeadDecorations"); if ((Object)(object)val5 == (Object)null) { val5 = new GameObject("HeadDecorations").transform; val5.SetParent(value, false); val5.localPosition = Vector3.zero; val5.localRotation = Quaternion.identity; val5.localScale = Vector3.one; } } foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { if (dictionary.TryGetValue(decoration.ParentTag, out var value2)) { Transform val6 = value2.Find("HeadDecorations"); if ((Object)(object)val6 != (Object)null) { Transform val7 = val6.Find(decoration.Name); if ((Object)(object)val7 == (Object)null) { AddMenuDecoration(val6, decoration.Name); } else { ((Component)val7).gameObject.SetActive(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() { GameObject val = GameObject.Find("PlayerAvatarMenu"); if ((Object)(object)val == (Object)null) { return null; } return val.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> dictionary = new Dictionary<string, Transform>(); Transform val = ((Component)component.playerAvatarVisuals).transform.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 = ((Component)component.playerAvatarVisuals).transform.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 = ((Component)component.playerAvatarVisuals).transform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side"); if ((Object)(object)val3 != (Object)null) { dictionary["body"] = val3; } for (int i = 0; i < names.Length; i++) { string decorationName = names[i]; bool showDecoration = states[i]; string key = parentTags[i]; if (dictionary.TryGetValue(key, out var value)) { Transform val4 = value.Find("HeadDecorations"); if ((Object)(object)val4 != (Object)null) { UpdateDecoration(val4, decorationName, showDecoration); } } } } catch (Exception ex) { ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogError((object)("RPC更新所有装饰物状态失败: " + ex.Message)); } } } private void UpdateDecoration(Transform parent, string decorationName, bool showDecoration) { Transform val = parent.Find(decorationName); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(showDecoration); } } } [HarmonyPatch(typeof(PlayerAvatarVisuals))] [HarmonyPatch("Start")] internal class PlayerAvatarVisualsPatch { private static void Postfix(PlayerAvatarVisuals __instance) { //IL_0103: 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_0129: 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) try { Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform val = ((Component)__instance).transform.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 = ((Component)__instance).transform.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 = ((Component)__instance).transform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side"); if ((Object)(object)val3 != (Object)null) { dictionary["body"] = val3; } if (dictionary.Count == 0) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)"找不到任何装饰物父级节点"); } return; } foreach (KeyValuePair<string, Transform> item in dictionary) { string key = item.Key; Transform value = item.Value; Transform val4 = value.Find("HeadDecorations"); if ((Object)(object)val4 == (Object)null) { val4 = new GameObject("HeadDecorations").transform; val4.SetParent(value, false); val4.localPosition = Vector3.zero; val4.localRotation = Quaternion.identity; val4.localScale = Vector3.one; } } foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { if (dictionary.TryGetValue(decoration.ParentTag, out var value2)) { Transform val5 = value2.Find("HeadDecorations"); if ((Object)(object)val5 != (Object)null) { AddNewDecoration(val5, decoration, __instance); } } else { ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogWarning((object)("初始化时找不到装饰物 " + decoration.DisplayName + " 的父级节点: " + decoration.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)); } } } 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(PlayerAvatarVisuals))] [HarmonyPatch("Start")] internal class MenuPlayerVisualsPatch { private static void Postfix(PlayerAvatarVisuals __instance) { //IL_011a: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) try { if (!__instance.isMenuAvatar) { return; } Dictionary<string, Transform> dictionary = new Dictionary<string, Transform>(); Transform val = ((Component)__instance).transform.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 = ((Component)__instance).transform.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 = ((Component)__instance).transform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT/_____________________________________/ANIM BODY TOP/code_body_top_up/code_body_top_side"); if ((Object)(object)val3 != (Object)null) { dictionary["body"] = val3; } if (dictionary.Count == 0) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogWarning((object)"找不到任何菜单角色装饰物父级节点"); } return; } foreach (KeyValuePair<string, Transform> item in dictionary) { string key = item.Key; Transform value = item.Value; Transform val4 = value.Find("HeadDecorations"); if ((Object)(object)val4 == (Object)null) { val4 = new GameObject("HeadDecorations").transform; val4.SetParent(value, false); val4.localPosition = Vector3.zero; val4.localRotation = Quaternion.identity; val4.localScale = Vector3.one; } foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { if (decoration.ParentTag == key) { PlayerUpdatePatch.AddMenuDecoration(val4, decoration.Name); } } } } catch (Exception ex) { ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogError((object)("初始化菜单角色装饰物失败: " + ex.Message)); } } } } [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 { 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)); } } } private static IEnumerator DelayedSync(PlayerAvatar playerAvatar) { yield return null; yield return (object)new WaitForSeconds(0.2f); try { PlayerUpdatePatch.UpdatePlayerDecorations(playerAvatar); } catch (Exception e2) { ManualLogSource? logger = Morehead.Logger; if (logger != null) { logger.LogError((object)("更新玩家装饰物状态失败: " + e2.Message)); } } yield return (object)new WaitForSeconds(0.1f); try { HeadDecorationSync syncComponent = ((Component)playerAvatar).GetComponent<HeadDecorationSync>(); if ((Object)(object)syncComponent != (Object)null) { syncComponent.SyncAllDecorations(); yield break; } ManualLogSource? logger2 = Morehead.Logger; if (logger2 != null) { logger2.LogWarning((object)"玩家复活后找不到HeadDecorationSync组件"); } } catch (Exception e) { ManualLogSource? logger3 = Morehead.Logger; if (logger3 != null) { logger3.LogError((object)("同步装饰物状态失败: " + e.Message)); } } } } namespace MoreHead { public static class ConfigManager { private static Dictionary<string?, bool> _decorationStates = new Dictionary<string, bool>(); private static ManualLogSource? Logger => Morehead.Logger; private static string ConfigFilePath { 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 { LoadConfig(); ApplySavedStates(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("初始化配置管理器时出错: " + ex.Message)); } } } private static void LoadConfig() { try { _decorationStates.Clear(); if (!File.Exists(ConfigFilePath)) { return; } string[] array = File.ReadAllLines(ConfigFilePath); 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) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)$"已加载配置,包含 {_decorationStates.Count} 个装饰物状态"); } } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("加载配置时出错: " + ex.Message)); } _decorationStates.Clear(); } } public static void SaveConfig() { try { UpdateConfigData(); List<string> list = new List<string>(); foreach (KeyValuePair<string, bool> decorationState in _decorationStates) { list.Add(decorationState.Key + "=" + (decorationState.Value ? "1" : "0")); } File.WriteAllLines(ConfigFilePath, list); } 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; } } private 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 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 static class HeadDecorationManager { 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" } }; private static ManualLogSource? Logger => Morehead.Logger; public static List<DecorationInfo> Decorations { get; private set; } = new List<DecorationInfo>(); public static void Initialize() { try { 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 text2 = FindPluginsDirectory(directoryName); if (!string.IsNullOrEmpty(text2) && Directory.Exists(text2)) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogInfo((object)("找到BepInEx/plugins目录: " + text2)); } string[] files2 = Directory.GetFiles(text2, "*.hhh", SearchOption.AllDirectories); list.AddRange(files2); ManualLogSource? logger4 = Logger; if (logger4 != null) { logger4.LogInfo((object)$"在plugins目录中找到 {files2.Length} 个.hhh文件"); } } else { ManualLogSource? logger5 = Logger; if (logger5 != null) { logger5.LogWarning((object)"无法找到BepInEx/plugins目录,将只加载本地装饰物"); } } } catch (Exception ex) { ManualLogSource? logger6 = Logger; if (logger6 != null) { logger6.LogError((object)("搜索plugins目录时出错: " + ex.Message)); } } list = list.Distinct().ToList(); if (list.Count == 0) { ManualLogSource? logger7 = Logger; if (logger7 != null) { logger7.LogWarning((object)"未找到任何装饰物包文件,请确保.hhh文件已放置"); } } else { ManualLogSource? logger8 = Logger; if (logger8 != null) { logger8.LogInfo((object)$"找到 {list.Count} 个装饰物包文件"); } if (files.Length != 0) { ManualLogSource? logger9 = Logger; if (logger9 != null) { logger9.LogInfo((object)$"- Decorations目录: {files.Length} 个文件"); } } } foreach (string item in list) { LoadDecorationBundle(item); } } catch (Exception ex2) { ManualLogSource? logger10 = Logger; if (logger10 != null) { logger10.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 }; Decorations.Add(decorationInfo); 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"]; } private static string? FindPluginsDirectory(string startDirectory) { try { string text = startDirectory; for (int i = 0; i < 5; i++) { string fileName = Path.GetFileName(text); if (string.Equals(fileName, "plugins", StringComparison.OrdinalIgnoreCase)) { string directoryName = Path.GetDirectoryName(text); if (directoryName != null) { string fileName2 = Path.GetFileName(directoryName); if (string.Equals(fileName2, "BepInEx", StringComparison.OrdinalIgnoreCase)) { return text; } } } string text2 = Path.Combine(text, "BepInEx", "plugins"); if (Directory.Exists(text2)) { return text2; } string directoryName2 = Path.GetDirectoryName(text); if (string.IsNullOrEmpty(directoryName2) || directoryName2 == text) { break; } text = directoryName2; } string pathRoot = Path.GetPathRoot(startDirectory); if (!string.IsNullOrEmpty(pathRoot)) { string text3 = Path.Combine(pathRoot, "REPO", "BepInEx", "plugins"); if (Directory.Exists(text3)) { return text3; } string[] array = new string[4] { Path.Combine(pathRoot, "Program Files (x86)", "Steam", "steamapps", "common", "REPO"), Path.Combine(pathRoot, "Program Files", "Steam", "steamapps", "common", "REPO"), Path.Combine(pathRoot, "SteamLibrary", "steamapps", "common", "REPO"), Path.Combine(pathRoot, "Games", "REPO") }; string[] array2 = array; foreach (string path in array2) { string text4 = Path.Combine(path, "BepInEx", "plugins"); if (Directory.Exists(text4)) { return text4; } } } return null; } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("查找plugins目录时出错: " + ex.Message)); } return null; } } } public static class MoreHeadUI { private static REPOButton? menuButton; private static REPOPopupPage? decorationsPage; private static Dictionary<string?, REPOButton> decorationButtons = new Dictionary<string, REPOButton>(); 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 const string PAGE_TITLE = "Rotate robot: A/D"; private static ManualLogSource? Logger => Morehead.Logger; public static void Initialize() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0042: 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_0068: Expected O, but got Unknown try { ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"正在初始化MoreHead UI..."); } menuButton = new REPOButton("<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); MenuAPI.AddElementToEscapeMenu((REPOElement)(object)menuButton, new Vector2(0f, 0f)); decorationsPage = new REPOPopupPage("Rotate robot: A/D", (Action<REPOPopupPage>)SetupPopupPage); CreatePageContent(); ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogInfo((object)"MoreHead UI初始化完成"); } } catch (Exception ex) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("初始化UI时出错: " + ex.Message)); } } } private static void SetupPopupPage(REPOPopupPage page) { //IL_000d: 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) try { page.SetSize(new Vector2(300f, 350f)); page.SetBackgroundDimming(true); page.SetMaskPadding((Padding?)new Padding(10f, 20f, 20f, 10f)); AddAuthorCredit(page); 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 AddAuthorCredit(REPOPopupPage page) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) try { REPOButton val = new REPOButton("<size=10><color=#FFFFA0>Masaicker</color> and <color=#FFFFA0>Yuriscat</color> co-developed.\n由<color=#FFFFA0>马赛克了</color>和<color=#FFFFA0>尤里的猫</color>共同制作。</size>", (Action)delegate { }); ((REPOSimplePage)page).AddElementToPage((REPOElement)(object)val, new Vector2(300f, 345f)); try { MenuManager obj = Object.FindObjectOfType<MenuManager>(); if (obj != null) { ((MonoBehaviour)obj).StartCoroutine(DelayedStyleAuthorCredit(val)); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)("无法修改作者标记样式: " + ex.Message)); } } ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogInfo((object)"添加作者标记完成"); } } catch (Exception ex2) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("添加作者标记时出错: " + ex2.Message)); } } } private static IEnumerator DelayedStyleAuthorCredit(REPOButton button) { yield return null; try { GameObject buttonObj = null; Button[] allButtons = Object.FindObjectsOfType<Button>(); Button[] array = allButtons; foreach (Button btn in array) { if (((Object)btn).name.Contains("Masaicker") && ((Object)btn).name.Contains("Yuriscat")) { buttonObj = ((Component)btn).gameObject; break; } } if (!((Object)(object)buttonObj != (Object)null)) { yield break; } Button buttonComponent = buttonObj.GetComponent<Button>(); if (!((Object)(object)buttonComponent != (Object)null)) { yield break; } ((Selectable)buttonComponent).interactable = false; Image[] images = buttonObj.GetComponentsInChildren<Image>(); Image[] array2 = images; foreach (Image image in array2) { if ((Object)(object)((Component)image).gameObject != (Object)(object)((Component)buttonComponent).gameObject) { ((Behaviour)image).enabled = false; } } } catch (Exception e) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)("修改作者标记样式失败: " + e.Message)); } } } private static void OnMenuButtonClick() { try { UpdateButtonStates(); REPOPopupPage? obj = decorationsPage; if (obj != null) { ((REPOSimplePage)obj).OpenPage(false); } SetHeaderPosition(); MovePlayerAvatarToFront(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("打开设置页面时出错: " + ex.Message)); } } } private static void SetHeaderPosition() { try { MonoBehaviour obj = Object.FindObjectOfType<MonoBehaviour>(); if (obj != null) { obj.StartCoroutine(DelayedSetHeaderPosition()); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("设置标题位置时出错: " + ex.Message)); } } } private static IEnumerator DelayedSetHeaderPosition() { yield return null; try { FieldInfo headerTransformField = typeof(REPOPopupPage).GetField("headerTransform", BindingFlags.Instance | BindingFlags.NonPublic); if (headerTransformField != null) { object? value = headerTransformField.GetValue(decorationsPage); RectTransform headerTransform = (RectTransform)((value is RectTransform) ? value : null); if ((Object)(object)headerTransform != (Object)null) { ((Transform)headerTransform).localPosition = new Vector3(185.5049f, 368.9677f, 0f); yield break; } ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"headerTransform为空"); } } else { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)"找不到headerTransform字段"); } } } catch (Exception e) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("延迟设置标题位置时出错: " + e.Message)); } } } private static void AdjustBoolSettingPosition() { try { MonoBehaviour obj = Object.FindObjectOfType<MonoBehaviour>(); if (obj != null) { obj.StartCoroutine(DelayedAdjustBoolSettingPosition()); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("调整Bool Setting位置时出错: " + ex.Message)); } } } private static IEnumerator DelayedAdjustBoolSettingPosition() { yield return null; try { object? value = AccessTools.Field(typeof(REPOPopupPage), "menuPage").GetValue(decorationsPage); MenuPage menuPage = (MenuPage)((value is MenuPage) ? value : null); if (!((Object)(object)menuPage != (Object)null)) { yield break; } Transform boolSetting = null; foreach (Transform item in ((Component)menuPage).transform) { Transform child = item; if ((Object)(object)child != (Object)null && ((Object)child).name.Contains("Bool Setting")) { boolSetting = child; break; } } if ((Object)(object)boolSetting != (Object)null) { RectTransform rectTransform = ((Component)boolSetting).GetComponent<RectTransform>(); if ((Object)(object)rectTransform != (Object)null) { ((Transform)rectTransform).localPosition = new Vector3(70f, 202.5f, 0f); } } else { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"找不到Bool Setting - (Clone)对象"); } } } catch (Exception e) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("延迟调整Bool Setting位置时出错: " + e.Message)); } } } private static void CreatePageContent() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) try { for (int i = 0; i < HeadDecorationManager.Decorations.Count; i++) { DecorationInfo decoration = HeadDecorationManager.Decorations[i]; REPOButton val = new REPOButton(GetButtonText(decoration.DisplayName?.ToUpper(), decoration.IsVisible), (Action)delegate { OnDecorationButtonClick(decoration.Name); }); int num = -(i * 20); REPOPopupPage? obj = decorationsPage; if (obj != null) { obj.AddElementToScrollView((REPOElement)(object)val, new Vector2(0f, (float)num)); } decorationButtons[decoration.Name ?? string.Empty] = val; } REPOButton val2 = new REPOButton("<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); REPOPopupPage? obj2 = decorationsPage; if (obj2 != null) { ((REPOSimplePage)obj2).AddElementToPage((REPOElement)(object)val2, new Vector2(301f, 0f)); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("创建页面内容时出错: " + ex.Message)); } } } private static void UpdateButtonStates() { try { foreach (DecorationInfo decoration in HeadDecorationManager.Decorations) { if (decorationButtons.TryGetValue(decoration.Name ?? string.Empty, out REPOButton value)) { value.SetText(GetButtonText(decoration.DisplayName?.ToUpper(), decoration.IsVisible)); } } } 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); if (decorationButtons.TryGetValue(decorationName2, out REPOButton value)) { value.SetText(GetButtonText(decorationInfo.DisplayName?.ToUpper(), isEnabled)); } else { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)("OnDecorationButtonClick: 找不到装饰物 " + decorationName2 + " 的按钮")); } } UpdateDecorations(); ConfigManager.SaveConfig(); } catch (Exception ex) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("切换装饰物 " + decorationName2 + " 状态时出错: " + ex.Message)); } } } private static void OnCloseButtonClick() { try { MenuManager.instance.PageCloseAll(); } 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 string GetButtonText(string? name, bool isEnabled) { return "<size=16>" + (isEnabled ? "<color=#00FF00>[ON]</color>" : "<color=#FF0000>[OFF]</color>") + " " + name + "</size>"; } private static void MovePlayerAvatarToFront() { try { MonoBehaviour obj = Object.FindObjectOfType<MonoBehaviour>(); if (obj != null) { obj.StartCoroutine(DelayedMovePlayerAvatarToFront()); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("移动玩家模型时出错: " + ex.Message)); } } } private static IEnumerator DelayedMovePlayerAvatarToFront() { yield return null; try { PlayerAvatarMenuHover playerAvatarHover = Object.FindObjectOfType<PlayerAvatarMenuHover>(); if ((Object)(object)playerAvatarHover != (Object)null) { GameObject playerAvatarObj2 = ((Component)((Component)playerAvatarHover).transform.parent).gameObject; object? value = AccessTools.Field(typeof(REPOPopupPage), "menuPage").GetValue(decorationsPage); MenuPage menuPage2 = (MenuPage)((value is MenuPage) ? value : null); if ((Object)(object)menuPage2 != (Object)null) { playerAvatarObj2.transform.SetParent(((Component)menuPage2).transform, true); playerAvatarObj2.transform.SetAsLastSibling(); playerAvatarObj2.transform.localPosition = new Vector3(-76f, -30f, 0f); } yield break; } GameObject playerAvatarObj = GameObject.Find("Menu Element Player Avatar"); if ((Object)(object)playerAvatarObj != (Object)null) { object? value2 = AccessTools.Field(typeof(REPOPopupPage), "menuPage").GetValue(decorationsPage); MenuPage menuPage = (MenuPage)((value2 is MenuPage) ? value2 : null); if ((Object)(object)menuPage != (Object)null) { playerAvatarObj.transform.SetParent(((Component)menuPage).transform, true); playerAvatarObj.transform.SetAsLastSibling(); playerAvatarObj.transform.localPosition = new Vector3(-76f, -30f, 0f); ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"已通过名称查找将玩家模型移动到前面,并设置坐标为(-76, -30, 0)"); } } } else { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)"找不到玩家模型对象"); } } } catch (Exception e) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("延迟移动玩家模型时出错: " + e.Message)); } } } } }
plugins/MoreHeadUtilities.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using MenuLib; using MenuLib.MonoBehaviors; using Microsoft.CodeAnalysis; using MoreHead; using MoreHead.MoreHead.Patchers; using MoreHeadUtilities.Plugin; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("MoreHeadUtilities")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+3911decbf9634d63ae1bca5173060ee0fee13c40")] [assembly: AssemblyProduct("MoreHeadUtilities")] [assembly: AssemblyTitle("MoreHeadUtilities")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MoreHeadUtilities { public class PartShrinker : MonoBehaviour { [SerializeField] private HiddenParts.Part partToHide = HiddenParts.Part.LeftPupil; [SerializeField] private bool hideChildren = true; private Transform TotalParent; private HiddenParts parentComponent; private static double totalSearchingTime; private bool isFrameOne = true; private bool isFrameTwo; public static ManualLogSource bepInExLog; public static void Init(ManualLogSource source) { bepInExLog = source; bepInExLog.LogInfo((object)"LoggerUtil initialized!"); } public void Log(string message) { if (MoreHeadUtilitiesPlugin._enableDebugLogging.Value) { bepInExLog.LogInfo((object)message); } } public void LogError(string message) { if (MoreHeadUtilitiesPlugin._enableDebugLogging.Value) { bepInExLog.LogError((object)message); } } public void Update() { if (isFrameOne) { isFrameOne = false; isFrameTwo = true; } else { if (!isFrameTwo) { return; } isFrameTwo = false; Stopwatch.StartNew(); if (!Object.op_Implicit((Object)(object)parentComponent)) { Log(((Object)((Component)this).gameObject).name + " is finding parent on awakening"); TotalParent = ((Component)this).transform; while (((Object)TotalParent).name != "ANIM BOT" && ((Object)TotalParent).name != null && ((Object)TotalParent).name != "WorldDecorationFollower") { TotalParent = TotalParent.parent; } if (((Object)TotalParent).name == null) { LogError("No root found"); return; } if (((Object)TotalParent).name == "WorldDecorationFollower") { LogError(((Object)((Component)this).gameObject).name + " is set to world parent. MoreHeadUtilities does not support part removal from a world object."); return; } parentComponent = ((Component)TotalParent).GetComponent<HiddenParts>(); if (!Object.op_Implicit((Object)(object)parentComponent)) { parentComponent = ((Component)TotalParent).gameObject.AddComponent<HiddenParts>(); } else { Log("Part already exists"); } } parentComponent.AddHiddenPart(partToHide, hideChildren); } } private void OnDisable() { if (isFrameOne) { return; } isFrameOne = true; if (!Object.op_Implicit((Object)(object)parentComponent)) { Log(((Object)((Component)this).gameObject).name + " is finding parent for destruction"); TotalParent = ((Component)this).transform; while (((Object)TotalParent).name != "ANIM BOT" && ((Object)TotalParent).name != null && ((Object)TotalParent).name != "WorldDecorationFollower") { TotalParent = TotalParent.parent; } if (((Object)TotalParent).name == null) { LogError("No root found"); return; } if (((Object)TotalParent).name == "WorldDecorationFollower") { LogError(((Object)((Component)this).gameObject).name + " is set to world parent. MoreHeadUtilities does not support part removal from a world object."); return; } parentComponent = ((Component)TotalParent).GetComponent<HiddenParts>(); if (!Object.op_Implicit((Object)(object)parentComponent)) { parentComponent = ((Component)TotalParent).gameObject.AddComponent<HiddenParts>(); } else { Log("Component already exists"); } } parentComponent.RemoveHiddenPart(partToHide, hideChildren); } } public class HiddenParts : MonoBehaviour { public enum Part { Health, LeftArm, RightArm, LeftLeg, RightLeg, EyeLeft, EyeRight, Head, Neck, Body, Hips, LeftPupil, RightPupil } public static ManualLogSource bepInExLog; private string[][] partNames = new string[13][] { new string[3] { "mesh_health", "mesh_health frame", "mesh_health shadow" }, new string[1] { "mesh_arm_l" }, new string[1] { "mesh_arm_r" }, new string[1] { "mesh_leg_l" }, new string[1] { "mesh_leg_r" }, new string[1] { "mesh_eye_l" }, new string[1] { "mesh_eye_r" }, new string[1] { "mesh_head_top" }, new string[2] { "mesh_head_bot_sphere", "mesh_head_bot_flat" }, new string[2] { "mesh_body_top_sphere", "mesh_body_top_flat" }, new string[1] { "mesh_body_bot" }, new string[1] { "mesh_pupil_l" }, new string[1] { "mesh_pupil_r" } }; private MeshRenderer[][] partRenderers = new MeshRenderer[13][] { (MeshRenderer[])(object)new MeshRenderer[3], (MeshRenderer[])(object)new MeshRenderer[1], (MeshRenderer[])(object)new MeshRenderer[1], (MeshRenderer[])(object)new MeshRenderer[1], (MeshRenderer[])(object)new MeshRenderer[1], (MeshRenderer[])(object)new MeshRenderer[1], (MeshRenderer[])(object)new MeshRenderer[1], (MeshRenderer[])(object)new MeshRenderer[1], (MeshRenderer[])(object)new MeshRenderer[2], (MeshRenderer[])(object)new MeshRenderer[2], (MeshRenderer[])(object)new MeshRenderer[1], (MeshRenderer[])(object)new MeshRenderer[1], (MeshRenderer[])(object)new MeshRenderer[1] }; private Part[][] childParts = new Part[13][] { new Part[0], new Part[0], new Part[0], new Part[0], new Part[0], new Part[1] { Part.LeftPupil }, new Part[1] { Part.RightPupil }, new Part[2] { Part.EyeLeft, Part.EyeRight }, new Part[2] { Part.Head, Part.Health }, new Part[3] { Part.Neck, Part.LeftArm, Part.RightArm }, new Part[3] { Part.Body, Part.LeftLeg, Part.RightLeg }, new Part[0], new Part[0] }; private List<Part> hiddenParts = new List<Part>(); private bool updatedThisFrame; public static void Init(ManualLogSource source) { bepInExLog = source; bepInExLog.LogInfo((object)"LoggerUtil initialized!"); } public void Log(string message) { ManualLogSource obj = bepInExLog; if (obj != null) { obj.LogInfo((object)message); } } public void LogError(string message) { ManualLogSource obj = bepInExLog; if (obj != null) { obj.LogError((object)message); } } public void Start() { foreach (Part value in Enum.GetValues(typeof(Part))) { for (int i = 0; i < partNames[(int)value].Length; i++) { Transform val = FindInHierarchy(((Component)this).transform, partNames[(int)value][i]); if ((Object)(object)val == (Object)null) { Log("Part '" + partNames[(int)value][i] + "' not found"); continue; } MeshRenderer component = ((Component)val).gameObject.GetComponent<MeshRenderer>(); if (Object.op_Implicit((Object)(object)component)) { Log("Found part '" + partNames[(int)value][i] + "'"); partRenderers[(int)value][i] = component; } } } } public void AddHiddenPart(Part part, bool hideChildren, bool update = true) { Log($"Adding part {part}"); hiddenParts.Add(part); if (hideChildren) { Part[] array = childParts[(int)part]; foreach (Part part2 in array) { AddHiddenPart(part2, hideChildren, update: false); } } updatedThisFrame = true; } public void RemoveHiddenPart(Part part, bool hideChildren, bool update = true) { if (hiddenParts.Contains(part)) { hiddenParts.Remove(part); } if (hideChildren) { Part[] array = childParts[(int)part]; foreach (Part part2 in array) { RemoveHiddenPart(part2, hideChildren, update: false); } } updatedThisFrame = true; } private Transform FindInHierarchy(Transform parent, string name) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (((Object)parent).name == name) { return parent; } foreach (Transform item in parent) { Transform parent2 = item; Transform val = FindInHierarchy(parent2, name); if ((Object)(object)val != (Object)null) { return val; } } return null; } public void LateUpdate() { if (updatedThisFrame) { UpdateHiddenParts(); updatedThisFrame = false; } } public void UpdateHiddenParts() { Log($"Updating parts, to be hidden: {hiddenParts.ToArray()}"); foreach (Part value in Enum.GetValues(typeof(Part))) { ShowPart(value); } foreach (Part hiddenPart in hiddenParts) { HidePart(hiddenPart); } } private void ShowPart(Part partToShow) { for (int i = 0; i < partNames[(int)partToShow].Length; i++) { MeshRenderer component = ((Component)partRenderers[(int)partToShow][i]).gameObject.GetComponent<MeshRenderer>(); if (Object.op_Implicit((Object)(object)component)) { ((Renderer)component).enabled = true; } } } private void HidePart(Part partToHide) { for (int i = 0; i < partNames[(int)partToHide].Length; i++) { MeshRenderer component = ((Component)partRenderers[(int)partToHide][i]).gameObject.GetComponent<MeshRenderer>(); if (Object.op_Implicit((Object)(object)component)) { ((Renderer)component).enabled = false; } } } } } namespace MoreHeadUtilities.Plugin { [BepInPlugin("com.maygik.moreheadutilities", "MoreHeadUtilities", "1.0.0")] public class MoreHeadUtilitiesPlugin : BaseUnityPlugin { public static ConfigEntry<bool> _enableDebugLogging; private void Awake() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) _enableDebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableDebugLogging", false, "Enable debug logging for MoreHeadUtilities."); if (_enableDebugLogging.Value) { PartShrinker.Init(((BaseUnityPlugin)this).Logger); ManualLogSource logger = ((BaseUnityPlugin)this).Logger; if (logger != null) { logger.LogInfo((object)"MoreHeadUtilities initialized and logger passed to PartShrinker."); } HiddenParts.Init(((BaseUnityPlugin)this).Logger); ManualLogSource logger2 = ((BaseUnityPlugin)this).Logger; if (logger2 != null) { logger2.LogInfo((object)"MoreHeadUtilities initialized and logger passed to HiddenParts."); } Logger.Init(((BaseUnityPlugin)this).Logger); ManualLogSource logger3 = ((BaseUnityPlugin)this).Logger; if (logger3 != null) { logger3.LogInfo((object)"MoreHeadUtilities initialized and logger passed to DecorationGroups."); } } new Harmony("com.maygik.moreheadutilities").PatchAll(); ManualLogSource logger4 = ((BaseUnityPlugin)this).Logger; if (logger4 != null) { logger4.LogInfo((object)"Harmony patches applied."); } } } } namespace MoreHead { internal static class Logger { public static ManualLogSource? log; public static void Init(ManualLogSource logger) { log = logger; } public static void Log(string message) { ManualLogSource? obj = log; if (obj != null) { obj.LogInfo((object)message); } } public static void LogError(string message) { ManualLogSource? obj = log; if (obj != null) { obj.LogError((object)message); } } } internal static class MoreHeadGroupStorage { public static Dictionary<string?, List<string?>> tagGroupElements = new Dictionary<string, List<string>>(); public static Dictionary<string, bool> activeGroups = new Dictionary<string, bool>(); } internal static class MoreHeadUIStorage { [CanBeNull] public static REPOPopupPage page = null; [CanBeNull] public static string group = null; public static bool resetPosition = true; public static Dictionary<string?, REPOButton> groupButtons = new Dictionary<string, REPOButton>(); public static Dictionary<string?, List<string>> groupButtonTags = new Dictionary<string, List<string>>(); } internal class HeadDecorationManagerStorage { public static List<string?> Decorations = new List<string>(); } [HarmonyPatch(typeof(MoreHeadUI))] [HarmonyPatch("CreateAllDecorationButtons", new Type[] { typeof(REPOPopupPage) })] internal static class Patch_CreateAllDecorationButtons { private static readonly MethodInfo ClearScrolls = AccessTools.Method(typeof(Dictionary<string, List<REPOScrollViewElement>>), "Clear", (Type[])null, (Type[])null); private static readonly MethodInfo ToListDecorations = AccessTools.Method(typeof(Enumerable), "ToList", (Type[])null, (Type[])null).MakeGenericMethod(typeof(DecorationInfo)); private static readonly MethodInfo Helper1 = AccessTools.Method(typeof(MoreHeadUIHelpers), "Patch1_CreateAllDecorationButtons", (Type[])null, (Type[])null); private static readonly MethodInfo Helper2 = AccessTools.Method(typeof(MoreHeadUIHelpers), "Patch2_CreateAllDecorationButtons", new Type[1] { typeof(REPOPopupPage) }, (Type[])null); private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instrs, ILGenerator il) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown List<CodeInstruction> list = instrs.ToList(); bool flag = false; bool flag2 = false; for (int i = 0; i < list.Count; i++) { CodeInstruction val = list[i]; if (!flag && val.opcode == OpCodes.Callvirt && val.operand == ClearScrolls) { Logger.Log("Patching Patch1_CreateAllDecorationButtons"); list.Insert(++i, new CodeInstruction(OpCodes.Call, (object)Helper1)); flag = true; } else if (!flag2 && val.opcode == OpCodes.Call && val.operand == ToListDecorations) { Logger.Log("Patching Patch2_CreateAllDecorationButtons"); int num = list.FindLastIndex((CodeInstruction ci) => ci.opcode == OpCodes.Ret); if (num < 0) { throw new InvalidOperationException("Couldn't find the final ret in CreateAllDecorationButtons"); } CodeInstruction obj = list[num]; Label label = il.DefineLabel(); obj.labels.Add(label); list.Insert(++i, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Insert(++i, new CodeInstruction(OpCodes.Call, (object)Helper2)); list.Insert(++i, new CodeInstruction(OpCodes.Leave_S, (object)label)); Logger.Log("Patched Patch2_CreateAllDecorationButtons"); break; } } return list; } } [HarmonyPatch(typeof(MoreHeadUI))] [HarmonyPatch("CreateAllDecorationButtons", new Type[] { typeof(REPOPopupPage) })] internal static class Prefix_CreateAllDecorationButtons { [HarmonyPrefix] private static bool Prefix(REPOPopupPage page) { MoreHeadUIStorage.page = page; MoreHeadUIStorage.groupButtons.Clear(); MoreHeadUIStorage.groupButtonTags.Clear(); return true; } } [HarmonyPatch(typeof(MoreHeadUI))] [HarmonyPatch("CreateDecorationButton", new Type[] { typeof(REPOPopupPage), typeof(DecorationInfo) })] internal static class Patch_CreateDecorationButton { private static readonly MethodInfo ShowTagDecorationsMI = AccessTools.Method(typeof(MoreHeadUI), "ShowTagDecorations", new Type[1] { typeof(string) }, (Type[])null); [HarmonyPrefix] private static bool Prefix(REPOPopupPage page, DecorationInfo decoration) { try { string text = HeadDecorationManagerStorage.Decorations[HeadDecorationManager.Decorations.IndexOf(decoration)]; if (text != null && text != "" && MoreHeadGroupStorage.tagGroupElements.TryGetValue("ALL", out List<string> value)) { if (!MoreHeadGroupStorage.activeGroups.ContainsKey(text)) { Logger.Log("Initialising group: " + text); MoreHeadGroupStorage.activeGroups[text] = false; } if (!value.Contains(text)) { CreateGroupButton(page, text); } } string[] source = (string[])typeof(MoreHeadUI).GetField("LIMB_TAGS", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(null); MoreHeadGroupStorage.tagGroupElements["ALL"].Add(text); if (text != null) { if (!MoreHeadUIStorage.groupButtonTags.ContainsKey(text)) { Logger.Log("Initialising group button tag list for " + text); MoreHeadUIStorage.groupButtonTags[text] = new List<string>(); } MoreHeadUIStorage.groupButtonTags[text].Add("ALL"); } List<string> value2; if (source.Contains(decoration.ParentTag.ToUpper())) { MoreHeadGroupStorage.tagGroupElements["LIMBS"].Add(text); if (text != null) { MoreHeadUIStorage.groupButtonTags[text].Add("LIMBS"); } } else if (MoreHeadGroupStorage.tagGroupElements.TryGetValue(decoration.ParentTag.ToUpper(), out value2)) { value2.Add(text); if (text != null) { MoreHeadUIStorage.groupButtonTags[text].Add(decoration.ParentTag.ToUpper()); } } return true; } catch (Exception arg) { Logger.LogError($"Error creating decoration button {decoration.Name}: {arg}"); throw; } } private static string GetGroupButtonText(string group) { if (!MoreHeadGroupStorage.activeGroups[group]) { return "<size=20><color=#CCCCCC>[+]" + group + "</color></size>"; } return "<size=20><color=#777777>[-]" + group + "</color></size>"; } private static void CreateGroupButton(REPOPopupPage page, string groupName) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown Logger.Log("Creating group button: " + groupName); try { string buttonText = GetGroupButtonText(groupName); REPOButton repoButton = null; page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0038: 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) repoButton = MenuAPI.CreateREPOButton(buttonText, (Action)delegate { OnDecorationGroupButtonClick(groupName); }, scrollView, default(Vector2)); return ((REPOElement)repoButton).rectTransform; }, 0f, 0f); if ((Object)(object)repoButton != (Object)null) { MoreHeadUIStorage.groupButtons[groupName] = repoButton; MoreHeadUIStorage.groupButtonTags[groupName] = new List<string>(); MoreHeadUIStorage.group = groupName; Logger.Log("Created group button: " + groupName); return; } throw new Exception("Failed to create group button."); } catch (Exception ex) { Logger.Log("Error creating group button: " + ex.Message); } } private static void OnDecorationGroupButtonClick(string? groupName) { Logger.Log("OnDecorationGroupButtonClick called for group: " + groupName); MoreHeadGroupStorage.activeGroups[groupName] = !MoreHeadGroupStorage.activeGroups[groupName]; Logger.Log("Invoking show tag decorations"); string text = (string)typeof(MoreHeadUI).GetField("currentTagFilter", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); MoreHeadUIStorage.resetPosition = false; ShowTagDecorationsMI.Invoke(null, new object[1] { text }); if (MoreHeadUIStorage.groupButtons.TryGetValue(groupName, out var value)) { string groupButtonText = GetGroupButtonText(groupName); ((TMP_Text)value.labelTMP).text = groupButtonText; } MoreHeadUIStorage.resetPosition = true; } } [HarmonyPatch(typeof(HeadDecorationManager))] [HarmonyPatch("LoadDecorationBundle", new Type[] { typeof(string) })] internal static class Patch_LoadDecorationBundle { private static readonly MethodInfo EnsureUniqueDisplayName = AccessTools.Method(typeof(HeadDecorationManager), "EnsureUniqueDisplayName", new Type[1] { typeof(string) }, (Type[])null); private static readonly MethodInfo EnsureUniqueName = AccessTools.Method(typeof(HeadDecorationManager), "EnsureUniqueName", new Type[1] { typeof(string) }, (Type[])null); private static readonly MethodInfo AddDecorationHelper1 = AccessTools.Method(typeof(HeadDecorationManagerHelpers), "Patch1_LoadDecorationBundle", new Type[1] { typeof(string) }, (Type[])null); private static readonly MethodInfo AddDecorationHelper2 = AccessTools.Method(typeof(HeadDecorationManagerHelpers), "Patch2_LoadDecorationBundle", (Type[])null, (Type[])null); private static readonly MethodInfo AddDecorationHelper3 = AccessTools.Method(typeof(HeadDecorationManagerHelpers), "Patch3_LoadDecorationBundle", (Type[])null, (Type[])null); private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instrs) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown List<CodeInstruction> list = instrs.ToList(); bool flag = false; bool flag2 = false; bool flag3 = false; for (int i = 0; i < list.Count(); i++) { CodeInstruction val = list[i]; if (val.opcode == OpCodes.Call && val.operand == EnsureUniqueDisplayName) { Logger.Log("Patching AddDecorationHelper2"); list.Insert(i, new CodeInstruction(OpCodes.Call, (object)AddDecorationHelper2)); Logger.Log("Patched AddDecorationHelper2"); flag2 = true; i += 2; } if (val.opcode == OpCodes.Call && val.operand == EnsureUniqueName) { Logger.Log("Patching AddDecorationHelper1"); list.Insert(i, new CodeInstruction(OpCodes.Dup, (object)null)); list.Insert(i + 1, new CodeInstruction(OpCodes.Call, (object)AddDecorationHelper1)); Logger.Log("Patched AddDecorationHelper1"); flag = true; i += 2; } if (!flag3 && list[i].opcode == OpCodes.Call && list[i].operand == AccessTools.Method(typeof(DecorationBlacklistManager), "IsBlacklisted", new Type[1] { typeof(string) }, (Type[])null)) { int num = i + 4; Logger.Log("Patching AddDecorationHelper3"); list.Insert(num++, new CodeInstruction(OpCodes.Call, (object)AddDecorationHelper3)); Logger.Log("Patched AddDecorationHelper3"); flag3 = true; i += 5; } if (flag2 && flag && flag3) { break; } } return list; } } [HarmonyPatch(typeof(MoreHeadUI))] [HarmonyPatch("CreateDecorationButton", new Type[] { typeof(REPOPopupPage), typeof(DecorationInfo) })] internal static class Transpiler_CreateDecorationButton { private static readonly MethodInfo PatchMethod = AccessTools.Method(typeof(MoreHeadUIHelpers), "Patch1_CreateDecorationButton", new Type[2] { typeof(DecorationInfo), typeof(string) }, (Type[])null); private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instrs) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_009b: 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_00bd: Expected O, but got Unknown List<CodeInstruction> list = instrs.ToList(); for (int i = 0; i < list.Count; i++) { CodeInstruction val = list[i]; if (val.opcode == OpCodes.Callvirt && val.operand is MethodInfo methodInfo && methodInfo.Name == "Add" && methodInfo.DeclaringType == typeof(List<REPOScrollViewElement>)) { Logger.Log("Patch adding group"); list.Insert(i + 1, new CodeInstruction(OpCodes.Ldarg_1, (object)null)); list.Insert(i + 2, new CodeInstruction(OpCodes.Ldstr, (object)(MoreHeadUIStorage.group ?? ""))); list.Insert(i + 3, new CodeInstruction(OpCodes.Call, (object)PatchMethod)); i += 3; } } return list; } } [HarmonyPatch(typeof(MoreHeadUI))] [HarmonyPatch("ShowTagDecorations", new Type[] { typeof(string) })] internal static class Patch_ShowTagDecorations { [HarmonyPrefix] private static bool Prefix(string tag) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown try { Type typeFromHandle = typeof(MoreHeadUI); Logger.Log("Accessing decorationsPage"); REPOPopupPage val = (REPOPopupPage)typeFromHandle.GetField("decorationsPage", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(null); Logger.Log("Accessing tagScrollViewElements"); Dictionary<string, List<REPOScrollViewElement>> dictionary = (Dictionary<string, List<REPOScrollViewElement>>)typeFromHandle.GetField("tagScrollViewElements", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(null); Logger.Log("Accessing currentTagFilter"); FieldInfo field = typeFromHandle.GetField("currentTagFilter", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); string text = (string)field.GetValue(null); Logger.Log("Running the proper ShowTagDecorations function"); dictionary.TryGetValue(text, out var value); MoreHeadGroupStorage.tagGroupElements.TryGetValue(text, out List<string> value2); Logger.Log($"There are {value.Count()} scroll elements and {value2.Count()} grouped elements"); if (!string.IsNullOrEmpty(text)) { for (int i = 0; i < value.Count(); i++) { if ((Object)(object)value[i] != (Object)null) { value[i].visibility = false; } } for (int j = 0; j < value2.Count(); j++) { if (value2[j] != null) { ((REPOElement)MoreHeadUIStorage.groupButtons[value2[j]]).repoScrollViewElement.visibility = false; } } } Logger.Log("Element visibility hidden"); dictionary.TryGetValue(tag, out value); MoreHeadGroupStorage.tagGroupElements.TryGetValue(tag, out value2); Logger.Log($"There are {value.Count()} tagged scroll elements and {value2.Count()} tagged grouped elements"); if (!string.IsNullOrEmpty(tag)) { for (int k = 0; k < value.Count(); k++) { if (value2[k] == null) { if ((Object)(object)value[k] != (Object)null) { value[k].visibility = true; } } else if ((Object)(object)value[k] != (Object)null && MoreHeadGroupStorage.activeGroups[value2[k]]) { value[k].visibility = true; } } for (int l = 0; l < value2.Count(); l++) { if (value2[l] != null && MoreHeadUIStorage.groupButtonTags[value2[l]].Contains(tag)) { ((REPOElement)MoreHeadUIStorage.groupButtons[value2[l]]).repoScrollViewElement.visibility = true; } } } field.SetValue(null, tag); if (MoreHeadUIStorage.resetPosition) { val.scrollView.SetScrollPosition(0f); } val.scrollView.UpdateElements(); } catch (Exception ex) { Logger.LogError("Error showing decorations for tag: " + tag + " | Error: " + ex.Message); } return false; } } } namespace MoreHead.MoreHead.Patchers { public static class HeadDecorationManagerHelpers { public static string bundleName; public static void Patch1_LoadDecorationBundle(string bundleBaseName) { Logger.Log("Saving bundle name"); bundleName = bundleBaseName; } public static void Patch2_LoadDecorationBundle() { Logger.Log("Patch_LoadDecorationBundle called"); string text = null; if (bundleName.Contains("~")) { string[] array = bundleName.Split(new char[1] { '~' }); if (array.Length >= 2) { text = array[^1].ToLower(); Logger.Log("Setting group: " + text); } } Logger.Log("Adding decoration"); HeadDecorationManagerStorage.Decorations.Add(text); } public static void Patch3_LoadDecorationBundle() { HeadDecorationManagerStorage.Decorations.RemoveAt(HeadDecorationManagerStorage.Decorations.Count - 1); Logger.Log("Removing last from decoration group list"); } } public static class MoreHeadUIHelpers { private static bool _inHelper; public static void Patch1_CreateAllDecorationButtons() { Logger.Log("Starting patch of CreateAllDecorationButtons"); Logger.Log("Accessing type MoreHeadUI"); Type typeFromHandle = typeof(MoreHeadUI); Logger.Log("Setting binding flags to Static and NonPublic"); Logger.Log("Retrieving ALL_TAGS field from MoreHeadUI"); string[] array = (string[])typeFromHandle.GetField("ALL_TAGS", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); foreach (string key in array) { MoreHeadGroupStorage.tagGroupElements[key] = new List<string>(); } } public static void Patch2_CreateAllDecorationButtons(REPOPopupPage page) { try { Logger.Log("Starting Patch2_CreateAllDecorationButtons"); _ = (string[])typeof(MoreHeadUI).GetField("ALL_TAGS", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); List<DecorationInfo> allDecorations = HeadDecorationManager.Decorations.ToList(); Logger.Log("Gotten IsBuiltInDecoration"); MethodInfo isBuiltInMI = AccessTools.Method(typeof(MoreHeadUI), "IsBuiltInDecoration", new Type[1] { typeof(DecorationInfo) }, (Type[])null); if (isBuiltInMI.GetParameters().Length == 1 && isBuiltInMI.ReturnType == typeof(bool)) { _ = (Func<DecorationInfo, bool>)Delegate.CreateDelegate(typeof(Func<DecorationInfo, bool>), isBuiltInMI); Logger.Log("Delegate successfully created for IsBuiltInDecoration."); Logger.Log("Bound Delegate"); List<DecorationInfo> list = (from decoration in allDecorations where (bool)isBuiltInMI.Invoke(null, new object[1] { decoration }) orderby HeadDecorationManagerStorage.Decorations[allDecorations.IndexOf(decoration)], decoration.DisplayName select decoration).ToList(); Logger.Log("builtInDecorations sorted"); List<DecorationInfo> list2 = (from decoration in allDecorations where !(bool)isBuiltInMI.Invoke(null, new object[1] { decoration }) orderby HeadDecorationManagerStorage.Decorations[allDecorations.IndexOf(decoration)] ?? '\uffff'.ToString(), decoration.DisplayName select decoration).ToList(); Logger.Log("externalDecorations sorted"); MethodInfo methodInfo = AccessTools.Method(typeof(MoreHeadUI), "CreateDecorationButton", new Type[2] { typeof(REPOPopupPage), typeof(DecorationInfo) }, (Type[])null); foreach (DecorationInfo item in list) { methodInfo.Invoke(null, new object[2] { page, item }); } foreach (DecorationInfo item2 in list2) { methodInfo.Invoke(null, new object[2] { page, item2 }); } Logger.Log("externalDecorations all created"); MoreHeadUIStorage.group = null; return; } throw new InvalidOperationException("IsBuiltInDecoration method signature does not match Func<DecorationInfo, bool>."); } catch (Exception arg) { Logger.LogError($"Error creating all decoration buttons: {arg}"); throw; } } public static void Patch1_CreateDecorationButton(DecorationInfo decoration, string group) { if (_inHelper) { return; } _inHelper = true; try { } finally { _inHelper = false; } } } }
plugins/MorePlayers.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Photon.Pun; using Photon.Realtime; using Steamworks; using Steamworks.Data; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("0.0.0.0")] namespace MorePlayers; [BepInPlugin("spindles.MorePlayersImproved", "MorePlayersImproved", "1.0.2")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(NetworkConnect), "TryJoiningRoom")] public class TryJoiningRoomPatch { private static bool Prefix(ref string ___RoomName) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown string value = Traverse.Create((object)DataDirector.instance).Field("networkPassword").GetValue() as string; if (string.IsNullOrEmpty(___RoomName)) { mls.LogError((object)"RoomName is null or empty, using previous method!"); return true; } if (configMaxPlayers.Value == 0) { mls.LogError((object)"The MaxPlayers config is null or empty, using previous method!"); return true; } Debug.Log((object)("Trying to join room: " + ___RoomName)); Hashtable val = new Hashtable(); ((Dictionary<object, object>)(object)val).Add((object)"PASSWORD", (object)value); PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); RoomOptions val2 = new RoomOptions { MaxPlayers = configMaxPlayers.Value, IsVisible = false }; Hashtable val3 = new Hashtable(); ((Dictionary<object, object>)(object)val3).Add((object)"PASSWORD", (object)value); val2.CustomRoomProperties = val3; PhotonNetwork.JoinOrCreateRoom(___RoomName, val2, TypedLobby.Default, (string[])null); return false; } } [HarmonyPatch(typeof(NetworkConnect), "OnConnectedToMaster")] public class OnConnectedToMasterPatch { private static bool Prefix() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_0142: Expected O, but got Unknown if (!configPublicLobbySupport.Value) { return true; } _ = (Lobby)Traverse.Create((object)SteamManager.instance).Field("currentLobby").GetValue(); bool flag = (bool)Traverse.Create((object)GameManager.instance).Field("connectRandom").GetValue(); _ = (string)Traverse.Create((object)DataDirector.instance).Field("networkPassword").GetValue(); string text = (string)Traverse.Create((object)DataDirector.instance).Field("networkServerName").GetValue(); _ = (string)Traverse.Create((object)DataDirector.instance).Field("networkJoinServerName").GetValue(); if (string.IsNullOrEmpty(text)) { mls.LogError((object)"RoomName is null or empty, using previous method!"); return true; } if (configMaxPlayers.Value == 0) { mls.LogError((object)"The MaxPlayers config is null or empty, using previous method!"); return true; } Debug.Log((object)"Connected to Master Server"); if (flag) { if (!string.IsNullOrEmpty(text)) { Debug.Log((object)("I am creating a custom open lobby named: " + text)); RoomOptions val = new RoomOptions(); val.CustomRoomPropertiesForLobby = new string[1] { "server_name" }; Hashtable val2 = new Hashtable(); ((Dictionary<object, object>)val2).Add((object)"server_name", (object)("[Modded] " + text)); val.CustomRoomProperties = val2; val.MaxPlayers = configMaxPlayers.Value; val.IsVisible = true; PhotonNetwork.CreateRoom((string)null, val, DataDirector.instance.customLobby, (string[])null); return false; } return true; } return true; } } [HarmonyPatch(typeof(SteamManager), "HostLobby")] public class HostLobbyPatch { private static bool Prefix() { HostLobbyAsync(); return false; } private static async void HostLobbyAsync() { Debug.Log((object)"Steam: Hosting lobby..."); Lobby? val = await SteamMatchmaking.CreateLobbyAsync(configMaxPlayers.Value); if (!val.HasValue) { Debug.LogError((object)"Lobby created but not correctly instantiated."); return; } Lobby value = val.Value; ((Lobby)(ref value)).SetPublic(); value = val.Value; ((Lobby)(ref value)).SetJoinable(false); } } public const string modGUID = "spindles.MorePlayersImproved"; public const string modName = "MorePlayersImproved"; public const string modVersion = "1.0.2"; private readonly Harmony harmony = new Harmony("spindles.MorePlayersImproved"); public static ConfigEntry<int> configMaxPlayers; public static ConfigEntry<bool> configPublicLobbySupport; public static ManualLogSource mls; private void Awake() { mls = Logger.CreateLogSource("spindles.MorePlayersImproved"); mls.LogInfo((object)"spindles.MorePlayersImproved has awoken!"); configMaxPlayers = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxPlayers", 10, "The max amount of players allowed in a server"); configPublicLobbySupport = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "PublicLobbySupport", true, "Toggles if public lobby support is enabled"); harmony.PatchAll(typeof(TryJoiningRoomPatch)); harmony.PatchAll(typeof(HostLobbyPatch)); mls.LogInfo((object)"spindles.MorePlayersImproved loaded main patches!"); if (typeof(SteamManager).GetRuntimeMethod("UnlockLobby", new Type[1] { typeof(bool) }) != null) { harmony.PatchAll(typeof(OnConnectedToMasterPatch)); mls.LogInfo((object)"spindles.MorePlayersImproved enabled PublicLobbySupport!"); } mls.LogInfo((object)"spindles.MorePlayersImproved is ready now!"); } }
plugins/NoLimitChatbox.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; 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("NoLimitChatbox")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoLimitChatbox")] [assembly: AssemblyTitle("NoLimitChatbox")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace NoLimitChatbox { [BepInPlugin("nickklmao.nolimitchatbox", "No Limit Chatbox", "1.0.1")] internal sealed class Entry : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Action<Action<ChatManager>, ChatManager> <0>__ChatManager_AwakeHook; public static Manipulator <1>__ChatManager_StateActiveILHook; } private const string MOD_NAME = "No Limit Chatbox"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("No Limit Chatbox"); private static void ChatManager_StateActiveILHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchLdcI4(instruction, 50) }); val.Index -= 3; val.RemoveRange(29); } private static void ChatManager_AwakeHook(Action<ChatManager> orig, ChatManager self) { //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_003b: Unknown result type (might be due to invalid IL or missing references) orig(self); ((TMP_Text)self.chatText).enableWordWrapping = true; Vector2 sizeDelta = ((TMP_Text)self.chatText).rectTransform.sizeDelta; sizeDelta.x = 534f; ((TMP_Text)self.chatText).rectTransform.sizeDelta = sizeDelta; } 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_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_0086: Expected O, but got Unknown logger.LogDebug((object)"Hooking `ChatManager.StateActive`"); new Hook((MethodBase)AccessTools.Method(typeof(ChatManager), "Awake", (Type[])null, (Type[])null), (Delegate)new Action<Action<ChatManager>, ChatManager>(ChatManager_AwakeHook)); logger.LogDebug((object)"Hooking `ChatManager.StateActive`"); MethodInfo methodInfo = AccessTools.Method(typeof(ChatManager), "StateActive", (Type[])null, (Type[])null); object obj = <>O.<1>__ChatManager_StateActiveILHook; if (obj == null) { Manipulator val = ChatManager_StateActiveILHook; <>O.<1>__ChatManager_StateActiveILHook = val; obj = (object)val; } new ILHook((MethodBase)methodInfo, (Manipulator)obj); } } }
plugins/Omni.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Omni")] [assembly: AssemblyTitle("Omni")] [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 VHSShaderOnItemGrab : MonoBehaviour { [Header("VHS Shader")] public MonoBehaviour vhsShaderPrefab; private bool effectApplied = false; private PhysGrabObject physGrabObject; private void Start() { physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); } private void Update() { if (effectApplied || (Object)(object)physGrabObject == (Object)null || !physGrabObject.grabbed) { return; } foreach (PhysGrabber item in physGrabObject.playerGrabbing) { if ((Object)(object)item?.playerAvatar != (Object)null) { AttachVHSShader(item.playerAvatar); } } effectApplied = true; } private void AttachVHSShader(PlayerAvatar player) { CharacterController componentInChildren = ((Component)player).GetComponentInChildren<CharacterController>(true); if ((Object)(object)componentInChildren == (Object)null) { Debug.LogWarning((object)"Character Controller not found under player."); return; } Transform val = ((Component)componentInChildren).transform.Find("Top Camera"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"Top Camera not found."); } else if ((Object)(object)((Component)val).GetComponent(((object)vhsShaderPrefab).GetType()) == (Object)null) { ((Component)val).gameObject.AddComponent(((object)vhsShaderPrefab).GetType()); Debug.Log((object)"VHS Shader attached to Top Camera."); } } } [RequireComponent(typeof(Renderer))] public class AudioReactiveMaterial : MonoBehaviour { [Header("Audio Settings")] public AudioSource audioSource; public float sensitivity = 15f; [Header("Materials")] public Material idleMaterial; public Material activeMaterial; private Renderer rend; private float[] samples = new float[64]; private void Start() { rend = ((Component)this).GetComponent<Renderer>(); if ((Object)(object)idleMaterial != (Object)null) { rend.material = idleMaterial; } } private void Update() { float audioVolume = GetAudioVolume(); float num = Mathf.Clamp01(audioVolume * sensitivity); if (num > 0.1f) { if ((Object)(object)activeMaterial != (Object)null) { rend.material = activeMaterial; } } else if ((Object)(object)idleMaterial != (Object)null) { rend.material = idleMaterial; } } private float GetAudioVolume() { if ((Object)(object)audioSource == (Object)null) { return 0f; } audioSource.GetOutputData(samples, 0); float num = 0f; for (int i = 0; i < samples.Length; i++) { num += Mathf.Abs(samples[i]); } return num / (float)samples.Length; } } public class OmniscyeBowlingGameManager : MonoBehaviourPun { [CompilerGenerated] private sealed class <ResetBallAfterDelay>d__36 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OmniscyeBowlingGameManager <>4__this; private int <finalScore>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ResetBallAfterDelay>d__36(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.isResetting = true; <finalScore>5__1 = <>4__this.pinsKnockedOver; Debug.Log((object)$"[Omniscye Bowling] Captured final score: {<finalScore>5__1}"); <>2__current = (object)new WaitForSeconds(<>4__this.resetDelay); <>1__state = 1; return true; case 1: <>1__state = -1; if (PhotonNetwork.OfflineMode) { <>4__this.ResetBallRPC(<finalScore>5__1); } else { ((MonoBehaviourPun)<>4__this).photonView.RPC("ResetBallRPC", (RpcTarget)3, new object[1] { <finalScore>5__1 }); } <>4__this.isResetting = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ThrowTimeoutCheck>d__32 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OmniscyeBowlingGameManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ThrowTimeoutCheck>d__32(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(<>4__this.maxThrowTime); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.throwActive) { Debug.Log((object)"[Omniscye Bowling] Throw timed out - auto finishing"); <>4__this.FinishThrow(); } 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("Omniscye Pins")] public GameObject[] pins; [Header("Omniscye Score Display")] public TextMeshProUGUI scoreText; public TextMeshProUGUI[] frameScoreTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[10]; [Header("Pin Detection Settings")] public float tippedAngleThreshold = 30f; [Header("Ball Reset Settings")] public Rigidbody ballRb; public Transform resetPosition; public Transform stopPoint; public Transform pinZoneStart; public Transform throwStart; public float resetDelay = 3f; public float maxThrowTime = 10f; public float ballStoppedThreshold = 0.05f; [Header("Death Mechanic")] public int deathScoreThreshold = 50; public HurtCollider playerKillCollider; [Header("Reward")] public GameObject rewardPrefab; public Transform rewardSpawnPoint; private bool isResetting = false; private bool ballInPinZone = false; private bool throwActive = false; private float ballStoppedTime = 0f; private int pinsKnockedOver = 0; private int throwCount = 0; private int currentFrame = 0; private List<int> throws = new List<int>(); private Coroutine throwTimeoutCoroutine; private Dictionary<GameObject, Vector3> originalUpDirections = new Dictionary<GameObject, Vector3>(); private Dictionary<GameObject, Vector3> originalPositions = new Dictionary<GameObject, Vector3>(); private Dictionary<GameObject, Quaternion> originalRotations = new Dictionary<GameObject, Quaternion>(); private void Start() { //IL_003f: 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_006f: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsConnected) { PhotonNetwork.OfflineMode = true; Debug.Log((object)"[Omniscye Bowling] OfflineMode enabled."); } GameObject[] array = pins; foreach (GameObject val in array) { originalUpDirections[val] = val.transform.up; originalPositions[val] = val.transform.position; originalRotations[val] = val.transform.rotation; } ((TMP_Text)scoreText).text = "Pins Knocked Over: 0"; for (int j = 0; j < frameScoreTexts.Length; j++) { if ((Object)(object)frameScoreTexts[j] != (Object)null) { ((TMP_Text)frameScoreTexts[j]).text = $"Frame {j + 1}: "; } } } private void Update() { if ((PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode) && !isResetting) { CheckBallPosition(); if (throwActive && ballInPinZone) { TrackPins(); } if (throwActive) { CheckIfBallStopped(); } } } private void CheckIfBallStopped() { //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) Vector3 velocity = ballRb.velocity; float magnitude = ((Vector3)(ref velocity)).magnitude; if (magnitude < ballStoppedThreshold) { ballStoppedTime += Time.deltaTime; if (ballStoppedTime >= 2f) { Debug.Log((object)"[Omniscye Bowling] Ball stopped moving - finishing throw"); FinishThrow(); } } else { ballStoppedTime = 0f; } } private void CheckBallPosition() { //IL_000c: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) float x = ((Component)ballRb).transform.position.x; float x2 = throwStart.position.x; float x3 = pinZoneStart.position.x; float x4 = stopPoint.position.x; if (!throwActive && x >= x2) { throwActive = true; ballStoppedTime = 0f; Debug.Log((object)"[Omniscye Bowling] Ball passed throw start - throw started"); if (throwTimeoutCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(throwTimeoutCoroutine); } throwTimeoutCoroutine = ((MonoBehaviour)this).StartCoroutine(ThrowTimeoutCheck()); } if (throwActive && !ballInPinZone && x >= x3) { ballInPinZone = true; Debug.Log((object)"[Omniscye Bowling] Ball entered pin zone"); } if (throwActive && x >= x4) { Debug.Log((object)"[Omniscye Bowling] Ball reached stop point - finishing throw"); FinishThrow(); } } [IteratorStateMachine(typeof(<ThrowTimeoutCheck>d__32))] private IEnumerator ThrowTimeoutCheck() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ThrowTimeoutCheck>d__32(0) { <>4__this = this }; } private void FinishThrow() { if (!isResetting) { throwActive = false; ballInPinZone = false; if (throwTimeoutCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(throwTimeoutCoroutine); throwTimeoutCoroutine = null; } Debug.Log((object)$"[Omniscye Bowling] Throw finished with final score: {pinsKnockedOver}"); ((MonoBehaviour)this).StartCoroutine(ResetBallAfterDelay()); } } private void TrackPins() { int num = 0; GameObject[] array = pins; foreach (GameObject val in array) { Renderer component = val.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null && component.enabled && IsPinKnockedOver(val)) { num++; } } if (num != pinsKnockedOver) { pinsKnockedOver = num; if (PhotonNetwork.OfflineMode) { UpdateScoreRPC(pinsKnockedOver); return; } ((MonoBehaviourPun)this).photonView.RPC("UpdateScoreRPC", (RpcTarget)3, new object[1] { pinsKnockedOver }); } } private bool IsPinKnockedOver(GameObject pin) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (!originalUpDirections.ContainsKey(pin)) { return false; } Vector3 val = originalUpDirections[pin]; float num = Vector3.Angle(val, pin.transform.up); return num > tippedAngleThreshold; } [IteratorStateMachine(typeof(<ResetBallAfterDelay>d__36))] private IEnumerator ResetBallAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ResetBallAfterDelay>d__36(0) { <>4__this = this }; } [PunRPC] private void UpdateScoreRPC(int score) { if (throwActive && ballInPinZone) { ((TMP_Text)scoreText).text = "Pins Knocked Over: " + score; } } [PunRPC] private void ResetBallRPC(int finalThrowScore) { //IL_02fd: 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_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) throws.Add(finalThrowScore); throwCount++; if (currentFrame < 10 && (Object)(object)frameScoreTexts[currentFrame] != (Object)null) { if (throwCount % 2 == 1) { if (finalThrowScore == 10) { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: STRIKE (10)"; throwCount++; currentFrame++; ResetPins(); Debug.Log((object)"[Omniscye Bowling] Strike! Moving to next frame."); } else { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: {finalThrowScore}"; HideKnockedPins(); Debug.Log((object)$"[Omniscye Bowling] First throw: {finalThrowScore} pins. Hiding knocked pins for second throw."); } } else { List<int> list = throws; int num = list[list.Count - 2]; int num2 = num + finalThrowScore; if (num2 == 10) { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: {num} / SPARE"; Debug.Log((object)"[Omniscye Bowling] Spare achieved!"); } else { ((TMP_Text)frameScoreTexts[currentFrame]).text = $"Frame {currentFrame + 1}: {num} / {finalThrowScore}"; Debug.Log((object)$"[Omniscye Bowling] Frame complete: {num} + {finalThrowScore} = {num2}"); } ResetPins(); currentFrame++; } } if (currentFrame >= 10) { int num3 = CalculateTotalScore(); Debug.Log((object)$"[Omniscye Bowling] Game complete! Total score: {num3}"); if (num3 < deathScoreThreshold) { Debug.Log((object)$"[Omniscye Bowling] Score {num3} below threshold {deathScoreThreshold} - triggering player death!"); TriggerPlayerDeath(); } else { Debug.Log((object)$"[Omniscye Bowling] Score {num3} meets threshold - rewarding players!"); SpawnRewardPrefab(); } currentFrame = 0; throwCount = 0; throws.Clear(); for (int i = 0; i < frameScoreTexts.Length; i++) { if ((Object)(object)frameScoreTexts[i] != (Object)null) { ((TMP_Text)frameScoreTexts[i]).text = $"Frame {i + 1}: "; } } ResetPins(); } ballRb.velocity = Vector3.zero; ballRb.angularVelocity = Vector3.zero; ballRb.isKinematic = true; ((Component)ballRb).transform.position = resetPosition.position; ((Component)ballRb).transform.rotation = resetPosition.rotation; ballRb.isKinematic = false; pinsKnockedOver = 0; ((TMP_Text)scoreText).text = "Pins Knocked Over: 0"; Debug.Log((object)$"[Omniscye Bowling] Ball reset complete. Frame: {currentFrame + 1}, Throw: {throwCount % 2 + 1}"); } private void SpawnRewardPrefab() { if ((Object)(object)rewardPrefab != (Object)null) { PhotonView component = rewardPrefab.GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { ((MonoBehaviourPun)this).photonView.RPC("EnableRewardRPC", (RpcTarget)3, new object[1] { component.ViewID }); Debug.Log((object)"[Omniscye Bowling] Sent RPC to enable reward object."); } else { Debug.LogWarning((object)"[Omniscye Bowling] Reward prefab is missing PhotonView."); } } else { Debug.LogWarning((object)"[Omniscye Bowling] Reward prefab not assigned."); } } [PunRPC] private void EnableRewardRPC(int viewID) { PhotonView val = PhotonView.Find(viewID); if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null) { ((Component)val).gameObject.SetActive(true); Debug.Log((object)"[Omniscye Bowling] Reward activated across all clients."); } else { Debug.LogWarning((object)"[Omniscye Bowling] Could not find reward PhotonView by ViewID."); } } private void ResetPins() { //IL_0022: 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_005a: 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) GameObject[] array = pins; foreach (GameObject val in array) { val.transform.position = originalPositions[val]; val.transform.rotation = originalRotations[val]; Rigidbody component = val.GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component)) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } Renderer component2 = val.GetComponent<Renderer>(); Collider component3 = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.enabled = true; } if (Object.op_Implicit((Object)(object)component3)) { component3.enabled = true; } } pinsKnockedOver = 0; Debug.Log((object)"[Omniscye Bowling] All pins reset and re-enabled"); } private void HideKnockedPins() { int num = 0; GameObject[] array = pins; foreach (GameObject val in array) { if (IsPinKnockedOver(val)) { Renderer component = val.GetComponent<Renderer>(); Collider component2 = val.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component)) { component.enabled = false; } if (Object.op_Implicit((Object)(object)component2)) { component2.enabled = false; } num++; } } Debug.Log((object)$"[Omniscye Bowling] Hidden {num} knocked pins for second throw"); } private int CalculateTotalScore() { int num = 0; foreach (int @throw in throws) { num += @throw; } return num; } private void TriggerPlayerDeath() { if ((Object)(object)playerKillCollider == (Object)null) { Debug.LogError((object)"[Omniscye Bowling] No HurtCollider assigned for player death!"); return; } PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)val.playerHealth != (Object)null) { Debug.Log((object)("[Omniscye Bowling] Killing player: " + ((Object)val).name)); int num = ((!((Object)(object)playerKillCollider.enemyHost != (Object)null)) ? (-1) : 0); val.playerHealth.Hurt(val.playerHealth.health, false, num); } } } } public class ChasingSkullValuable : Trap { [Header("Chase Settings")] public float forceStrength = 50f; public float maxSpeed = 15f; public float detectionRange = 30f; public float playerKnockbackForce = 25f; [Header("Physics")] public Rigidbody rb; private PlayerAvatar targetPlayer; public override void Start() { ((Trap)this).Start(); if ((Object)(object)rb == (Object)null) { rb = ((Component)this).GetComponent<Rigidbody>(); } } public override void Update() { ((Trap)this).Update(); if (!base.physGrabObject.grabbed) { FindPlayerTarget(); ChaseTarget(); } else { targetPlayer = null; } } private void FindPlayerTarget() { //IL_005f: 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 ((Object)(object)targetPlayer != (Object)null && !targetPlayer.isDisabled) { return; } float num = detectionRange; PlayerAvatar val = null; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!item.isDisabled) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; val = item; } } } targetPlayer = val; } private void ChaseTarget() { //IL_002e: 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_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) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)targetPlayer == (Object)null) && !targetPlayer.isDisabled) { Vector3 val = ((Component)targetPlayer).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; val = rb.velocity; if (((Vector3)(ref val)).magnitude < maxSpeed) { rb.AddForce(normalized * forceStrength, (ForceMode)5); } } } private void OnCollisionEnter(Collision collision) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) if (SemiFunc.IsMasterClientOrSingleplayer()) { PlayerAvatar componentInParent = ((Component)collision.collider).GetComponentInParent<PlayerAvatar>(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isDisabled) { componentInParent.tumble.TumbleRequest(true, false); Vector3 val = ((Component)componentInParent).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; componentInParent.tumble.TumbleForce(normalized * playerKnockbackForce); componentInParent.tumble.TumbleOverrideTime(1.5f); } } } } public class CoasterSeatCarrier : MonoBehaviour { [Tooltip("Child under the cart where the player sits (must be parented)")] public Transform seatPoint; [Header("Grab & Follow Settings")] [Tooltip("How close the player must be to latch on")] public float grabDistance = 1f; [Tooltip("Spring stiffness for position follow")] public float positionStiffness = 10f; [Tooltip("Spring stiffness for rotation follow")] public float rotationStiffness = 0.2f; private PlayerAvatar playerTarget; private void FixedUpdate() { //IL_0125: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_0191: 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_003b: 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) if ((Object)(object)playerTarget == (Object)null) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.isDisabled || !(Vector3.Distance(seatPoint.position, ((Component)item).transform.position) <= grabDistance)) { continue; } playerTarget = item; break; } } if ((Object)(object)playerTarget != (Object)null && !playerTarget.isDisabled) { Rigidbody rb = playerTarget.tumble.rb; if (!playerTarget.tumble.isTumbling) { playerTarget.tumble.TumbleRequest(true, false); } playerTarget.tumble.TumbleOverrideTime(1f); playerTarget.FallDamageResetSet(0.1f); Vector3 val = SemiFunc.PhysFollowPosition(((Component)playerTarget.tumble).transform.position, seatPoint.position, rb.velocity, positionStiffness); rb.AddForce(val * (positionStiffness * Time.fixedDeltaTime), (ForceMode)1); Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)playerTarget.tumble).transform, seatPoint.rotation, rb, rotationStiffness); rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1); } } } [RequireComponent(typeof(Renderer))] public class CubeWalk : MonoBehaviour { [CompilerGenerated] private sealed class <FlipRight>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CubeWalk <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FlipRight>d__13(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 (!<>4__this.isFlipping) { <>4__this.isFlipping = true; ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.PerformFlip()); } break; } <>2__current = (object)new WaitForSeconds(<>4__this.flipDelay); <>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 <PerformFlip>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CubeWalk <>4__this; private float <rotationAmount>5__1; private float <rotationSpeed>5__2; private float <totalRotation>5__3; private Vector3 <rightAngleRotation>5__4; private float <step>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PerformFlip>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0089: 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_00f1: 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_013d: 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_016e: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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_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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <rotationAmount>5__1 = 90f; <rotationSpeed>5__2 = <rotationAmount>5__1 / <>4__this.flipDelay * Time.deltaTime; <totalRotation>5__3 = 0f; break; case 1: <>1__state = -1; break; } if (<totalRotation>5__3 < <rotationAmount>5__1) { <step>5__5 = Mathf.Min(<rotationSpeed>5__2, <rotationAmount>5__1 - <totalRotation>5__3); ((Component)<>4__this).transform.RotateAround(<>4__this.pivot, <>4__this.rotationAxis, <step>5__5); <totalRotation>5__3 += <step>5__5; <>2__current = null; <>1__state = 1; return true; } <rightAngleRotation>5__4 = new Vector3(Mathf.Round(((Component)<>4__this).transform.eulerAngles.x / 90f) * 90f, Mathf.Round(((Component)<>4__this).transform.eulerAngles.y / 90f) * 90f, Mathf.Round(((Component)<>4__this).transform.eulerAngles.z / 90f) * 90f); ((Component)<>4__this).transform.eulerAngles = <rightAngleRotation>5__4; <>4__this.pivot = ((Component)<>4__this).transform.position + new Vector3(((Component)<>4__this).transform.localScale.x / 2f, (0f - ((Component)<>4__this).transform.localScale.y) / 2f, ((Component)<>4__this).transform.localScale.z / 2f); <>4__this.isFlipping = 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(); } } [Header("Flip Settings")] public float flipDelay = 0.5f; [Header("Audio Settings")] public AudioSource audioSource; public float sensitivity = 15f; [Header("Materials")] public Material blackMaterial; public Material redMaterial; private Vector3 pivot; private bool isFlipping = false; private Vector3 rotationAxis = new Vector3(0f, 0f, -1f); private Renderer rend; private float[] samples = new float[64]; private void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) pivot = ((Component)this).transform.position + new Vector3(((Component)this).transform.localScale.x / 2f, (0f - ((Component)this).transform.localScale.y) / 2f, ((Component)this).transform.localScale.z / 2f); rend = ((Component)this).GetComponent<Renderer>(); rend.material = blackMaterial; ((MonoBehaviour)this).StartCoroutine(FlipRight()); } private void Update() { float audioVolume = GetAudioVolume(); float num = Mathf.Clamp01(audioVolume * sensitivity); if (num > 0.1f) { rend.material = redMaterial; } else { rend.material = blackMaterial; } } private float GetAudioVolume() { if ((Object)(object)audioSource == (Object)null) { return 0f; } audioSource.GetOutputData(samples, 0); float num = 0f; for (int i = 0; i < samples.Length; i++) { num += Mathf.Abs(samples[i]); } return num / (float)samples.Length; } [IteratorStateMachine(typeof(<FlipRight>d__13))] private IEnumerator FlipRight() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FlipRight>d__13(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<PerformFlip>d__14))] private IEnumerator PerformFlip() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PerformFlip>d__14(0) { <>4__this = this }; } } public class CursedFollowCat : MonoBehaviourPun { public float followDistance = 50f; public float moveForce = 20f; public float rotationForce = 5f; public float toppleAngleThreshold = 45f; public float resetAfterSeconds = 5f; private PlayerAvatar playerTarget; private Rigidbody rb; private float toppleTimer = 0f; private void Start() { rb = ((Component)this).GetComponent<Rigidbody>(); } private void FixedUpdate() { if (SemiFunc.IsMasterClientOrSingleplayer()) { AcquirePlayerTarget(); if ((Object)(object)playerTarget != (Object)null && !playerTarget.isDisabled) { FollowPlayer(); } CheckForTopple(); } } private void AcquirePlayerTarget() { //IL_003a: 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) float num = followDistance; playerTarget = null; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!item.isDisabled) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num2 <= num) { num = num2; playerTarget = item; } } } } private void FollowPlayer() { //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_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_0024: 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_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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) Vector3 position = ((Component)playerTarget).transform.position; Vector3 val = SemiFunc.PhysFollowPosition(rb.position, position, rb.velocity, moveForce); rb.AddForce(val * (moveForce * Time.fixedDeltaTime), (ForceMode)1); Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)rb).transform, Quaternion.LookRotation(position - ((Component)this).transform.position), rb, rotationForce); rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1); } private void CheckForTopple() { //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) float num = Vector3.Angle(((Component)this).transform.up, Vector3.up); if (num > toppleAngleThreshold) { toppleTimer += Time.fixedDeltaTime; if (toppleTimer >= resetAfterSeconds) { ResetUpright(); toppleTimer = 0f; } } else { toppleTimer = 0f; } } private void ResetUpright() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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) ((Component)this).transform.rotation = Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f); rb.angularVelocity = Vector3.zero; rb.velocity = Vector3.zero; } } public class CursedBlackHoleOrbValuable : Trap { [Header("Black Hole Settings")] public float blackHoleRange = 20f; public float pullForce = 100f; public override void Update() { ((Trap)this).Update(); if (base.physGrabObject.grabbed && SemiFunc.IsMasterClientOrSingleplayer()) { ApplyContinuousPull(); } } private void ApplyContinuousPull() { //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_0092: 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_00b9: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { bool flag = false; foreach (PhysGrabber item2 in base.physGrabObject.playerGrabbing) { if ((Object)(object)item2.playerAvatar == (Object)(object)item) { flag = true; break; } } if (!flag && !item.isDisabled) { float num = Vector3.Distance(position, ((Component)item).transform.position); if (num <= blackHoleRange) { Vector3 val = position - ((Component)item).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; item.tumble.TumbleRequest(true, false); float num2 = Mathf.Clamp01(1f - num / blackHoleRange); float num3 = pullForce * num2; item.tumble.TumbleForce(normalized * num3); item.tumble.TumbleOverrideTime(0.2f); } } } } } public class CursedRollerValuable : MonoBehaviour { [Header("Patrol Settings")] public float moveForce = 15f; public float rotationForce = 5f; public float wanderInterval = 5f; public float wanderRadius = 10f; [Header("Coaster Settings")] public Transform seatPoint; public float grabDistance = 1f; public float positionStiffness = 10f; public float rotationStiffness = 0.2f; public float latchDuration = 5f; public float tossForce = 30f; public float regrabCooldown = 5f; private PlayerAvatar playerTarget; private Rigidbody rb; private float wanderTimer = 0f; private Vector3 randomWanderTarget; private float latchTimer = 0f; private float regrabTimer = 0f; private void Start() { rb = ((Component)this).GetComponent<Rigidbody>(); SetRandomWanderTarget(); } private void FixedUpdate() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (regrabTimer > 0f) { regrabTimer -= Time.fixedDeltaTime; } if ((Object)(object)playerTarget == (Object)null && regrabTimer <= 0f) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.isDisabled || !(Vector3.Distance(seatPoint.position, ((Component)item).transform.position) <= grabDistance)) { continue; } playerTarget = item; latchTimer = 0f; break; } } if ((Object)(object)playerTarget != (Object)null) { CarryPlayer(); latchTimer += Time.fixedDeltaTime; if (latchTimer >= latchDuration) { TossPlayer(); playerTarget = null; latchTimer = 0f; regrabTimer = regrabCooldown; SetRandomWanderTarget(); } } else { wanderTimer += Time.fixedDeltaTime; if (wanderTimer >= wanderInterval) { wanderTimer = 0f; SetRandomWanderTarget(); } MoveToWanderTarget(); } } private void CarryPlayer() { //IL_0073: 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_0084: 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_0094: 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_00a3: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) Rigidbody val = playerTarget.tumble.rb; if (!playerTarget.tumble.isTumbling) { playerTarget.tumble.TumbleRequest(true, false); } playerTarget.tumble.TumbleOverrideTime(1f); playerTarget.FallDamageResetSet(0.1f); Vector3 val2 = SemiFunc.PhysFollowPosition(((Component)playerTarget.tumble).transform.position, seatPoint.position, val.velocity, positionStiffness); val.AddForce(val2 * (positionStiffness * Time.fixedDeltaTime), (ForceMode)1); Vector3 val3 = SemiFunc.PhysFollowRotation(((Component)playerTarget.tumble).transform, seatPoint.rotation, val, rotationStiffness); val.AddTorque(val3 * Time.fixedDeltaTime, (ForceMode)1); } private void TossPlayer() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_0048: 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) Vector3 val = ((Component)playerTarget).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; playerTarget.tumble.TumbleRequest(true, false); playerTarget.tumble.TumbleForce(normalized * tossForce); playerTarget.tumble.TumbleOverrideTime(1f); } private void SetRandomWanderTarget() { //IL_0001: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Random.insideUnitCircle * wanderRadius; randomWanderTarget = ((Component)this).transform.position + new Vector3(val.x, 0f, val.y); } private void MoveToWanderTarget() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = SemiFunc.PhysFollowPosition(rb.position, randomWanderTarget, rb.velocity, moveForce); rb.AddForce(val * (moveForce * Time.fixedDeltaTime), (ForceMode)1); Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)rb).transform, Quaternion.LookRotation(randomWanderTarget - ((Component)this).transform.position), rb, rotationForce); rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1); } } public class FallTeleportTrigger : MonoBehaviour { public float fallYThreshold = -100f; public Transform teleportTarget; private PlayerAvatar localPlayer; private void Start() { localPlayer = ((IEnumerable<PlayerAvatar>)GameDirector.instance.PlayerList).FirstOrDefault((Func<PlayerAvatar, bool>)((PlayerAvatar p) => p.photonView.IsMine || !PhotonNetwork.InRoom)); } private void Update() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.Generated && Object.op_Implicit((Object)(object)localPlayer) && Object.op_Implicit((Object)(object)teleportTarget) && SemiFunc.IsMasterClientOrSingleplayer() && (int)GameDirector.instance.currentState == 2 && ((Component)localPlayer).transform.position.y < fallYThreshold) { PlayerTumble tumble = localPlayer.tumble; if ((Object)(object)tumble != (Object)null && (Object)(object)tumble.physGrabObject != (Object)null) { tumble.TumbleSet(true, false); tumble.physGrabObject.Teleport(teleportTarget.position, teleportTarget.rotation); tumble.physGrabObject.rb.velocity = Vector3.zero; tumble.physGrabObject.rb.angularVelocity = Vector3.zero; localPlayer.FallDamageResetSet(2f); } } } } public class GreedyVendingTrap : MonoBehaviourPun { [CompilerGenerated] private sealed class <PressCooldown>d__10 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GreedyVendingTrap <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PressCooldown>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.recentlyPressed = true; <>2__current = (object)new WaitForSeconds(<>4__this.cooldown); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.recentlyPressed = 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 ItemToggle itemToggle; private bool warned = false; private bool recentlyPressed = false; public AudioClip warningClip; public AudioSource audioSource; public Animator warningAnimator; public string animationTriggerName = "Warn"; public float cooldown = 0.5f; private void Start() { itemToggle = ((Component)this).GetComponent<ItemToggle>(); } private void Update() { if (!itemToggle.toggleImpulse || recentlyPressed) { return; } ((MonoBehaviour)this).StartCoroutine(PressCooldown()); if (!warned) { warned = true; if ((Object)(object)warningClip != (Object)null && (Object)(object)audioSource != (Object)null) { audioSource.PlayOneShot(warningClip); } if ((Object)(object)warningAnimator != (Object)null) { warningAnimator.SetTrigger(animationTriggerName); } Debug.Log((object)"[Trap] First press - warning issued."); } else { Debug.Log((object)"[Trap] Second press - punishing all players."); KillAllPlayers(); } } [IteratorStateMachine(typeof(<PressCooldown>d__10))] private IEnumerator PressCooldown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PressCooldown>d__10(0) { <>4__this = this }; } private void KillAllPlayers() { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)val.playerHealth != (Object)null) { int num = -1; val.playerHealth.Hurt(val.playerHealth.health, false, num); } } } } [RequireComponent(typeof(Collider))] public class KinematicCoasterMover : MonoBehaviour { [Header("Waypoints & Timing")] public Transform waypointRoot; public float speed = 5f; public float startDelay = 10f; public bool loop = true; public float rotationSpeed = 5f; [Header("Mesh Import Rotation Correction (tweak in Inspector)")] public Vector3 meshEulerOffset = new Vector3(-90f, 180f, -0.085f); private Transform[] waypoints; private int idx; private float delayTimer; private bool started; private Quaternion originalRotation; private Quaternion meshOffsetQuat; private static readonly Regex regex = new Regex("Waypoint_(\\d+)$"); private void Awake() { //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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) originalRotation = ((Component)this).transform.rotation; waypoints = (from t in ((Component)waypointRoot).GetComponentsInChildren<Transform>(true) where regex.IsMatch(((Object)t).name) select new { t = t, i = int.Parse(regex.Match(((Object)t).name).Groups[1].Value) } into x orderby x.i select x.t).ToArray(); meshOffsetQuat = Quaternion.Euler(meshEulerOffset); idx = 0; delayTimer = startDelay; started = false; if (waypoints.Length != 0) { ((Component)this).transform.position = waypoints[0].position; } } private void Update() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00f3: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) if (waypoints == null || waypoints.Length == 0) { return; } if (!started) { delayTimer -= Time.deltaTime; ((Component)this).transform.rotation = originalRotation; if (delayTimer <= 0f) { started = true; } return; } if (idx == 0 && ((Component)this).transform.rotation == originalRotation && waypoints.Length > 1) { Vector3 val = waypoints[1].position - waypoints[0].position; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion rotation = Quaternion.LookRotation(normalized, Vector3.up) * meshOffsetQuat; ((Component)this).transform.rotation = rotation; } Vector3 position = waypoints[idx].position; Vector3 val2 = position - ((Component)this).transform.position; float num = speed * Time.deltaTime; if (((Vector3)(ref val2)).magnitude <= num) { ((Component)this).transform.position = position; AdvanceIndex(); return; } Transform transform = ((Component)this).transform; transform.position += ((Vector3)(ref val2)).normalized * num; Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up) * meshOffsetQuat; ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val3, rotationSpeed * Time.deltaTime); } private void AdvanceIndex() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) idx++; if (idx >= waypoints.Length) { if (loop) { idx = 0; delayTimer = startDelay; started = false; ((Component)this).transform.rotation = originalRotation; } else { ((Behaviour)this).enabled = false; } } } private void OnDrawGizmos() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)waypointRoot == (Object)null)) { Vector3[] array = (from t in ((Component)waypointRoot).GetComponentsInChildren<Transform>(true) where regex.IsMatch(((Object)t).name) select new { p = t.position, i = int.Parse(regex.Match(((Object)t).name).Groups[1].Value) } into x orderby x.i select x.p).ToArray(); Gizmos.color = Color.cyan; for (int i = 0; i + 1 < array.Length; i++) { Gizmos.DrawLine(array[i], array[i + 1]); } } } } public class LowGravityValuable : MonoBehaviour { private PhotonView photonView; private bool gravitySet = false; private void Start() { photonView = ((Component)this).GetComponent<PhotonView>(); if (SemiFunc.IsMasterClientOrSingleplayer()) { ApplyLowGravity(); } } private void ApplyLowGravity() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!gravitySet) { Physics.gravity = new Vector3(0f, -1.2f, 0f); gravitySet = true; Debug.Log((object)"[LowGravityValuable] Gravity set to low space mode."); } } } public class CursedMusicBoxValuable : Trap { [Header("Audio")] public Sound cursedMusicSound; [Header("Spin Settings")] public float spinForce = 50f; public float tumbleForce = 15f; public float spinInterval = 0.2f; [Header("Visual Effects")] public ParticleSystem curseSparks; public Light curseLight; [Header("Animator")] public Animator cursedAnimator; public string holdBoolParameter = "IsHeld"; [Header("Camera Shake")] public float cameraShakeTime = 0.2f; public float cameraShakeStrength = 3f; public Vector2 cameraShakeBounds = new Vector2(1.5f, 5f); private float spinTimer; private Rigidbody rb; private bool soundPlaying = false; public override void Start() { ((Trap)this).Start(); rb = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)curseLight != (Object)null) { ((Behaviour)curseLight).enabled = false; } } public override void Update() { ((Trap)this).Update(); if (SemiFunc.IsMasterClientOrSingleplayer()) { CheckForGrabTumble(); } HandleGrabAnimation(); } private void CheckForGrabTumble() { if (!SemiFunc.FPSImpulse15() && base.physGrabObject.grabbed) { ActivateCurseEffects(); { foreach (PhysGrabber item in base.physGrabObject.playerGrabbing) { SpinAndTumblePlayer(item.playerAvatar); } return; } } StopCurseEffects(); } private void ActivateCurseEffects() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!soundPlaying) { cursedMusicSound.Play(base.physGrabObject.centerPoint, 1f, 1f, 1f, 1f); soundPlaying = true; } if ((Object)(object)curseLight != (Object)null) { ((Behaviour)curseLight).enabled = true; } if ((Object)(object)curseSparks != (Object)null && !curseSparks.isPlaying) { curseSparks.Play(); } } private void StopCurseEffects() { if (soundPlaying) { cursedMusicSound.Stop(); soundPlaying = false; } if ((Object)(object)curseLight != (Object)null) { ((Behaviour)curseLight).enabled = false; } if ((Object)(object)curseSparks != (Object)null && curseSparks.isPlaying) { curseSparks.Stop(); } } private void SpinAndTumblePlayer(PlayerAvatar player) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_00c6: 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) spinTimer += Time.deltaTime; if (spinTimer >= spinInterval) { spinTimer = 0f; player.tumble.TumbleRequest(true, false); player.tumble.TumbleForce(((Component)player).transform.forward * tumbleForce); player.tumble.TumbleTorque(Vector3.up * spinForce); player.tumble.TumbleOverrideTime(2f); player.tumble.ImpactHurtSet(1f, 5); GameDirector.instance.CameraShake.ShakeDistance(cameraShakeStrength, 3f, 8f, ((Component)this).transform.position, cameraShakeTime); GameDirector.instance.CameraImpact.ShakeDistance(cameraShakeStrength, cameraShakeBounds.x, cameraShakeBounds.y, ((Component)this).transform.position, cameraShakeTime); } } private void HandleGrabAnimation() { if (!((Object)(object)cursedAnimator == (Object)null)) { bool grabbed = base.physGrabObject.grabbed; cursedAnimator.SetBool(holdBoolParameter, grabbed); } } } public class OmniPlinkoInstaller : MonoBehaviour { [CompilerGenerated] private sealed class <InstallSequence>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OmniPlinkoInstaller <>4__this; private float <progress>5__1; private int <msgIndex>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InstallSequence>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)<>4__this.disableOnStart != (Object)null) { <>4__this.disableOnStart.SetActive(false); } ((Component)<>4__this.startButton).gameObject.SetActive(false); <>4__this.bgm.Play(); <progress>5__1 = 0f; <msgIndex>5__2 = 0; goto IL_0164; case 1: <>1__state = -1; goto IL_0164; case 2: { <>1__state = -1; <>4__this.rootCanvas.SetActive(false); Debug.Log((object)"Omni-OS fully initialized. Canvas off."); return false; } IL_0164: if (<progress>5__1 < 100f) { <progress>5__1 += Random.Range(1f, 4f); <>4__this.progressBar.value = <progress>5__1 / 100f; if (<progress>5__1 >= (float)(<msgIndex>5__2 + 1) * (100f / (float)<>4__this.messages.Length) && <msgIndex>5__2 < <>4__this.messages.Length) { ((TMP_Text)<>4__this.statusText).text = <>4__this.messages[<msgIndex>5__2++]; } <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; return true; } <>4__this.installerUI.SetActive(false); <>4__this.loadedUI.SetActive(true); <>2__current = (object)new WaitForSeconds(3f); <>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(); } } [CompilerGenerated] private sealed class <PressCooldown>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public OmniPlinkoInstaller <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PressCooldown>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.recentlyPressed = true; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.recentlyPressed = 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(); } } [Header("UI Elements")] public GameObject rootCanvas; public GameObject installerUI; public GameObject loadedUI; public Slider progressBar; public TextMeshProUGUI statusText; public Button startButton; public AudioSource bgm; [Header("Setup Control")] public GameObject disableOnStart; private ItemToggle itemToggle; private bool recentlyPressed = false; private readonly string[] messages = new string[6] { "Initializing Installer...", "Decrypting Payload...", "Installing Omni-Kernel...", "Configuring Quantum Drivers...", "Patching BIOS...", "Finalizing Setup..." }; private void Start() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown itemToggle = ((Component)this).GetComponent<ItemToggle>(); installerUI.SetActive(true); loadedUI.SetActive(false); rootCanvas.SetActive(true); ((UnityEvent)startButton.onClick).AddListener((UnityAction)delegate { ((MonoBehaviour)this).StartCoroutine(InstallSequence()); }); } private void Update() { if ((Object)(object)itemToggle != (Object)null && itemToggle.toggleImpulse && !recentlyPressed) { ((MonoBehaviour)this).StartCoroutine(PressCooldown()); Debug.Log((object)"[Installer] Grab press detected - starting installer."); ((UnityEvent)startButton.onClick).Invoke(); } } [IteratorStateMachine(typeof(<PressCooldown>d__13))] private IEnumerator PressCooldown() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PressCooldown>d__13(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<InstallSequence>d__14))] private IEnumerator InstallSequence() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InstallSequence>d__14(0) { <>4__this = this }; } } public class NetworkedProximityTrigger : MonoBehaviourPun { [Header("Trigger Settings")] public float triggerDistance = 2f; public float deactivateAfterSeconds = 49f; public bool retriggerable = false; [Header("Actions")] public VideoPlayer videoPlayer; public AudioSource externalAudioSource; [Header("Audio Control")] public bool startAudioOnActivate = false; public bool stopAudioOnDeactivate = false; public GameObject[] objectsToToggle; [Header("Animator Settings")] public Animator targetAnimator; public string triggerParameterName = "Activate"; private bool isActive = false; private bool hasTriggered = false; private float timer = 0f; private PlayerAvatar playerTarget; private void FixedUpdate() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (hasTriggered) { return; } if ((Object)(object)playerTarget == (Object)null) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.isDisabled || !(Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position) <= triggerDistance)) { continue; } playerTarget = item; break; } } if (!((Object)(object)playerTarget != (Object)null) || playerTarget.isDisabled) { return; } if (!isActive) { TriggerActivate(); return; } timer += Time.fixedDeltaTime; if (timer >= deactivateAfterSeconds) { TriggerDeactivate(); hasTriggered = true; } } private void TriggerActivate() { if (PhotonNetwork.IsConnectedAndReady || PhotonNetwork.OfflineMode) { ((MonoBehaviourPun)this).photonView.RPC("ActivateTrigger", (RpcTarget)3, Array.Empty<object>()); } else { ActivateTrigger(); } } private void TriggerDeactivate() { if (PhotonNetwork.IsConnectedAndReady || PhotonNetwork.OfflineMode) { ((MonoBehaviourPun)this).photonView.RPC("DeactivateTrigger", (RpcTarget)3, Array.Empty<object>()); } else { DeactivateTrigger(); } } [PunRPC] private void ActivateTrigger() { if (isActive) { return; } isActive = true; timer = 0f; if ((Object)(object)videoPlayer != (Object)null) { videoPlayer.Play(); } if (startAudioOnActivate && (Object)(object)externalAudioSource != (Object)null && !externalAudioSource.isPlaying) { externalAudioSource.Play(); } GameObject[] array = objectsToToggle; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(true); } } if ((Object)(object)targetAnimator != (Object)null && !string.IsNullOrEmpty(triggerParameterName)) { targetAnimator.SetTrigger(triggerParameterName); } } [PunRPC] private void DeactivateTrigger() { if (!isActive) { return; } isActive = false; playerTarget = null; if ((Object)(object)videoPlayer != (Object)null) { videoPlayer.Stop(); } if (stopAudioOnDeactivate && (Object)(object)externalAudioSource != (Object)null) { externalAudioSource.Stop(); } GameObject[] array = objectsToToggle; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null) { val.SetActive(false); } } } } public class PlayerWallBlocker : Trap { [Header("Push Settings")] public float blockRange = 2f; public float pushForce = 30f; public override void Update() { ((Trap)this).Update(); if (SemiFunc.IsMasterClientOrSingleplayer()) { PushBackNearbyPlayers(); } } private void PushBackNearbyPlayers() { //IL_0030: 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_005f: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00ac: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!item.isDisabled) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num <= blockRange) { Vector3 val = ((Component)item).transform.position - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; normalized.y = 0f; Rigidbody rb = item.tumble.rb; rb.AddForce(normalized * pushForce * Time.deltaTime, (ForceMode)2); } } } } } public class PlinkoGameManager : MonoBehaviourPun { [CompilerGenerated] private sealed class <DropTimeoutCheck>d__21 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlinkoGameManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DropTimeoutCheck>d__21(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.maxDropTime); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.dropActive) { <>4__this.FinishDrop(); } 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 <ResetDropAfterDelay>d__26 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlinkoGameManager <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ResetDropAfterDelay>d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.isResetting = true; <>2__current = (object)new WaitForSeconds(<>4__this.resetDelay); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.isResetting = 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(); } } [Header("Ball")] public Rigidbody ballRb; public Transform dropStart; public float maxDropTime = 10f; [Header("Detection")] public float detectionRadius = 0.5f; public float resetDelay = 3f; [Header("Zones")] public List<Transform> rewardZones = new List<Transform>(); public List<Transform> deathZones = new List<Transform>(); [Header("Reward System")] public GameObject rewardPrefab; public Transform rewardSpawnPoint; public AudioSource rewardAudioSource; public AudioClip rewardClip; [Header("Death")] public HurtCollider playerKillCollider; private PlinkoGrabTracker grabTracker; private bool dropActive = false; private bool isResetting = false; private Coroutine dropTimeoutRoutine; private List<Transform> usedDeathZones = new List<Transform>(); private List<Transform> usedRewardZones = new List<Transform>(); private void Start() { if (!PhotonNetwork.IsConnected) { PhotonNetwork.OfflineMode = true; } if ((Object)(object)ballRb == (Object)null) { Debug.LogError((object)"❌ Ball Rigidbody not assigned!"); } else { Debug.Log((object)("✅ Ball Rigidbody assigned: " + ((Object)ballRb).name)); } grabTracker = ((Component)ballRb).GetComponent<PlinkoGrabTracker>(); Debug.Log((object)$"\ud83c\udfaf Reward zones: {rewardZones.Count}"); Debug.Log((object)$"☠\ufe0f Death zones: {deathZones.Count}"); Debug.Log((object)"✅ Plinko setup complete."); } private void Update() { if ((Object)(object)ballRb == (Object)null) { ((Behaviour)this).enabled = false; } else if ((PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode) && !isResetting) { CheckBallDropStartY(); if (dropActive) { CheckDeathZones(); } } } private void CheckBallDropStartY() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!dropActive && (Object)(object)dropStart != (Object)null && ballRb.position.y <= dropStart.position.y) { dropActive = true; } } [IteratorStateMachine(typeof(<DropTimeoutCheck>d__21))] private IEnumerator DropTimeoutCheck() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DropTimeoutCheck>d__21(0) { <>4__this = this }; } private void CheckDeathZones() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < deathZones.Count; i++) { Transform val = deathZones[i]; if ((Object)(object)val == (Object)null || usedDeathZones.Contains(val)) { continue; } float num = Vector3.Distance(ballRb.position, val.position); if (num <= detectionRadius) { usedDeathZones.Add(val); Debug.Log((object)("☠\ufe0f Death zone hit: " + ((Object)val).name)); FinishDrop(); if (PhotonNetwork.OfflineMode) { RemoteKillRPC(); } else { ((MonoBehaviourPun)this).photonView.RPC("RemoteKillRPC", (RpcTarget)0, Array.Empty<object>()); } break; } } } public void OnRewardZoneTrigger(Transform zone) { if (dropActive && !isResetting && !usedRewardZones.Contains(zone)) { usedRewardZones.Add(zone); Debug.Log((object)("\ud83c\udf81 Reward zone triggered: " + ((Object)zone).name)); SpawnReward(); FinishDrop(); } } private void SpawnReward() { //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_0055: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rewardPrefab == (Object)null) && !((Object)(object)rewardSpawnPoint == (Object)null)) { Vector3 position = rewardSpawnPoint.position; if (PhotonNetwork.OfflineMode) { Object.Instantiate<GameObject>(rewardPrefab, position, Quaternion.identity); } else { PhotonNetwork.Instantiate("RewardThing", position, Quaternion.identity, (byte)0, (object[])null); } if (Object.op_Implicit((Object)(object)rewardAudioSource) && Object.op_Implicit((Object)(object)rewardClip)) { rewardAudioSource.PlayOneShot(rewardClip); } } } private void FinishDrop() { dropActive = false; if (dropTimeoutRoutine != null) { ((MonoBehaviour)this).StopCoroutine(dropTimeoutRoutine); dropTimeoutRoutine = null; } ((MonoBehaviour)this).StartCoroutine(ResetDropAfterDelay()); } [IteratorStateMachine(typeof(<ResetDropAfterDelay>d__26))] private IEnumerator ResetDropAfterDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ResetDropAfterDelay>d__26(0) { <>4__this = this }; } [PunRPC] private void RemoteKillRPC() { if ((Object)(object)grabTracker?.lastGrabber?.playerHealth != (Object)null) { Debug.Log((object)("☠\ufe0f Killing player: " + ((Object)grabTracker.lastGrabber).name)); grabTracker.lastGrabber.playerHealth.Hurt(grabTracker.lastGrabber.playerHealth.health, false, -1); } } } public class PlinkoGrabTracker : MonoBehaviour { [Header("Grab Tracking")] public PlayerAvatar lastGrabber; public PlinkoGameManager gameManager; private PhysGrabObject physGrab; private void Awake() { physGrab = ((Component)this).GetComponent<PhysGrabObject>(); if ((Object)(object)gameManager == (Object)null) { gameManager = Object.FindObjectOfType<PlinkoGameManager>(); } } private void Update() { if ((Object)(object)physGrab != (Object)null && physGrab.playerGrabbing != null && physGrab.playerGrabbing.Count > 0) { PhysGrabber val = physGrab.playerGrabbing[physGrab.playerGrabbing.Count - 1]; if ((Object)(object)val != (Object)null && (Object)(object)val.playerAvatar != (Object)null) { lastGrabber = val.playerAvatar; } } } private void OnTriggerEnter(Collider other) { if (((Component)other).CompareTag("RewardZone")) { gameManager.OnRewardZoneTrigger(((Component)other).transform); } } } public class RewardZone : MonoBehaviour { } public class TeleportGlitchValuable : Trap { [Header("Teleport Settings")] public float teleportForce = 150f; public float teleportInterval = 2f; private float teleportTimer = 0f; public override void Update() { ((Trap)this).Update(); if (SemiFunc.IsMasterClientOrSingleplayer()) { CheckForGrabTeleport(); } } private void CheckForGrabTeleport() { if (base.physGrabObject.grabbed) { teleportTimer += Time.deltaTime; if (!(teleportTimer >= teleportInterval)) { return; } teleportTimer = 0f; { foreach (PhysGrabber item in base.physGrabObject.playerGrabbing) { if ((Object)(object)item != (Object)null && (Object)(object)item.playerAvatar != (Object)null) { ApplyTeleportEffect(item.playerAvatar); } } return; } } teleportTimer = 0f; } private void ApplyTeleportEffect(PlayerAvatar player) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) player.tumble.TumbleRequest(true, false); Vector3 up = Vector3.up; player.tumble.TumbleForce(up * teleportForce); player.tumble.TumbleOverrideTime(1.5f); } } namespace NWH.DWP2.DefaultWater { [ExecuteInEditMode] [RequireComponent(typeof(WaterBase))] public class Displace : MonoBehaviour { public void Awake() { if (((Behaviour)this).enabled) { OnEnable(); } else { OnDisable(); } } public void OnEnable() { Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_ON"); Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_OFF"); } public void OnDisable() { Shader.EnableKeyword("WATER_VERTEX_DISPLACEMENT_OFF"); Shader.DisableKeyword("WATER_VERTEX_DISPLACEMENT_ON"); } } [ExecuteInEditMode] [RequireComponent(typeof(WaterBase))] public class GerstnerDisplace : Displace { } public class MeshContainer { public Mesh mesh; public Vector3[] vertices; public Vector3[] normals; public MeshContainer(Mesh m) { mesh = m; vertices = m.vertices; normals = m.normals; } public void Update() { mesh.vertices = vertices; mesh.normals = normals; } } [ExecuteInEditMode] [RequireComponent(typeof(WaterBase))] public class PlanarReflection : MonoBehaviour { public LayerMask reflectionMask; public bool reflectSkybox; public Color clearColor = Color.grey; public string reflectionSampler = "_ReflectionTex"; public float clipPlaneOffset = 0.07f; private Vector3 m_Oldpos; private Camera m_ReflectionCamera; private Material m_SharedMaterial; private Dictionary<Camera, bool> m_HelperCameras; public void Start() { m_SharedMaterial = ((WaterBase)(object)((Component)this).gameObject.GetComponent(typeof(WaterBase))).sharedMaterial; } public void LateUpdate() { if (m_HelperCameras != null) { m_HelperCameras.Clear(); } } private Camera CreateReflectionCameraFor(Camera cam) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0087: 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) string text = ((Object)((Component)this).gameObject).name + "Reflection" + ((Object)cam).name; GameObject val = GameObject.Find(text); if (!Object.op_Implicit((Object)(object)val)) { val = new GameObject(text, new Type[1] { typeof(Camera) }); } if (!Object.op_Implicit((Object)(object)val.GetComponent(typeof(Camera)))) { val.AddComponent(typeof(Camera)); } Camera component = val.GetComponent<Camera>(); component.backgroundColor = clearColor; component.clearFlags = (CameraClearFlags)(reflectSkybox ? 1 : 2); SetStandardCameraParameter(component, reflectionMask); if (!Object.op_Implicit((Object)(object)component.targetTexture)) { component.targetTexture = CreateTextureFor(cam); } return component; } private void SetStandardCameraParameter(Camera cam, LayerMask mask) { //IL_0002: 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) cam.cullingMask = LayerMask.op_Implicit(mask) & ~(1 << LayerMask.NameToLayer("Water")); cam.backgroundColor = Color.black; ((Behaviour)cam).enabled = false; } private RenderTexture CreateTextureFor(Camera cam) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown RenderTexture val = new RenderTexture(Mathf.FloorToInt((float)cam.pixelWidth * 0.5f), Mathf.FloorToInt((float)cam.pixelHeight * 0.5f), 24); ((Object)val).hideFlags = (HideFlags)52; return val; } public void RenderHelpCameras(Camera currentCam) { if (m_HelperCameras == null) { m_HelperCameras = new Dictionary<Camera, bool>(); } if (!m_HelperCameras.ContainsKey(currentCam)) { m_HelperCameras.Add(currentCam, value: false); } if (!m_HelperCameras[currentCam]) { if (!Object.op_Implicit((Object)(object)m_ReflectionCamera)) { m_ReflectionCamera = CreateReflectionCameraFor(currentCam); } RenderReflectionFor(currentCam, m_ReflectionCamera); m_HelperCameras[currentCam] = true; } } public void WaterTileBeingRendered(Transform tr, Camera currentCam) { RenderHelpCameras(currentCam); if (Object.op_Implicit((Object)(object)m_ReflectionCamera) && Object.op_Implicit((Object)(object)m_SharedMaterial)) { m_SharedMaterial.SetTexture(reflectionSampler, (Texture)(object)m_ReflectionCamera.targetTexture); } } public void OnEnable() { Shader.EnableKeyword("WATER_REFLECTIVE"); Shader.DisableKeyword("WATER_SIMPLE"); } public void OnDisable() { Shader.EnableKeyword("WATER_SIMPLE"); Shader.DisableKeyword("WATER_REFLECTIVE"); } private void RenderReflectionFor(Camera cam, Camera reflectCamera) { //IL_0048: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_017a: 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_0190: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: 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_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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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: 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_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: 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_0253: 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_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026e: 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_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)reflectCamera) || (Object.op_Implicit((Object)(object)m_SharedMaterial) && !m_SharedMaterial.HasProperty(reflectionSampler))) { return; } reflectCamera.cullingMask = LayerMask.op_Implicit(reflectionMask) & ~(1 << LayerMask.NameToLayer("Water")); SaneCameraSettings(reflectCamera); reflectCamera.backgroundColor = clearColor; reflectCamera.clearFlags = (CameraClearFlags)(reflectSkybox ? 1 : 2); if (reflectSkybox && Object.op_Implicit((Object)(object)((Component)cam).gameObject.GetComponent(typeof(Skybox)))) { Skybox val = (Skybox)((Component)reflectCamera).gameObject.GetComponent(typeof(Skybox)); if (!Object.op_Implicit((Object)(object)val)) { val = (Skybox)((Component)reflectCamera).gameObject.AddComponent(typeof(Skybox)); } val.material = ((Skybox)((Component)cam).GetComponent(typeof(Skybox))).material; } GL.invertCulling = true; Transform transform = ((Component)this).transform; Vector3 eulerAngles = ((Component)cam).transform.eulerAngles; ((Component)reflectCamera).transform.eulerAngles = new Vector3(0f - eulerAngles.x, eulerAngles.y, eulerAngles.z); ((Component)reflectCamera).transform.position = ((Component)cam).transform.position; Vector3 position = ((Component)transform).transform.position; position.y = transform.position.y; Vector3 up = ((Component)transform).transform.up; float num = 0f - Vector3.Dot(up, position) - clipPlaneOffset; Vector4 plane = default(Vector4); ((Vector4)(ref plane))..ctor(up.x, up.y, up.z, num); Matrix4x4 val2 = Matrix4x4.zero; val2 = CalculateReflectionMatrix(val2, plane); m_Oldpos = ((Component)cam).transform.position; Vector3 position2 = ((Matrix4x4)(ref val2)).MultiplyPoint(m_Oldpos); reflectCamera.worldToCameraMatrix = cam.worldToCameraMatrix * val2; Vector4 clipPlane = CameraSpacePlane(reflectCamera, position, up, 1f); Matrix4x4 projectionMatrix = cam.projectionMatrix; projectionMatrix = CalculateObliqueMatrix(projectionMatrix, clipPlane); reflectCamera.projectionMatrix = projectionMatrix; ((Component)reflectCamera).transform.position = position2; Vector3 eulerAngles2 = ((Component)cam).transform.eulerAngles; ((Component)reflectCamera).transform.eulerAngles = new Vector3(0f - eulerAngles2.x, eulerAngles2.y, eulerAngles2.z); reflectCamera.Render(); GL.invertCulling = false; } private void SaneCameraSettings(Camera helperCam) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) helperCam.depthTextureMode = (DepthTextureMode)0; helperCam.backgroundColor = Color.black; helperCam.clearFlags = (CameraClearFlags)2; helperCam.renderingPath = (RenderingPath)1; } private static Matrix4x4 CalculateObliqueMatrix(Matrix4x4 projection, Vector4 clipPlane) { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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_003a: 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_0046: 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_0062: 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_0095: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) Vector4 val = ((Matrix4x4)(ref projection)).inverse * new Vector4(Sgn(clipPlane.x), Sgn(clipPlane.y), 1f, 1f); Vector4 val2 = clipPlane * (2f / Vector4.Dot(clipPlane, val)); ((Matrix4x4)(ref projection))[2] = val2.x - ((Matrix4x4)(ref projection))[3]; ((Matrix4x4)(ref projection))[6] = val2.y - ((Matrix4x4)(ref projection))[7]; ((Matrix4x4)(ref projection))[10] = val2.z - ((Matrix4x4)(ref projection))[11]; ((Matrix4x4)(ref projection))[14] = val2.w - ((Matrix4x4)(ref projection))[15]; return projection; } private static Matrix4x4 CalculateReflectionMatrix(Matrix4x4 reflectionMat, Vector4 plane) { //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) reflectionMat.m00 = 1f - 2f * ((
plugins/REPO-DeadTTS.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using REPO_DeadTTS.Config; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("REPO-DeadTTS")] [assembly: AssemblyDescription("Mod created by flipf17")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("REPO-DeadTTS")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8e05cd18-c8aa-419a-b430-33faaf371490")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace REPO_DeadTTS { [BepInPlugin("flipf17.DeadTTS", "DeadTTS", "1.0.14")] public class Plugin : BaseUnityPlugin { private Harmony _harmony; public static Plugin instance; private static ManualLogSource logger; private void Awake() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown instance = this; CreateCustomLogger(); ConfigSettings.BindConfigSettings(); _harmony = new Harmony("DeadTTS"); PatchAll(); Log("DeadTTS loaded"); } private void PatchAll() { IEnumerable<Type> enumerable; try { enumerable = Assembly.GetExecutingAssembly().GetTypes(); } catch (ReflectionTypeLoadException ex) { enumerable = ex.Types.Where((Type t) => t != null); } foreach (Type item in enumerable) { _harmony.PatchAll(item); } } private void CreateCustomLogger() { try { logger = Logger.CreateLogSource(string.Format("{0}-{1}", "DeadTTS", "1.0.14")); } catch { logger = ((BaseUnityPlugin)this).Logger; } } internal static void Log(string message) { logger.LogInfo((object)message); } internal static void LogError(string message) { logger.LogError((object)message); } internal static void LogWarning(string message) { logger.LogWarning((object)message); } internal static void LogVerbose(string message) { if (ConfigSettings.verboseLogs.Value) { logger.LogInfo((object)("[VERBOSE] " + message)); } } internal static void LogErrorVerbose(string message) { if (ConfigSettings.verboseLogs.Value) { logger.LogError((object)("[VERBOSE] " + message)); } } internal static void LogWarningVerbose(string message) { if (ConfigSettings.verboseLogs.Value) { logger.LogWarning((object)("[VERBOSE] " + message)); } } } public static class PluginInfo { public const string PLUGIN_GUID = "flipf17.DeadTTS"; public const string PLUGIN_NAME = "DeadTTS"; public const string PLUGIN_VERSION = "1.0.14"; } } namespace REPO_DeadTTS.Patches { [HarmonyPatch] public class DeadTTSPlayerData : MonoBehaviour { internal static PlayerAvatar localPlayer; internal static FieldInfo playerNameField = typeof(PlayerAvatar).GetField("playerName", BindingFlags.Instance | BindingFlags.NonPublic); internal static FieldInfo steamIdField = typeof(PlayerAvatar).GetField("steamId", BindingFlags.Instance | BindingFlags.NonPublic); internal static MethodInfo setupClient = typeof(PlayerDeathHead).GetMethod("SetupClient", BindingFlags.Instance | BindingFlags.NonPublic); public bool isLocalPlayer = false; public PlayerAvatar playerAvatar; private string _playerName; private string _steamId; public PlayerDeathHead playerDeathHead; public PhotonView photonView => Object.op_Implicit((Object)(object)playerAvatar) ? playerAvatar.photonView : null; public string playerName { get { if (string.IsNullOrEmpty(_playerName)) { _playerName = (string)playerNameField.GetValue(playerAvatar); } return _playerName; } internal set { _playerName = value; } } public string steamId { get { if (string.IsNullOrEmpty(_steamId)) { _steamId = (string)steamIdField.GetValue(playerAvatar); } return _steamId; } internal set { _steamId = value; } } private void Awake() { playerAvatar = ((Component)this).GetComponent<PlayerAvatar>(); isLocalPlayer = Object.op_Implicit((Object)(object)playerAvatar) && (Object)(object)playerAvatar == (Object)(object)PlayerPatcher.localPlayer; } [HarmonyPatch(typeof(PlayerAvatar), "AddToStatsManagerRPC")] [HarmonyPostfix] public static void OnAddToStatsManagerRPC(string _playerName, string _steamID, PlayerAvatar __instance) { DeadTTSPlayerData component = ((Component)__instance).GetComponent<DeadTTSPlayerData>(); if (Object.op_Implicit((Object)(object)component)) { component.playerName = _playerName; component.steamId = _steamID; } } [HarmonyPatch(typeof(PlayerDeathHead), "SetupDone")] [HarmonyPostfix] public static void OnDeathHeadSetupDone(PlayerDeathHead __instance) { if (GameManager.Multiplayer() && !PhotonNetwork.IsMasterClient) { return; } PlayerAvatar val = __instance.playerAvatar; DeadTTSPlayerData deadTTSPlayerData = ((val != null) ? ((Component)val).GetComponent<DeadTTSPlayerData>() : null); if (Object.op_Implicit((Object)(object)deadTTSPlayerData)) { if (ConfigSettings.fixMissingDeathHeads.Value) { deadTTSPlayerData.ReassignPlayerDeathHead(__instance); } if (GameManager.Multiplayer()) { PhotonView component = ((Component)deadTTSPlayerData.playerDeathHead).GetComponent<PhotonView>(); deadTTSPlayerData.photonView.RPC("ReassignPlayerDeathHeadRPC", (RpcTarget)4, new object[1] { component.ViewID }); Plugin.Log($"Sending PlayerDeathHead assignment assurance to clients for player: {deadTTSPlayerData.playerName} ({val.photonView.Owner.ActorNumber}) ..."); } else { Plugin.LogError("[OnDeathHeadSetupDone] Could not find PlayerAvatar assigned to PlayerDeathHead."); } } } [PunRPC] public void ReassignPlayerDeathHeadRPC(int deathHeadViewId, PhotonMessageInfo _info = default(PhotonMessageInfo)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MasterOnlyRPC(_info) || !ConfigSettings.fixMissingDeathHeads.Value) { return; } PlayerDeathHead[] array = Object.FindObjectsOfType<PlayerDeathHead>(); PlayerDeathHead[] array2 = array; foreach (PlayerDeathHead val in array2) { PhotonView component = ((Component)val).GetComponent<PhotonView>(); if (Object.op_Implicit((Object)(object)component) && component.ViewID == deathHeadViewId) { ReassignPlayerDeathHead(val); ((MonoBehaviour)this).StartCoroutine((IEnumerator)setupClient.Invoke(playerDeathHead, null)); return; } } Plugin.LogError(string.Format("Unknown error while trying to reassign PlayerDeathHead component to player: {0} ({1}) with death head view id: ", (!string.IsNullOrEmpty(playerName)) ? playerName : (Object.op_Implicit((Object)(object)playerAvatar) ? ((Object)playerAvatar).name : ""), photonView.Owner.ActorNumber) + deathHeadViewId); } [HarmonyPatch(typeof(PlayerAvatar), "PlayerDeathDone")] [HarmonyPrefix] public static void ReassignPlayerDeathHeadBackup(PlayerAvatar __instance) { if (ConfigSettings.fixMissingDeathHeads.Value) { DeadTTSPlayerData component = ((Component)__instance).GetComponent<DeadTTSPlayerData>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.playerDeathHead)) { component.ReassignPlayerDeathHead(component.playerDeathHead); } } } internal void ReassignPlayerDeathHead(PlayerDeathHead deathHead) { playerDeathHead = deathHead; int viewID = ((Component)playerDeathHead).GetComponent<PhotonView>().ViewID; if ((Object)(object)playerAvatar.playerDeathHead != (Object)(object)playerDeathHead || (Object)(object)playerDeathHead.playerAvatar != (Object)(object)playerAvatar || (Object)(object)((Component)playerDeathHead).transform.parent != (Object)(object)((Component)playerAvatar).transform.parent) { playerAvatar.playerDeathHead = playerDeathHead; playerDeathHead.playerAvatar = playerAvatar; ((Component)playerDeathHead).transform.SetParent(((Component)playerAvatar).transform.parent); Plugin.Log(string.Format("Reassigned PlayerDeathHead for player: {0} ({1}) - Assigned death head view id: ", (!string.IsNullOrEmpty(playerName)) ? playerName : (Object.op_Implicit((Object)(object)playerAvatar) ? ((Object)playerAvatar).name : ""), photonView.Owner.ActorNumber) + viewID); } if (!GameManager.Multiplayer() || !Object.op_Implicit((Object)(object)playerAvatar)) { return; } try { string text = (string)steamIdField.GetValue(playerAvatar); PlayerAvatar val = SessionManager.instance.CrownedPlayerGet(); string text2 = (Object.op_Implicit((Object)(object)val) ? ((string)steamIdField.GetValue(val)) : ""); if (SemiFunc.IsMultiplayer() && ((Object)(object)playerAvatar == (Object)(object)val || (!string.IsNullOrEmpty(text) && text == text2))) { playerDeathHead.arenaCrown.SetActive(true); } } catch { } } } [HarmonyPatch] public static class UIPatcher { private static HashSet<WorldSpaceUITTS> deadTTSElements = new HashSet<WorldSpaceUITTS>(); private static HashSet<WorldSpaceUITTS> deadTTSElementsFollowLog = new HashSet<WorldSpaceUITTS>(); private static Dictionary<PlayerAvatar, bool> isDisabledStates = new Dictionary<PlayerAvatar, bool>(); private static FieldInfo textField = typeof(WorldSpaceUITTS).GetField("text", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo playerAvatarField = typeof(WorldSpaceUITTS).GetField("playerAvatar", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo followTransformField = typeof(WorldSpaceUITTS).GetField("followTransform", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo worldPositionField = typeof(WorldSpaceUITTS).GetField("worldPosition", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo followPositionField = typeof(WorldSpaceUITTS).GetField("followPosition", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo wordTimeField = typeof(WorldSpaceUITTS).GetField("wordTime", BindingFlags.Instance | BindingFlags.NonPublic); private static FieldInfo ttsVoiceField = typeof(WorldSpaceUITTS).GetField("ttsVoice", BindingFlags.Instance | BindingFlags.NonPublic); [HarmonyPatch(typeof(WorldSpaceUIParent), "TTS")] [HarmonyPrefix] public static void OnTTSUI(PlayerAvatar _player, string _text, float _time, WorldSpaceUIParent __instance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Expected O, but got Unknown //IL_0104: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)_player) || !GameManager.Multiplayer() || (int)GameDirector.instance.currentState != 2 || (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop() && !SemiFunc.RunIsArena()) || !PlayerPatcher.IsPlayerDead(_player) || !ConfigSettings.useSpatialAudioDeadTTS.Value || !ConfigSettings.displayDeadTTSText.Value) { return; } if (!Object.op_Implicit((Object)(object)_player.playerDeathHead)) { Plugin.LogErrorVerbose("Failed to re-create TTS UI component. PlayerDeathHead was not set by the game."); return; } if (string.IsNullOrEmpty(_text)) { Plugin.LogErrorVerbose("Failed to re-create TTS UI component. Passed text value was null or empty."); return; } if (!ConfigSettings.onlyEnableWhenDiscovered.Value || (bool)PlayerPatcher.serverSeenField.GetValue(_player.playerDeathHead) || PlayerPatcher.IsLocalPlayerDead() || !SemiFunc.RunIsLevel()) { try { WorldSpaceUITTS component = Object.Instantiate<GameObject>(__instance.TTSPrefab, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation, ((Component)__instance).transform).GetComponent<WorldSpaceUITTS>(); if (!Object.op_Implicit((Object)(object)component)) { Plugin.LogError("Failed to create Dead TTS WorldSpaceUITTS component. Invalid prefab?"); return; } TextMeshProUGUI val = (TextMeshProUGUI)textField.GetValue(component); ((TMP_Text)val).text = _text; if (!PlayerPatcher.IsLocalPlayerDead()) { string text = ((TMP_Text)val).text; string text2 = ConfigSettings.deadTTSColor.Value.Trim(new char[1] { ' ' }).TrimStart(new char[1] { '#' }); if (text2.Length == 6) { ((TMP_Text)val).richText = true; try { text = "<color=#" + text2 + ">" + ((TMP_Text)val).text + "</color>"; ((TMP_Text)val).text = text; } catch (Exception ex) { Plugin.LogError("Failed to apply dead TTS color: " + ConfigSettings.deadTTSColor.Value + "\n" + ex); } } } playerAvatarField.SetValue(component, _player); Transform transform = ((Component)_player.playerDeathHead).transform; followTransformField.SetValue(component, transform); worldPositionField.SetValue(component, transform.position); followPositionField.SetValue(component, transform.position); wordTimeField.SetValue(component, _time); PlayerVoiceChat val2 = (PlayerVoiceChat)PlayerPatcher.voiceChatField.GetValue(_player); if (Object.op_Implicit((Object)(object)val2)) { ttsVoiceField.SetValue(component, val2.ttsVoice); } deadTTSElements.Add(component); try { deadTTSElements.RemoveWhere((WorldSpaceUITTS obj) => (Object)(object)obj == (Object)null); deadTTSElementsFollowLog.RemoveWhere((WorldSpaceUITTS obj) => (Object)(object)obj == (Object)null); return; } catch { return; } } catch (Exception ex2) { Plugin.LogError("Error initializing dead TTS UI:\n" + ex2); return; } } try { Plugin.LogWarningVerbose("Not creating TTS UI Element for dead player. ConfigEnableWhenDiscovered: " + ConfigSettings.onlyEnableWhenDiscovered.Value + " | PlayerDiscovered: " + (ConfigSettings.onlyEnableWhenDiscovered.Value ? ((bool)PlayerPatcher.serverSeenField.GetValue(_player.playerDeathHead)).ToString() : "N/A") + " | IsLocalPlayerDead: " + PlayerPatcher.IsLocalPlayerDead() + " | RunIsLevel: " + SemiFunc.RunIsLevel()); } catch (Exception ex3) { Plugin.LogErrorVerbose("Error logging state for OnTTSUI: " + ex3); } } [HarmonyPatch(typeof(WorldSpaceUITTS), "Update")] [HarmonyPrefix] public static void UpdateUIPositionPrefix(WorldSpaceUITTS __instance) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown if (!deadTTSElements.Contains(__instance)) { return; } try { PlayerAvatar val = (PlayerAvatar)playerAvatarField.GetValue(__instance); bool value = (bool)PlayerPatcher.isDisabledField.GetValue(val); isDisabledStates[val] = value; PlayerPatcher.isDisabledField.SetValue(val, false); if (!deadTTSElementsFollowLog.Contains(__instance)) { deadTTSElementsFollowLog.Add(__instance); TextMeshProUGUI val2 = (TextMeshProUGUI)textField.GetValue(__instance); Transform val3 = (Transform)followTransformField.GetValue(__instance); TTSVoice val4 = (TTSVoice)ttsVoiceField.GetValue(__instance); bool flag = Object.op_Implicit((Object)(object)val4) && (bool)PlayerPatcher.isSpeakingField.GetValue(val4); if (!Object.op_Implicit((Object)(object)val4)) { Plugin.LogWarningVerbose("FollowTransform: " + (((Object)(object)val3 != (Object)null) ? ((Object)val3).name : "NONE") + " | TTSVoice.IsSpeaking: " + (((Object)(object)val4 != (Object)null) ? flag.ToString() : "TTSVoice Not Set!")); } } } catch (Exception ex) { Plugin.LogError("Error (A) updating dead TTS UI location:\n" + ex); deadTTSElements.Remove(__instance); } } [HarmonyPatch(typeof(WorldSpaceUITTS), "Update")] [HarmonyPostfix] public static void UpdateUIPositionPostfix(WorldSpaceUITTS __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if (!deadTTSElements.Contains(__instance)) { return; } try { PlayerAvatar val = (PlayerAvatar)playerAvatarField.GetValue(__instance); if (isDisabledStates.TryGetValue(val, out var value)) { PlayerPatcher.isDisabledField.SetValue(val, value); } } catch (Exception ex) { Plugin.LogError("Error (B) updating dead TTS UI location:\n" + ex); deadTTSElements.Remove(__instance); } } } [HarmonyPatch] public static class PlayerPatcher { internal static PlayerAvatar localPlayer; internal static FieldInfo voiceChatField = typeof(PlayerAvatar).GetField("voiceChat", BindingFlags.Instance | BindingFlags.NonPublic); internal static FieldInfo isDisabledField = typeof(PlayerAvatar).GetField("isDisabled", BindingFlags.Instance | BindingFlags.NonPublic); internal static FieldInfo serverSeenField = typeof(PlayerDeathHead).GetField("serverSeen", BindingFlags.Instance | BindingFlags.NonPublic); internal static FieldInfo eyeMaterialField = typeof(PlayerDeathHead).GetField("eyeMaterial", BindingFlags.Instance | BindingFlags.NonPublic); internal static FieldInfo eyeMaterialAmountField = typeof(PlayerDeathHead).GetField("eyeMaterialAmount", BindingFlags.Instance | BindingFlags.NonPublic); internal static FieldInfo eyeFlashLerpField = typeof(PlayerDeathHead).GetField("eyeFlashLerp", BindingFlags.Instance | BindingFlags.NonPublic); internal static FieldInfo isSpeakingField = typeof(TTSVoice).GetField("isSpeaking", BindingFlags.Instance | BindingFlags.NonPublic); internal static Dictionary<PlayerAvatar, float> deadPlayersVoicePitch = new Dictionary<PlayerAvatar, float>(); [HarmonyPatch(typeof(PlayerAvatar), "Awake")] [HarmonyPostfix] public static void InitPlayer(ref bool ___isLocal, PlayerAvatar __instance) { if (___isLocal) { localPlayer = __instance; } ((Component)__instance).gameObject.AddComponent<DeadTTSPlayerData>(); } [HarmonyPatch(typeof(RoundDirector), "StartRoundLogic")] [HarmonyPrefix] public static void RandomizeTTSPitch(int value, RoundDirector __instance) { int num = value; deadPlayersVoicePitch.Clear(); for (int i = 0; i < GameDirector.instance.PlayerList.Count; i++) { PlayerAvatar val = GameDirector.instance.PlayerList[i]; DeadTTSPlayerData component = ((Component)val).GetComponent<DeadTTSPlayerData>(); if (!Object.op_Implicit((Object)(object)val)) { continue; } float num2 = 1f; if (GameManager.Multiplayer() && value > 0) { int num3 = -1; int seed = -1; try { num3 = val.photonView.Owner.ActorNumber; } catch (Exception ex) { Plugin.LogWarning("Failed to get player id for player: " + ((Object.op_Implicit((Object)(object)component) && !string.IsNullOrEmpty(component.playerName)) ? component.playerName : ((Object)val).name) + " when calculating random seed. Don't worry about this."); Plugin.LogWarningVerbose("Error: " + ex); } if (num3 != -1) { seed = num + num3; Random random = new Random(seed); float value2 = ConfigSettings.minRandomPitch.Value; float value3 = ConfigSettings.maxRandomPitch.Value; num2 = (float)(random.NextDouble() * (double)(value3 - value2) + (double)value2); } if (deadPlayersVoicePitch.TryGetValue(val, out var value4) && num2 != value4) { Plugin.Log("Setting dead TTS pitch for player with id: " + num3 + " to: " + num2); } Plugin.LogVerbose("DeadTTS Pitch BaseSeed: " + num + " PlayerId: " + num3 + " PlayerSeed: " + seed); } deadPlayersVoicePitch[val] = num2; } } [HarmonyPatch(typeof(PlayerVoiceChat), "TtsFollowVoiceSettings")] [HarmonyPostfix] public static void OnTtsFollowVoiceSettings(ref PlayerAvatar ___playerAvatar, ref AudioLowPassLogic ___lowPassLogicTTS, ref bool ___inLobbyMixerTTS, ref float ___clipLoudnessTTS, PlayerVoiceChat __instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)___playerAvatar) || !GameManager.Multiplayer() || (int)GameDirector.instance.currentState != 2 || (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop() && !SemiFunc.RunIsArena())) { return; } DeadTTSPlayerData component = ((Component)___playerAvatar).GetComponent<DeadTTSPlayerData>(); if (!(IsPlayerDead(___playerAvatar) & ___inLobbyMixerTTS)) { return; } if (!ConfigSettings.onlyEnableWhenDiscovered.Value || !Object.op_Implicit((Object)(object)___playerAvatar.playerDeathHead) || (bool)serverSeenField.GetValue(___playerAvatar.playerDeathHead) || IsLocalPlayerDead() || !SemiFunc.RunIsLevel()) { if (Object.op_Implicit((Object)(object)__instance.ttsAudioSource) && Object.op_Implicit((Object)(object)__instance.mixerTTSSound)) { if ((Object)(object)__instance.ttsAudioSource.outputAudioMixerGroup != (Object)(object)__instance.mixerTTSSound) { __instance.ttsAudioSource.outputAudioMixerGroup = __instance.mixerTTSSound; if (!Object.op_Implicit((Object)(object)___playerAvatar.playerDeathHead)) { Plugin.LogError("Game did not assign player a death head."); } if (!Object.op_Implicit((Object)(object)__instance.ttsVoice)) { Plugin.LogError("Game did not assign player a tts voice."); } else { Plugin.LogVerbose($"The game has toggled ON lobby chat for player: {((Object.op_Implicit((Object)(object)component) && !string.IsNullOrEmpty(component.playerName)) ? component.playerName : ((Object)___playerAvatar).name)} ({___playerAvatar.photonView.Owner.ActorNumber}). Disabling TTS lobby mixer."); __instance.ttsVoice.setVoice(1); __instance.ttsVoice.StopAndClearVoice(); } } float pitch = (deadPlayersVoicePitch.ContainsKey(___playerAvatar) ? deadPlayersVoicePitch[___playerAvatar] : 1f); __instance.ttsAudioSource.pitch = pitch; if ((Object)(object)___playerAvatar != (Object)(object)localPlayer && (!ConfigSettings.disableWhileDead.Value || !IsLocalPlayerDead())) { __instance.ttsAudioSource.volume = ConfigSettings.deadTTSVolume.Value; if (ConfigSettings.useSpatialAudioDeadTTS.Value) { __instance.ttsAudioSource.spatialBlend = 1f; } } else { __instance.ttsAudioSource.volume = 1f; } } else { string text = (((Object)(object)__instance.ttsAudioSource != (Object)null) ? "Game did not assign player a ttsAudioSource. " : ""); text += (((Object)(object)__instance.mixerTTSSound != (Object)null) ? "Game did not assign player a mixerTTSSound." : ""); if (!string.IsNullOrEmpty(text)) { Plugin.LogError(text.TrimEnd(new char[1] { ' ' })); } } } if (Object.op_Implicit((Object)(object)___playerAvatar.playerDeathHead)) { bool flag = (bool)isSpeakingField.GetValue(__instance.ttsVoice); Material val = (Material)eyeMaterialField.GetValue(___playerAvatar.playerDeathHead); int num = (int)eyeMaterialAmountField.GetValue(___playerAvatar.playerDeathHead); if (flag) { float num2 = (float)eyeFlashLerpField.GetValue(___playerAvatar.playerDeathHead); float num3 = Mathf.Clamp01(Mathf.Max(___clipLoudnessTTS, 0f) / 0.2f); num2 = Mathf.Lerp(num2, num3, 20f * Time.deltaTime); val.SetFloat(num, Mathf.Pow(num2, 0.5f)); eyeFlashLerpField.SetValue(___playerAvatar.playerDeathHead, num2); } else { val.SetFloat(num, 0f); eyeFlashLerpField.SetValue(___playerAvatar.playerDeathHead, 0); } } } [HarmonyPatch(typeof(PlayerVoiceChat), "ToggleLobby")] [HarmonyPostfix] public static void OnToggleOffLobbyChat(bool _toggle, ref PlayerAvatar ___playerAvatar, PlayerVoiceChat __instance) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown if (!GameManager.Multiplayer() || (int)GameDirector.instance.currentState != 2 || (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop() && !SemiFunc.RunIsArena())) { return; } DeadTTSPlayerData component = ((Component)___playerAvatar).GetComponent<DeadTTSPlayerData>(); PhotonView val = (Object.op_Implicit((Object)(object)component) ? component.photonView : ___playerAvatar.photonView); if (!_toggle) { Plugin.LogVerbose($"The game has toggled OFF lobby chat for player: {((Object.op_Implicit((Object)(object)component) && !string.IsNullOrEmpty(component.playerName)) ? component.playerName : ((Object)___playerAvatar).name)} ({___playerAvatar.photonView.Owner.ActorNumber})"); if (Object.op_Implicit((Object)(object)__instance.ttsAudioSource) && Object.op_Implicit((Object)(object)__instance.mixerTTSSound)) { __instance.ttsAudioSource.volume = 1f; __instance.ttsAudioSource.pitch = 1f; __instance.ttsVoice.setVoice(0); } if (Object.op_Implicit((Object)(object)___playerAvatar.playerDeathHead)) { Material val2 = (Material)eyeMaterialField.GetValue(___playerAvatar.playerDeathHead); int num = (int)eyeMaterialAmountField.GetValue(___playerAvatar.playerDeathHead); val2.SetFloat(num, 0f); } } } [HarmonyPatch(typeof(PlayerVoiceChat), "LateUpdate")] [HarmonyPrefix] public static void MoveTTSAudioTransform(ref PlayerAvatar ___playerAvatar, ref bool ___inLobbyMixerTTS, PlayerVoiceChat __instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0087: 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_00a8: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)___playerAvatar) && GameManager.Multiplayer() && (int)GameDirector.instance.currentState == 2 && (SemiFunc.RunIsLevel() || SemiFunc.RunIsShop() || SemiFunc.RunIsArena()) && ___inLobbyMixerTTS && IsPlayerDead(___playerAvatar) && Object.op_Implicit((Object)(object)___playerAvatar.playerDeathHead) && Object.op_Implicit((Object)(object)__instance.ttsVoice)) { ((Component)__instance).transform.position = Vector3.Lerp(((Component)__instance).transform.position, ((Component)___playerAvatar.playerDeathHead).transform.position, 30f * Time.deltaTime); } } public static bool IsLocalPlayerDead() { return IsPlayerDead(PlayerAvatar.instance); } public static bool IsPlayerDead(PlayerAvatar playerAvatar) { return Object.op_Implicit((Object)(object)playerAvatar) && (bool)isDisabledField.GetValue(playerAvatar) && (!Object.op_Implicit((Object)(object)playerAvatar.playerDeathHead) || ((Behaviour)playerAvatar.playerDeathHead).isActiveAndEnabled); } } } namespace REPO_DeadTTS.Config { [Serializable] public static class ConfigSettings { public static ConfigEntry<float> minRandomPitch; public static ConfigEntry<float> maxRandomPitch; public static ConfigEntry<float> deadTTSVolume; public static ConfigEntry<bool> displayDeadTTSText; public static ConfigEntry<bool> useSpatialAudioDeadTTS; public static ConfigEntry<bool> onlyEnableWhenDiscovered; public static ConfigEntry<bool> disableWhileDead; public static ConfigEntry<string> deadTTSColor; public static ConfigEntry<bool> fixMissingDeathHeads; public static ConfigEntry<bool> verboseLogs; public static Dictionary<string, ConfigEntryBase> currentConfigEntries = new Dictionary<string, ConfigEntryBase>(); internal static void BindConfigSettings() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown Plugin.Log("Binding Configs"); minRandomPitch = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("General", "Dead TTS Random Pitch Min", 0.8f, new ConfigDescription("The lower range limit when randomizing dead players pitch.\nValues will be clamped between 0.8 and 2.0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.8f, 2f), Array.Empty<object>()))); maxRandomPitch = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("General", "Dead TTS Random Pitch Max", 1.5f, new ConfigDescription("The upper range limit when randomizing dead players pitch.\nValues will be clamped between 0.8 and 2.0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.8f, 2f), Array.Empty<object>()))); deadTTSVolume = AddConfigEntry<float>(((BaseUnityPlugin)Plugin.instance).Config.Bind<float>("General", "Dead TTS Volume", 0.5f, new ConfigDescription("Affects the TTS volume of all dead players.\nSet to 0 to mute the TTS of dead players. If muted, the TTS text will still appear.\nValues will be clamped between 0.0 and 1.0", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()))); displayDeadTTSText = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Display Dead TTS Text", true, "If true, TTS Text will appear from dead players' heads.")); useSpatialAudioDeadTTS = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Use Spatial Audio", true, "If true, TTS audio from dead players should be 3D directional.\nIf false, the audio should appear as if it's in your head all the time.")); onlyEnableWhenDiscovered = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Enable When Discovered", false, "If true, you will only hear DeadTTS from players once their head is \"discovered\".")); disableWhileDead = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Disable While Dead", false, "Dead TTS will be disabled while you are dead.")); deadTTSColor = AddConfigEntry<string>(((BaseUnityPlugin)Plugin.instance).Config.Bind<string>("General", "Dead TTS Text Color Hex", "CC3333", new ConfigDescription("Hex color value for dead TTS text color. Hex string must be 6 characters long. Leave this field blank to use the vanilla TTS color.", (AcceptableValueBase)null, Array.Empty<object>()))); fixMissingDeathHeads = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Fix Missing Death Heads", true, new ConfigDescription("Fixes an uncommon bug where the game may not assign a player a death head.", (AcceptableValueBase)null, Array.Empty<object>()))); verboseLogs = AddConfigEntry<bool>(((BaseUnityPlugin)Plugin.instance).Config.Bind<bool>("General", "Verbose Logs", false, new ConfigDescription("Enables verbose logs. Useful for debugging.", (AcceptableValueBase)null, Array.Empty<object>()))); if (minRandomPitch.Value < 0.8f) { minRandomPitch.Value = (float)((ConfigEntryBase)minRandomPitch).DefaultValue; } if (maxRandomPitch.Value > 2f) { maxRandomPitch.Value = (float)((ConfigEntryBase)maxRandomPitch).DefaultValue; } minRandomPitch.Value = Mathf.Clamp(minRandomPitch.Value, 0.8f, 2f); maxRandomPitch.Value = Mathf.Max(maxRandomPitch.Value, minRandomPitch.Value); deadTTSVolume.Value = Mathf.Clamp(deadTTSVolume.Value, 0f, 2f); deadTTSColor.Value = deadTTSColor.Value.Trim(new char[1] { ' ' }); } internal static ConfigEntry<T> AddConfigEntry<T>(ConfigEntry<T> configEntry) { currentConfigEntries.Add(((ConfigEntryBase)configEntry).Definition.Key, (ConfigEntryBase)(object)configEntry); return configEntry; } } }
plugins/REPOConfig.dll
Decompiled 9 months 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 MenuLib.Structs; 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.2.3")] [assembly: AssemblyInformationalVersion("1.1.8+0e6abbd5173e15b6a0a267663eda01dba538620d")] [assembly: AssemblyProduct("REPOConfig")] [assembly: AssemblyTitle("REPOConfig")] [assembly: AssemblyVersion("1.2.3.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__5_0; public static BuilderDelegate <>9__5_1; public static Action <>9__6_4; public static Action <>9__6_8; public static Action <>9__7_3; public static ShouldCloseMenuDelegate <>9__7_5; public static Action <>9__7_10; public static BuilderDelegate <>9__7_6; public static ScrollViewBuilderDelegate <>9__7_9; public static Func<ConfigEntryBase, string> <>9__8_0; public static ScrollViewBuilderDelegate <>9__8_2; public static Func<PluginInfo, string> <>9__9_0; public static Func<KeyValuePair<ConfigDefinition, ConfigEntryBase>, ConfigEntryBase> <>9__9_1; internal void <Initialize>b__5_0(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(186f, 32f)).labelTMP).fontSize = 28f; } internal void <Initialize>b__5_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(126f, 86f)); } internal void <CreateModMenu>b__6_4() { hasPopupMenuOpened = false; } internal void <CreateModMenu>b__6_8() { hasPopupMenuOpened = false; } internal void <CreateModList>b__7_3() { hasPopupMenuOpened = false; } internal bool <CreateModList>b__7_5() { if (!hasPopupMenuOpened) { return changedEntryValues.Count == 0; } return false; } internal void <CreateModList>b__7_6(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 = changedEntryValues.ToArray(); changedEntryValues.Clear(); KeyValuePair<ConfigEntryBase, object>[] array2 = array; for (int i = 0; i < array2.Length; i++) { KeyValuePair<ConfigEntryBase, object> keyValuePair = array2[i]; var (val2, obj2) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair); object value = (val2.BoxedValue = obj2); originalEntryValues[val2] = value; } }, mainPageParent, new Vector2(370f, 18f)); } internal void <CreateModList>b__7_10() { KeyValuePair<ConfigEntryBase, object>[] array = changedEntryValues.ToArray(); changedEntryValues.Clear(); KeyValuePair<ConfigEntryBase, object>[] array2 = array; for (int i = 0; i < array2.Length; i++) { KeyValuePair<ConfigEntryBase, object> keyValuePair = array2[i]; var (val2, obj2) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair); object value = (val2.BoxedValue = obj2); originalEntryValues[val2] = value; } } internal RectTransform <CreateModList>b__7_9(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__8_0(ConfigEntryBase entry) { return entry.Definition.Section; } internal RectTransform <CreateModEntries>b__8_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 string <GetModConfigEntries>b__9_0(PluginInfo p) { return p.Metadata.Name; } internal ConfigEntryBase <GetModConfigEntries>b__9_1(KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) { return configEntry.Value; } } private static readonly Dictionary<ConfigEntryBase, object> changedEntryValues = new Dictionary<ConfigEntryBase, object>(); private static readonly Dictionary<ConfigEntryBase, object> originalEntryValues = new Dictionary<ConfigEntryBase, object>(); internal static REPOButton lastClickedModButton; private static readonly List<REPOButton> currentModButtons = new List<REPOButton>(); private static bool hasPopupMenuOpened; 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 object obj = <>c.<>9__5_0; if (obj == null) { BuilderDelegate val = delegate(Transform parent) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)MenuAPI.CreateREPOButton("Mods", (Action)CreateModMenu, parent, new Vector2(186f, 32f)).labelTMP).fontSize = 28f; }; <>c.<>9__5_0 = val; obj = (object)val; } MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj); object obj2 = <>c.<>9__5_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(126f, 86f)); }; <>c.<>9__5_1 = val2; obj2 = (object)val2; } MenuAPI.AddElementToEscapeMenu((BuilderDelegate)obj2); } internal static void CreateModMenu() { //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_0066: 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_0089: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown changedEntryValues.Clear(); lastClickedModButton = null; REPOPopupPage repoPopupPage = MenuAPI.CreateREPOPopupPage("Mods", (PresetSide)0, false, true, 0f); repoPopupPage.scrollView.scrollSpeed = 3f; REPOPopupPage obj = repoPopupPage; Padding maskPadding = repoPopupPage.maskPadding; maskPadding.top = 35f; obj.maskPadding = maskPadding; REPOPopupPage obj2 = repoPopupPage; obj2.onEscapePressed = (ShouldCloseMenuDelegate)Delegate.Combine((Delegate?)(object)obj2.onEscapePressed, (Delegate?)(ShouldCloseMenuDelegate)delegate { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (hasPopupMenuOpened) { return false; } if (changedEntryValues.Count == 0) { return true; } MenuAPI.OpenPopup("Unsaved Changes", Color.red, "You have unsaved changes, are you sure you want to exit?", (Action)delegate { repoPopupPage.ClosePage(true); changedEntryValues.Clear(); hasPopupMenuOpened = false; }, (Action)delegate { hasPopupMenuOpened = false; }); hasPopupMenuOpened = true; return false; }); repoPopupPage.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_002f: 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_0053: Unknown result type (might be due to invalid IL or missing references) ((Component)MenuAPI.CreateREPOInputField("Mod Search", (Action<string>)delegate(string s) { string text = (string.IsNullOrEmpty(s) ? null : s.ToLower().Trim()); foreach (REPOButton currentModButton in currentModButtons) { ((REPOElement)currentModButton).repoScrollViewElement.visibility = text == null || ((TMP_Text)currentModButton.labelTMP).text.ToLower().Contains(text); } repoPopupPage.scrollView.SetScrollPosition(0f); }, parent, new Vector2(83f, 272f), false, "", "")).transform.localScale = Vector3.one * 0.95f; }); CreateModList(repoPopupPage); 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_0025: Unknown result type (might be due to invalid IL or missing references) if (changedEntryValues.Count == 0 || hasPopupMenuOpened) { 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); changedEntryValues.Clear(); hasPopupMenuOpened = false; }, (Action)delegate { hasPopupMenuOpened = false; }); hasPopupMenuOpened = true; } }, parent, new Vector2(66f, 18f)); }); repoPopupPage.OpenPage(false); } private static void CreateModList(REPOPopupPage mainModPage) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown currentModButtons.Clear(); 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_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_0067: Unknown result type (might be due to invalid IL or missing references) REPOButton modButton = MenuAPI.CreateREPOButton(modName, (Action)null, parent, default(Vector2)); ((TMP_Text)modButton.labelTMP).fontStyle = (FontStyles)0; 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 (changedEntryValues.Count == 0) { OpenPage(); } else { MenuAPI.OpenPopup("Unsaved Changes", Color.red, "You have unsaved changes, are you sure you want to exit?", (Action)delegate { changedEntryValues.Clear(); OpenPage(); hasPopupMenuOpened = false; }, (Action)delegate { hasPopupMenuOpened = false; }); hasPopupMenuOpened = true; } } }; currentModButtons.Add(modButton); return ((REPOElement)modButton).rectTransform; void OpenPage() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //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_00bd: Expected O, but got Unknown //IL_00c2: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown MenuAPI.CloseAllPagesAddedOnTop(); REPOPopupPage modPage = MenuAPI.CreateREPOPopupPage(modName, (PresetSide)1, false, false, 5f); modPage.scrollView.scrollSpeed = 3f; REPOPopupPage obj3 = modPage; object obj4 = <>c.<>9__7_5; if (obj4 == null) { ShouldCloseMenuDelegate val3 = () => !hasPopupMenuOpened && changedEntryValues.Count == 0; <>c.<>9__7_5 = val3; obj4 = (object)val3; } obj3.onEscapePressed = (ShouldCloseMenuDelegate)obj4; REPOPopupPage obj5 = modPage; object obj6 = <>c.<>9__7_6; if (obj6 == null) { BuilderDelegate val4 = 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 = changedEntryValues.ToArray(); changedEntryValues.Clear(); KeyValuePair<ConfigEntryBase, object>[] array4 = array3; for (int j = 0; j < array4.Length; j++) { KeyValuePair<ConfigEntryBase, object> keyValuePair2 = array4[j]; var (val11, obj12) = (KeyValuePair<ConfigEntryBase, object>)(ref keyValuePair2); object value = (val11.BoxedValue = obj12); originalEntryValues[val11] = value; } }, mainPageParent, new Vector2(370f, 18f)); }; <>c.<>9__7_6 = val4; obj6 = (object)val4; } obj5.AddElement((BuilderDelegate)obj6); REPOPopupPage obj7 = modPage; BuilderDelegate obj8 = val2; if (obj8 == null) { BuilderDelegate val5 = delegate(Transform mainPageParent) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) MenuAPI.CreateREPOButton("Revert", (Action)delegate { if (changedEntryValues.Count != 0) { changedEntryValues.Clear(); OpenPage(); } }, mainPageParent, new Vector2(585f, 18f)); }; BuilderDelegate val6 = val5; val2 = val5; obj8 = val6; } obj7.AddElement(obj8); 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 val9 = 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)val9).rectTransform; Rect rect = modPage.maskRectTransform.rect; ((Transform)rectTransform).localPosition = Vector2.op_Implicit(new Vector2((((Rect)(ref rect)).width - val9.GetLabelSize().x) * 0.5f, 0f)); return ((REPOElement)val9).rectTransform; }, 0f, 0f); REPOPopupPage obj9 = modPage; object obj10 = <>c.<>9__7_9; if (obj10 == null) { ScrollViewBuilderDelegate val7 = 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 val8 = default(Vector2); ((Vector2)(ref val8))..ctor(0f, 10f); return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val8)).rectTransform; }; <>c.<>9__7_9 = val7; obj10 = (object)val7; } obj9.AddElementToScrollView((ScrollViewBuilderDelegate)obj10, 0f, 0f); CreateModEntries(modPage, configEntryBases); modPage.OpenPage(true); lastClickedModButton = modButton; } void ResetToDefault() { ConfigEntryBase[] array2 = configEntryBases; foreach (ConfigEntryBase obj2 in array2) { obj2.BoxedValue = obj2.DefaultValue; } changedEntryValues.Clear(); OpenPage(); } }, 0f, 0f); } } private static void CreateModEntries(REPOPopupPage modPage, ConfigEntryBase[] configEntryBases) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Expected O, but got Unknown foreach (IGrouping<string, ConfigEntryBase> group in from entry in configEntryBases group entry by entry.Definition.Section) { modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0013: 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) REPOLabel obj7 = MenuAPI.CreateREPOLabel(FixNaming(group.Key), scrollView, default(Vector2)); ((TMP_Text)obj7.labelTMP).fontStyle = (FontStyles)1; return ((REPOElement)obj7).rectTransform; }, 0f, 0f); foreach (ConfigEntryBase entry2 in group) { string modName = FixNaming(entry2.Definition.Key); originalEntryValues.Remove(entry2); originalEntryValues.Add(entry2, entry2.BoxedValue); 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_005c: 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_0082: 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) REPOSlider val11 = MenuAPI.CreateREPOSlider(modName, string.Empty, (Action<int>)delegate(int i) { object obj6 = Enum.Parse(enumType, values[i]); if (originalEntryValues.TryGetValue(entry2, out var value6) && obj6 == value6) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = obj6; } }, scrollView, values, entry2.BoxedValue.ToString(), default(Vector2), "", "", (BarBehavior)0); TextMeshProUGUI descriptionTMP4 = val11.descriptionTMP; TextMeshProUGUI labelTMP5 = val11.labelTMP; FontStyles fontStyle5 = (FontStyles)0; ((TMP_Text)labelTMP5).fontStyle = (FontStyles)0; ((TMP_Text)descriptionTMP4).fontStyle = fontStyle5; return ((REPOElement)val11).rectTransform; }, 0f, 0f); continue; } AcceptableValueBase acceptableValues = entry2.Description.AcceptableValues; AcceptableValueList<string> val2 = acceptableValues as AcceptableValueList<string>; if (val2 != null) { modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0075: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) REPOSlider val10 = MenuAPI.CreateREPOSlider(modName, string.Empty, (Action<string>)delegate(string s) { if (originalEntryValues.TryGetValue(entry2, out var value5) && s == (string)value5) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = s; } }, scrollView, val2.AcceptableValues, (string)entry2.BoxedValue, default(Vector2), "", "", (BarBehavior)0); TextMeshProUGUI descriptionTMP3 = val10.descriptionTMP; TextMeshProUGUI labelTMP4 = val10.labelTMP; FontStyles fontStyle4 = (FontStyles)0; ((TMP_Text)labelTMP4).fontStyle = (FontStyles)0; ((TMP_Text)descriptionTMP3).fontStyle = fontStyle4; return ((REPOElement)val10).rectTransform; }, 0f, 0f); continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_004b: 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_0095: Unknown result type (might be due to invalid IL or missing references) string text4 = (string)entry2.DefaultValue; REPOInputField val9 = MenuAPI.CreateREPOInputField(modName, (Action<string>)delegate(string s) { if (originalEntryValues.TryGetValue(entry2, out var value4) && s == (string)value4) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = s; } }, scrollView, Vector2.zero, false, (!string.IsNullOrEmpty(text4)) ? text4 : "<NONE>", (string)entry2.BoxedValue); TextMeshProUGUI labelTMP3 = val9.labelTMP; TMP_Text inputTMP = val9.inputStringSystem.inputTMP; FontStyles fontStyle3 = (FontStyles)0; inputTMP.fontStyle = (FontStyles)0; ((TMP_Text)labelTMP3).fontStyle = fontStyle3; return ((REPOElement)val9).rectTransform; }, 0f, 0f); continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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) int num9; int num10; int num12; if (entry2.Description.AcceptableValues is AcceptableValueRange<int> val7) { num9 = val7.MinValue; num10 = val7.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 text3 = modName; string empty2 = string.Empty; Action<int> obj5 = delegate(int i) { if (originalEntryValues.TryGetValue(entry2, out var value3) && i == (int)value3) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = i; } }; num12 = (int)entry2.BoxedValue; int num13 = num9; int num14 = num10; REPOSlider val8 = MenuAPI.CreateREPOSlider(text3, empty2, obj5, scrollView, default(Vector2), num13, num14, num12, "", "", (BarBehavior)0); TextMeshProUGUI descriptionTMP2 = val8.descriptionTMP; TextMeshProUGUI labelTMP2 = val8.labelTMP; FontStyles fontStyle2 = (FontStyles)0; ((TMP_Text)labelTMP2).fontStyle = (FontStyles)0; ((TMP_Text)descriptionTMP2).fontStyle = fontStyle2; return ((REPOElement)val8).rectTransform; }, 0f, 0f); continue; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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) int num = 2; float num2; float num3; if (entry2.Description.AcceptableValues is AcceptableValueRange<float> val5) { num2 = val5.MinValue; num3 = val5.MaxValue; num = Mathf.Max(new int[4] { GetDecimalPlaces(num2), GetDecimalPlaces(num3), GetDecimalPlaces((float)entry2.DefaultValue), 2 }); } 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 empty = string.Empty; Action<float> obj4 = delegate(float f) { if (originalEntryValues.TryGetValue(entry2, out var value2) && Math.Abs(f - (float)value2) < float.Epsilon) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = f; } }; float num5 = (float)entry2.BoxedValue; float num6 = num2; float num7 = num3; int num8 = num; REPOSlider val6 = MenuAPI.CreateREPOSlider(text2, empty, obj4, scrollView, default(Vector2), num6, num7, num8, num5, "", "", (BarBehavior)0); TextMeshProUGUI descriptionTMP = val6.descriptionTMP; TextMeshProUGUI labelTMP = val6.labelTMP; FontStyles fontStyle = (FontStyles)0; ((TMP_Text)labelTMP).fontStyle = (FontStyles)0; ((TMP_Text)descriptionTMP).fontStyle = fontStyle; return ((REPOElement)val6).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> obj2 = delegate(bool b) { if (originalEntryValues.TryGetValue(entry2, out var value) && b == (bool)value) { changedEntryValues.Remove(entry2); } else { changedEntryValues[entry2] = b; } }; bool flag = (bool)entry2.BoxedValue; REPOToggle obj3 = MenuAPI.CreateREPOToggle(text, obj2, scrollView, default(Vector2), "ON", "OFF", flag); ((TMP_Text)obj3.labelTMP).fontStyle = (FontStyles)0; return ((REPOElement)obj3).rectTransform; }, 0f, 0f); } object obj = <>c.<>9__8_2; if (obj == null) { ScrollViewBuilderDelegate val3 = 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 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(0f, 20f); return ((REPOElement)MenuAPI.CreateREPOSpacer(scrollView, default(Vector2), val4)).rectTransform; }; <>c.<>9__8_2 = val3; obj = (object)val3; } modPage.AddElementToScrollView((ScrollViewBuilderDelegate)obj, 0f, 0f); } } private static Dictionary<string, ConfigEntryBase[]> GetModConfigEntries() { Dictionary<string, ConfigEntryBase[]> dictionary = new Dictionary<string, ConfigEntryBase[]>(); foreach (PluginInfo item in Chainloader.PluginInfos.Values.OrderBy((PluginInfo p) => p.Metadata.Name)) { List<ConfigEntryBase> list = new List<ConfigEntryBase>(); foreach (ConfigEntryBase item2 in ((IEnumerable<KeyValuePair<ConfigDefinition, ConfigEntryBase>>)item.Instance.Config).Select((KeyValuePair<ConfigDefinition, ConfigEntryBase> configEntry) => configEntry.Value)) { ConfigDescription description = item2.Description; object[] array = ((description != null) ? description.Tags : null); if (array == null || (!array.Contains("HideREPOConfig") && !array.Contains("HideFromREPOConfig"))) { list.Add(item2); } } if (list.Count > 0) { dictionary.TryAdd(FixNaming(item.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.2.3")] [BepInDependency("nickklmao.menulib", "2.5.0")] internal sealed class Entry : BaseUnityPlugin { private const string MOD_NAME = "REPOConfig"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("REPOConfig"); private static ConfigEntry<bool> showInGame; private static void MenuPageMain_StartHook(Action<MenuPageMain> orig, MenuPageMain self) { //IL_0030: 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_00c2: 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) REPOButton val = MenuAPI.CreateREPOButton("Mods", (Action)ConfigMenu.CreateModMenu, ((Component)self).transform, new Vector2(48.3f, 0f)); List<Transform> list = (from Transform transform in (IEnumerable)((Component)self).transform where ((Object)transform).name.Contains("Menu Button") orderby transform.localPosition.y descending select transform).ToList(); list.Insert(list.Count - 1, ((Component)val).transform); float num = 224f; foreach (Transform item in list) { Vector3 localPosition = item.localPosition; localPosition.y = num; item.localPosition = localPosition; num -= 30f; } orig(self); } private void Awake() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) 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/RepoDice.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; 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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using MoreUpgrades; using MoreUpgrades.Classes; using Newtonsoft.Json; using Photon.Pun; using REPOLib.Modules; using RepoDice; using RepoDice.Dice; using RepoDice.Effects; using RepoDice.Patches; using RepoDice.Visual; using TMPro; using Unity.VisualScripting; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("MoreUpgrades")] [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("Slayer6409")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+526197b4302455a205b4e828a796ff4db1cbbd9b")] [assembly: AssemblyProduct("RepoDice")] [assembly: AssemblyTitle("RepoDice")] [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 CycleSigns : MonoBehaviour { private class DiceVisuals { public Sprite Sprite; public Color ModelColor; public Color EmissionColor; public float Emission; public DiceVisuals(Sprite sprite, Color color, Color emissionColor, float emission) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Sprite = sprite; ModelColor = color; EmissionColor = emissionColor; Emission = emission; } } public float CycleTime = 1f; private float CurrentTimer = 0f; private int CurrentSprite = 0; private bool Stop = false; private SpriteRenderer SignSpriteRenderer; private SpriteRenderer SignSpriteRenderer2; private SpriteRenderer SignSpriteRenderer3; private Renderer DiceRenderer; private List<DiceVisuals> Visuals = new List<DiceVisuals>(); private void Start() { //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_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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Visuals.Add(new DiceVisuals(global::RepoDice.RepoDice.WarningExclamation, Color.yellow, Color.yellow, 40f)); Visuals.Add(new DiceVisuals(global::RepoDice.RepoDice.WarningDeath, Color.red, Color.red, 100f)); Visuals.Add(new DiceVisuals(global::RepoDice.RepoDice.WarningLuck, Color.green, Color.green, 300f)); if (Misc.isGlitchOrConfig()) { Visuals.Add(new DiceVisuals(global::RepoDice.RepoDice.WarningGlitch, Color.magenta, Color.magenta, 300f)); } SignSpriteRenderer = ((Component)((Component)this).transform.Find("Emergency Sign")).gameObject.GetComponent<SpriteRenderer>(); SignSpriteRenderer2 = ((Component)((Component)this).transform.Find("Emergency Sign2")).gameObject.GetComponent<SpriteRenderer>(); DiceRenderer = ((Component)this).gameObject.GetComponent<Renderer>(); } private void Update() { if (!Stop) { CurrentTimer -= Time.deltaTime; if (CurrentTimer <= 0f) { CurrentTimer = CycleTime; CycleSprite(); } } } private void CycleSprite() { //IL_0095: 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_00dc: Unknown result type (might be due to invalid IL or missing references) CurrentSprite++; if (CurrentSprite >= Visuals.Count) { CurrentSprite = 0; } SignSpriteRenderer.sprite = Visuals[CurrentSprite].Sprite; SignSpriteRenderer2.sprite = Visuals[CurrentSprite].Sprite; DiceRenderer.material.SetColor("_Color", Visuals[CurrentSprite].ModelColor); DiceRenderer.material.SetColor("_EmissionColor", Visuals[CurrentSprite].EmissionColor * Visuals[CurrentSprite].Emission); } public void HideSigns() { Stop = true; ((Renderer)((Component)SignSpriteRenderer).GetComponent<SpriteRenderer>()).enabled = false; ((Renderer)((Component)SignSpriteRenderer2).GetComponent<SpriteRenderer>()).enabled = false; } } namespace RepoDice { public class DebugMenu : MonoBehaviour { public class RightClickHandler2 : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { public string effectName; public string category; public bool fromSaint = false; public void OnPointerClick(PointerEventData eventData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)eventData.button == 1) { FavoriteEffectManager.FavoriteData favoriteData = FavoriteEffectManager.LoadFavorites(); switch (category) { case "Favorites": ToggleFavorite(effectName, favoriteData.Favorites); break; case "FavoriteScraps": ToggleFavorite(effectName, favoriteData.FavoriteScraps); break; case "FavoriteShopItems": ToggleFavorite(effectName, favoriteData.FavoriteShopItems); break; } FavoriteEffectManager.SaveFavorites(favoriteData); clearMainViewport(); switch (category) { case "Favorites": ShowSelectMenu(fromSaint); break; case "FavoriteScraps": spawnScrap(); break; case "FavoriteShopItems": spawnShopItems(); break; } } } private void ToggleFavorite(string name, List<string> favorites) { if (favorites.Contains(name)) { favorites.Remove(name); } else { favorites.Add(name); } } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<CallbackContext> <>9__19_0; public static UnityAction <>9__19_2; public static UnityAction <>9__19_3; public static UnityAction <>9__19_4; public static UnityAction <>9__19_5; public static UnityAction <>9__20_0; public static UnityAction <>9__20_1; public static UnityAction <>9__20_2; public static Func<PlayerAvatar, string> <>9__21_0; public static Func<IGrouping<string, PlayerAvatar>, PlayerAvatar> <>9__21_1; public static Func<PlayerAvatar, string> <>9__21_2; public static UnityAction<bool> <>9__23_0; public static UnityAction<bool> <>9__23_1; public static UnityAction <>9__23_3; public static Action<CallbackContext> <>9__24_0; public static Func<IEffect, string> <>9__29_1; public static UnityAction <>9__31_0; public static UnityAction <>9__31_1; public static UnityAction <>9__31_2; public static UnityAction <>9__31_3; public static UnityAction <>9__31_4; public static Func<EnemySetup, string> <>9__32_0; public static Func<IGrouping<string, EnemySetup>, EnemySetup> <>9__32_1; public static Func<EnemySetup, string> <>9__32_3; public static Func<Item, string> <>9__33_0; public static Func<IGrouping<string, Item>, Item> <>9__33_1; public static Func<Item, string> <>9__33_3; public static UnityAction <>9__34_1; public static UnityAction <>9__34_0; public static UnityAction <>9__34_2; public static Func<KeyValuePair<string, AudioClip>, string> <>9__35_0; public static UnityAction <>9__37_0; public static Func<string, string> <>9__39_1; internal void <showDebugMenu>b__19_0(CallbackContext ctx) { CloseSelectMenu(); } internal void <showDebugMenu>b__19_2() { clearMainViewport(); ShowSelectMenu(); } internal void <showDebugMenu>b__19_3() { clearSubViewport(); spawnFunctions(); } internal void <showDebugMenu>b__19_4() { clearSubViewport(); playerFunctions(); } internal void <showDebugMenu>b__19_5() { clearSubViewport(); specialFunctions(isSpecial()); } internal void <playerFunctions>b__20_0() { clearMainViewport(); RevivePlayer(); } internal void <playerFunctions>b__20_1() { clearMainViewport(); TeleportPlayer(); } internal void <playerFunctions>b__20_2() { clearMainViewport(); TeleportPlayer(bring: true); } internal string <TeleportPlayer>b__21_0(PlayerAvatar x) { return x.playerName; } internal PlayerAvatar <TeleportPlayer>b__21_1(IGrouping<string, PlayerAvatar> g) { return g.First(); } internal string <TeleportPlayer>b__21_2(PlayerAvatar x) { return x.playerName; } internal void <setupButtons>b__23_0(bool isOn) { RepoDice.DebugMenuColorUsesPlayerColor.Value = isOn; } internal void <setupButtons>b__23_1(bool isOn) { RepoDice.DebugMenuClosesAfter.Value = !isOn; } internal void <setupButtons>b__23_3() { CloseSelectMenu(force: true); } internal void <ShowSelectEffectMenu>b__24_0(CallbackContext ctx) { CloseSelectMenu(); } internal string <getOrdered>b__29_1(IEffect effect) { return effect.Name; } internal void <spawnFunctions>b__31_0() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) clearMainViewport(); spawnEnemy(Vector3.one); } internal void <spawnFunctions>b__31_1() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) clearMainViewport(); spawnEnemy(new Vector3(2.5f, 2.5f, 2.5f)); } internal void <spawnFunctions>b__31_2() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) clearMainViewport(); spawnEnemy(new Vector3(0.5f, 0.5f, 0.5f)); } internal void <spawnFunctions>b__31_3() { clearMainViewport(); spawnScrap(); } internal void <spawnFunctions>b__31_4() { clearMainViewport(); spawnShopItems(); } internal string <spawnEnemy>b__32_0(EnemySetup x) { return ((Object)x).name; } internal EnemySetup <spawnEnemy>b__32_1(IGrouping<string, EnemySetup> g) { return g.First(); } internal string <spawnEnemy>b__32_3(EnemySetup e) { return ((Object)e).name; } internal string <spawnShopItems>b__33_0(Item x) { return x.itemName; } internal Item <spawnShopItems>b__33_1(IGrouping<string, Item> g) { return g.First(); } internal string <spawnShopItems>b__33_3(Item s) { return s.itemName; } internal void <specialFunctions>b__34_1() { clearMainViewport(); ShowSoundMenu(); } internal void <specialFunctions>b__34_0() { clearMainViewport(); poiTeleports(); } internal void <specialFunctions>b__34_2() { clearMainViewport(); jail(); } internal string <ShowSoundMenu>b__35_0(KeyValuePair<string, AudioClip> x) { return x.Key; } internal void <poiTeleports>b__37_0() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviourPun)Networker.Instance).photonView.RPC("ForceTeleportRPC", (RpcTarget)0, new object[3] { PlayerAvatar.instance.photonView.ViewID, ((Component)LevelGenerator.Instance.LevelPathTruck).transform.position, ((Component)LevelGenerator.Instance.LevelPathTruck).transform.rotation }); CloseSelectMenu(); } internal string <spawnScrap>b__39_1(string s) { return s; } } public static Color mainColor = new Color(13f / 85f, 0f, 27f / 85f, 1f); public static Color ButtonColor = new Color(0.6430231f, 0.2783019f, 1f, 1f); public static Color TextColor = new Color(0.9607844f, 43f / 85f, 0.9803922f, 1f); public static Color FavoriteTextColor = new Color(0.9607844f, 0.2058824f, 0.2803922f, 1f); public static Color BackgroundColor = new Color(0.6039216f, 0.2392157f, 1f, 0.2f); public static Color AccentColor = new Color(0.6078432f, 0.2588235f, 0.9921569f, 0.4627451f); public static GameObject EffectMenu = null; public static bool ran; public static List<Image> backgroundImages = new List<Image>(); public static List<Image> accentImages = new List<Image>(); public static List<Image> buttonImages = new List<Image>(); public static List<TMP_Text> textElements = new List<TMP_Text>(); public static List<Text> textElements2 = new List<Text>(); public static Transform mainScrollContent; public static Transform subScrollContent; public static void SetupColors() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00a4: 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_00aa: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_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 (!RepoDice.DebugMenuColorUsesPlayerColor.Value) { if (!ColorUtility.TryParseHtmlString(RepoDice.DebugMenuColor.Value, ref mainColor)) { ColorUtility.TryParseHtmlString("#270051", ref mainColor); } BackgroundColor = mainColor; BackgroundColor.a = 0.46f; } else { mainColor = PlayerAvatar.instance.playerAvatarVisuals.color; BackgroundColor = PlayerAvatar.instance.playerAvatarVisuals.color; BackgroundColor.a = 0.46f; } (Color brighter, Color darker) tuple = ColorHelper.GenerateColors(mainColor); Color item = tuple.brighter; Color item2 = tuple.darker; ButtonColor = item; AccentColor = item2; TextColor = ColorHelper.GetReadableTextColor(mainColor); FavoriteTextColor = ColorHelper.GetEmphasisTextColor(mainColor); } public static void setupElements() { buttonImages.Add(RepoDice.DebugSubButtonPrefab.GetComponent<Image>()); buttonImages.Add(RepoDice.DebugMenuButtonPrefab.GetComponent<Image>()); textElements.Add(RepoDice.DebugSubButtonPrefab.GetComponentInChildren<TMP_Text>()); textElements.Add(RepoDice.DebugMenuButtonPrefab.GetComponentInChildren<TMP_Text>()); buttonImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Background/Scroll View/Scrollbar Vertical")).GetComponent<Image>()); buttonImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Background/ClearButton")).GetComponent<Image>()); backgroundImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/TopPart")).GetComponent<Image>()); backgroundImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Background/Image")).GetComponent<Image>()); backgroundImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Background")).GetComponent<Image>()); accentImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Background/Border")).GetComponent<Image>()); accentImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Background/Scroll View")).GetComponent<Image>()); textElements.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/TopPart/Border/Title")).GetComponent<TMP_Text>()); accentImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/TopPart/Border")).GetComponent<Image>()); buttonImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Select Effect")).GetComponent<Image>()); textElements.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Select Effect/Text (TMP)")).GetComponent<TMP_Text>()); textElements.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Background/ClearButton/Text (TMP)")).GetComponent<TMP_Text>()); buttonImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Spawn Menu")).GetComponent<Image>()); textElements.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Spawn Menu/Text (TMP)")).GetComponent<TMP_Text>()); buttonImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Player Functions")).GetComponent<Image>()); textElements.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Player Functions/Text (TMP)")).GetComponent<TMP_Text>()); buttonImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Special Functions")).GetComponent<Image>()); textElements.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Special Functions/Text (TMP)")).GetComponent<TMP_Text>()); buttonImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Grant Admin")).GetComponent<Image>()); textElements.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Grant Admin/Text (TMP)")).GetComponent<TMP_Text>()); accentImages.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Scroll View")).GetComponent<Image>()); textElements2.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/KeepOpen/Label")).GetComponent<Text>()); textElements2.Add(((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Bald/Label")).GetComponent<Text>()); textElements.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/ColorPlayer/Label")).GetComponent<TMP_Text>()); setupSelectElements(); ran = true; } public static void setupSelectElements() { buttonImages.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/Background/Scroll View/Scrollbar Vertical")).GetComponent<Image>()); buttonImages.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/Background/ClearButton")).GetComponent<Image>()); backgroundImages.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/TopPart")).GetComponent<Image>()); backgroundImages.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/Background/Image")).GetComponent<Image>()); backgroundImages.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/Background")).GetComponent<Image>()); accentImages.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/Background/Border")).GetComponent<Image>()); accentImages.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/Background/Scroll View")).GetComponent<Image>()); textElements.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/TopPart/Border/Title")).GetComponent<TMP_Text>()); accentImages.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/TopPart/Border")).GetComponent<Image>()); textElements.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/Background/ClearButton/Text (TMP)")).GetComponent<TMP_Text>()); textElements2.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/Bald/Label")).GetComponent<Text>()); textElements.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/KeepOpen/Label")).GetComponent<TMP_Text>()); textElements.Add(((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/ColorPlayer/Label")).GetComponent<TMP_Text>()); } public static void setColors() { //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_009c: 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_0100: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) ColorBlock colors = ((Selectable)((Component)RepoDice.DebugMenuPrefab.transform.Find("DebugMenu/Background/Scroll View/Scrollbar Vertical")).GetComponent<Scrollbar>()).colors; ColorBlock colors2 = ((Selectable)((Component)RepoDice.SelectMenuPrefab.transform.Find("DebugMenu/Background/Scroll View/Scrollbar Vertical")).GetComponent<Scrollbar>()).colors; ((ColorBlock)(ref colors)).normalColor = TextColor; ((ColorBlock)(ref colors)).highlightedColor = TextColor; ((ColorBlock)(ref colors)).pressedColor = TextColor; ((ColorBlock)(ref colors)).selectedColor = TextColor; ((ColorBlock)(ref colors2)).normalColor = TextColor; ((ColorBlock)(ref colors2)).highlightedColor = TextColor; ((ColorBlock)(ref colors2)).pressedColor = TextColor; ((ColorBlock)(ref colors2)).selectedColor = TextColor; foreach (Image buttonImage in buttonImages) { ((Graphic)buttonImage).color = ButtonColor; } foreach (TMP_Text textElement in textElements) { ((Graphic)textElement).color = TextColor; } foreach (Text item in textElements2) { ((Graphic)item).color = TextColor; } foreach (Image accentImage in accentImages) { ((Graphic)accentImage).color = AccentColor; } foreach (Image backgroundImage in backgroundImages) { ((Graphic)backgroundImage).color = BackgroundColor; } } public static void showDebugMenu() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00d3: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //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_0254: Expected O, but got Unknown //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Expected O, but got Unknown //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Expected O, but got Unknown SetupColors(); if (!ran) { setupElements(); } if (ran) { setColors(); } if ((Object)(object)EffectMenu != (Object)null) { Object.Destroy((Object)(object)EffectMenu); EffectMenu = null; } InputAction val = new InputAction((string)null, (InputActionType)0, "<Keyboard>/escape", (string)null, (string)null, (string)null); val.performed += delegate { CloseSelectMenu(); }; val.Enable(); EffectMenu = Object.Instantiate<GameObject>(RepoDice.DebugMenuPrefab); Canvas component = EffectMenu.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; component.overrideSorting = true; component.sortingOrder = 999; EffectMenu.transform.localPosition = Vector3.zero; EffectMenu.transform.localScale = Vector3.one; EffectMenu.transform.localRotation = Quaternion.identity; if ((Object)(object)EffectMenu == (Object)null) { Debug.LogError((object)"EffectMenu is null after instantiation!"); return; } subScrollContent = EffectMenu.transform.Find("DebugMenu/Scroll View/Viewport/Content"); mainScrollContent = EffectMenu.transform.Find("DebugMenu/Background/Scroll View/Viewport/Content"); TMP_InputField searchInput = ((Component)EffectMenu.transform.Find("DebugMenu/Background/SearchField")).GetComponent<TMP_InputField>(); ((UnityEvent<string>)(object)searchInput.onValueChanged).AddListener((UnityAction<string>)FilterItems); Button component2 = ((Component)EffectMenu.transform.Find("DebugMenu/Background/ClearButton")).GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { searchInput.text = ""; }); DebugMenuController debugMenuController = EffectMenu.AddComponent<DebugMenuController>(); debugMenuController.EffectMenu = EffectMenu; setupButtons(); Button component3 = ((Component)EffectMenu.transform.Find("DebugMenu/Select Effect")).GetComponent<Button>(); TMP_Text component4 = ((Component)EffectMenu.transform.Find("DebugMenu/Select Effect/Text (TMP)")).GetComponent<TMP_Text>(); ButtonClickedEvent onClick = component3.onClick; object obj = <>c.<>9__19_2; if (obj == null) { UnityAction val2 = delegate { clearMainViewport(); ShowSelectMenu(); }; <>c.<>9__19_2 = val2; obj = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj); Button component5 = ((Component)EffectMenu.transform.Find("DebugMenu/Spawn Menu")).GetComponent<Button>(); TMP_Text component6 = ((Component)EffectMenu.transform.Find("DebugMenu/Spawn Menu/Text (TMP)")).GetComponent<TMP_Text>(); ButtonClickedEvent onClick2 = component5.onClick; object obj2 = <>c.<>9__19_3; if (obj2 == null) { UnityAction val3 = delegate { clearSubViewport(); spawnFunctions(); }; <>c.<>9__19_3 = val3; obj2 = (object)val3; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); Button component7 = ((Component)EffectMenu.transform.Find("DebugMenu/Player Functions")).GetComponent<Button>(); TMP_Text component8 = ((Component)EffectMenu.transform.Find("DebugMenu/Player Functions/Text (TMP)")).GetComponent<TMP_Text>(); ButtonClickedEvent onClick3 = component7.onClick; object obj3 = <>c.<>9__19_4; if (obj3 == null) { UnityAction val4 = delegate { clearSubViewport(); playerFunctions(); }; <>c.<>9__19_4 = val4; obj3 = (object)val4; } ((UnityEvent)onClick3).AddListener((UnityAction)obj3); Button component9 = ((Component)EffectMenu.transform.Find("DebugMenu/Special Functions")).GetComponent<Button>(); ButtonClickedEvent onClick4 = component9.onClick; object obj4 = <>c.<>9__19_5; if (obj4 == null) { UnityAction val5 = delegate { clearSubViewport(); specialFunctions(isSpecial()); }; <>c.<>9__19_5 = val5; obj4 = (object)val5; } ((UnityEvent)onClick4).AddListener((UnityAction)obj4); Button component10 = ((Component)EffectMenu.transform.Find("DebugMenu/Grant Admin")).GetComponent<Button>(); Object.Destroy((Object)(object)((Component)component10).gameObject); Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } public static void playerFunctions() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //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_00cf: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown Transform val = EffectMenu.transform.Find("DebugMenu/Scroll View/Viewport/Content"); GameObject val2 = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, val); TMP_Text component = ((Component)val2.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = "Revive Player"; Button component2 = val2.GetComponent<Button>(); ButtonClickedEvent onClick = component2.onClick; object obj = <>c.<>9__20_0; if (obj == null) { UnityAction val3 = delegate { clearMainViewport(); RevivePlayer(); }; <>c.<>9__20_0 = val3; obj = (object)val3; } ((UnityEvent)onClick).AddListener((UnityAction)obj); GameObject val4 = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, val); TMP_Text component3 = ((Component)val4.transform.GetChild(0)).GetComponent<TMP_Text>(); component3.text = "Teleport to Player"; Button component4 = val4.GetComponent<Button>(); ButtonClickedEvent onClick2 = component4.onClick; object obj2 = <>c.<>9__20_1; if (obj2 == null) { UnityAction val5 = delegate { clearMainViewport(); TeleportPlayer(); }; <>c.<>9__20_1 = val5; obj2 = (object)val5; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); GameObject val6 = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, val); TMP_Text component5 = ((Component)val6.transform.GetChild(0)).GetComponent<TMP_Text>(); component5.text = "Bring Player"; Button component6 = val6.GetComponent<Button>(); ButtonClickedEvent onClick3 = component6.onClick; object obj3 = <>c.<>9__20_2; if (obj3 == null) { UnityAction val7 = delegate { clearMainViewport(); TeleportPlayer(bring: true); }; <>c.<>9__20_2 = val7; obj3 = (object)val7; } ((UnityEvent)onClick3).AddListener((UnityAction)obj3); } public static void TeleportPlayer(bool bring = false) { //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown Transform val = EffectMenu.transform.Find("DebugMenu/Background/Scroll View/Viewport/Content"); List<PlayerAvatar> source = SemiFunc.PlayerGetAll(); source = (from x in source group x by x.playerName into g select g.First() into x orderby x.playerName select x).ToList(); foreach (PlayerAvatar player in source) { if (player.playerHealth.health < 1) { continue; } GameObject val2 = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, val); TMP_Text component = ((Component)val2.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = player.playerName ?? ""; Button component2 = val2.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0064: 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) CloseSelectMenu(); PlayerAvatar instance = PlayerAvatar.instance; if (instance.playerHealth.health <= 0 && bring) { Networker.Instance.ForceTeleportRPC(player.photonView.ViewID, ((Component)instance).transform.position + new Vector3(0f, 1f, 0f), ((Component)instance).transform.rotation); } else { Networker.Instance.ForceTeleportRPC(instance.photonView.ViewID, ((Component)player).transform.position + new Vector3(0f, 1f, 0f), ((Component)player).transform.rotation); } }); } } public static bool isSpecial() { if (PlayerAvatar.instance.steamID == RepoDice.slayerSteamID) { return true; } if (PlayerAvatar.instance.steamID == RepoDice.glitchSteamID) { return true; } if (PlayerAvatar.instance.steamID == RepoDice.lizzieSteamID) { return true; } return false; } public static void setupButtons(bool fromSaint = false) { //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown Toggle component = ((Component)EffectMenu.transform.Find("DebugMenu/ColorPlayer")).GetComponent<Toggle>(); component.isOn = RepoDice.DebugMenuColorUsesPlayerColor.Value; Toggle component2 = ((Component)EffectMenu.transform.Find("DebugMenu/KeepOpen")).GetComponent<Toggle>(); if (fromSaint) { ((Component)component2).gameObject.SetActive(false); } component2.isOn = !RepoDice.DebugMenuClosesAfter.Value; ((UnityEvent<bool>)(object)component.onValueChanged).AddListener((UnityAction<bool>)delegate(bool isOn) { RepoDice.DebugMenuColorUsesPlayerColor.Value = isOn; }); if (((Component)component2).gameObject.activeInHierarchy) { ((UnityEvent<bool>)(object)component2.onValueChanged).AddListener((UnityAction<bool>)delegate(bool isOn) { RepoDice.DebugMenuClosesAfter.Value = !isOn; }); } Toggle component3 = ((Component)EffectMenu.transform.Find("DebugMenu/Bald")).GetComponent<Toggle>(); component3.isOn = RepoDice.Bald.Value; GameObject BaldImage = ((Component)EffectMenu.transform.Find("DebugMenu/Background/Image")).gameObject; ((UnityEvent<bool>)(object)component3.onValueChanged).AddListener((UnityAction<bool>)delegate(bool isOn) { RepoDice.Bald.Value = isOn; BaldImage.SetActive(isOn); }); if (RepoDice.Bald.Value) { BaldImage.SetActive(true); } else { BaldImage.SetActive(false); } Button component4 = ((Component)EffectMenu.transform.Find("DebugMenu/CloseButton")).GetComponent<Button>(); ButtonClickedEvent onClick = component4.onClick; object obj = <>c.<>9__23_3; if (obj == null) { UnityAction val = delegate { CloseSelectMenu(force: true); }; <>c.<>9__23_3 = val; obj = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj); } public static void ShowSelectEffectMenu(bool fromSaint = false) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00f6: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown SetupColors(); if (!ran) { setupElements(); } if (ran) { setColors(); } if ((Object)(object)EffectMenu != (Object)null) { Object.Destroy((Object)(object)EffectMenu); EffectMenu = null; } EffectMenu = Object.Instantiate<GameObject>(RepoDice.SelectMenuPrefab, (Transform)null, false); Canvas component = EffectMenu.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; component.overrideSorting = true; component.sortingOrder = 999; EffectMenu.transform.localPosition = Vector3.zero; EffectMenu.transform.localScale = Vector3.one; EffectMenu.transform.localRotation = Quaternion.identity; mainScrollContent = EffectMenu.transform.Find("DebugMenu/Background/Scroll View/Viewport/Content"); InputAction val = new InputAction((string)null, (InputActionType)0, "<Keyboard>/escape", (string)null, (string)null, (string)null); val.performed += delegate { CloseSelectMenu(); }; val.Enable(); TMP_InputField searchInput = ((Component)EffectMenu.transform.Find("DebugMenu/Background/SearchField")).GetComponent<TMP_InputField>(); ((UnityEvent<string>)(object)searchInput.onValueChanged).AddListener((UnityAction<string>)FilterItems); Button component2 = ((Component)EffectMenu.transform.Find("DebugMenu/Background/ClearButton")).GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { searchInput.text = ""; }); if ((Object)(object)EffectMenu == (Object)null) { Debug.LogError((object)"EffectMenu is null after instantiation!"); return; } DebugMenuController debugMenuController = EffectMenu.AddComponent<DebugMenuController>(); debugMenuController.EffectMenu = EffectMenu; setupButtons(fromSaint); Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; ShowSelectMenu(fromSaint); } public static void CloseSelectMenu(bool force = false) { if ((RepoDice.DebugMenuClosesAfter.Value || force) && (Object)(object)EffectMenu != (Object)null) { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; Object.Destroy((Object)(object)EffectMenu); } } private static void FilterItems(string searchText) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown Transform val = EffectMenu.transform.Find("DebugMenu/Background/Scroll View/Viewport/Content"); foreach (Transform item in val) { Transform val2 = item; TextMeshProUGUI componentInChildren = ((Component)val2).GetComponentInChildren<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { bool active = string.IsNullOrEmpty(searchText) || ((TMP_Text)componentInChildren).text.ToLower().Contains(searchText.ToLower()); ((Component)val2).gameObject.SetActive(active); } } } public static void clearMainViewport() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown Transform val = EffectMenu.transform.Find("DebugMenu/Background/Scroll View/Viewport/Content"); foreach (Transform item in val) { Transform val2 = item; Object.Destroy((Object)(object)((Component)val2).gameObject); } } public static void clearSubViewport() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown Transform val = EffectMenu.transform.Find("DebugMenu/Scroll View/Viewport/Content"); foreach (Transform item in val) { Transform val2 = item; Object.Destroy((Object)(object)((Component)val2).gameObject); } } public static List<IEffect> getOrdered() { List<IEffect> source = new List<IEffect>(DieBehaviour.AllowedEffects); if (Misc.GetLocalPlayer().steamID == RepoDice.slayerSteamID) { source = new List<IEffect>(DieBehaviour.AllEffects); } FavoriteEffectManager.FavoriteData favoriteData = FavoriteEffectManager.LoadFavorites(); List<string> favoriteEffectNames = favoriteData.Favorites; return source.OrderByDescending((IEffect effect) => favoriteEffectNames.Contains(effect.Name)).ThenBy<IEffect, string>((IEffect effect) => effect.Name, StringComparer.OrdinalIgnoreCase).ToList(); } public static void ShowSelectMenu(bool fromSaint = false) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown Transform val = EffectMenu.transform.Find("DebugMenu/Background/Scroll View/Viewport/Content"); List<IEffect> ordered = getOrdered(); FavoriteEffectManager.FavoriteData favoriteData = FavoriteEffectManager.LoadFavorites(); List<string> favorites = favoriteData.Favorites; foreach (IEffect effect in ordered) { GameObject val2 = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, val); TMP_Text component = ((Component)val2.transform.GetChild(0)).GetComponent<TMP_Text>(); bool flag = favorites.Contains(effect.Name); string text = (flag ? "*" : ""); component.text = $"{text} {effect.Name} [{effect.Outcome}] {text}"; ((Graphic)component).color = (flag ? FavoriteTextColor : TextColor); component.outlineWidth = 1f; if (component.text.Length > 20) { component.fontSize = 12f; } else { component.fontSize = 16f; } Button component2 = val2.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { CloseSelectMenu(fromSaint); if (SemiFunc.IsMasterClientOrSingleplayer()) { Networker.Instance.SelectEffectMenuRPC(fromSaint, PlayerAvatar.instance.photonView.ViewID, effect.Name); } else { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("SelectEffectMenuRPC", (RpcTarget)2, new object[3] { fromSaint, PlayerAvatar.instance.photonView.ViewID, effect.Name }); } bool flag2 = false; string text2 = ""; }); RightClickHandler2 rightClickHandler = val2.AddComponent<RightClickHandler2>(); rightClickHandler.effectName = effect.Name; rightClickHandler.category = "Favorites"; rightClickHandler.fromSaint = fromSaint; } } public static void spawnFunctions() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_00b4: 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_00bf: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //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_018d: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, subScrollContent); TMP_Text component = ((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = "Spawn Enemy"; Button component2 = val.GetComponent<Button>(); ButtonClickedEvent onClick = component2.onClick; object obj = <>c.<>9__31_0; if (obj == null) { UnityAction val2 = delegate { //IL_0007: Unknown result type (might be due to invalid IL or missing references) clearMainViewport(); spawnEnemy(Vector3.one); }; <>c.<>9__31_0 = val2; obj = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj); GameObject val3 = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, subScrollContent); TMP_Text component3 = ((Component)val3.transform.GetChild(0)).GetComponent<TMP_Text>(); component3.text = "Spawn BIG Enemy"; Button component4 = val3.GetComponent<Button>(); ButtonClickedEvent onClick2 = component4.onClick; object obj2 = <>c.<>9__31_1; if (obj2 == null) { UnityAction val4 = delegate { //IL_0016: Unknown result type (might be due to invalid IL or missing references) clearMainViewport(); spawnEnemy(new Vector3(2.5f, 2.5f, 2.5f)); }; <>c.<>9__31_1 = val4; obj2 = (object)val4; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); GameObject val5 = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, subScrollContent); TMP_Text component5 = ((Component)val5.transform.GetChild(0)).GetComponent<TMP_Text>(); component5.text = "Spawn SMOL Enemy"; Button component6 = val5.GetComponent<Button>(); ButtonClickedEvent onClick3 = component6.onClick; object obj3 = <>c.<>9__31_2; if (obj3 == null) { UnityAction val6 = delegate { //IL_0016: Unknown result type (might be due to invalid IL or missing references) clearMainViewport(); spawnEnemy(new Vector3(0.5f, 0.5f, 0.5f)); }; <>c.<>9__31_2 = val6; obj3 = (object)val6; } ((UnityEvent)onClick3).AddListener((UnityAction)obj3); GameObject val7 = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, subScrollContent); TMP_Text component7 = ((Component)val7.transform.GetChild(0)).GetComponent<TMP_Text>(); component7.text = "Spawn Valuable"; Button component8 = val7.GetComponent<Button>(); ButtonClickedEvent onClick4 = component8.onClick; object obj4 = <>c.<>9__31_3; if (obj4 == null) { UnityAction val8 = delegate { clearMainViewport(); spawnScrap(); }; <>c.<>9__31_3 = val8; obj4 = (object)val8; } ((UnityEvent)onClick4).AddListener((UnityAction)obj4); GameObject val9 = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, subScrollContent); TMP_Text component9 = ((Component)val9.transform.GetChild(0)).GetComponent<TMP_Text>(); component9.text = "Spawn Shop Items"; Button component10 = val9.GetComponent<Button>(); ButtonClickedEvent onClick5 = component10.onClick; object obj5 = <>c.<>9__31_4; if (obj5 == null) { UnityAction val10 = delegate { clearMainViewport(); spawnShopItems(); }; <>c.<>9__31_4 = val10; obj5 = (object)val10; } ((UnityEvent)onClick5).AddListener((UnityAction)obj5); } public static void spawnEnemy(Vector3 size) { //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_0156: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown FavoriteEffectManager.FavoriteData favoriteData = FavoriteEffectManager.LoadFavorites(); List<string> favoriteEnemyNames = favoriteData.FavoriteEnemies; List<EnemySetup> list = (from x in Misc.getEnemies() group x by ((Object)x).name into g select g.First() into e orderby (!favoriteEnemyNames.Contains(((Object)e).name)) ? 1 : 0, ((Object)e).name select e).ToList(); foreach (EnemySetup enemy in list) { GameObject val = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, mainScrollContent); TMP_Text component = ((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>(); bool flag = favoriteEnemyNames.Contains(((Object)enemy).name); string text = (flag ? "*" : ""); component.text = text + " " + ((Object)enemy).name; ((Graphic)component).color = (flag ? FavoriteTextColor : TextColor); Button component2 = val.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) CloseSelectMenu(); Vector3 val2 = ((Component)PlayerAvatar.instance).transform.position + ((Component)PlayerAvatar.instance).transform.forward; ((MonoBehaviourPun)Networker.Instance).photonView.RPC("SpawnAndScaleEnemy", (RpcTarget)2, new object[5] { ((Object)enemy).name, 1, val2, size, false }); }); RightClickHandler2 rightClickHandler = val.AddComponent<RightClickHandler2>(); rightClickHandler.effectName = ((Object)enemy).name; rightClickHandler.category = "FavoriteEnemies"; } } public static void spawnShopItems() { //IL_0157: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown FavoriteEffectManager.FavoriteData favoriteData = FavoriteEffectManager.LoadFavorites(); List<string> favoriteShopItemNames = favoriteData.FavoriteShopItems; List<Item> source = (from x in StatsManager.instance.itemDictionary.Values.ToList() group x by x.itemName into g select g.First()).ToList(); source = (from s in source orderby (!favoriteShopItemNames.Contains(s.itemName)) ? 1 : 0, s.itemName select s).ToList(); foreach (Item item in source) { GameObject val = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, mainScrollContent); TMP_Text component = ((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>(); bool flag = favoriteShopItemNames.Contains(item.itemName); string text = (flag ? "*" : ""); component.text = text + " " + item.itemName; ((Graphic)component).color = (flag ? FavoriteTextColor : TextColor); Button component2 = val.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) CloseSelectMenu(); Vector3 val2 = ((Component)PlayerAvatar.instance).transform.position + ((Component)PlayerAvatar.instance).transform.forward; ((MonoBehaviourPun)Networker.Instance).photonView.RPC("spawnItemRPC", (RpcTarget)2, new object[3] { item.itemName, val2, RepoDice.keepItems.Value }); }); RightClickHandler2 rightClickHandler = val.AddComponent<RightClickHandler2>(); rightClickHandler.effectName = item.itemName; rightClickHandler.category = "FavoriteShopItems"; } } public static void specialFunctions(bool special) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //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_0068: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown if (special) { GameObject val = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, subScrollContent); TMP_Text component = ((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = "Play Sound"; Button component2 = val.GetComponent<Button>(); ButtonClickedEvent onClick = component2.onClick; object obj = <>c.<>9__34_1; if (obj == null) { UnityAction val2 = delegate { clearMainViewport(); ShowSoundMenu(); }; <>c.<>9__34_1 = val2; obj = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj); } GameObject val3 = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, subScrollContent); TMP_Text component3 = ((Component)val3.transform.GetChild(0)).GetComponent<TMP_Text>(); component3.text = "POI Teleports"; Button component4 = val3.GetComponent<Button>(); ButtonClickedEvent onClick2 = component4.onClick; object obj2 = <>c.<>9__34_0; if (obj2 == null) { UnityAction val4 = delegate { clearMainViewport(); poiTeleports(); }; <>c.<>9__34_0 = val4; obj2 = (object)val4; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); if (!special) { return; } GameObject val5 = Object.Instantiate<GameObject>(RepoDice.DebugSubButtonPrefab, subScrollContent); TMP_Text component5 = ((Component)val5.transform.GetChild(0)).GetComponent<TMP_Text>(); component5.text = "Jail"; Button component6 = val5.GetComponent<Button>(); ButtonClickedEvent onClick3 = component6.onClick; object obj3 = <>c.<>9__34_2; if (obj3 == null) { UnityAction val6 = delegate { clearMainViewport(); jail(); }; <>c.<>9__34_2 = val6; obj3 = (object)val6; } ((UnityEvent)onClick3).AddListener((UnityAction)obj3); } public static void ShowSoundMenu() { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown Transform val = EffectMenu.transform.Find("DebugMenu/Background/Scroll View/Viewport/Content"); foreach (KeyValuePair<string, AudioClip> entry in RepoDice.sounds.OrderBy<KeyValuePair<string, AudioClip>, string>((KeyValuePair<string, AudioClip> x) => x.Key)) { GameObject val2 = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, val); TMP_Text component = ((Component)val2.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = entry.Key; component.outlineWidth = 1f; if (component.text.Length > 20) { component.fontSize = 12f; } else { component.fontSize = 16f; } Button component2 = val2.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { CloseSelectMenu(); ((MonoBehaviourPun)Networker.Instance).photonView.RPC("playSoundForEveryone", (RpcTarget)0, new object[1] { entry.Key }); }); } } public static void RevivePlayer() { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown Transform val = EffectMenu.transform.Find("DebugMenu/Background/Scroll View/Viewport/Content"); Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; List<PlayerAvatar> list = SemiFunc.PlayerGetAll(); int num = 0; foreach (PlayerAvatar player in list) { if (player.playerHealth.health <= 0) { num++; GameObject val2 = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, val); TMP_Text component = ((Component)val2.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = player.playerName ?? ""; Button component2 = val2.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { clearMainViewport(); CloseSelectMenu(); RevivePlayer(); ((MonoBehaviourPun)Networker.Instance).photonView.RPC("reviveRPC", (RpcTarget)0, new object[1] { player.photonView.ViewID }); }); } } if (num == 0) { GameObject val3 = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, val); TMP_Text component3 = ((Component)val3.transform.GetChild(0)).GetComponent<TMP_Text>(); component3.text = "No Dead Players"; } } public static void poiTeleports() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, mainScrollContent); TMP_Text component = ((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = "Ship"; Button component2 = val.GetComponent<Button>(); ButtonClickedEvent onClick = component2.onClick; object obj = <>c.<>9__37_0; if (obj == null) { UnityAction val2 = delegate { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviourPun)Networker.Instance).photonView.RPC("ForceTeleportRPC", (RpcTarget)0, new object[3] { PlayerAvatar.instance.photonView.ViewID, ((Component)LevelGenerator.Instance.LevelPathTruck).transform.position, ((Component)LevelGenerator.Instance.LevelPathTruck).transform.rotation }); CloseSelectMenu(); }; <>c.<>9__37_0 = val2; obj = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj); ExtractionPoint[] array = Object.FindObjectsByType<ExtractionPoint>((FindObjectsSortMode)0); ExtractionPoint[] array2 = array; foreach (ExtractionPoint entrance in array2) { GameObject val3 = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, mainScrollContent); TMP_Text component3 = ((Component)val3.transform.GetChild(0)).GetComponent<TMP_Text>(); component3.text = ((Object)entrance).name; Button component4 = val3.GetComponent<Button>(); ((UnityEvent)component4.onClick).AddListener((UnityAction)delegate { //IL_003b: 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) ((MonoBehaviourPun)Networker.Instance).photonView.RPC("ForceTeleportRPC", (RpcTarget)0, new object[3] { PlayerAvatar.instance.photonView.ViewID, ((Component)entrance).transform.position, ((Component)entrance).transform.rotation }); CloseSelectMenu(); }); } LevelPoint[] array3 = Object.FindObjectsByType<LevelPoint>((FindObjectsSortMode)0); LevelPoint[] array4 = array3; foreach (LevelPoint levelPoint in array4) { GameObject val4 = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, mainScrollContent); TMP_Text component5 = ((Component)val4.transform.GetChild(0)).GetComponent<TMP_Text>(); component5.text = ((Object)levelPoint).name; Button component6 = val4.GetComponent<Button>(); ((UnityEvent)component6.onClick).AddListener((UnityAction)delegate { //IL_003b: 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) ((MonoBehaviourPun)Networker.Instance).photonView.RPC("ForceTeleportRPC", (RpcTarget)0, new object[3] { PlayerAvatar.instance.photonView.ViewID, ((Component)levelPoint).transform.position, ((Component)levelPoint).transform.rotation }); CloseSelectMenu(); }); } } public static void jail() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown List<PlayerAvatar> list = SemiFunc.PlayerGetAll(); GameObject val = GameObject.Find("Shop Door"); if ((Object)(object)val == (Object)null) { return; } LevelPoint lp = ((Component)val.transform.parent).GetComponentInChildren<LevelPoint>(); foreach (PlayerAvatar player in list) { GameObject val2 = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, mainScrollContent); TMP_Text component = ((Component)val2.transform.GetChild(0)).GetComponent<TMP_Text>(); component.text = player.playerName; Button component2 = val2.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { //IL_0041: 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) ((MonoBehaviourPun)Networker.Instance).photonView.RPC("ForceTeleportRPC", (RpcTarget)0, new object[3] { player.photonView.ViewID, ((Component)lp).transform.position, ((Component)lp).transform.rotation }); CloseSelectMenu(); }); } } public static void spawnScrap() { //IL_012a: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown FavoriteEffectManager.FavoriteData favoriteData = FavoriteEffectManager.LoadFavorites(); List<string> favoriteScrapNames = favoriteData.FavoriteScraps; if (Misc.valuablePrefabsByName.Count == 0) { Misc.CacheValuables(); } List<string> list = Misc.valuablePrefabsByName.Keys.ToList(); RepoDice.SuperLog(list.Count.ToString(), (LogLevel)16); list = (from s in list orderby (!favoriteScrapNames.Contains(s)) ? 1 : 0, s select s).ToList(); foreach (string scrap in list) { GameObject val = Object.Instantiate<GameObject>(RepoDice.DebugMenuButtonPrefab, mainScrollContent); TMP_Text component = ((Component)val.transform.GetChild(0)).GetComponent<TMP_Text>(); bool flag = favoriteScrapNames.Contains(scrap); string text = (flag ? "*" : ""); component.text = text + " " + scrap; ((Graphic)component).color = (flag ? FavoriteTextColor : TextColor); Button component2 = val.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) CloseSelectMenu(); Vector3 val2 = ((Component)PlayerAvatar.instance).transform.position + ((Component)PlayerAvatar.instance).transform.forward; ((MonoBehaviourPun)Networker.Instance).photonView.RPC("spawnValuable", (RpcTarget)2, new object[2] { scrap, val2 }); }); RightClickHandler2 rightClickHandler = val.AddComponent<RightClickHandler2>(); rightClickHandler.effectName = scrap; rightClickHandler.category = "FavoriteScraps"; } } } public static class FavoriteEffectManager { public class FavoriteData { public List<string> Favorites { get; set; } = new List<string>(); public List<string> FavoriteEnemies { get; set; } = new List<string>(); public List<string> FavoriteTraps { get; set; } = new List<string>(); public List<string> FavoriteScraps { get; set; } = new List<string>(); public List<string> FavoriteShopItems { get; set; } = new List<string>(); public List<string> FavoriteItems { get; set; } = new List<string>(); } private static readonly string directoryPath = Path.Combine(Application.persistentDataPath, "EmergencyDice"); private static readonly string filePath = Path.Combine(directoryPath, "Favorites.json"); public static FavoriteData LoadFavorites() { if (!Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } if (!File.Exists(filePath)) { Debug.LogWarning((object)("Favorites file not found at " + filePath + ". Returning empty data.")); return new FavoriteData(); } try { string text = File.ReadAllText(filePath); return JsonConvert.DeserializeObject<FavoriteData>(text) ?? new FavoriteData(); } catch { Debug.LogError((object)("Failed to load favorites from " + filePath + ". Returning empty data.")); return new FavoriteData(); } } public static void SaveFavorites(FavoriteData favorites) { if (!Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } try { string contents = JsonConvert.SerializeObject((object)favorites, (Formatting)1); File.WriteAllText(filePath, contents); Debug.Log((object)("Favorites successfully saved to " + filePath)); } catch (Exception ex) { Debug.LogError((object)("Failed to save favorites to " + filePath + ". Error: " + ex.Message)); } } } public class DebugMenuController : MonoBehaviour { public GameObject EffectMenu; private InputAction escAction; private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown escAction = new InputAction((string)null, (InputActionType)0, "<Keyboard>/escape", (string)null, (string)null, (string)null); escAction.performed += delegate { CloseMenu(); }; escAction.Enable(); } private void OnDestroy() { escAction.Disable(); } public void CloseMenu() { if ((Object)(object)EffectMenu != (Object)null) { Object.Destroy((Object)(object)EffectMenu); EffectMenu = null; Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; } } } public class ColorHelper { public static string AppendTransparency(string hexColor, int percentage) { string text = ((int)Math.Round((double)percentage / 100.0 * 255.0)).ToString("X2"); return hexColor + text; } public static (Color brighter, Color darker) GenerateColors(Color primary) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_003e: 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) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(primary, ref num, ref num2, ref num3); float num4 = Mathf.Clamp01(num3 + 0.3f); float num5 = Mathf.Clamp01(num3 * 0.5f); Color item = Color.HSVToRGB(num, num2, num4); Color item2 = Color.HSVToRGB(num, num2, num5); return (item, item2); } public static Color HexToColor(string hex) { //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) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); if (ColorUtility.TryParseHtmlString(hex, ref result)) { return result; } throw new Exception("Invalid hex color"); } public static string ColorToHex(Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return "#" + ColorUtility.ToHtmlStringRGB(color); } public static Color GetEmphasisTextColor(Color background) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(background, ref num, ref num2, ref num3); num = (num + 0.5f) % 1f; num2 = Mathf.Clamp01(num2 + 0.3f); num3 = ((num3 < 0.6f) ? 0.8f : Mathf.Clamp01(1f - num3 * 0.5f)); return Color.HSVToRGB(num, num2, num3); } public static Color GetReadableTextColor(Color background) { //IL_0001: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) float luminance = GetLuminance(background); return (luminance > 0.5f) ? HexToColor("#1a1100") : Color.white; } public static float GetLuminance(Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) float num = Linearize(color.r); float num2 = Linearize(color.g); float num3 = Linearize(color.b); return 0.2126f * num + 0.7152f * num2 + 0.0722f * num3; } private static float Linearize(float channel) { return (channel <= 0.03928f) ? (channel / 12.92f) : Mathf.Pow((channel + 0.055f) / 1.055f, 2.4f); } } public class Misc : MonoBehaviour { public enum Size { tiny, small, medium, big, wide, tall, veryTall } public enum UpgradeType { health, energy, strength, jumps, speed, range } public static readonly Dictionary<Size, List<GameObject>> valuablePrefabsBySize = new Dictionary<Size, List<GameObject>>(); public static readonly Dictionary<string, GameObject> valuablePrefabsByName = new Dictionary<string, GameObject>(); private static List<EnemySetup> cachedEnemies = new List<EnemySetup>(); public static T GetRandomEnum<T>() where T : Enum { Array values = Enum.GetValues(typeof(T)); return (T)values.GetValue(Random.Range(0, values.Length)); } public static void CacheValuables() { valuablePrefabsBySize.Clear(); valuablePrefabsByName.Clear(); if ((Object)(object)RunManager.instance == (Object)null) { RepoDice.Logger.LogError((object)"Failed to cache LevelValuables. RunManager instance is null."); return; } foreach (Level level in RunManager.instance.levels) { foreach (LevelValuables valuablePreset in level.ValuablePresets) { try { Dictionary<Size, List<GameObject>> dictionary = new Dictionary<Size, List<GameObject>> { { Size.tiny, valuablePreset.tiny }, { Size.small, valuablePreset.small }, { Size.medium, valuablePreset.medium }, { Size.big, valuablePreset.big }, { Size.wide, valuablePreset.wide }, { Size.tall, valuablePreset.tall }, { Size.veryTall, valuablePreset.veryTall } }; foreach (KeyValuePair<Size, List<GameObject>> item in dictionary) { if (!valuablePrefabsBySize.TryGetValue(item.Key, out List<GameObject> value)) { value = new List<GameObject>(); valuablePrefabsBySize[item.Key] = value; } foreach (GameObject item2 in item.Value) { if ((Object)(object)item2 != (Object)null) { RepoDice.SuperLog("Found Valuable Preset: " + ((Object)item2).name, (LogLevel)16); if (!value.Contains(item2)) { value.Add(item2); } string key = ((Object)item2).name.ToLower(); if (!valuablePrefabsByName.ContainsKey(key)) { valuablePrefabsByName[key] = item2; } } } } } catch (Exception ex) { RepoDice.Logger.LogWarning((object)("Exception while caching valuables: " + ex.Message)); } } } } public static GameObject? GetRandomValuable(Size? size = null) { if (valuablePrefabsBySize.Count == 0) { CacheValuables(); } if (size.HasValue) { if (valuablePrefabsBySize.TryGetValue(size.Value, out List<GameObject> value) && value.Count > 0) { return value[Random.Range(0, value.Count)]; } return null; } List<List<GameObject>> list = valuablePrefabsBySize.Values.Where((List<GameObject> l) => l.Count > 0).ToList(); if (list.Count == 0) { return null; } List<GameObject> list2 = list[Random.Range(0, list.Count)]; return list2[Random.Range(0, list2.Count)]; } public static List<GameObject>? getValuablesWithName(string name) { string name2 = name; if (valuablePrefabsByName.Count == 0) { CacheValuables(); } return valuablePrefabsByName.Values.Where((GameObject x) => ((Object)x).name.ToLower().Contains(name2.ToLower())).ToList(); } public static GameObject? GetValuableByName(string name) { if (valuablePrefabsByName.Count == 0) { CacheValuables(); } GameObject value; return valuablePrefabsByName.TryGetValue(name.ToLower(), out value) ? value : null; } public static List<GameObject> GetValuablesBySize(Size size) { if (valuablePrefabsBySize.Count == 0) { CacheValuables(); } List<GameObject> value; return valuablePrefabsBySize.TryGetValue(size, out value) ? value : new List<GameObject>(); } public static PlayerAvatar GetPlayerBySteamID(string id) { string id2 = id; PlayerAvatar val = GameDirector.instance.PlayerList.Find((PlayerAvatar x) => x.steamID == id2); if ((Object)(object)val == (Object)null) { return null; } return val; } public static bool IsValidGround(Vector3 position, float maxDropDistance = 5f, LayerMask? layerMask = null) { //IL_0017: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //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_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) LayerMask val = (LayerMask)(((??)layerMask) ?? LayerMask.op_Implicit(-5)); if (!Physics.Raycast(position, Vector3.down, maxDropDistance, LayerMask.op_Implicit(val))) { return false; } List<PlayerAvatar> playerList = GameDirector.instance.PlayerList; foreach (PlayerAvatar item in playerList) { if (Vector3.Distance(((Component)item).transform.position, position) < 3f) { return false; } } return true; } public static PlayerAvatar GetLocalPlayer() { foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if ((Object)(object)player.photonView != (Object)null && player.photonView.IsMine) { return player; } } RepoDice.Logger.LogWarning((object)"Local PlayerAvatar not found!"); return null; } public static bool isGlitchOrConfig() { if (SemiFunc.PlayerGetSteamID(PlayerAvatar.instance) == RepoDice.glitchSteamID || RepoDice.IWannaSeeWhatGlitchSees.Value) { return true; } return false; } public static PlayerAvatar GetRandomPlayer() { List<PlayerAvatar> playerList = GameDirector.instance.PlayerList; if (playerList == null || playerList.Count == 0) { return null; } int index = Random.Range(0, playerList.Count); return playerList[index]; } 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 void SpawnEnemy(string enemyName, int count, Vector3 position, bool isFreebird = false, bool isGlitchy = false, bool fromTry = false, bool hunterStuff = false) { //IL_0418: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0172: 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_01bd: 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) string enemyName2 = enemyName; if (RepoDice.ExtendedLogging.Value) { foreach (EnemySetup enemy in getEnemies()) { RepoDice.SuperLog("Enemy Found: " + ((Object)enemy).name, (LogLevel)16); } } try { EnemySetup val = ((IEnumerable<EnemySetup>)getEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => ((Object)x).name == enemyName2)); if ((Object)(object)val == (Object)null) { val = ((IEnumerable<EnemySetup>)getEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => NameContains(x, enemyName2))); } if ((Object)(object)val == (Object)null) { RepoDice.SuperLog(enemyName2 + " not found!", (LogLevel)16); } if (!((Object)(object)val != (Object)null)) { return; } Vector3 val2 = position + Vector3.forward + Vector3.forward; int num = 0; bool flag = IsValidGround(val2); while (!flag) { num++; val2 = position + new Vector3((float)Random.Range(-3, 4), Random.Range(0.8f, 1.8f), (float)Random.Range(-3, 4)); flag = IsValidGround(val2); if (num > 5) { break; } } LevelPoint val3 = SemiFunc.LevelPointGet(position, 4f, 20f); if (!flag) { if ((Object)(object)val3 == (Object)null) { return; } val2 = ((Component)val3).transform.position; } for (int i = 0; i < count; i++) { List<EnemyParent> list = Enemies.SpawnEnemy(val, val2, Quaternion.identity, false); RepoDice.SuperLog($"Spawned {list.Count} enemies for '{enemyName2}'", (LogLevel)16); if (isFreebird) { foreach (EnemyParent item in list) { if (SemiFunc.IsMultiplayer()) { if (SemiFunc.IsMasterClient()) { Networker.Instance.makeFreebirdRpc(((MonoBehaviourPun)item).photonView.ViewID); continue; } ((MonoBehaviourPun)Networker.Instance).photonView.RPC("makeFreebirdRpc", (RpcTarget)1, new object[1] { ((MonoBehaviourPun)item).photonView.ViewID }); } else { Networker.Instance.makeFreebirdRpc(((MonoBehaviourPun)item).photonView.ViewID); } } } if (isGlitchy) { foreach (EnemyParent item2 in list) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("makeGlassRPC", (RpcTarget)0, new object[3] { ((MonoBehaviourPun)item2).photonView.ViewID, true, true }); } } if (!hunterStuff) { continue; } int shotsAtOnce = Random.Range(8, 15); foreach (EnemyParent item3 in list) { EnemyHunter componentInChildren = ((Component)item3).GetComponentInChildren<EnemyHunter>(); if ((Object)(object)componentInChildren != (Object)null) { FastShooterMono fastShooterMono = ComponentHolderProtocol.AddComponent<FastShooterMono>((Object)(object)((Component)componentInChildren).transform); fastShooterMono.hunter = componentInChildren; fastShooterMono.shotsAtOnce = shotsAtOnce; } else { RepoDice.SuperLog("Hunter " + ((Object)item3).name + " not found!", (LogLevel)16); } } } } catch (Exception ex) { if (!fromTry) { RepoDice.SuperLog("Error with spawning enemy, spawning Animal instead: " + ex, (LogLevel)2); SpawnEnemy("Animal", 1, position, isFreebird, isGlitchy, fromTry: true); } } } public static bool NameContains(EnemySetup enemySetup, string name) { if ((Object)(object)enemySetup == (Object)null) { return false; } if (LooseStringMatch(((Object)enemySetup).name, name)) { return true; } EnemyParent val = null; foreach (GameObject item in enemySetup.spawnObjects.Where((GameObject x) => (Object)(object)x != (Object)null).Distinct()) { if (!item.TryGetComponent<EnemyParent>(ref val)) { } } if ((Object)(object)val != (Object)null) { if (LooseStringMatch(val.enemyName, name)) { return true; } if (LooseStringMatch(((Object)((Component)val).gameObject).name, name)) { return true; } } return false; } public static void MakeGlass(Material mat, float alpha = 0.3f, bool fucky = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) Color color = mat.color; if ((Object)(object)mat == (Object)(object)RepoDice.GlitchyMaterial) { return; } if (fucky) { Shader val = Shader.Find("Autodesk Interactive"); if ((Object)(object)val == (Object)null) { RepoDice.SuperLog("Autodesk Interactive shader not found!", (LogLevel)16); return; } mat.shader = val; } else { Shader val2 = Shader.Find("Standard"); if ((Object)(object)val2 == (Object)null) { RepoDice.SuperLog("Standard shader not found!", (LogLevel)16); return; } mat.shader = val2; } mat.SetFloat("_Mode", 3f); mat.SetInt("_SrcBlend", 5); mat.SetInt("_DstBlend", 10); mat.SetInt("_ZWrite", 0); mat.DisableKeyword("_ALPHATEST_ON"); mat.EnableKeyword("_ALPHABLEND_ON"); mat.DisableKeyword("_ALPHAPREMULTIPLY_ON"); mat.renderQueue = 3000; Color color2 = color; color2.a = alpha; mat.color = color2; } public static ReadOnlyCollection<EnemySetup> getEnemies() { if (cachedEnemies.Count == 0) { List<EnemySetup> list = new List<EnemySetup>(); list.AddRange(EnemyDirector.instance.enemiesDifficulty1); list.AddRange(EnemyDirector.instance.enemiesDifficulty2); list.AddRange(EnemyDirector.instance.enemiesDifficulty3); cachedEnemies = list; } return cachedEnemies.AsReadOnly(); } public static bool LooseStringMatch(string a, string b) { string text = RemoveWhitespace(a).ToLowerInvariant(); string text2 = RemoveWhitespace(b).ToLowerInvariant(); return text == text2; } private static string RemoveWhitespace(string input) { return new string(input.Where((char c) => !char.IsWhiteSpace(c)).ToArray()); } public static void SpawnAndScaleEnemy(string enemyName, int count, Vector3 position, Vector3 scale, bool isGlitchy = false) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_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_0106: 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_012c: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_026d: 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) string enemyName2 = enemyName; if (RepoDice.ExtendedLogging.Value) { foreach (EnemySetup enemy in getEnemies()) { RepoDice.SuperLog("Enemy Found: " + ((Object)enemy).name, (LogLevel)16); } } try { EnemySetup val = ((IEnumerable<EnemySetup>)getEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => ((Object)x).name == enemyName2)); if ((Object)(object)val == (Object)null) { val = ((IEnumerable<EnemySetup>)getEnemies()).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup x) => ((Object)x).name.Contains(enemyName2))); } if ((Object)(object)val == (Object)null) { RepoDice.SuperLog(enemyName2 + " not found!", (LogLevel)16); } if (!((Object)(object)val != (Object)null)) { return; } RepoDice.SuperLog("Spawning enemy: " + ((Object)val).name, (LogLevel)16); Vector3 val2 = position + Vector3.forward + Vector3.forward; int num = 0; bool flag = IsValidGround(val2); while (!flag) { num++; val2 = position + new Vector3((float)Random.Range(-3, 4), Random.Range(0.8f, 1.8f), (float)Random.Range(-3, 4)); flag = IsValidGround(val2); if (num > 5) { break; } } LevelPoint val3 = SemiFunc.LevelPointGet(position, 4f, 20f); if (!flag) { if ((Object)(object)val3 == (Object)null) { return; } val2 = ((Component)val3).transform.position; } for (int i = 0; i < count; i++) { List<EnemyParent> list = Enemies.SpawnEnemy(val, val2, Quaternion.identity, false); foreach (EnemyParent item in list) { PhotonView component = ((Component)item).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && SemiFunc.IsMasterClientOrSingleplayer()) { if (SemiFunc.IsMultiplayer()) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("SetScale", (RpcTarget)1, new object[2] { component.ViewID, scale }); } Networker.Instance.SetScale(component.ViewID, scale); } } if (!isGlitchy) { continue; } foreach (EnemyParent item2 in list) { ((MonoBehaviourPun)Networker.Instance).photonView.RPC("makeGlassRPC", (RpcTarget)0, new object[3] { ((MonoBehaviourPun)item2).photonView.ViewID, true, true }); } } } catch (Exception ex) { RepoDice.SuperLog(ex.Message, (LogLevel)2); } } } public class Networker : MonoBehaviourPun { public static Networker Instance; private PhotonView photonView; private List<string> upgrades = new List<string>(); private List<string> actualUpgradeList = new List<string>(); private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { RepoDice.SuperLog("", (LogLevel)4); Object.Destroy((Object)(object)((Component)this).gameObject); } else { Debug.Log((object)"Networker::Awake"); Instance = this; photonView = ((Component)this).GetComponent<PhotonView>(); } } private void Start() { upgrades = StatsManager.instance.FetchPlayerUpgrades(SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarLocal())).Keys.ToList(); } [PunRPC] public void SetScale(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); } } [PunRPC] public void setStaminaRPC(float stamina) { if (PlayerAvatar.instance.playerHealth.health != 0) { PlayerController.instance.EnergyCurrent = stamina; } } [PunRPC] public void chooseEffectRPC(int photonViewID) { if (PlayerAvatar.instance.photonView.ViewID == photonViewID) { DebugMenu.ShowSelectEffectMenu(fromSaint: true); } } [PunRPC] public void reviveRPC(int photonViewID) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(photonViewID); if (val.playerHealth.health <= 0) { if (!val.playerDeathHead.triggered) { val.playerDeathHead.Trigger(); } if (PhotonNetwork.IsMasterClient) { val.playerDeathHead.physGrabObject.Teleport(((Component)LevelGenerator.Instance.LevelPathTruck).transform.position + Vector3.up, ((Component)LevelGenerator.Instance.LevelPathTruck).transform.rotation); ((MonoBehaviour)this).StartCoroutine(waitRevive(val)); } } } public IEnumerator waitRevive(PlayerAvatar? player) { PlayerAvatar player2 = player; yield return (object)new WaitUntil((Func<bool>)(() => ((Behaviour)player2.playerDeathHead).isActiveAndEnabled)); yield return (object)new WaitForSeconds(0.5f); PlayerAvatar obj = player2; if (obj != null) { obj.Revive(true); } } [PunRPC] public void makePlayerGlass(int playerPhotonID, int deathHeadPhotonID, bool reverse) { PhotonView val = PhotonView.Find(playerPhotonID); PhotonView val2 = PhotonView.Find(deathHeadPhotonID); MaterialMemory materialMemory = ((Component)val).gameObject.GetComponent<MaterialMemory>(); if ((Object)(object)materialMemory == (Object)null) { materialMemory = ((Component)val).gameObject.AddComponent<MaterialMemory>(); } MaterialMemory component = ((Component)val2).gameObject.GetComponent<MaterialMemory>(); if ((Object)(object)component == (Object)null) { component = ((Component)val2).gameObject.AddComponent<MaterialMemory>(); } Renderer[] componentsInChildren = ((Component)((Component)val).gameObject.transform.parent.Find("Player Visuals/[RIG]")).GetComponentsInChildren<Renderer>(); Renderer[] componentsInChildren2 = ((Component)val2).GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val3 in array) { if (reverse) { if (!materialMemory.materials.ContainsKey(val3)) { materialMemory.materials[val3] = val3.material; } val3.material = RepoDice.GlitchyMaterial; } else if ((Object)(object)val3.material == (Object)(object)RepoDice.GlitchyMaterial && materialMemory.materials.ContainsKey(val3)) { val3.material = materialMemory.materials[val3]; } } } public IEnumerator DelayJumpscare() { yield return (object)new WaitForSeconds(Random.Range(10f, 60f)); photonView.RPC("doJumpscare", (RpcTarget)0, Array.Empty<object>()); } [PunRPC] public void doJumpscare() { RepoDice.JumpscareScript.Scare(); } [PunRPC] public void makeGlassRPC(int photonViewID, bool canBeGlitchy, bool forceGlitchy) { PhotonView val = PhotonView.Find(photonViewID); Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>(); MaterialMemory materialMemory = ((Component)val).gameObject.GetComponent<MaterialMemory>(); if ((Object)(object)materialMemory == (Object)null) { materialMemory = ((Component)val).gameObject.AddComponent<MaterialMemory>(); } bool flag = forceGlitchy || (RepoDice.glitchyMode.Value && canBeGlitchy && Random.value > 0.9f); Renderer[] array = componentsInChildren; foreach (Renderer val2 in array) { if (flag) { if (!materialMemory.materials.ContainsKey(val2)) { materialMemory.materials[val2] = val2.material; } val2.material = RepoDice.GlitchyMaterial; } else { if ((Object)(object)val2.material == (Object)(object)RepoDice.GlitchyMaterial && materialMemory.materials.ContainsKey(val2)) { val2.material = materialMemory.materials[val2]; } Misc.MakeGlass(val2.material); } } } [PunRPC] public void forceNeckBreak(int photonViewID) { if (PlayerAvatar.instance.photonView.ViewID == photonViewID) { TurnThatFrown.BreakNeck(); } } [PunRPC] public void makeEverythingMore(float percentage) { ValuableObject[] array = Object.FindObjectsOfType<ValuableObject>(true); ValuableObject[] array2 = array; foreach (ValuableObject val in array2) { val.photonView.RPC("DollarValueSetRPC", (RpcTarget)3, new object[1] { val.dollarValueCurrent * percentage }); } } [PunRPC] public void makeFreebirdRpc(int photonViewID) { PhotonView val = PhotonView.Find(photonViewID); if ((O
plugins/REPOLib.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.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 Steamworks; 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.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0+2a3919a7a0497d73c37672c768f840403b3beb8d")] [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) { Log((LogLevel)32, data); } 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.1.0")] 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)); _harmony.PatchAll(typeof(PlayerControllerPatch)); ConfigManager.Initialize(((BaseUnityPlugin)this).Config); Upgrades.Initialize(); 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.1.0"; } } 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(PlayerController))] internal static class PlayerControllerPatch { [CompilerGenerated] private sealed class <LateStartTranspiler>d__0 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IEnumerator, IDisposable { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private bool <found>5__2; private List<CodeInstruction>.Enumerator <>7__wrap2; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LateStartTranspiler>d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap2 = default(List<CodeInstruction>.Enumerator); <>1__state = -2; } private bool MoveNext() { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerController), "playerAvatarScript"); MethodInfo methodInfo = AccessTools.Method(typeof(SemiFunc), "PlayerGetSteamID", new Type[1] { typeof(PlayerAvatar) }, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(Upgrades), "InvokeStartActions", new Type[1] { typeof(string) }, (Type[])null); <found>5__2 = false; int num = 0; List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { list.Add(instruction); if (num switch { 0 => instruction.opcode == OpCodes.Ldloc_1, 1 => instruction.opcode == OpCodes.Ldfld && CodeInstructionExtensions.LoadsField(instruction, fieldInfo, false), 2 => instruction.opcode == OpCodes.Call && CodeInstructionExtensions.Calls(instruction, methodInfo), 3 => instruction.opcode == OpCodes.Stloc_2, _ => false, }) { num++; if (num > 3) { <found>5__2 = true; num = 0; list.Add(new CodeInstruction(OpCodes.Ldloc_2, (object)null)); list.Add(new CodeInstruction(OpCodes.Call, (object)methodInfo2)); } } else { num = 0; } } <>7__wrap2 = list.GetEnumerator(); <>1__state = -3; break; } case 1: <>1__state = -3; break; } if (<>7__wrap2.MoveNext()) { CodeInstruction current2 = <>7__wrap2.Current; <>2__current = current2; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap2 = default(List<CodeInstruction>.Enumerator); if (!<found>5__2) { Logger.LogWarning("Failed to patch PlayerController.LateStart!"); } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap2).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <LateStartTranspiler>d__0 <LateStartTranspiler>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <LateStartTranspiler>d__ = this; } else { <LateStartTranspiler>d__ = new <LateStartTranspiler>d__0(0); } <LateStartTranspiler>d__.instructions = <>3__instructions; return <LateStartTranspiler>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } [IteratorStateMachine(typeof(<LateStartTranspiler>d__0))] [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyTranspiler] private static IEnumerable<CodeInstruction> LateStartTranspiler(IEnumerable<CodeInstruction> instructions) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LateStartTranspiler>d__0(-2) { <>3__instructions = instructions }; } } [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(); Upgrades.RegisterUpgrades(); } } [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 { internal 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) { return (Object)(object)GetPrefab(prefabId) != (Object)null; } 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) { if (Prefabs.TryGetValue(prefabId, out GameObject value, ignoreKeyCase: true)) { return value; } return Resources.Load<GameObject>(prefabId); } 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); } } internal 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.1.0" }; [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."); 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? GetNetworkPrefab(string prefabId) { return CustomPrefabPool.GetPrefab(prefabId); } public static bool TryGetNetworkPrefab(string prefabId, [NotNullWhen(true)] out GameObject? prefab) { prefab = GetNetworkPrefab(prefabId); return (Object)(object)prefab != (Object)null; } 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 Upgrades { private static readonly Dictionary<string, PlayerUpgrade> _playerUpgrades = new Dictionary<string, PlayerUpgrade>(); private static NetworkedEvent? _upgradeEvent; public static IReadOnlyList<PlayerUpgrade> PlayerUpgrades => _playerUpgrades.Values.ToList(); internal static void Initialize() { _upgradeEvent = new NetworkedEvent("REPOLib Upgrade", HandleUpgradeEvent); } internal static void RegisterUpgrades() { if ((Object)(object)StatsManager.instance == (Object)null) { Logger.LogError("Upgrades: Failed to register upgrades. StatsManager instance is null."); return; } foreach (KeyValuePair<string, PlayerUpgrade> playerUpgrade in _playerUpgrades) { string text = "playerUpgrade" + playerUpgrade.Key; Dictionary<string, int> playerDictionary = playerUpgrade.Value.PlayerDictionary; if (StatsManager.instance.dictionaryOfDictionaries.TryGetValue(text, out var value)) { playerDictionary = value; Logger.LogInfo("Upgrades: Loaded upgrade \"" + text + "\" from StatsManager.", extended: true); } else { playerDictionary.Clear(); StatsManager.instance.dictionaryOfDictionaries.Add(text, playerDictionary); Logger.LogInfo("Upgrades: Added upgrade \"" + text + "\" to StatsManager.", extended: true); } } } internal static void InvokeStartActions(string steamId) { PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(steamId); if ((Object)(object)val == (Object)null) { return; } string arg = SemiFunc.PlayerGetName(val); foreach (PlayerUpgrade playerUpgrade in PlayerUpgrades) { if (playerUpgrade.StartAction != null) { try { int level = playerUpgrade.GetLevel(steamId); playerUpgrade.StartAction(val, level); Logger.LogDebug($"Upgrades: Invoked start action for upgrade \"{playerUpgrade.UpgradeId}\" on player \"{arg}\" at level {level}"); } catch (Exception arg2) { Logger.LogError($"Upgrades: Failed to invoke start action for upgrade \"{playerUpgrade.UpgradeId}\" on player \"{arg}\". {arg2}"); } } } } internal static void RaiseUpgradeEvent(string upgradeId, string steamId, int level) { //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_0019: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0037: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (_upgradeEvent != null) { Hashtable val = new Hashtable(); ((Dictionary<object, object>)val).Add((object)"UpgradeId", (object)upgradeId); ((Dictionary<object, object>)val).Add((object)"SteamId", (object)steamId); ((Dictionary<object, object>)val).Add((object)"Level", (object)level); Hashtable eventContent = val; _upgradeEvent.RaiseEvent(eventContent, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } } private static void HandleUpgradeEvent(EventData eventData) { object customData = eventData.CustomData; Hashtable val = (Hashtable)((customData is Hashtable) ? customData : null); if (val != null) { string upgradeId = (string)val[(object)"UpgradeId"]; string steamId = (string)val[(object)"SteamId"]; int level = (int)val[(object)"Level"]; if (TryGetUpgrade(upgradeId, out PlayerUpgrade playerUpgrade)) { playerUpgrade.ApplyUpgrade(steamId, level); } } } public static PlayerUpgrade? RegisterUpgrade(string upgradeId, Item? item, Action<PlayerAvatar, int>? startAction, Action<PlayerAvatar, int>? upgradeAction) { if (_playerUpgrades.ContainsKey(upgradeId)) { Logger.LogError("Failed to register upgrade \"" + upgradeId + "\". An upgrade with this UpgradeId has already been registered."); return null; } PlayerUpgrade playerUpgrade = new PlayerUpgrade(upgradeId, item, startAction, upgradeAction); _playerUpgrades.Add(upgradeId, playerUpgrade); return playerUpgrade; } public static PlayerUpgrade? GetUpgrade(string upgradeId) { if (_playerUpgrades.TryGetValue(upgradeId, out PlayerUpgrade value)) { return value; } return null; } public static bool TryGetUpgrade(string upgradeId, [NotNullWhen(true)] out PlayerUpgrade? playerUpgrade) { playerUpgrade = GetUpgrade(upgradeId); return playerUpgrade != null; } } public class PlayerUpgrade { public readonly string UpgradeId; public readonly Item? Item; public Dictionary<string, int> PlayerDictionary = new Dictionary<string, int>(); internal readonly Action<PlayerAvatar, int>? StartAction; private readonly Action<PlayerAvatar, int>? _upgradeAction; internal PlayerUpgrade(string upgradeId, Item? item, Action<PlayerAvatar, int>? startAction, Action<PlayerAvatar, int>? upgradeAction) { UpgradeId = upgradeId; Item = item; StartAction = startAction; _upgradeAction = upgradeAction; } public int GetLevel(PlayerAvatar playerAvatar) { if ((Object)(object)playerAvatar == (Object)null) { return 0; } return GetLevel(playerAvatar.steamID); } public int GetLevel(string steamId) { if (PlayerDictionary.TryGetValue(steamId, out var value)) { return value; } return 0; } public int AddLevel(PlayerAvatar playerAvatar, int amount = 1) { if ((Object)(object)playerAvatar == (Object)null) { return 0; } return AddLevel(playerAvatar.steamID, amount); } public int AddLevel(string steamId, int amount = 1) { return ChangeLevelBy(steamId, amount); } public int RemoveLevel(PlayerAvatar playerAvatar, int amount = 1) { if ((Object)(object)playerAvatar == (Object)null) { return 0; } return RemoveLevel(playerAvatar.steamID, amount); } public int RemoveLevel(string steamId, int amount = 1) { return ChangeLevelBy(steamId, -amount); } public int SetLevel(PlayerAvatar playerAvatar, int level) { if ((Object)(object)playerAvatar == (Object)null) { return 0; } return SetLevel(playerAvatar.steamID, level); } public int SetLevel(string steamId, int level) { level = Mathf.Max(level, 0); PlayerDictionary[steamId] = level; ApplyUpgrade(steamId, level); Upgrades.RaiseUpgradeEvent(UpgradeId, steamId, level); return level; } private int ChangeLevelBy(string steamId, int amount) { int level = GetLevel(steamId); level += amount; return SetLevel(steamId, level); } internal void ApplyUpgrade(string steamId, int level) { PlayerDictionary[steamId] = level; if (_upgradeAction == null) { return; } PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(steamId); if ((Object)(object)val == (Object)null) { return; } string arg = SemiFunc.PlayerGetName(val); try { _upgradeAction(val, GetLevel(steamId)); Logger.LogDebug($"PlayerUpgrade: Invoked upgrade action for upgrade \"{UpgradeId}\" on player \"{arg}\" at level {level}"); } catch (Exception arg2) { Logger.LogError($"PlayerUpgrade: Failed to invoke upgrade action for upgrade \"{UpgradeId}\" on player \"{arg}\". {arg2}"); } } } public class REPOLibItemUpgrade : MonoBehaviour { [SerializeField] private string _upgradeId; private ItemToggle _itemToggle; public string UpgradeId => _upgradeId; private void Start() { _itemToggle = ((Component)this).GetComponent<ItemToggle>(); } public void Upgrade() { if ((Object)(object)_itemToggle == (Object)null) { Logger.LogError("REPOLibItemUpgrade: Failed to upgrade \"" + UpgradeId + "\". ItemToggle is null."); return; } int playerTogglePhotonID = _itemToggle.playerTogglePhotonID; PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(playerTogglePhotonID); if ((Object)(object)val == (Object)null) { Logger.LogError($"REPOLibItemUpgrade: Failed to upgrade \"{UpgradeId}\". Could not find PlayerAvatar from ItemToggle's playerTogglePhotonID {playerTogglePhotonID}."); } else if (val.isLocal) { if (!Upgrades.TryGetUpgrade(UpgradeId, out PlayerUpgrade playerUpgrade)) { Logger.LogError("REPOLibItemUpgrade: Failed to upgrade \"" + UpgradeId + "\". Could not find PlayerUpgrade from UpgradeId."); } else { playerUpgrade.AddLevel(val); } } } } 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) { string name2 = name; GameObject val = ((IEnumerable<GameObject>)GetValuables()).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name.Equals(name2, StringComparison.OrdinalIgnoreCase))); return ((val != null) ? val.GetComponent<ValuableObject>() : null) ?? 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) { string name2 = name; GameObject val = GetValuables().SortByStringLength((GameObject x) => ((Object)x).name, ListExtensions.StringSortMode.Shortest).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name.Contains(name2, StringComparison.OrdinalIgnoreCase))); return ((val != null) ? val.GetComponent<ValuableObject>() : null) ?? 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 { internal static class AudioSourceExtensions { public static void FixAudioMixerGroup(this AudioSource audioSource) { audioSource.FixAudioMixerGroup(((Component)audioSource).gameObject); } public static void FixAudioMixerGroup(this AudioSource audioSource, GameObject rootObject) { if ((Object)(object)audioSource == (Object)null) { return; } string text = ((!((Object)(object)rootObject == (Object)(object)((Component)audioSource).gameObject)) ? (((Object)rootObject).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 + "\""); } } internal 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; } } internal 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))); } } internal 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(na
plugins/REPOZoomyEyes.dll
Decompiled 9 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; using ZoomyEyes.Config; using ZoomyEyes.Controllers; using ZoomyEyes.Patches; using ZoomyEyes.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("REPOZoomyEyes")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("REPOZoomyEyes")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ca40feb7-1f42-46cf-818f-e3cd22d1b372")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ZoomyEyes { [BepInPlugin("ZoomyEyes", "ZoomyEyes", "1.1.0")] public class ZoomyEyesPlugin : BaseUnityPlugin { public enum ZoomState { Default, ZoomedIn, ZoomedOut } public class SoundTransition { public AudioClip Clip; public float Pitch; } public const string PLUGIN_GUID = "ZoomyEyes"; public const string PLUGIN_NAME = "ZoomyEyes"; public const string PLUGIN_VERSION = "1.1.0"; public static ZoomyEyesPlugin Instance; private readonly Harmony harmony = new Harmony("ZoomyEyes"); internal static ManualLogSource Log; public const float TRANSITION_SPEED = 5f; public const float EASING_DURATION = 0.3f; public const float ZOOM_IN_PITCH = 1.2f; public const float ZOOM_OUT_PITCH = 0.8f; public const bool ENABLE_SCROLL_WHEEL = true; public const float SCROLL_NETWORK_THROTTLE = 0.1f; public const float SCROLL_SMOOTHING_FACTOR = 0.3f; public static Dictionary<string, float> lastKnownFieldValues = new Dictionary<string, float>(); public static ConfigEntry<KeyCode> ZoomKey; public static ConfigEntry<bool> EnableDebugLogging; public static ConfigEntry<bool> InvertPupilZoom; public static ConfigEntry<bool> EnableSounds; public static ConfigEntry<float> SoundVolume; public static ConfigEntry<float> DefaultNormalPupilSize; public static AudioClip DefaultZoomSound; public static AudioClip DefaultUnZoomSound; public static ConfigEntry<float> DefaultPupilSize; public static ConfigEntry<float> ZoomedInPupilSize; public static ConfigEntry<float> ZoomedOutPupilSize; public static ConfigEntry<float> DefaultZoomFOVMultiplier; public static ConfigEntry<float> ZoomedInFOVMultiplier; public static ConfigEntry<float> ZoomedOutFOVMultiplier; internal static List<Camera> playerCameras = new List<Camera>(); public static Dictionary<(ZoomState from, ZoomState to), SoundTransition> SoundTransitions = new Dictionary<(ZoomState, ZoomState), SoundTransition>(); public static float NORMAL_PUPIL_SIZE => DefaultNormalPupilSize.Value; private void Awake() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } Log = ((BaseUnityPlugin)this).Logger; ZoomKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ZoomKey", (KeyCode)122, "Key to zoom eyes and FOV"); InvertPupilZoom = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "InvertPupilZoom", true, "If disabled, pupils will grow larger when zoomed out and smaller when zoomed in"); DefaultNormalPupilSize = ((BaseUnityPlugin)this).Config.Bind<float>("General", "NormalPupilSize", 1f, new ConfigDescription("Default pupil size when not zooming (1.0 is game default)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 3f), Array.Empty<object>())); EnableSounds = ((BaseUnityPlugin)this).Config.Bind<bool>("Sound", "EnableSounds", true, "Enable zoom sound effects"); SoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Sound", "SoundVolume", 0.5f, new ConfigDescription("Volume for zoom sound effects (0.0-1.0)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); DefaultPupilSize = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom Levels", "DefaultPupilSize", 2f, new ConfigDescription("Default pupil size when the zoom key is pressed", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.6f, 2.4f), Array.Empty<object>())); ZoomedInPupilSize = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom Levels", "ZoomedInPupilSize", 0.2f, new ConfigDescription("Pupil size when zoomed in (scroll up)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 0.5f), Array.Empty<object>())); ZoomedOutPupilSize = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom Levels", "ZoomedOutPupilSize", 3f, new ConfigDescription("Pupil size when zoomed out (scroll down)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2.5f, 4f), Array.Empty<object>())); DefaultZoomFOVMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom Levels", "DefaultZoomFOVMultiplier", 0.8f, new ConfigDescription("Default FOV multiplier when the zoom key is pressed", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.6f, 1f), Array.Empty<object>())); ZoomedInFOVMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom Levels", "ZoomedInFOVMultiplier", 0.5f, new ConfigDescription("FOV multiplier when zoomed in", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 0.7f), Array.Empty<object>())); ZoomedOutFOVMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom Levels", "ZoomedOutFOVMultiplier", 1.4f, new ConfigDescription("FOV multiplier when zoomed out", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.2f, 1.8f), Array.Empty<object>())); EnableDebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "EnableDebugLogging", false, "Enable additional debug logging"); Log.LogInfo((object)"Plugin ZoomyEyes is loading..."); InitializeSoundTransitions(); LoadAudioFiles(); harmony.PatchAll(); Log.LogInfo((object)"Plugin ZoomyEyes is loaded!"); if (InvertPupilZoom.Value) { Log.LogInfo((object)"Pupil zoom inversion is enabled - pupils will dilate when zoomed in and contract when zoomed out"); } Log.LogInfo((object)$"Default normal pupil size set to: {DefaultNormalPupilSize.Value}"); DefaultNormalPupilSize.SettingChanged += delegate { ApplyNormalPupilSizeToAll(); Log.LogInfo((object)$"Normal pupil size changed to: {DefaultNormalPupilSize.Value}"); }; } private void InitializeSoundTransitions() { SoundTransitions[(ZoomState.Default, ZoomState.ZoomedIn)] = new SoundTransition { Clip = DefaultZoomSound, Pitch = 1.4f }; SoundTransitions[(ZoomState.ZoomedIn, ZoomState.Default)] = new SoundTransition { Clip = DefaultUnZoomSound, Pitch = 0.8f }; SoundTransitions[(ZoomState.Default, ZoomState.ZoomedOut)] = new SoundTransition { Clip = DefaultUnZoomSound, Pitch = 0.6f }; SoundTransitions[(ZoomState.ZoomedOut, ZoomState.Default)] = new SoundTransition { Clip = DefaultZoomSound, Pitch = 1.2f }; } public static void LogMenuPageColorText(MenuPageColor menuPage) { //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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_013f: 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_0229: Unknown result type (might be due to invalid IL or missing references) try { TextMeshProUGUI[] componentsInChildren = ((Component)menuPage).GetComponentsInChildren<TextMeshProUGUI>(true); Log.LogInfo((object)$"Found {componentsInChildren.Length} TextMeshProUGUI components in MenuPageColor menu"); TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val in array) { if ((Object)(object)val != (Object)null) { string gameObjectPath = GetGameObjectPath(((TMP_Text)val).transform); Color color = ((Graphic)val).color; Log.LogInfo((object)("Text '" + ((Object)((Component)val).gameObject).name + "' at path '" + gameObjectPath + "':")); Log.LogInfo((object)(" Content: \"" + ((TMP_Text)val).text + "\"")); Log.LogInfo((object)$" Color: R={color.r:F2}, G={color.g:F2}, B={color.b:F2}, A={color.a:F2}"); Log.LogInfo((object)$" Font Size: {((TMP_Text)val).fontSize}"); Log.LogInfo((object)$" Font Style: {((TMP_Text)val).fontStyle}"); Log.LogInfo((object)$" Alignment: {((TMP_Text)val).alignment}"); ManualLogSource log = Log; TMP_FontAsset font = ((TMP_Text)val).font; log.LogInfo((object)(" Font: " + (((font != null) ? ((Object)font).name : null) ?? "null"))); Log.LogInfo((object)$" Enable Auto Sizing: {((TMP_Text)val).enableAutoSizing}"); if (((TMP_Text)val).text.Contains("Color")) { Log.LogInfo((object)" ** This appears to be the 'Select Color' text **"); ManualLogSource log2 = Log; Material material = ((Graphic)val).material; log2.LogInfo((object)(" Material: " + (((material != null) ? ((Object)material).name : null) ?? "null"))); Log.LogInfo((object)$" Margin: {((TMP_Text)val).margin}"); Log.LogInfo((object)$" Character Spacing: {((TMP_Text)val).characterSpacing}"); Log.LogInfo((object)$" Word Spacing: {((TMP_Text)val).wordSpacing}"); Log.LogInfo((object)$" Line Spacing: {((TMP_Text)val).lineSpacing}"); Log.LogInfo((object)$" Paragraph Spacing: {((TMP_Text)val).paragraphSpacing}"); } } } } catch (Exception ex) { Log.LogError((object)("Error inspecting menu text: " + ex.Message)); } } private static string GetGameObjectPath(Transform transform) { string text = ((Object)transform).name; Transform parent = transform.parent; while ((Object)(object)parent != (Object)null) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } private void LoadAudioFiles() { try { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "DefaultZoomSound.wav"); if (File.Exists(text)) { DefaultZoomSound = LoadWavFileAsAudioClip(text, "DefaultZoomSound"); Log.LogInfo((object)"Loaded DefaultZoomSound.wav successfully"); } else { Log.LogWarning((object)("Could not find DefaultZoomSound.wav at path: " + text)); Log.LogWarning((object)"Place the sound file in your BepInEx/plugins/ZoomyEyes folder"); } string text2 = Path.Combine(directoryName, "DefaultUnZoomSound.wav"); if (File.Exists(text2)) { DefaultUnZoomSound = LoadWavFileAsAudioClip(text2, "DefaultUnZoomSound"); Log.LogInfo((object)"Loaded DefaultUnZoomSound.wav successfully"); } else { Log.LogWarning((object)("Could not find DefaultUnZoomSound.wav at path: " + text2)); Log.LogWarning((object)"Place the sound file in your BepInEx/plugins/ZoomyEyes folder"); if ((Object)(object)DefaultZoomSound != (Object)null) { Log.LogInfo((object)"Using DefaultZoomSound.wav as a fallback for unzoom sound"); DefaultUnZoomSound = DefaultZoomSound; } } InitializeSoundTransitions(); } catch (Exception ex) { Log.LogError((object)("Error loading audio files: " + ex.Message)); } } private AudioClip LoadWavFileAsAudioClip(string filePath, string clipName) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 try { string text = "file://" + filePath; UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)20); UnityWebRequestAsyncOperation val = audioClip.SendWebRequest(); while (!((AsyncOperation)val).isDone) { Thread.Sleep(10); } if ((int)audioClip.result != 1) { Log.LogError((object)("Error loading audio file: " + audioClip.error)); return null; } AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip); ((Object)content).name = clipName; return content; } catch (Exception ex) { Log.LogError((object)("Error loading WAV file " + filePath + ": " + ex.Message)); return null; } } public static bool IsInMainMenu() { if ((Object)(object)RunManager.instance == (Object)null) { return true; } return (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelMainMenu; } public static void DebugLog(string message) { if (EnableDebugLogging.Value) { Log.LogInfo((object)("[DEBUG] " + message)); } } public static SoundTransition GetSoundTransition(ZoomState fromState, ZoomState toState) { if (SoundTransitions.TryGetValue((fromState, toState), out var value)) { return value; } bool flag = IsZoomingIn(fromState, toState); return new SoundTransition { Clip = (flag ? DefaultZoomSound : DefaultUnZoomSound), Pitch = (flag ? 1.2f : 0.8f) }; } public static bool IsZoomingIn(ZoomState fromState, ZoomState toState) { if (fromState == ZoomState.ZoomedOut && toState == ZoomState.Default) { return true; } if (fromState == ZoomState.Default && toState == ZoomState.ZoomedIn) { return true; } return false; } public static void PlaySoundAtPosition(AudioClip clip, Vector3 position, float pitch = 1f, float volume = 1f) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (!EnableSounds.Value || (Object)(object)clip == (Object)null) { return; } try { GameObject val = new GameObject("TempAudio"); val.transform.position = position; AudioSource val2 = val.AddComponent<AudioSource>(); val2.clip = clip; val2.volume = volume * SoundVolume.Value; val2.pitch = pitch; val2.spatialBlend = 1f; val2.minDistance = 1f; val2.maxDistance = 15f; val2.rolloffMode = (AudioRolloffMode)1; val2.Play(); Object.Destroy((Object)(object)val, clip.length / pitch + 0.1f); DebugLog($"Playing sound {((Object)clip).name} at position {position} with pitch {pitch}"); } catch (Exception ex) { Log.LogError((object)("Error playing sound: " + ex.Message)); } } public static void ApplyNormalPupilSizeToAll() { try { if (IsInMainMenu()) { return; } List<PlayerAvatar> list = SemiFunc.PlayerGetAll(); foreach (PlayerAvatar item in list) { if ((Object)(object)item.photonView != (Object)null) { int viewID = item.photonView.ViewID; if (item.photonView.IsMine) { PupilStateManager.SetDefaultSize(viewID, DefaultNormalPupilSize.Value); } } } PupilStateManager.UpdateMenuAvatarPupils(); DebugLog($"Applied normal pupil size to all players: {DefaultNormalPupilSize.Value}"); } catch (Exception ex) { Log.LogError((object)("Error applying normal pupil size: " + ex.Message)); } } } } namespace ZoomyEyes.UI { public class SliderValueHandler : MonoBehaviour { [CompilerGenerated] private sealed class <DelayedDiagnostics>d__4 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public SliderValueHandler <>4__this; private float <configValue>5__1; private float <normalizedValue>5__2; private Transform <barText>5__3; private TextMeshProUGUI <textComponent>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedDiagnostics>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <barText>5__3 = null; <textComponent>5__4 = null; <>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 //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>4__this.slider != (Object)null) { <configValue>5__1 = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; <normalizedValue>5__2 = <>4__this.NormalizedPupilSizeToSliderValue(<configValue>5__1); ZoomyEyesPlugin.DebugLog($"DEBUG: After delay - Original slider value would be {PupilSliderConfig.PupilSizeToSliderValue(<configValue>5__1):F1}"); ZoomyEyesPlugin.DebugLog($"DEBUG: After delay - Trying normalized value (0-1): {<normalizedValue>5__2:F3}"); <>4__this.slider.SetBar(<normalizedValue>5__2); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 2; return true; } break; case 2: <>1__state = -1; <barText>5__3 = ((Component)<>4__this.slider).transform.Find("Bar Text"); if ((Object)(object)<barText>5__3 != (Object)null) { <textComponent>5__4 = ((Component)<barText>5__3).GetComponent<TextMeshProUGUI>(); if ((Object)(object)<textComponent>5__4 != (Object)null) { ZoomyEyesPlugin.DebugLog("DEBUG: After setting normalized value - Text shows: " + ((TMP_Text)<textComponent>5__4).text); } <textComponent>5__4 = null; } <barText>5__3 = null; break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private MenuSlider slider; private bool initialized = false; private float lastSetValue = -1f; public void Initialize(MenuSlider slider) { this.slider = slider; initialized = true; RefreshSliderPosition(); ((MonoBehaviour)this).StartCoroutine(DelayedDiagnostics()); } [IteratorStateMachine(typeof(<DelayedDiagnostics>d__4))] private IEnumerator DelayedDiagnostics() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedDiagnostics>d__4(0) { <>4__this = this }; } private float NormalizedPupilSizeToSliderValue(float pupilSize) { float num = PupilSliderConfig.MaxPupilSize - PupilSliderConfig.MinPupilSize; return (pupilSize - PupilSliderConfig.MinPupilSize) / num; } public void RefreshSliderPosition() { if (initialized && !((Object)(object)slider == (Object)null)) { float value = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; float num = NormalizedPupilSizeToSliderValue(value); if (Mathf.Abs(num - lastSetValue) > 0.01f) { slider.SetBar(num); lastSetValue = num; ZoomyEyesPlugin.DebugLog($"Updated slider position to normalized value: {num:F3} (pupil size: {value:F2})"); } } } private void OnEnable() { RefreshSliderPosition(); } } public class SliderReinitializer : MonoBehaviour { public string elementName = ""; public MenuSlider menuSlider; public float startValue; public void Start() { try { if (!((Object)(object)menuSlider != (Object)null)) { return; } menuSlider.elementName = elementName; Transform val = ((Component)this).transform.Find("Element Name"); if ((Object)(object)val != (Object)null) { TextMeshProUGUI component = ((Component)val).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).SetText(elementName, true); } } ((Object)((Component)this).gameObject).name = "Slider - " + elementName; if (elementName == "Pupil Size") { float value = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; float num = PupilSliderConfig.MaxPupilSize - PupilSliderConfig.MinPupilSize; startValue = (value - PupilSliderConfig.MinPupilSize) / num; ZoomyEyesPlugin.DebugLog($"Initializing slider with config value {value:F2} -> normalized position {startValue:F3}"); float num2 = PupilSliderConfig.SliderValueToPupilSize(startValue); ZoomyEyesPlugin.DefaultNormalPupilSize.Value = num2; ZoomyEyesPlugin.DebugLog($"Updated pupil size config during initialization: {num2:F2}"); } menuSlider.SetBar(startValue); if (!(elementName == "Pupil Size")) { return; } Transform val2 = ((Component)this).transform.Find("Bar Text"); if ((Object)(object)val2 != (Object)null) { TextMeshProUGUI component2 = ((Component)val2).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component2 != (Object)null) { PupilSizeTextUpdater pupilSizeTextUpdater = ((Component)this).gameObject.AddComponent<PupilSizeTextUpdater>(); pupilSizeTextUpdater.Initialize(component2); ZoomyEyesPlugin.Log.LogInfo((object)"Added text updater in SliderReinitializer"); } } PupilStateManager.UpdateMenuAvatarPupils(); } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error in SliderReinitializer.Start: " + ex.Message)); } } } public class PupilSizeTextUpdater : MonoBehaviour { [CompilerGenerated] private sealed class <ApplyInitialValueWithDelay>d__9 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PupilSizeTextUpdater <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyInitialValueWithDelay>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>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; PupilStateManager.UpdateMenuAvatarPupils(); ZoomyEyesPlugin.DebugLog("Applied initial pupil size after delay"); 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 <ApplyPendingUpdate>d__12 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PupilSizeTextUpdater <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ApplyPendingUpdate>d__12(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.dragEndDelay); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.pendingPupilSize >= 0f) { <>4__this.RequestPupilSizeUpdate(<>4__this.pendingPupilSize); <>4__this.pendingPupilSize = -1f; } <>4__this.pendingUpdateCoroutine = null; 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 TextMeshProUGUI mainTextComponent; private TextMeshProUGUI maskedTextComponent; private string lastSetText = ""; private float lastUpdateTime = 0f; private float updateDelay = 0.1f; private float dragEndDelay = 0.3f; private float pendingPupilSize = -1f; private Coroutine pendingUpdateCoroutine = null; public void Initialize(TextMeshProUGUI mainText) { mainTextComponent = mainText; Transform val = ((Component)this).transform.Find("MaskedText"); if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf) { Transform val2 = val.Find("Bar Text (1)"); if ((Object)(object)val2 != (Object)null) { maskedTextComponent = ((Component)val2).GetComponent<TextMeshProUGUI>(); } } ((MonoBehaviour)this).StartCoroutine(ApplyInitialValueWithDelay()); } [IteratorStateMachine(typeof(<ApplyInitialValueWithDelay>d__9))] private IEnumerator ApplyInitialValueWithDelay() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyInitialValueWithDelay>d__9(0) { <>4__this = this }; } private void Update() { try { UpdateTextIfPercentage(mainTextComponent); UpdateTextIfPercentage(maskedTextComponent); } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error in PupilSizeTextUpdater: " + ex.Message)); Object.Destroy((Object)(object)this); } } private void UpdateTextIfPercentage(TextMeshProUGUI textComponent) { if ((Object)(object)textComponent == (Object)null) { return; } string text = ((TMP_Text)textComponent).text; if (!text.EndsWith("%") || !float.TryParse(text.TrimEnd(new char[1] { '%' }), out var result)) { return; } float sliderValue = result / 100f; float num = PupilSliderConfig.SliderValueToPupilSize(sliderValue); string text3 = (((TMP_Text)textComponent).text = PupilSliderConfig.FormatPupilSizeText(num)); if (text3 != lastSetText) { lastSetText = text3; ZoomyEyesPlugin.DefaultNormalPupilSize.Value = num; pendingPupilSize = num; float time = Time.time; if (time - lastUpdateTime >= updateDelay) { lastUpdateTime = time; RequestPupilSizeUpdate(num); } if (pendingUpdateCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(pendingUpdateCoroutine); } pendingUpdateCoroutine = ((MonoBehaviour)this).StartCoroutine(ApplyPendingUpdate()); ZoomyEyesPlugin.DebugLog("Updated slider text in Update: " + text3); } } [IteratorStateMachine(typeof(<ApplyPendingUpdate>d__12))] private IEnumerator ApplyPendingUpdate() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ApplyPendingUpdate>d__12(0) { <>4__this = this }; } private void RequestPupilSizeUpdate(float pupilSize) { ZoomyEyesPlugin.DefaultNormalPupilSize.Value = pupilSize; PupilStateManager.ApplyNormalPupilSizeToAll(); PupilStateManager.UpdateMenuAvatarPupils(); } } } namespace ZoomyEyes.Patches { [HarmonyPatch(typeof(CameraZoom))] internal class CameraZoomPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void CapturePlayerCameras(CameraZoom __instance) { try { if (__instance.cams == null) { return; } ZoomyEyesPlugin.Log.LogInfo((object)$"Found {__instance.cams.Count} cameras in CameraZoom"); foreach (Camera cam in __instance.cams) { if ((Object)(object)cam != (Object)null && !ZoomyEyesPlugin.playerCameras.Contains(cam)) { ZoomyEyesPlugin.playerCameras.Add(cam); ZoomyEyesPlugin.Log.LogInfo((object)("Added camera: " + ((Object)cam).name + " to tracking list")); } } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error capturing cameras: " + ex.Message)); } } } [HarmonyPatch(typeof(MenuPageColor))] internal class MenuPageColorPatch { public static MenuSlider PupilSizeSlider; private static bool sliderAdded; [HarmonyPatch("Start")] [HarmonyPostfix] private static void AddPupilSizeSlider(MenuPageColor __instance) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = null; foreach (MenuPages menuPage2 in MenuManager.instance.menuPages) { GameObject menuPage = menuPage2.menuPage; if (((Object)menuPage).name == "Menu Page Settings Audio") { Transform val2 = menuPage.transform.Find("Menu Scroll Box"); Transform val3 = ((val2 != null) ? val2.Find("Mask") : null); Transform val4 = ((val3 != null) ? val3.Find("Scroller") : null); Transform val5 = ((val4 != null) ? val4.Find("Slider - Master volume") : null); if ((Object)(object)val5 != (Object)null) { val = ((Component)val5).gameObject; break; } } } if ((Object)(object)val != (Object)null) { PupilSizeSlider = CreatePupilSizeSlider(val, ((Component)__instance).transform, PupilSliderConfig.SliderPosition, PupilSliderConfig.SliderName); ((Object)((Component)PupilSizeSlider).gameObject).name = "Slider - Pupil Size"; AddCustomSliderListener(PupilSizeSlider); sliderAdded = true; ZoomyEyesPlugin.Log.LogInfo((object)"Added pupil size slider to color menu"); } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error adding pupil size slider to color menu: " + ex.Message)); } } private static void AddCustomSliderListener(MenuSlider slider) { try { SliderValueHandler sliderValueHandler = ((Component)slider).gameObject.AddComponent<SliderValueHandler>(); sliderValueHandler.Initialize(slider); ZoomyEyesPlugin.DebugLog("Added custom slider value handler"); } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error adding slider value handler: " + ex.Message)); } } private static MenuSlider CreatePupilSizeSlider(GameObject sliderPrefab, Transform parentTransform, Vector3 position, string elementName) { //IL_000f: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(sliderPrefab, parentTransform); val.transform.position = position; Transform val2 = val.transform.Find("MaskedText"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(true); Transform val3 = val2.Find("Bar Text (1)"); if ((Object)(object)val3 != (Object)null) { TextMeshProUGUI component = ((Component)val3).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = new Color(0f, 0f, 0f); } } } Transform obj = val.transform.Find("SliderBG"); Transform val4 = ((obj != null) ? obj.Find("RawImage (2)") : null); if ((Object)(object)val4 != (Object)null) { ((Component)val4).gameObject.SetActive(false); } Transform obj2 = val.transform.Find("SliderBG"); Transform val5 = ((obj2 != null) ? obj2.Find("RawImage (3)") : null); if ((Object)(object)val5 != (Object)null) { ((Graphic)((Component)val5).GetComponent<RawImage>()).color = PupilSliderConfig.SliderBackgroundColor; } Transform val6 = val.transform.Find("Bar"); if ((Object)(object)val6 != (Object)null) { Transform val7 = val6.Find("RawImage"); if ((Object)(object)val7 != (Object)null) { ((Graphic)((Component)val7).GetComponent<RawImage>()).color = PupilSliderConfig.SliderBarColor; } } MenuSlider component2 = val.GetComponent<MenuSlider>(); if ((Object)(object)component2 != (Object)null) { component2.pointerSegmentJump = 1; component2.buttonSegmentJump = 1; } MenuSetting component3 = val.GetComponent<MenuSetting>(); if ((Object)(object)component3 != (Object)null) { Object.Destroy((Object)(object)component3); } MenuSettingElement component4 = val.GetComponent<MenuSettingElement>(); if ((Object)(object)component4 != (Object)null) { Object.Destroy((Object)(object)component4); } SliderReinitializer sliderReinitializer = val.AddComponent<SliderReinitializer>(); sliderReinitializer.menuSlider = component2; sliderReinitializer.elementName = elementName; float value = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; ZoomyEyesPlugin.DebugLog(string.Format(arg1: sliderReinitializer.startValue = PupilSliderConfig.PupilSizeToSliderValue(value), format: "Created slider with initial value {0:F2} -> slider position {1:F1}", arg0: value)); return component2; } } [HarmonyPatch(typeof(MenuSlider), "SetBar")] internal class MenuSliderSetBarPatch { [HarmonyPostfix] private static void UpdatePupilSizeText(MenuSlider __instance, float value) { try { if (!(__instance.elementName == "Pupil Size")) { return; } float num = PupilSliderConfig.SliderValueToPupilSize(value); string text = PupilSliderConfig.FormatPupilSizeText(num); Transform val = ((Component)__instance).transform.Find("Bar Text"); if ((Object)(object)val != (Object)null) { TextMeshProUGUI component = ((Component)val).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = text; } } Transform val2 = ((Component)__instance).transform.Find("MaskedText"); if ((Object)(object)val2 != (Object)null && ((Component)val2).gameObject.activeSelf) { Transform val3 = val2.Find("Bar Text (1)"); if ((Object)(object)val3 != (Object)null) { TextMeshProUGUI component2 = ((Component)val3).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component2 != (Object)null) { ((TMP_Text)component2).text = text; } } } if (value > 0.01f && Mathf.Abs(num - ZoomyEyesPlugin.DefaultNormalPupilSize.Value) > 0.01f) { ZoomyEyesPlugin.DefaultNormalPupilSize.Value = num; PlayerAvatar val4 = FindLocalPlayer(); if ((Object)(object)val4 != (Object)null && (Object)(object)val4.photonView != (Object)null) { int viewID = val4.photonView.ViewID; PupilStateManager.SetDefaultSize(viewID, num); } ZoomyEyesPlugin.DebugLog($"Pupil size updated from slider SetBar: {value:F1}% -> {num:F2}"); } ZoomyEyesPlugin.DebugLog("Updated slider text to: " + text); } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error updating slider text: " + ex.Message)); } } private static PlayerAvatar FindLocalPlayer() { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)val.photonView != (Object)null && val.photonView.IsMine) { return val; } } return null; } } [HarmonyPatch(typeof(MenuPageColor), "ConfirmButton")] internal class MenuPageConfirmButtonPatch { [HarmonyPostfix] private static void SavePupilSizeToConfig(MenuPageColor __instance) { try { float value = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; ZoomyEyesPlugin.Log.LogInfo((object)$"Current pupil size before saving: {value}"); if ((Object)(object)MenuPageColorPatch.PupilSizeSlider != (Object)null) { Transform val = ((Component)MenuPageColorPatch.PupilSizeSlider).transform.Find("Bar Text"); if ((Object)(object)val != (Object)null) { TextMeshProUGUI component = ((Component)val).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ZoomyEyesPlugin.Log.LogInfo((object)("Displayed slider text: " + ((TMP_Text)component).text)); } } } ((BaseUnityPlugin)ZoomyEyesPlugin.Instance).Config.Save(); ZoomyEyesPlugin.Log.LogInfo((object)$"Saved pupil size configuration: {ZoomyEyesPlugin.DefaultNormalPupilSize.Value}"); PlayerAvatar val2 = FindLocalPlayer(); if ((Object)(object)val2 != (Object)null) { int viewID = val2.photonView.ViewID; PupilStateManager.SetDefaultSize(viewID, ZoomyEyesPlugin.DefaultNormalPupilSize.Value); } if ((Object)(object)val2 != (Object)null && (Object)(object)val2.photonView != (Object)null && PhotonNetwork.IsConnected && PhotonNetwork.InRoom) { val2.photonView.RPC("SyncDefaultPupilSize", (RpcTarget)1, new object[1] { ZoomyEyesPlugin.DefaultNormalPupilSize.Value }); PlayerAvatarPatch.lastSentDefaultPupilSize = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; ZoomyEyesPlugin.Log.LogInfo((object)"Sent pupil size update after save"); } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error saving pupil size config: " + ex.Message)); } } private static PlayerAvatar FindLocalPlayer() { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)val.photonView != (Object)null && val.photonView.IsMine) { return val; } } return null; } } [HarmonyPatch(typeof(MenuManager))] [HarmonyPatch("Start")] internal class MenuStartPatch { [HarmonyPostfix] private static void Postfix() { try { ZoomyEyesPlugin.DebugLog("Menu manager started, updating menu avatar pupils"); EyeZoomController.UpdateMenuAvatarPupils(); } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error updating menu pupils on menu manager start: " + ex.Message)); } } } [HarmonyPatch(typeof(PlayerAvatar))] internal class PlayerAvatarPatch { [HarmonyPatch(typeof(TruckScreenText))] [HarmonyPatch("ArrowPointAtGoalLogic")] internal class DefaultPupilSizeMaintainer { private static PlayerAvatar cachedLocalPlayer = null; private static float lastNetworkUpdateTime = 0f; private static float networkUpdateInterval = 0.5f; [HarmonyPostfix] private static void MaintainDefaultPupilSizes() { if (ZoomyEyesPlugin.IsInMainMenu()) { return; } if ((Object)(object)cachedLocalPlayer == (Object)null || (Object)(object)cachedLocalPlayer.photonView == (Object)null || !cachedLocalPlayer.photonView.IsMine) { List<PlayerAvatar> list = SemiFunc.PlayerGetAll(); foreach (PlayerAvatar item in list) { if ((Object)(object)item.photonView != (Object)null && item.photonView.IsMine) { cachedLocalPlayer = item; break; } } if ((Object)(object)cachedLocalPlayer == (Object)null) { return; } } int viewID = cachedLocalPlayer.photonView.ViewID; float value = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; PupilStateManager.SetDefaultSize(viewID, value); if (Time.time - lastNetworkUpdateTime >= networkUpdateInterval) { if (Mathf.Abs(value - lastSentDefaultPupilSize) > 0.01f && PhotonNetwork.IsConnected && PhotonNetwork.InRoom) { cachedLocalPlayer.photonView.RPC("SyncDefaultPupilSize", (RpcTarget)1, new object[1] { value }); lastSentDefaultPupilSize = value; ZoomyEyesPlugin.DebugLog($"Sent updated default pupil size: {value:F2}"); } lastNetworkUpdateTime = Time.time; } } } [HarmonyPatch(typeof(PlayerAvatar), "Update")] private class PupilSizeMonitorPatch { private static FieldInfo multiplierTargetField = AccessTools.Field(typeof(PlayerAvatar), "overridePupilSizeMultiplierTarget"); private static FieldInfo timerField = AccessTools.Field(typeof(PlayerAvatar), "overridePupilSizeTimer"); [HarmonyPostfix] private static void Postfix(PlayerAvatar __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.playerAvatarVisuals == (Object)null || (Object)(object)__instance.playerAvatarVisuals.playerEyes == (Object)null) { return; } try { int playerID = -1; if ((Object)(object)__instance.photonView != (Object)null) { playerID = __instance.photonView.ViewID; } if (!(multiplierTargetField == null) && !(timerField == null)) { float multiplier = (float)multiplierTargetField.GetValue(__instance); float num = (float)timerField.GetValue(__instance); PupilStateManager.SetOverrideState(playerID, num > 0f, multiplier); } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error in pupil size monitor: " + ex.Message)); } } } [HarmonyPatch(typeof(TruckScreenText), "ArrowPointAtGoalLogic")] internal class CentralPupilController { [HarmonyPostfix] private static void ApplyPupilSizes() { if (ZoomyEyesPlugin.IsInMainMenu()) { return; } try { PupilStateManager.ApplyPupilSizesToAllPlayers(); } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error in centralized pupil controller: " + ex.Message)); } } } private static bool wasZKeyPressed = false; private static float lastLogTime = 0f; private static readonly float LOG_INTERVAL = 0.5f; public static float lastSentDefaultPupilSize = 0f; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AddEyeZoomController(PlayerAvatar __instance) { try { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.playerAvatarVisuals == (Object)null) && !((Object)(object)__instance.playerAvatarVisuals.playerEyes == (Object)null)) { if ((Object)(object)((Component)__instance).GetComponent<EyeZoomController>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<EyeZoomController>(); ZoomyEyesPlugin.Log.LogInfo((object)("Added EyeZoomController to player: " + ((Object)__instance).name)); } if ((Object)(object)__instance.photonView != (Object)null) { int viewID = __instance.photonView.ViewID; bool isMine = __instance.photonView.IsMine; PupilStateManager.SetPlayerEyes(viewID, __instance.playerAvatarVisuals.playerEyes, isMine); } } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error in AddEyeZoomController: " + ex.Message)); } } [HarmonyPatch("Update")] [HarmonyPostfix] private static void HandleEyeZoom(PlayerAvatar __instance) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) try { if (ZoomyEyesPlugin.IsInMainMenu() || (Object)(object)__instance == (Object)null) { return; } PhotonView component = ((Component)__instance).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null || !component.IsMine) { return; } EyeZoomController component2 = ((Component)__instance).GetComponent<EyeZoomController>(); if ((Object)(object)component2 == (Object)null) { return; } bool key = Input.GetKey(ZoomyEyesPlugin.ZoomKey.Value); if (key != wasZKeyPressed) { float currentFOV = component2.GetCurrentFOV(); wasZKeyPressed = key; component2.SetZooming(key, currentFOV); if (PhotonNetwork.IsConnected && PhotonNetwork.InRoom) { try { component.RPC("SyncEyeZoom", (RpcTarget)1, new object[7] { key, (int)component2.CurrentZoomState, ZoomyEyesPlugin.InvertPupilZoom.Value, ZoomyEyesPlugin.DefaultPupilSize.Value, ZoomyEyesPlugin.ZoomedInPupilSize.Value, ZoomyEyesPlugin.ZoomedOutPupilSize.Value, ZoomyEyesPlugin.DefaultNormalPupilSize.Value }); } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error sending RPC: " + ex.Message)); } } } if (key) { component2.HandleScrollInput(); } } catch (Exception ex2) { ZoomyEyesPlugin.Log.LogError((object)("Error in HandleEyeZoom: " + ex2.Message)); } } } } namespace ZoomyEyes.Controllers { public class EyeZoomController : MonoBehaviour { private PlayerEyes playerEyes; private PhotonView photonView; private float originalPupilSize = 1f; private bool isInFOVTransition = false; private float fovStartValue; private float fovEndValue; private float fovTransitionStartTime; private float fovTransitionDuration; private float currentFOVValue; private float trueCurrentFOV = 70f; private bool hasZoomedOnce = false; private ZoomyEyesPlugin.ZoomState currentZoomState = ZoomyEyesPlugin.ZoomState.Default; private ZoomyEyesPlugin.ZoomState targetZoomState = ZoomyEyesPlugin.ZoomState.Default; private ZoomyEyesPlugin.ZoomState previousZoomState = ZoomyEyesPlugin.ZoomState.Default; private float lastScrollNetworkUpdate = 0f; private bool zoomStateChanged = false; private float lastFOVChangeTime = 0f; private float minimumFOVChangeInterval = 0.1f; private float lastFOVLogTime = 0f; private const float FOV_LOG_INTERVAL = 5f; private float lastFOVCheckTime = 0f; private const float FOV_CHECK_INTERVAL = 0.5f; public bool isZooming { get; private set; } = false; public ZoomyEyesPlugin.ZoomState CurrentZoomState => currentZoomState; private void Awake() { try { PlayerAvatar component = ((Component)this).GetComponent<PlayerAvatar>(); if ((Object)(object)component != (Object)null && (Object)(object)component.playerAvatarVisuals != (Object)null) { playerEyes = component.playerAvatarVisuals.playerEyes; photonView = ((Component)this).GetComponent<PhotonView>(); originalPupilSize = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; if ((Object)(object)photonView != (Object)null) { int viewID = photonView.ViewID; bool isMine = photonView.IsMine; PupilStateManager.SetPlayerEyes(viewID, playerEyes, isMine); } string text = "unknown"; if ((Object)(object)photonView != (Object)null && photonView.Owner != null) { text = photonView.Owner.NickName ?? photonView.Owner.ActorNumber.ToString(); } ZoomyEyesPlugin.Log.LogInfo((object)("EyeZoomController initialized for player: " + ((Object)component).name + " (ID: " + text + ")")); ZoomyEyesPlugin.DebugLog($"Original pupil size captured: {originalPupilSize}"); } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error in EyeZoomController.Awake: " + ex.Message)); } } private void Update() { try { if (ZoomyEyesPlugin.IsInMainMenu()) { return; } if (Time.time - lastFOVCheckTime > 0.5f) { if (!isZooming && !isInFOVTransition && (Object)(object)photonView != (Object)null && photonView.IsMine) { float actualDefaultFOV = GetActualDefaultFOV(); if (Mathf.Abs(trueCurrentFOV - actualDefaultFOV) > 0.5f) { trueCurrentFOV = actualDefaultFOV; ZoomyEyesPlugin.DebugLog($"Detected FOV change: updated tracked FOV to {actualDefaultFOV:F1}"); } } lastFOVCheckTime = Time.time; } if (isZooming && currentZoomState != targetZoomState) { previousZoomState = currentZoomState; currentZoomState = targetZoomState; if ((Object)(object)photonView != (Object)null && photonView.IsMine) { float targetFOV = CalculateFOVFromZoomState(currentZoomState); StartFOVTransition(targetFOV); PlayZoomStateChangeSound(previousZoomState, currentZoomState); } if ((Object)(object)photonView != (Object)null) { int viewID = photonView.ViewID; PupilStateManager.SetZoomState(viewID, zooming: true, currentZoomState, photonView.IsMine); } ZoomyEyesPlugin.DebugLog($"Transitioned to zoom state: {currentZoomState}"); } if (zoomStateChanged && Time.time - lastScrollNetworkUpdate >= 0.1f) { if ((Object)(object)photonView != (Object)null && photonView.IsMine && isZooming) { SyncZoomState(); } zoomStateChanged = false; } if ((Object)(object)photonView != (Object)null && photonView.IsMine) { if (isInFOVTransition) { float num = Time.time - fovTransitionStartTime; float num2 = Mathf.Clamp01(num / fovTransitionDuration); float num3 = Mathf.SmoothStep(0f, 1f, num2); currentFOVValue = Mathf.Lerp(fovStartValue, fovEndValue, num3); trueCurrentFOV = currentFOVValue; ApplyFOVToAllCameras(currentFOVValue); if (num2 >= 1f) { isInFOVTransition = false; currentFOVValue = fovEndValue; trueCurrentFOV = fovEndValue; ZoomyEyesPlugin.DebugLog($"FOV transition completed: {fovEndValue:F1}"); } } else if (isZooming) { MaintainFOV(); } } if (Time.time - lastFOVLogTime > 5f && isZooming && (Object)(object)photonView != (Object)null && photonView.IsMine) { float cameraDirectFOV = GetCameraDirectFOV(); ZoomyEyesPlugin.DebugLog($"Current FOV: {cameraDirectFOV:F1}, Target FOV: {trueCurrentFOV:F1}"); lastFOVLogTime = Time.time; } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error in EyeZoomController.Update: " + ex.Message)); } } public void OnExternalFovChange(float newDefaultFov) { if (!isZooming) { trueCurrentFOV = newDefaultFov; ApplyFOVToAllCameras(newDefaultFov); ZoomyEyesPlugin.DebugLog($"Updated FOV to match external change: {newDefaultFov}"); return; } float num = CalculateFOVFromZoomState(currentZoomState); if (isInFOVTransition) { fovEndValue = num; ZoomyEyesPlugin.DebugLog($"Updated FOV transition target to: {num}"); } else { StartFOVTransition(num); ZoomyEyesPlugin.DebugLog($"Starting new FOV transition due to external FOV change: {num}"); } } public static void UpdateMenuAvatarPupils() { PupilStateManager.UpdateMenuAvatarPupils(); } private void MaintainFOV() { if (!(trueCurrentFOV <= 0f)) { ApplyFOVToAllCameras(trueCurrentFOV); } } private void ApplyFOVToAllCameras(float fov) { foreach (Camera playerCamera in ZoomyEyesPlugin.playerCameras) { if ((Object)(object)playerCamera != (Object)null) { playerCamera.fieldOfView = fov; } } if ((Object)(object)Camera.main != (Object)null && !ZoomyEyesPlugin.playerCameras.Contains(Camera.main)) { Camera.main.fieldOfView = fov; } } private float GetActualDefaultFOV() { if ((Object)(object)CameraZoom.Instance != (Object)null) { return CameraZoom.Instance.playerZoomDefault; } foreach (Camera playerCamera in ZoomyEyesPlugin.playerCameras) { if ((Object)(object)playerCamera != (Object)null && ((Behaviour)playerCamera).enabled) { return playerCamera.fieldOfView; } } if ((Object)(object)Camera.main != (Object)null) { return Camera.main.fieldOfView; } return 70f; } private void StartFOVTransition(float targetFOV) { if (Time.time - lastFOVChangeTime < minimumFOVChangeInterval) { ZoomyEyesPlugin.DebugLog("Ignoring FOV change request - too soon after previous change"); } else { if (Mathf.Approximately(targetFOV, fovEndValue) && isInFOVTransition) { return; } float num = (isInFOVTransition ? currentFOVValue : trueCurrentFOV); float cameraDirectFOV = GetCameraDirectFOV(); if (Mathf.Abs(num - cameraDirectFOV) > 1f) { ZoomyEyesPlugin.DebugLog($"FOV discrepancy - tracked: {num:F1}, camera: {cameraDirectFOV:F1}"); } if (Mathf.Abs(num - targetFOV) < 0.5f) { trueCurrentFOV = targetFOV; currentFOVValue = targetFOV; return; } if (isInFOVTransition) { float num2 = Time.time - fovTransitionStartTime; float num3 = Mathf.Clamp01(num2 / fovTransitionDuration); ZoomyEyesPlugin.DebugLog($"Interrupting FOV transition at progress {num3:P0}, current FOV: {num:F1}"); } fovStartValue = num; fovEndValue = targetFOV; fovTransitionStartTime = Time.time; fovTransitionDuration = 0.3f; isInFOVTransition = true; lastFOVChangeTime = Time.time; trueCurrentFOV = num; currentFOVValue = num; ZoomyEyesPlugin.DebugLog($"Starting FOV transition: {fovStartValue:F1} -> {fovEndValue:F1} over {fovTransitionDuration:F2}s"); } } private float GetCameraDirectFOV() { foreach (Camera playerCamera in ZoomyEyesPlugin.playerCameras) { if ((Object)(object)playerCamera != (Object)null && ((Behaviour)playerCamera).enabled) { return playerCamera.fieldOfView; } } if ((Object)(object)Camera.main != (Object)null) { return Camera.main.fieldOfView; } return GetActualDefaultFOV(); } public float GetCurrentFOV() { if (isInFOVTransition || isZooming) { return trueCurrentFOV; } return GetActualDefaultFOV(); } private void PlayZoomStateChangeSound(ZoomyEyesPlugin.ZoomState fromState, ZoomyEyesPlugin.ZoomState toState) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) if (!ZoomyEyesPlugin.EnableSounds.Value) { return; } try { ZoomyEyesPlugin.SoundTransition soundTransition = ZoomyEyesPlugin.GetSoundTransition(fromState, toState); if ((Object)(object)soundTransition.Clip == (Object)null) { return; } Vector3 position = ((Component)this).transform.position + new Vector3(0f, 1.7f, 0f); if ((Object)(object)photonView != (Object)null && photonView.IsMine) { if ((Object)(object)Camera.main != (Object)null) { position = ((Component)Camera.main).transform.position; } else if (ZoomyEyesPlugin.playerCameras.Count > 0) { foreach (Camera playerCamera in ZoomyEyesPlugin.playerCameras) { if ((Object)(object)playerCamera != (Object)null && ((Behaviour)playerCamera).enabled) { position = ((Component)playerCamera).transform.position; break; } } } } ZoomyEyesPlugin.PlaySoundAtPosition(soundTransition.Clip, position, soundTransition.Pitch, ZoomyEyesPlugin.SoundVolume.Value); ZoomyEyesPlugin.DebugLog($"Playing transition sound from {fromState} to {toState} with pitch {soundTransition.Pitch:F1}"); } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error playing zoom sound: " + ex.Message)); } } public void SetZoomingWithState(bool zooming, ZoomyEyesPlugin.ZoomState state, bool inverted) { if (ZoomyEyesPlugin.IsInMainMenu() || ((Object)(object)photonView != (Object)null && photonView.IsMine)) { return; } previousZoomState = currentZoomState; if (zooming && !isZooming) { if (!hasZoomedOnce) { originalPupilSize = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; trueCurrentFOV = GetActualDefaultFOV(); hasZoomedOnce = true; ZoomyEyesPlugin.DebugLog($"Remote player inversion preference: {inverted}"); PlaySoundForRemotePlayer(activating: true); } } else if (!zooming && isZooming) { PlaySoundForRemotePlayer(activating: false); state = ZoomyEyesPlugin.ZoomState.Default; } isZooming = zooming; if (zooming) { if (currentZoomState != state) { PlayZoomStateChangeSound(currentZoomState, state); } currentZoomState = state; targetZoomState = state; } if ((Object)(object)photonView != (Object)null) { int viewID = photonView.ViewID; PupilStateManager.SetZoomState(viewID, isZooming, currentZoomState); } ZoomyEyesPlugin.DebugLog($"Remote player zoom state changed: {isZooming}, state: {currentZoomState}, inversion: {inverted}"); } private void PlaySoundForRemotePlayer(bool activating) { //IL_0041: 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_0082: Unknown result type (might be due to invalid IL or missing references) if (!ZoomyEyesPlugin.EnableSounds.Value) { return; } try { AudioClip val = (activating ? ZoomyEyesPlugin.DefaultZoomSound : ZoomyEyesPlugin.DefaultUnZoomSound); if (!((Object)(object)val == (Object)null)) { Vector3 position = ((Component)this).transform.position + new Vector3(0f, 1.7f, 0f); float pitch = (activating ? 1f : 1.1f); float volume = (activating ? 1f : 0.4f); ZoomyEyesPlugin.PlaySoundAtPosition(val, position, pitch, volume); ZoomyEyesPlugin.DebugLog("Playing remote player " + (activating ? "activation" : "deactivation") + " sound"); } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error playing remote player sound: " + ex.Message)); } } public void HandleScrollInput() { if (ZoomyEyesPlugin.IsInMainMenu()) { return; } float axis = Input.GetAxis("Mouse ScrollWheel"); if (Mathf.Approximately(axis, 0f)) { return; } if (Time.time - lastFOVChangeTime < minimumFOVChangeInterval) { ZoomyEyesPlugin.DebugLog("Ignoring scroll input - too soon after previous change"); return; } ZoomyEyesPlugin.ZoomState zoomState = ((axis > 0f) ? ((targetZoomState == ZoomyEyesPlugin.ZoomState.Default) ? ZoomyEyesPlugin.ZoomState.ZoomedIn : ((targetZoomState != ZoomyEyesPlugin.ZoomState.ZoomedOut) ? targetZoomState : ZoomyEyesPlugin.ZoomState.Default)) : ((targetZoomState == ZoomyEyesPlugin.ZoomState.Default) ? ZoomyEyesPlugin.ZoomState.ZoomedOut : ((targetZoomState != ZoomyEyesPlugin.ZoomState.ZoomedIn) ? targetZoomState : ZoomyEyesPlugin.ZoomState.Default))); if (zoomState != targetZoomState) { targetZoomState = zoomState; zoomStateChanged = true; ZoomyEyesPlugin.DebugLog($"Switching to zoom state: {targetZoomState}"); if ((Object)(object)photonView != (Object)null && photonView.IsMine) { int viewID = photonView.ViewID; PupilStateManager.SetZoomState(viewID, zooming: true, zoomState, isLocalPlayer: true); } UpdateMenuAvatarPupils(); } } private float CalculateFOVFromZoomState(ZoomyEyesPlugin.ZoomState state) { float actualDefaultFOV = GetActualDefaultFOV(); return state switch { ZoomyEyesPlugin.ZoomState.ZoomedIn => actualDefaultFOV * ZoomyEyesPlugin.ZoomedInFOVMultiplier.Value, ZoomyEyesPlugin.ZoomState.ZoomedOut => actualDefaultFOV * ZoomyEyesPlugin.ZoomedOutFOVMultiplier.Value, _ => actualDefaultFOV * ZoomyEyesPlugin.DefaultZoomFOVMultiplier.Value, }; } private void SyncZoomState() { if (!isZooming || (Object)(object)photonView == (Object)null || !photonView.IsMine || !PhotonNetwork.IsConnected || !PhotonNetwork.InRoom) { return; } try { bool value = ZoomyEyesPlugin.InvertPupilZoom.Value; photonView.RPC("SyncEyeZoom", (RpcTarget)1, new object[7] { true, (int)currentZoomState, value, ZoomyEyesPlugin.DefaultPupilSize.Value, ZoomyEyesPlugin.ZoomedInPupilSize.Value, ZoomyEyesPlugin.ZoomedOutPupilSize.Value, ZoomyEyesPlugin.DefaultNormalPupilSize.Value }); ZoomyEyesPlugin.DebugLog($"Sent zoom state {currentZoomState} with inversion {value} to other players"); lastScrollNetworkUpdate = Time.time; } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error sending zoom state: " + ex.Message)); } } public void SetZooming(bool zooming, float currentFOV) { //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_023c: 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) if (ZoomyEyesPlugin.IsInMainMenu()) { return; } if (zooming && !isZooming) { bool value = ZoomyEyesPlugin.InvertPupilZoom.Value; if (!hasZoomedOnce) { originalPupilSize = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; trueCurrentFOV = currentFOV; hasZoomedOnce = true; ZoomyEyesPlugin.DebugLog("**** DEBUG: ZOOM ACTIVATED ****"); ZoomyEyesPlugin.DebugLog($"Using configured pupil size: {originalPupilSize}"); ZoomyEyesPlugin.DebugLog($"Current default FOV: {GetActualDefaultFOV()}"); ZoomyEyesPlugin.DebugLog($"Pupil inversion setting: {value}"); ZoomyEyesPlugin.DebugLog("--- Camera Details ---"); foreach (Camera playerCamera in ZoomyEyesPlugin.playerCameras) { if ((Object)(object)playerCamera != (Object)null) { ZoomyEyesPlugin.DebugLog($"Camera '{((Object)playerCamera).name}': FOV = {playerCamera.fieldOfView}, Enabled = {((Behaviour)playerCamera).enabled}"); } } ZoomyEyesPlugin.DebugLog("---------------------"); } bool flag = Input.GetAxis("Mouse ScrollWheel") > 0f; bool flag2 = Input.GetAxis("Mouse ScrollWheel") < 0f; if (flag) { previousZoomState = currentZoomState; currentZoomState = ZoomyEyesPlugin.ZoomState.ZoomedIn; targetZoomState = ZoomyEyesPlugin.ZoomState.ZoomedIn; } else if (flag2) { previousZoomState = currentZoomState; currentZoomState = ZoomyEyesPlugin.ZoomState.ZoomedOut; targetZoomState = ZoomyEyesPlugin.ZoomState.ZoomedOut; } else { previousZoomState = currentZoomState; currentZoomState = ZoomyEyesPlugin.ZoomState.Default; targetZoomState = ZoomyEyesPlugin.ZoomState.Default; } if ((Object)(object)photonView != (Object)null && photonView.IsMine && (Object)(object)ZoomyEyesPlugin.DefaultZoomSound != (Object)null) { Vector3 position = (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.position : (((Component)this).transform.position + Vector3.up * 1.7f)); ZoomyEyesPlugin.PlaySoundAtPosition(ZoomyEyesPlugin.DefaultZoomSound, position); } } else if (!zooming && isZooming) { if ((Object)(object)photonView != (Object)null && photonView.IsMine && (Object)(object)ZoomyEyesPlugin.DefaultUnZoomSound != (Object)null) { Vector3 position2 = (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.position : (((Component)this).transform.position + Vector3.up * 1.7f)); ZoomyEyesPlugin.PlaySoundAtPosition(ZoomyEyesPlugin.DefaultUnZoomSound, position2, 1.1f, 0.4f); } ZoomyEyesPlugin.DebugLog($"Returning to normal pupil size: {originalPupilSize}"); } isZooming = zooming; if ((Object)(object)photonView != (Object)null) { int viewID = photonView.ViewID; PupilStateManager.SetZoomState(viewID, isZooming, currentZoomState, photonView.IsMine); } if (!((Object)(object)photonView != (Object)null) || !photonView.IsMine) { return; } float num; if (zooming) { num = CalculateFOVFromZoomState(currentZoomState); } else { num = GetActualDefaultFOV(); float num2 = trueCurrentFOV; if (!isInFOVTransition || !Mathf.Approximately(fovEndValue, num)) { fovStartValue = num2; fovEndValue = num; fovTransitionStartTime = Time.time; fovTransitionDuration = 0.3f; isInFOVTransition = true; lastFOVChangeTime = Time.time; currentFOVValue = num2; ZoomyEyesPlugin.DebugLog($"Z released - Starting FOV transition to current default: {fovStartValue:F1} -> {fovEndValue:F1}"); UpdateMenuAvatarPupils(); return; } } StartFOVTransition(num); UpdateMenuAvatarPupils(); } [PunRPC] public void SyncEyeZoom(bool zooming, int stateValue, bool inverted, float defaultPupilSize, float zoomedInPupilSize, float zoomedOutPupilSize, float normalPupilSize) { try { if (!ZoomyEyesPlugin.IsInMainMenu()) { string text = "unknown"; if ((Object)(object)photonView != (Object)null && photonView.Owner != null) { text = photonView.Owner.NickName ?? photonView.Owner.ActorNumber.ToString(); } ZoomyEyesPlugin.DebugLog($"Received zoom state: {zooming}, state: {(ZoomyEyesPlugin.ZoomState)stateValue}, inversion: {inverted} from player: {text}"); ZoomyEyesPlugin.DebugLog($"Received pupil sizes: default={defaultPupilSize:F2}, in={zoomedInPupilSize:F2}, out={zoomedOutPupilSize:F2}"); if ((Object)(object)photonView != (Object)null) { int viewID = photonView.ViewID; PupilStateManager.SetRemotePupilSizes(viewID, defaultPupilSize, zoomedInPupilSize, zoomedOutPupilSize, normalPupilSize, inverted); } SetZoomingWithState(zooming, (ZoomyEyesPlugin.ZoomState)stateValue, inverted); } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error in SyncEyeZoom: " + ex.Message)); } } [PunRPC] public void SyncDefaultPupilSize(float newSize) { try { if (!ZoomyEyesPlugin.IsInMainMenu()) { ZoomyEyesPlugin.DebugLog($"Received default pupil size update: {newSize:F2}"); if ((Object)(object)photonView != (Object)null) { int viewID = photonView.ViewID; PupilStateManager.SetDefaultSize(viewID, newSize); } } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error in SyncDefaultPupilSize: " + ex.Message)); } } } public static class PupilStateManager { public class PlayerPupilState { public float DefaultPupilSize = 1f; public bool HasActiveOverride = false; public float OverrideMultiplier = 1f; public float OverrideStartTime = 0f; public bool IsZooming = false; public ZoomyEyesPlugin.ZoomState CurrentZoomState = ZoomyEyesPlugin.ZoomState.Default; public bool IsLocalPlayer = false; public bool UseInvertedPupils = false; public bool IsTransitioning = false; public float TransitionStartTime = 0f; public float TransitionStartSize = 1f; public float TransitionTargetSize = 1f; public TransitionType CurrentTransition = TransitionType.None; public float TransitionDuration = 0.3f; public float CurrentPupilSize = 1f; public PlayerEyes PlayerEyes; public int TransitionsStarted = 0; public int TransitionsCompleted = 0; public float LongestTransitionTime = 0f; } public enum TransitionType { None, ToOverride, FromOverride, ToZoom, FromZoom, DefaultSizeChange } [CompilerGenerated] private sealed class <DelayedStartTransition>d__31 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public MonoBehaviour menuBehavior; public PlayerEyes menuEyes; public FieldInfo pupilSizeField; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedStartTransition>d__31(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; menuTransitionCoroutine = menuBehavior.StartCoroutine(TransitionMenuPupils(menuEyes, pupilSizeField)); 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 <TransitionMenuPupils>d__33 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PlayerEyes menuEyes; public FieldInfo pupilSizeField; private float <startSize>5__1; private float <targetSize>5__2; private float <startTime>5__3; private float <duration>5__4; private float <initialProgress>5__5; private float <beforeValue>5__6; private float <afterValue>5__7; private float <progress>5__8; private float <easedProgress>5__9; private float <lastSize>5__10; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TransitionMenuPupils>d__33(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; isMenuTransitioning = true; <startSize>5__1 = menuCurrentPupilSize; <targetSize>5__2 = menuTargetPupilSize; <startTime>5__3 = Time.time; <duration>5__4 = 0.3f; <initialProgress>5__5 = 0.1f; menuCurrentPupilSize = Mathf.Lerp(<startSize>5__1, <targetSize>5__2, <initialProgress>5__5); if ((Object)(object)menuEyes != (Object)null && pupilSizeField != null) { <beforeValue>5__6 = (float)pupilSizeField.GetValue(menuEyes); pupilSizeField.SetValue(menuEyes, menuCurrentPupilSize); <afterValue>5__7 = (float)pupilSizeField.GetValue(menuEyes); ZoomyEyesPlugin.DebugLog($"Transition INITIAL step: {<beforeValue>5__6:F2} → {<afterValue>5__7:F2} (target: {<targetSize>5__2:F2})"); if (Mathf.Abs(<afterValue>5__7 - menuCurrentPupilSize) > 0.01f) { ZoomyEyesPlugin.Log.LogError((object)$"Initial step didn't apply correctly! Expected: {menuCurrentPupilSize:F2}, Got: {<afterValue>5__7:F2}"); pupilSizeField.SetValue(menuEyes, menuCurrentPupilSize); } } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; } if (Time.time - <startTime>5__3 < <duration>5__4) { if ((Object)(object)menuEyes == (Object)null || (Object)(object)PlayerAvatarMenu.instance == (Object)null) { isMenuTransitioning = false; menuTransitionCoroutine = null; return false; } <progress>5__8 = (Time.time - <startTime>5__3) / <duration>5__4; <easedProgress>5__9 = Mathf.SmoothStep(0f, 1f, <progress>5__8); <lastSize>5__10 = menuCurrentPupilSize; menuCurrentPupilSize = Mathf.Lerp(<startSize>5__1, <targetSize>5__2, <easedProgress>5__9); if (Mathf.Abs(<lastSize>5__10 - menuCurrentPupilSize) > 0.01f) { ZoomyEyesPlugin.DebugLog($"Transition progress {<progress>5__8:P0}: {<lastSize>5__10:F2} → {menuCurrentPupilSize:F2}"); } pupilSizeField.SetValue(menuEyes, menuCurrentPupilSize); if (Mathf.Abs(<targetSize>5__2 - menuTargetPupilSize) > 0.01f) { ZoomyEyesPlugin.DebugLog($"Transition target changed during transition: {<targetSize>5__2:F2} → {menuTargetPupilSize:F2}"); <startSize>5__1 = menuCurrentPupilSize; <targetSize>5__2 = menuTargetPupilSize; <startTime>5__3 = Time.time; } <>2__current = null; <>1__state = 2; return true; } if ((Object)(object)menuEyes != (Object)null) { menuCurrentPupilSize = menuTargetPupilSize; pupilSizeField.SetValue(menuEyes, menuCurrentPupilSize); ZoomyEyesPlugin.DebugLog($"Transition COMPLETE: final size = {menuCurrentPupilSize:F2}"); } isMenuTransitioning = false; menuTransitionCoroutine = null; 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 Dictionary<int, PlayerPupilState> playerStates; private static FieldInfo pupilSizeMultiplierField; private static PlayerAvatarVisuals menuAvatarVisuals; private static Coroutine menuTransitionCoroutine; private static bool isMenuTransitioning; private static float menuCurrentPupilSize; private static float menuTargetPupilSize; public const float MENU_TRANSITION_DURATION = 0.3f; public const float ZOOM_TRANSITION_DURATION = 0.3f; public const float OVERRIDE_TRANSITION_DURATION = 3f; private const float LOG_THROTTLE_PERIOD = 0.5f; private static Dictionary<int, float> lastTransitionLogTime; private static Dictionary<int, string> playerNames; static PupilStateManager() { playerStates = new Dictionary<int, PlayerPupilState>(); isMenuTransitioning = false; menuCurrentPupilSize = 1f; menuTargetPupilSize = 1f; lastTransitionLogTime = new Dictionary<int, float>(); playerNames = new Dictionary<int, string>(); pupilSizeMultiplierField = AccessTools.Field(typeof(PlayerEyes), "pupilSizeMultiplier"); if (pupilSizeMultiplierField == null) { ZoomyEyesPlugin.Log.LogError((object)"Failed to access pupilSizeMultiplier field via reflection!"); } } private static void LogDebug(int playerID, string message, bool forceLog = false) { if (ZoomyEyesPlugin.EnableDebugLogging.Value || forceLog) { string text = ""; text = ((!playerNames.TryGetValue(playerID, out var value)) ? $"[Player {playerID}] " : ("[" + value + "] ")); ZoomyEyesPlugin.Log.LogInfo((object)(text + message)); } } public static PlayerPupilState GetPlayerState(int playerID) { if (!playerStates.ContainsKey(playerID)) { playerStates[playerID] = new PlayerPupilState(); playerStates[playerID].DefaultPupilSize = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; playerStates[playerID].CurrentPupilSize = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; LogDebug(playerID, $"Created new pupil state tracker with size {playerStates[playerID].DefaultPupilSize:F2}", forceLog: true); } return playerStates[playerID]; } public static void SetOverrideState(int playerID, bool active, float multiplier) { PlayerPupilState playerState = GetPlayerState(playerID); if (active != playerState.HasActiveOverride) { if (active) { playerState.HasActiveOverride = true; playerState.OverrideMultiplier = multiplier; playerState.OverrideStartTime = Time.time; LogDebug(playerID, $"OVERRIDE ACTIVATED: multiplier={multiplier:F2}"); StartTransition(playerID, TransitionType.ToOverride); } else { LogDebug(playerID, $"OVERRIDE DEACTIVATED (after {Time.time - playerState.OverrideStartTime:F1}s)"); playerState.HasActiveOverride = false; StartTransition(playerID, TransitionType.FromOverride); } } else if (active && Math.Abs(multiplier - playerState.OverrideMultiplier) > 0.01f) { LogDebug(playerID, $"Override multiplier changed: {playerState.OverrideMultiplier:F2} → {multiplier:F2}"); playerState.OverrideMultiplier = multiplier; float num = CalculateTargetSize(playerID); if (playerState.IsTransitioning) { LogDebug(playerID, $" - Updating ongoing transition target: {playerState.TransitionTargetSize:F2} → {num:F2}"); playerState.TransitionTargetSize = num; } else { StartTransition(playerID, TransitionType.ToOverride); } } } public static void SetPlayerEyes(int playerID, PlayerEyes eyes, bool isLocalPlayer = false) { if (!((Object)(object)eyes == (Object)null)) { PlayerPupilState playerState = GetPlayerState(playerID); playerState.PlayerEyes = eyes; playerState.IsLocalPlayer = isLocalPlayer; if (isLocalPlayer) { playerState.UseInvertedPupils = ZoomyEyesPlugin.InvertPupilZoom.Value; } if (pupilSizeMultiplierField != null) { float num = (float)pupilSizeMultiplierField.GetValue(eyes); LogDebug(playerID, $"Set player eyes reference with current size: {num:F2}"); } ApplyPupilSize(playerID); } } public static void SetRemotePupilSizes(int playerID, float defaultSize, float zoomedInSize, float zoomedOutSize, float normalSize, bool invertedPupils) { LogDebug(playerID, $"Setting remote pupil sizes: default={defaultSize:F2}, in={zoomedInSize:F2}, out={zoomedOutSize:F2}, normal={normalSize:F2}"); ZoomyEyesPlugin.lastKnownFieldValues[$"player_{playerID}_defaultPupilSize"] = defaultSize; ZoomyEyesPlugin.lastKnownFieldValues[$"player_{playerID}_zoomedInPupilSize"] = zoomedInSize; ZoomyEyesPlugin.lastKnownFieldValues[$"player_{playerID}_zoomedOutPupilSize"] = zoomedOutSize; ZoomyEyesPlugin.lastKnownFieldValues[$"player_{playerID}_normalPupilSize"] = normalSize; PlayerPupilState playerState = GetPlayerState(playerID); playerState.UseInvertedPupils = invertedPupils; SetDefaultSize(playerID, normalSize); } private static float GetRemotePlayerSize(int playerID, string key, float defaultValue) { string key2 = $"player_{playerID}_{key}"; if (ZoomyEyesPlugin.lastKnownFieldValues.TryGetValue(key2, out var value)) { return value; } return defaultValue; } public static void SetZoomState(int playerID, bool zooming, ZoomyEyesPlugin.ZoomState zoomState, bool isLocalPlayer = false) { PlayerPupilState playerState = GetPlayerState(playerID); playerState.IsLocalPlayer = isLocalPlayer; if (zooming != playerState.IsZooming || (zooming && zoomState != playerState.CurrentZoomState)) { bool isZooming = playerState.IsZooming; ZoomyEyesPlugin.ZoomState currentZoomState = playerState.CurrentZoomState; playerState.IsZooming = zooming; playerState.CurrentZoomState = zoomState; if (!isZooming && zooming) { LogDebug(playerID, $"ZOOM ACTIVATED: state={zoomState}"); StartTransition(playerID, TransitionType.ToZoom); UpdateMenuAvatarPupils(); } else if (isZooming && !zooming) { LogDebug(playerID, "ZOOM DEACTIVATED"); StartTransition(playerID, TransitionType.FromZoom); UpdateMenuAvatarPupils(); } else if (isZooming && zooming && currentZoomState != zoomState) { LogDebug(playerID, $"Zoom state changed: {currentZoomState} → {zoomState}"); StartTransition(playerID, TransitionType.ToZoom); UpdateMenuAvatarPupils(); } } } public static void SetDefaultSize(int playerID, float size) { PlayerPupilState playerState = GetPlayerState(playerID); if (Math.Abs(size - playerState.DefaultPupilSize) > 0.01f) { float defaultPupilSize = playerState.DefaultPupilSize; playerState.DefaultPupilSize = size; if (!playerState.HasActiveOverride && !playerState.IsZooming) { StartTransition(playerID, TransitionType.DefaultSizeChange); LogDebug(playerID, " - Starting transition to new default size"); } else { LogDebug(playerID, $" - Not transitioning (override={playerState.HasActiveOverride}, zooming={playerState.IsZooming})"); } UpdateMenuAvatarPupils(); } } private static void StartTransition(int playerID, TransitionType transitionType) { PlayerPupilState playerState = GetPlayerState(playerID); float num = CalculateTargetSize(playerID); if (Math.Abs(num - playerState.CurrentPupilSize) < 0.01f) { LogDebug(playerID, $" - Skipping transition (already at target size: {num:F2})"); return; } float num2; switch (transitionType) { case TransitionType.ToOverride: case TransitionType.FromOverride: num2 = 3f; break; case TransitionType.ToZoom: case TransitionType.FromZoom: num2 = 0.3f; break; default: num2 = 0.3f; break; } playerState.IsTransitioning = true; playerState.TransitionStartTime = Time.time; playerState.TransitionStartSize = playerState.CurrentPupilSize; playerState.TransitionTargetSize = num; playerState.CurrentTransition = transitionType; playerState.TransitionDuration = num2; playerState.TransitionsStarted++; LogDebug(playerID, $"TRANSITION STARTED: {transitionType} | {playerState.TransitionStartSize:F2} → {num:F2} (duration: {num2:F1}s)"); LogDebug(playerID, $" - Current state: override={playerState.HasActiveOverride}, zooming={playerState.IsZooming}, zoom state={playerState.CurrentZoomState}"); string text = ""; text = (playerState.HasActiveOverride ? $"override active (multiplier={playerState.OverrideMultiplier:F2})" : ((!playerState.IsZooming) ? "default size" : $"zooming (state={playerState.CurrentZoomState})")); LogDebug(playerID, " - Target determination: " + text); } private static float CalculateTargetSize(int playerID) { PlayerPupilState playerState = GetPlayerState(playerID); if (playerState.HasActiveOverride) { return 1f * playerState.OverrideMultiplier; } if (playerState.IsZooming) { if (playerState.UseInvertedPupils) { switch (playerState.CurrentZoomState) { case ZoomyEyesPlugin.ZoomState.ZoomedIn: if (!playerState.IsLocalPlayer) { return GetRemotePlayerSize(playerID, "zoomedOutPupilSize", ZoomyEyesPlugin.ZoomedOutPupilSize.Value); } return ZoomyEyesPlugin.ZoomedOutPupilSize.Value; case ZoomyEyesPlugin.ZoomState.ZoomedOut: if (!playerState.IsLocalPlayer) { return GetRemotePlayerSize(playerID, "zoomedInPupilSize", ZoomyEyesPlugin.ZoomedInPupilSize.Value); } return ZoomyEyesPlugin.ZoomedInPupilSize.Value; default: if (!playerState.IsLocalPlayer) { return GetRemotePlayerSize(playerID, "defaultPupilSize", ZoomyEyesPlugin.DefaultPupilSize.Value); } return ZoomyEyesPlugin.DefaultPupilSize.Value; } } switch (playerState.CurrentZoomState) { case ZoomyEyesPlugin.ZoomState.ZoomedIn: if (!playerState.IsLocalPlayer) { return GetRemotePlayerSize(playerID, "zoomedInPupilSize", ZoomyEyesPlugin.ZoomedInPupilSize.Value); } return ZoomyEyesPlugin.ZoomedInPupilSize.Value; case ZoomyEyesPlugin.ZoomState.ZoomedOut: if (!playerState.IsLocalPlayer) { return GetRemotePlayerSize(playerID, "zoomedOutPupilSize", ZoomyEyesPlugin.ZoomedOutPupilSize.Value); } return ZoomyEyesPlugin.ZoomedOutPupilSize.Value; default: if (!playerState.IsLocalPlayer) { return GetRemotePlayerSize(playerID, "defaultPupilSize", ZoomyEyesPlugin.DefaultPupilSize.Value); } return ZoomyEyesPlugin.DefaultPupilSize.Value; } } return playerState.DefaultPupilSize; } public static float CalculatePupilSize(int playerID) { PlayerPupilState playerState = GetPlayerState(playerID); if (playerState.IsTransitioning) { float num = Time.time - playerState.TransitionStartTime; float num2 = Mathf.Clamp01(num / playerState.TransitionDuration); float num3 = Mathf.SmoothStep(0f, 1f, num2); float num4 = (playerState.CurrentPupilSize = Mathf.Lerp(playerState.TransitionStartSize, playerState.TransitionTargetSize, num3)); if (ZoomyEyesPlugin.EnableDebugLogging.Value) { if (!lastTransitionLogTime.ContainsKey(playerID)) { lastTransitionLogTime[playerID] = 0f; } if (Time.time - lastTransitionLogTime[playerID] > 0.5f) { LogDebug(playerID, $" Transition progress: {num2:P0} | Current size: {num4:F2}"); lastTransitionLogTime[playerID] = Time.time; } } if (num2 >= 1f) { playerState.IsTransitioning = false; playerState.CurrentTransition = TransitionType.None; playerState.TransitionsCompleted++; float num5 = Time.time - playerState.TransitionStartTime; if (num5 > playerState.LongestTransitionTime) { playerState.LongestTransitionTime = num5; } LogDebug(playerID, $"TRANSITION COMPLETE: {playerState.TransitionStartSize:F2} → {playerState.TransitionTargetSize:F2} in {num5:F2}s"); } } else if (!playerState.IsTransitioning) { float num6 = CalculateTargetSize(playerID); if (Math.Abs(num6 - playerState.CurrentPupilSize) > 0.01f) { LogDebug(playerID, $"Pupil size drift detected: {playerState.CurrentPupilSize:F2} vs target {num6:F2}", forceLog: true); StartTransition(playerID, TransitionType.None); } } return playerState.CurrentPupilSize; } public static bool IsPlayerInTransition(int playerID) { return playerStates.ContainsKey(playerID) && playerStates[playerID].IsTransitioning; } public static void ApplyPupilSize(int playerID) { PlayerPupilState playerState = GetPlayerState(playerID); if (!((Object)(object)playerState.PlayerEyes == (Object)null) && !(pupilSizeMultiplierField == null)) { float num = CalculatePupilSize(playerID); pupilSizeMultiplierField.SetValue(playerState.PlayerEyes, num); } } public static void ApplyPupilSizesToAllPlayers() { if (ZoomyEyesPlugin.IsInMainMenu()) { return; } try { foreach (KeyValuePair<int, PlayerPupilState> playerState in playerStates) { int key = playerState.Key; ApplyPupilSize(key); } } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error applying pupil sizes to all players: " + ex.Message)); } } public static void UpdateMenuAvatarPupils() { try { if ((Object)(object)MenuManager.instance == (Object)null) { return; } if ((Object)(object)menuAvatarVisuals == (Object)null || (Object)(object)menuAvatarVisuals.playerEyes == (Object)null) { if (!((Object)(object)PlayerAvatarMenu.instance != (Object)null)) { ZoomyEyesPlugin.DebugLog("PlayerAvatarMenu.instance is null, cannot find menu avatar visuals"); return; } menuAvatarVisuals = ((Component)PlayerAvatarMenu.instance).GetComponentInChildren<PlayerAvatarVisuals>(); ZoomyEyesPlugin.Log.LogInfo((object)("Found menu avatar visuals: " + (((Object)(object)menuAvatarVisuals != (Object)null) ? "yes" : "no"))); } if ((Object)(object)menuAvatarVisuals == (Object)null || (Object)(object)menuAvatarVisuals.playerEyes == (Object)null || pupilSizeMultiplierField == null) { ZoomyEyesPlugin.DebugLog("Cannot update menu avatar pupils: missing references"); return; } float num = (float)pupilSizeMultiplierField.GetValue(menuAvatarVisuals.playerEyes); float currentPupilSizeForMenu = GetCurrentPupilSizeForMenu(); if (ZoomyEyesPlugin.EnableDebugLogging.Value) { FieldInfo field = typeof(PlayerAvatarPatch).GetField("wasZKeyPressed", BindingFlags.Static | BindingFlags.NonPublic); bool flag = false; if (field != null) { flag = (bool)field.GetValue(null); } ZoomyEyesPlugin.DebugLog($"Menu pupil update: wasZKeyPressed={flag}, realSize={num:F2}, targetSize={currentPupilSizeForMenu:F2}, currentMenuTarget={menuTargetPupilSize:F2}"); PlayerAvatar val = FindLocalPlayer(); if ((Object)(object)val != (Object)null) { PhotonView photonView = val.photonView; int num2 = ((photonView != null) ? photonView.ViewID : (-1)); if (num2 >= 0 && playerStates.ContainsKey(num2)) { PlayerPupilState playerPupilState = playerStates[num2]; ZoomyEyesPlugin.DebugLog($" Player state: IsZooming={playerPupilState.IsZooming}, ZoomState={playerPupilState.CurrentZoomState}, CurrentSize={playerPupilState.CurrentPupilSize:F2}"); } } } if (Mathf.Abs(menuTargetPupilSize - currentPupilSizeForMenu) < 0.01f) { if (Mathf.Abs(num - menuTargetPupilSize) > 0.05f && !isMenuTransitioning) { ZoomyEyesPlugin.DebugLog($"Menu avatar pupil was changed externally: {num:F2}, forcing initial step toward {menuTargetPupilSize:F2}"); float num3 = Mathf.Lerp(num, menuTargetPupilSize, 0.2f); pupilSizeMultiplierField.SetValue(menuAvatarVisuals.playerEyes, num3); menuCurrentPupilSize = num3; float num4 = (float)pupilSizeMultiplierField.GetValue(menuAvatarVisuals.playerEyes); if (Mathf.Abs(num4 - num3) > 0.01f) { ZoomyEyesPlugin.Log.LogError((object)$"Initial correction didn't apply! Expected: {num3:F2}, Got: {num4:F2}"); } } return; } float num5 = menuTargetPupilSize; menuTargetPupilSize = currentPupilSizeForMenu; menuCurrentPupilSize = num; if (isMenuTransitioning) { ZoomyEyesPlugin.DebugLog($"Transition already in progress, target updated: {num5:F2} -> {menuTargetPupilSize:F2}"); return; } if ((Object)(object)PlayerAvatarMenu.instance != (Object)null) { MonoBehaviour instance = (MonoBehaviour)(object)PlayerAvatarMenu.instance; if ((Object)(object)instance != (Object)null) { if (menuTransitionCoroutine != null) { instance.StopCoroutine(menuTransitionCoroutine); menuTransitionCoroutine = null; } float num6 = Mathf.Lerp(menuCurrentPupilSize, menuTargetPupilSize, 0.15f); pupilSizeMultiplierField.SetValue(menuAvatarVisuals.playerEyes, num6); menuCurrentPupilSize = num6; instance.StartCoroutine(DelayedStartTransition(instance, menuAvatarVisuals.playerEyes, pupilSizeMultiplierField)); } else { float num7 = Mathf.Lerp(menuCurrentPupilSize, menuTargetPupilSize, 0.2f); pupilSizeMultiplierField.SetValue(menuAvatarVisuals.playerEyes, num7); menuCurrentPupilSize = num7; ZoomyEyesPlugin.DebugLog($"Applied initial step: {menuCurrentPupilSize:F2} (no coroutine available)"); } } else { ZoomyEyesPlugin.DebugLog("Cannot start transition: PlayerAvatarMenu.instance is null"); } ZoomyEyesPlugin.DebugLog($"Updated menu avatar pupil target to: {menuTargetPupilSize:F2}"); } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error updating menu avatar pupils: " + ex.Message)); } } [IteratorStateMachine(typeof(<DelayedStartTransition>d__31))] private static IEnumerator DelayedStartTransition(MonoBehaviour menuBehavior, PlayerEyes menuEyes, FieldInfo pupilSizeField) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedStartTransition>d__31(0) { menuBehavior = menuBehavior, menuEyes = menuEyes, pupilSizeField = pupilSizeField }; } private static float GetCurrentPupilSizeForMenu() { try { FieldInfo field = typeof(PlayerAvatarPatch).GetField("wasZKeyPressed", BindingFlags.Static | BindingFlags.NonPublic); bool flag = false; if (field != null) { flag = (bool)field.GetValue(null); } if (!flag) { ZoomyEyesPlugin.DebugLog($"Menu avatar: not zooming, using normal size: {ZoomyEyesPlugin.DefaultNormalPupilSize.Value:F2}"); return ZoomyEyesPlugin.DefaultNormalPupilSize.Value; } PlayerAvatar val = FindLocalPlayer(); if ((Object)(object)val != (Object)null) { PhotonView photonView = val.photonView; int num = ((photonView != null) ? photonView.ViewID : (-1)); if (num >= 0 && playerStates.ContainsKey(num)) { PlayerPupilState playerPupilState = playerStates[num]; float num2 = (playerPupilState.UseInvertedPupils ? (playerPupilState.CurrentZoomState switch { ZoomyEyesPlugin.ZoomState.ZoomedIn => ZoomyEyesPlugin.ZoomedOutPupilSize.Value, ZoomyEyesPlugin.ZoomState.ZoomedOut => ZoomyEyesPlugin.ZoomedInPupilSize.Value, _ => ZoomyEyesPlugin.DefaultPupilSize.Value, }) : (playerPupilState.CurrentZoomState switch { ZoomyEyesPlugin.ZoomState.ZoomedIn => ZoomyEyesPlugin.ZoomedInPupilSize.Value, ZoomyEyesPlugin.ZoomState.ZoomedOut => ZoomyEyesPlugin.ZoomedOutPupilSize.Value, _ => ZoomyEyesPlugin.DefaultPupilSize.Value, })); ZoomyEyesPlugin.DebugLog($"Menu avatar: zooming with state {playerPupilState.CurrentZoomState}, using size: {num2:F2}"); return num2; } } ZoomyEyesPlugin.DebugLog($"Menu avatar: using default zoom size: {ZoomyEyesPlugin.DefaultPupilSize.Value:F2}"); return ZoomyEyesPlugin.DefaultPupilSize.Value; } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error getting menu pupil size: " + ex.Message)); return ZoomyEyesPlugin.DefaultNormalPupilSize.Value; } } [IteratorStateMachine(typeof(<TransitionMenuPupils>d__33))] private static IEnumerator TransitionMenuPupils(PlayerEyes menuEyes, FieldInfo pupilSizeField) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TransitionMenuPupils>d__33(0) { menuEyes = menuEyes, pupilSizeField = pupilSizeField }; } private static PlayerAvatar FindLocalPlayer() { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)val.photonView != (Object)null && val.photonView.IsMine) { return val; } } return null; } public static void ApplyNormalPupilSizeToAll() { try { if (ZoomyEyesPlugin.IsInMainMenu()) { return; } float value = ZoomyEyesPlugin.DefaultNormalPupilSize.Value; List<PlayerAvatar> list = SemiFunc.PlayerGetAll(); foreach (PlayerAvatar item in list) { if ((Object)(object)item.photonView != (Object)null) { int viewID = item.photonView.ViewID; SetDefaultSize(viewID, value); } } UpdateMenuAvatarPupils(); ZoomyEyesPlugin.DebugLog($"Applied normal pupil size to all players: {value}"); } catch (Exception ex) { ZoomyEyesPlugin.Log.LogError((object)("Error applying normal pupil size: " + ex.Message)); } } public static void LogAllPlayerStates() { ZoomyEyesPlugin.Log.LogInfo((object)"=== PUPIL STATE MANAGER - ALL PLAYER STATES ==="); foreach (KeyValuePair<int, PlayerPupilState> playerState in playerStates) { int key = playerState.Key; PlayerPupilState value = playerState.Value; string text = (playerNames.ContainsKey(key) ? playerNames[key] : $"Player {key}"); ZoomyEyesPlugin.Log.LogInfo((object)(text + ":")); ZoomyEyesPlugin.Log.LogInfo((object)$" Default Size: {value.DefaultPupilSize:F2}"); ZoomyEyesPlugin.Log.LogInfo((object)$" Override: {value.HasActiveOverride} (multiplier: {value.OverrideMultiplier:F2})"); ZoomyEyesPlugin.Log.LogInfo((object)$" Zoom: {value.IsZooming} (state: {value.CurrentZoomState})"); ZoomyEyesPlugin.Log.LogInfo((object)$" Transition: {value.IsTransitioning} (type: {value.CurrentTransition})"); ZoomyEyesPlugin.Log.LogInfo((object)$" Current Size: {value.CurrentPupilSize:F2}"); ZoomyEyesPlugin.Log.LogInfo((object)$" Stats: {value.TransitionsStarted} started, {value.TransitionsCompleted} completed"); ZoomyEyesPlugin.Log.LogInfo((object)$" Longest transition: {value.LongestTransitionTime:F2}s"); } ZoomyEyesPlugin.Log.LogInfo((object)"================================================="); } private static void LogDetailedState(int playerID) { if (!playerStates.ContainsKey(playerID)) { ZoomyEyesPlugin.Log.LogInfo((object)$"[PUPIL DIAGNOSTICS] No state exists for player {playerID}"); return; } PlayerPupilState playerPupilState = playerStates[playerID]; string text = (playerNames.ContainsKey(playerID) ? playerNames[playerID] : $"Player {playerID}"); ZoomyEyesPlugin.Log.LogInfo((object)("=== PUPIL DIAGNOSTICS FOR " + text + " ===")); ZoomyEyesPlugin.Log.LogInfo((object)$"Current pupil size: {playerPupilState.CurrentPupilSize:F2}"); ZoomyEyesPlugin.Log.LogInfo((object)$"Default pupil size: {playerPupilState.DefaultPupilSize:F2}"); ZoomyEyesPlugin.Log.LogInfo((object)$"Is zooming: {playerPupilState.IsZooming}"); ZoomyEyesPlugin.Log.LogInfo((object)$"Zoom state: {playerPupilState.CurrentZoomState}"); ZoomyEyesPlugin.Log.LogInfo((object)$"Has override: {playerPupilState.HasActiveOverride}"); ZoomyEyesPlugin.Log.LogInfo((object)$"Override multiplier: {playerPupilState.OverrideMultiplier:F2}"); ZoomyEyesPlugin.Log.LogInfo((object)$"Is transitioning: {playerPupilState.IsTransitioning}"); if (playerPupilState.IsTransitioning) { float num = Time.time - playerPupilState.TransitionStartTime; float num2 = Mathf.Clamp01(num / playerPupilState.TransitionDuration); ZoomyEyesPlugin.Log.LogInfo((object)$"Transition type: {playerPupilState.CurrentTransition}"); ZoomyEyesPlugin.Log.LogInfo((object)$"Transition start size: {playerPupilState.TransitionStartSize:F2}"); ZoomyEyesPlugin.Log.LogInfo((object)$"Transition target size: {playerPupilState.TransitionTargetSize:F2}"); ZoomyEyesPlugin.Log.LogInfo((object)$"Transition progress: {num2:P0} ({num:F2}s elapsed)"); ZoomyEyesPlugin.Log.LogInfo((object)$"Transition start time: {playerPupilState.TransitionStartTime:F2}"); ZoomyEyesPlugin.Log.LogInfo((object)$"Current time: {Time.time:F2}"); } ZoomyEyesPlugin.Log.LogInfo((object)$"Target calculated size (current priority): {CalculateTargetSize(playerID):F2}"); ZoomyEyesPlugin.Log.LogInfo((object)"==========================================="); } } } namespace ZoomyEyes.Config { public static class PupilSliderConfig { public static Vector3 SliderPosition = new Vector3(445f, 745f, 0f); public static Color SliderBackgroundColor = new Color(0f, 0f, 0f, 0.63f); public static Color SliderBarColor = Color.grey; public static string SliderName = "Pupil Size"; public static float MinPupilSize = 0.2f; public
plugins/SomeEmotesREPO.dll
Decompiled 9 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; 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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("ImGogole")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.4.0")] [assembly: AssemblyInformationalVersion("1.0.4+28906c51394ffff726c4bb8da0cdba07ec3a4e6e")] [assembly: AssemblyProduct("SomeEmotesREPO")] [assembly: AssemblyTitle("SomeEmotesREPO")] [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; } } } [Serializable] public class Preferences { public List<string> farovites = new List<string>(); public KeyCode panelKey = (KeyCode)112; } namespace SomeEmotesREPO { [HarmonyPatch(typeof(PlayerAvatar))] internal class AddEmoteSystemPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerAvatar __instance) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (GameManager.Multiplayer()) { if (Object.op_Implicit((Object)(object)GameManager.instance) && GameManager.instance.connectRandom) { SomeEmotesREPO.Logger.LogWarning((object)"CAUTION ! You are using a mod in a public lobby, people who doesn't have the mod and yourself can have some errors due to compatibility."); } EmoteSystem emoteSystem = ((Component)__instance).GetComponent<EmoteSystem>(); if (!Object.op_Implicit((Object)(object)emoteSystem)) { emoteSystem = ((Component)__instance).gameObject.AddComponent<EmoteSystem>(); } emoteSystem.SetPlayerAvatar(__instance); if (__instance.photonView.IsMine) { SomeEmotesREPO.Logger.LogInfo((object)$"EmoteSystem has been added to the player. Press [{EmoteLoader.PanelKey}] to see the Emote Panel."); } } else { SomeEmotesREPO.Logger.LogInfo((object)"Not in a multiplayer game : ignored."); } } } [HarmonyPatch(typeof(GameDirector))] internal class AddPatchGameDirector { [HarmonyPrefix] [HarmonyPatch("DeathStart")] private static void DeathStart_Prefix() { if (EmoteSystem.Ready && EmoteSystem.Instance.IsEmoting) { EmoteSystem.Instance.StopEmote(); } } } [HarmonyPatch(typeof(PlayerExpression))] internal class AddPatchPlayerExpression { [HarmonyPrefix] [HarmonyPatch("DoExpression")] private static bool DoExpression_Prefix() { return !BlockBecauseEmoteIsPlaying(); } [HarmonyPrefix] [HarmonyPatch("ToggleExpression")] private static bool ToggleExpression_Prefix() { return !BlockBecauseEmoteIsPlaying(); } private static bool BlockBecauseEmoteIsPlaying() { return EmoteSystem.Ready && EmoteSystem.Instance.IsEmoting; } } public static class EmoteBundleLoader { private static AssetBundle emoteBundle; public static AssetBundle Load(string path) { if ((Object)(object)emoteBundle == (Object)null) { emoteBundle = AssetBundle.LoadFromFile(path); if ((Object)(object)emoteBundle == (Object)null) { SomeEmotesREPO.Logger.LogError((object)"EmoteBundle is not found"); } } return emoteBundle; } public static void Unload() { if ((Object)(object)emoteBundle != (Object)null) { emoteBundle.Unload(true); emoteBundle = null; } } public static T LoadAsset<T>(string name) where T : Object { if ((Object)(object)emoteBundle == (Object)null) { return default(T); } name = name.ToLower(); string[] allAssetNames = emoteBundle.GetAllAssetNames(); string[] array = allAssetNames; foreach (string text in array) { if (text.ToLower().EndsWith(name)) { return emoteBundle.LoadAsset<T>(text); } } return default(T); } public static List<string> GetAllAnimNames() { List<string> list = new List<string>(); string[] allAssetNames = emoteBundle.GetAllAssetNames(); foreach (string text in allAssetNames) { if (text.EndsWith(".anim")) { list.Add(text); } } return list; } } public class EmoteLauncher : MonoBehaviour { public Animator animator; public EmoteSystem emoteSystem; public List<string> emoteNames = new List<string>(); private Dictionary<string, AnimationClip> animationDict = new Dictionary<string, AnimationClip>(); private AnimatorOverrideController overrideController; private string overrideKeyName = "Placeholder"; private float initialRot; private Transform targetPlayer; private GameObject visuals; private GameObject spotlight; public SkinnedMeshRenderer leg_R; public SkinnedMeshRenderer leg_L; public SkinnedMeshRenderer body_bot; public SkinnedMeshRenderer body_top_sphere; public SkinnedMeshRenderer arm_L; public SkinnedMeshRenderer arm_R; public SkinnedMeshRenderer health_LED; public SkinnedMeshRenderer health_frame; public SkinnedMeshRenderer health_shadow; public SkinnedMeshRenderer head_bot_sphere; public SkinnedMeshRenderer head_bot_flat; public SkinnedMeshRenderer head_top; public SkinnedMeshRenderer eye_L; public SkinnedMeshRenderer iris_L; public SkinnedMeshRenderer eye_R; public SkinnedMeshRenderer iris_R; public List<string> EmoteNames => emoteNames; public void AddEntry(string name, AnimationClip clip) { animationDict.Add(name, clip); } public void Init(Transform target) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown targetPlayer = target; visuals = ((Component)((Component)this).transform.GetChild(0)).gameObject; spotlight = ((Component)((Component)this).transform.GetChild(1)).gameObject; animator = ((Component)this).GetComponentInChildren<Animator>(); overrideController = new AnimatorOverrideController(animator.runtimeAnimatorController); animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)overrideController; foreach (KeyValuePair<string, AnimationClip> item in animationDict) { emoteNames.Add(item.Key); } InitBones(); InitLight(); visuals.SetActive(false); spotlight.SetActive(false); } private void Update() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)targetPlayer)) { ((Component)this).transform.position = targetPlayer.position; } } private void LateUpdate() { //IL_002d: 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_004d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)emoteSystem) && emoteSystem.IsEmoting) { ((Component)this).transform.eulerAngles = new Vector3(((Component)this).transform.eulerAngles.x, initialRot, ((Component)this).transform.eulerAngles.z); } } public void SetFavorites(List<string> favs) { if (favs != null && favs.Count != 0) { List<string> list = favs.Where(emoteNames.Contains).Distinct().ToList(); if (list.Count != 0) { emoteNames.RemoveAll(list.Contains); emoteNames.InsertRange(0, list); EmoteLoader.Instance.emotesName = new List<string>(emoteNames); int count = Math.Min(8, emoteNames.Count); List<string> favorites = emoteNames.Take(count).ToList(); EmoteLoader.Instance.SetFavorites(favorites); } } } public void SetRotation(float _initialRot) { initialRot = _initialRot; } public bool Animate(string emoteName) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!animationDict.TryGetValue(emoteName, out AnimationClip value)) { return false; } ((Component)animator).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); visuals.SetActive(true); spotlight.SetActive(true); overrideController[overrideKeyName] = value; animator.ResetTrigger("StopEmote"); animator.SetTrigger("TriggerEmote"); return true; } public void StopEmote() { visuals.SetActive(false); spotlight.SetActive(false); animator.SetTrigger("StopEmote"); } private void InitLight() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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_003d: 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) Light val = spotlight.AddComponent<Light>(); ((Component)val).transform.localPosition = Vector3.up * 2.5f; ((Component)val).transform.localEulerAngles = -Vector3.left * 90f; val.type = (LightType)0; val.innerSpotAngle = 35f; val.spotAngle = 40f; val.color = new Color(1f, 0.97f, 0.84f); val.intensity = 1.75f; val.bounceIntensity = 1f; val.range = 5f; val.shadows = (LightShadows)0; val.cullingMask = -1; } private void InitBones() { leg_R = ((Component)FindDeepChild(((Component)this).transform, "leg_R_0")).GetComponent<SkinnedMeshRenderer>(); leg_L = ((Component)FindDeepChild(((Component)this).transform, "leg_L_0")).GetComponent<SkinnedMeshRenderer>(); body_bot = ((Component)FindDeepChild(((Component)this).transform, "body_bot_0")).GetComponent<SkinnedMeshRenderer>(); body_top_sphere = ((Component)FindDeepChild(((Component)this).transform, "body_top_sphere_0")).GetComponent<SkinnedMeshRenderer>(); arm_L = ((Component)FindDeepChild(((Component)this).transform, "arm_L_0")).GetComponent<SkinnedMeshRenderer>(); arm_R = ((Component)FindDeepChild(((Component)this).transform, "arm_R_0")).GetComponent<SkinnedMeshRenderer>(); health_LED = ((Component)FindDeepChild(((Component)this).transform, "health_LED_0")).GetComponent<SkinnedMeshRenderer>(); health_frame = ((Component)FindDeepChild(((Component)this).transform, "health_frame_0")).GetComponent<SkinnedMeshRenderer>(); health_shadow = ((Component)FindDeepChild(((Component)this).transform, "health_shadow_0")).GetComponent<SkinnedMeshRenderer>(); head_bot_sphere = ((Component)FindDeepChild(((Component)this).transform, "head_bot_sphere_0")).GetComponent<SkinnedMeshRenderer>(); head_bot_flat = ((Component)FindDeepChild(((Component)this).transform, "head_bot_flat_0")).GetComponent<SkinnedMeshRenderer>(); head_top = ((Component)FindDeepChild(((Component)this).transform, "head_top_0")).GetComponent<SkinnedMeshRenderer>(); eye_L = ((Component)FindDeepChild(((Component)this).transform, "eye_L_0")).GetComponent<SkinnedMeshRenderer>(); iris_L = ((Component)FindDeepChild(((Component)this).transform, "iris_L_0")).GetComponent<SkinnedMeshRenderer>(); eye_R = ((Component)FindDeepChild(((Component)this).transform, "eye_R_0")).GetComponent<SkinnedMeshRenderer>(); iris_R = ((Component)FindDeepChild(((Component)this).transform, "iris_R_0")).GetComponent<SkinnedMeshRenderer>(); } public void InitTexturesFrom(GameObject initial) { if ((Object)(object)leg_R != (Object)null) { ((Renderer)leg_R).materials = GetMaterialsFromBone(initial, "mesh_leg_r"); } if ((Object)(object)leg_L != (Object)null) { ((Renderer)leg_L).materials = GetMaterialsFromBone(initial, "mesh_leg_l"); } if ((Object)(object)body_bot != (Object)null) { ((Renderer)body_bot).materials = GetMaterialsFromBone(initial, "mesh_body_bot"); } if ((Object)(object)body_top_sphere != (Object)null) { ((Renderer)body_top_sphere).materials = GetMaterialsFromBone(initial, "mesh_body_top_sphere"); } if ((Object)(object)arm_L != (Object)null) { ((Renderer)arm_L).materials = GetMaterialsFromBone(initial, "mesh_arm_l"); } if ((Object)(object)arm_R != (Object)null) { ((Renderer)arm_R).materials = GetMaterialsFromBone(initial, "mesh_arm_r"); } if ((Object)(object)health_LED != (Object)null) { ((Renderer)health_LED).materials = GetMaterialsFromBone(initial, "mesh_health"); } if ((Object)(object)health_frame != (Object)null) { ((Renderer)health_frame).materials = GetMaterialsFromBone(initial, "mesh_health frame"); } if ((Object)(object)health_shadow != (Object)null) { ((Renderer)health_shadow).materials = GetMaterialsFromBone(initial, "mesh_health shadow"); } if ((Object)(object)head_bot_sphere != (Object)null) { ((Renderer)head_bot_sphere).materials = GetMaterialsFromBone(initial, "mesh_head_bot_sphere"); } if ((Object)(object)head_bot_flat != (Object)null) { ((Renderer)head_bot_flat).materials = GetMaterialsFromBone(initial, "mesh_head_bot_flat"); } if ((Object)(object)head_top != (Object)null) { ((Renderer)head_top).materials = GetMaterialsFromBone(initial, "mesh_head_top"); } if ((Object)(object)eye_L != (Object)null) { ((Renderer)eye_L).materials = GetMaterialsFromBone(initial, "mesh_eye_l"); } if ((Object)(object)iris_L != (Object)null) { ((Renderer)iris_L).materials = GetMaterialsFromBone(initial, "mesh_pupil_l"); } if ((Object)(object)eye_R != (Object)null) { ((Renderer)eye_R).materials = GetMaterialsFromBone(initial, "mesh_eye_r"); } if ((Object)(object)iris_R != (Object)null) { ((Renderer)iris_R).materials = GetMaterialsFromBone(initial, "mesh_pupil_r"); } } private Material[] GetMaterialsFromBone(GameObject initial, string name) { Transform val = FindDeepChild(initial.transform, name); if ((Object)(object)val != (Object)null) { return ((Renderer)((Component)val).GetComponent<MeshRenderer>()).materials; } return null; } private Transform FindDeepChild(Transform parent, string childName) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown foreach (Transform item in parent) { Transform val = item; if (((Object)val).name.ToLower() == childName.ToLower()) { return val; } Transform val2 = FindDeepChild(val, childName); if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } } public class EmoteLoader : MonoBehaviour { private AssetBundle assetBundle; private static EmoteLoader instance; public List<string> emotesName = new List<string>(); private Preferences emotesPreferences; public static EmoteLoader Instance => instance; public static KeyCode PanelKey => (KeyCode)((!((Object)(object)instance != (Object)null) || instance.emotesPreferences == null) ? 112 : ((int)instance.emotesPreferences.panelKey)); public int TotalPages => Mathf.CeilToInt((float)(emotesName.Count / 8)); private void Awake() { instance = this; } private void Start() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string path = Path.Combine(directoryName, "emotes.bundle"); assetBundle = EmoteBundleLoader.Load(path); string path2 = Path.Combine(directoryName, "preferences.json"); try { string text = File.ReadAllText(path2); emotesPreferences = JsonUtility.FromJson<Preferences>(text); } catch { SomeEmotesREPO.Logger.LogInfo((object)"No preferences file found, creating one."); emotesPreferences = new Preferences(); SavePreferences(); } } public static Font GetFont() { return instance.assetBundle.LoadAllAssets<Font>().First((Font f) => ((Object)f).name.ToLower().Contains("teko-regular")); } public void SavePreferences() { string path = Path.Combine(Paths.PluginPath, "ImGogole-SomeEmotesREPO", "preferences.json"); string contents = JsonUtility.ToJson((object)emotesPreferences); File.WriteAllText(path, contents); } public void SetFavorites(List<string> favs) { emotesPreferences.farovites = favs; SavePreferences(); } public EmoteLauncher LoadEmote(PlayerAvatar playerAvatar) { //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) if ((Object)(object)assetBundle == (Object)null) { SomeEmotesREPO.Logger.LogError((object)"Unable to load emotes.bundle"); return null; } emotesName.Clear(); GameObject val = EmoteBundleLoader.LoadAsset<GameObject>("emote.prefab"); if ((Object)(object)val == (Object)null) { SomeEmotesREPO.Logger.LogError((object)"Prefab emote not found"); return null; } GameObject val2 = Object.Instantiate<GameObject>(val, Vector3.zero, Quaternion.identity); EmoteLauncher emoteLauncher = val2.AddComponent<EmoteLauncher>(); List<string> allAnimNames = EmoteBundleLoader.GetAllAnimNames(); foreach (string item in allAnimNames) { string text = ExtractElement(item); if (!string.IsNullOrWhiteSpace(text)) { emoteLauncher.AddEntry(text, EmoteBundleLoader.LoadAsset<AnimationClip>(item)); emotesName.Add(text); } } emoteLauncher.Init(((Component)playerAvatar).transform); emoteLauncher.SetFavorites(emotesPreferences.farovites); emoteLauncher.InitTexturesFrom(((Component)((Component)playerAvatar).transform.parent).gameObject); return emoteLauncher; } public static string ExtractElement(string path) { if (string.IsNullOrWhiteSpace(path)) { return string.Empty; } string text = path.Trim(); int num = text.LastIndexOf('/'); if (num >= 0) { text = text.Substring(num + 1); } if (text.EndsWith(".anim", StringComparison.OrdinalIgnoreCase)) { text = text.Substring(0, text.Length - ".anim".Length); } return text; } } public class EmoteSelectionManager : MonoBehaviour { private static EmoteSelectionManager instance; private bool visible = false; private int currentPage = 0; private List<string> lines = new List<string>(); private List<string> emotesToPlay = new List<string>(); public const int emotePerPages = 8; public const int LineHeigth = 30; public const string delimiter = "-----------------------------"; public GUIStyle style; public List<string> Lines => lines; public List<string> EmotesToPlay => emotesToPlay; public bool Visible => visible; public static EmoteSelectionManager Instance => instance; private void Awake() { instance = this; SomeEmotesREPO.Logger.LogInfo((object)"EmoteSelectionManager ready."); } public void SetVisible(bool isVisible) { visible = isVisible; if (visible) { OpenPanel(0); } } public void OpenPanel(int page) { currentPage = page; UpdateLines(); } private void Update() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (ChatManager.instance.chatActive || !Visible) { return; } if (currentPage > 0 && Input.GetKeyDown((KeyCode)276)) { OpenPanel(currentPage - 1); } if (currentPage < EmoteLoader.Instance.TotalPages && Input.GetKeyDown((KeyCode)275)) { OpenPanel(currentPage + 1); } for (int i = 0; i < emotesToPlay.Count; i++) { KeyCode val = (KeyCode)(49 + i); KeyCode val2 = (KeyCode)(257 + i); bool flag = Input.GetKeyDown(val) || Input.GetKeyDown(val2); bool flag2 = Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)307) || Input.GetKey((KeyCode)313); if (flag) { if (flag2) { EmoteSystem.Instance.SetFavorite(emotesToPlay[i]); UpdateLines(); } else { EmoteSystem.Instance.PlayEmote(emotesToPlay[i]); } } } } private void UpdateLines() { //IL_0225: Unknown result type (might be due to invalid IL or missing references) lines.Clear(); emotesToPlay.Clear(); List<string> list = EmoteSystem.Instance.FetchEmotes(currentPage * 8, 8); if (currentPage == 0) { lines.Add("Favorite emotes"); lines.Add("-----------------------------"); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { lines.Add($"[{i + 1}] {list[i]}"); emotesToPlay.Add(list[i]); } } else { lines.Add("No emote yet"); } lines.Add("-----------------------------"); lines.Add("Press [->] for next page"); } else { lines.Add($"Page {currentPage + 1}/{EmoteLoader.Instance.TotalPages + 1}"); lines.Add("-----------------------------"); for (int j = 0; j < list.Count; j++) { lines.Add($"[{j + 1}] {list[j]}"); emotesToPlay.Add(list[j]); } lines.Add("-----------------------------"); if (EmoteLoader.Instance.TotalPages > currentPage) { lines.Add("Press [->] for next page"); } lines.Add("Press [<-] for previous page"); } if (list.Count > 0) { lines.Add("Press [Num] to emote"); lines.Add("Press [Alt + Num] to add to favorite"); } lines.Add($"Press [{EmoteLoader.PanelKey}] to quit"); } private void OnGUI() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (!EmoteSystem.Ready || !Visible || Lines.Count == 0) { return; } if (style == null) { style = GUI.skin.GetStyle("label"); style.fontSize = 22; style.font = EmoteLoader.GetFont(); style.richText = true; } float num = (float)Screen.height - 8f - (float)(Lines.Count * 30); foreach (string line in Lines) { GUI.Label(new Rect(8f, num, (float)Screen.width - 16f, 30f), line, style); num += 30f; } } } public class EmoteSystem : MonoBehaviourPun { private bool isEmoting = false; private int emoteId = -1; private float emoteTime = 0f; private float initialRot = 0f; private bool ready = false; private Transform camTransform; private PlayerAvatar playerAvatar; private PlayerAvatarVisuals playerVisuals; private static float initalCamOffset = 3.25f; private static float camOffset = initalCamOffset; private static EmoteSystem instance; private EmoteLauncher emoteLauncher; private Animator animator; public static bool Ready { get { if (!Object.op_Implicit((Object)(object)instance)) { return false; } return instance.ready; } } public bool IsEmoting { get { return isEmoting; } set { isEmoting = value; if (isEmoting) { emoteTime = 0f; } } } public static EmoteSystem Instance => instance; private PhotonView PV => playerVisuals.playerAvatar.photonView; private void Awake() { ready = false; if ((Object)(object)Camera.main != (Object)null) { camTransform = ((Component)Camera.main).transform; } } public List<string> FetchEmotes(int startIndex, int count) { return emoteLauncher.EmoteNames.Skip(Math.Max(startIndex, 0)).Take(Math.Max(count, 0)).ToList(); } public void SetFavorite(string fav) { SetFavorites(new List<string> { fav }); } public void SetFavorites(List<string> favs) { emoteLauncher.SetFavorites(favs); } public void SetPlayerAvatar(PlayerAvatar pa) { playerAvatar = pa; ((MonoBehaviour)this).StartCoroutine(SetVisuals()); } private IEnumerator SetVisuals() { yield return (object)new WaitForSeconds(0.75f); if ((Object)(object)playerAvatar != (Object)null) { playerVisuals = playerAvatar.playerAvatarVisuals; if ((Object)(object)playerVisuals == (Object)null) { playerVisuals = ((Component)((Component)playerAvatar).transform.parent).GetComponentInChildren<PlayerAvatarVisuals>(); animator = ((Component)playerVisuals).GetComponentInChildren<Animator>(); } } if (PV.IsMine) { instance = this; } if (GameManager.Multiplayer()) { emoteLauncher = EmoteLoader.Instance.LoadEmote(playerAvatar); emoteLauncher.emoteSystem = this; } ready = true; } public void PlayEmote(string emoteId) { if (PV.IsMine) { EmoteSelectionManager.Instance.SetVisible(isVisible: false); IsEmoting = true; ((MonoBehaviourPun)this).photonView.RPC("RPC_PlayEmote", (RpcTarget)0, new object[2] { emoteId, initialRot }); } } public void StopEmote() { if (PV.IsMine) { EmoteSelectionManager.Instance.SetVisible(isVisible: false); IsEmoting = false; ((MonoBehaviourPun)this).photonView.RPC("RPC_StopEmote", (RpcTarget)0, Array.Empty<object>()); } } [PunRPC] private void RPC_PlayEmote(string emoteId, float _initialRot) { IsEmoting = true; emoteLauncher.SetRotation(_initialRot); emoteLauncher.Animate(emoteId); SomeEmotesREPO.Logger.LogInfo((object)("[" + ((MonoBehaviourPun)this).photonView.Owner.NickName + "] played emote " + emoteId + ".")); } [PunRPC] private void RPC_StopEmote() { IsEmoting = false; emoteLauncher.StopEmote(); } private void Update() { //IL_00a4: 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_00af: 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_01c1: Unknown result type (might be due to invalid IL or missing references) if (!ready) { return; } if (IsEmoting) { emoteTime += Time.deltaTime; if (IsPlayerTakeControlBack()) { IsEmoting = false; StopEmote(); } } if (PV.IsMine && Object.op_Implicit((Object)(object)camTransform)) { if (isEmoting) { camTransform.localPosition = new Vector3(0f, 0f, 0f - camOffset); } else { camTransform.localPosition = Vector3.zero; } float y = Input.mouseScrollDelta.y; if (y != 0f) { camOffset -= y * Time.deltaTime * 20f; camOffset = Mathf.Clamp(camOffset, 0.5f, 4f); } } if (Object.op_Implicit((Object)(object)playerVisuals)) { if (PV.IsMine && !playerAvatar.deadSet && Input.GetKeyDown(EmoteLoader.PanelKey) && !ChatManager.instance.chatActive) { EmoteSelectionManager.Instance.SetVisible(!EmoteSelectionManager.Instance.Visible); } if (!PV.IsMine) { ((Behaviour)animator).enabled = !IsEmoting; playerVisuals.meshParent.SetActive(!IsEmoting); } else { initialRot = ((Component)playerAvatar).transform.eulerAngles.y; } } } public bool IsPlayerTakeControlBack() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!PV.IsMine) { return false; } Vector2 movement = InputManager.instance.GetMovement(); if (((Vector2)(ref movement)).sqrMagnitude > 0.01f) { return true; } if (InputManager.instance.KeyDown((InputKey)1) || InputManager.instance.KeyDown((InputKey)2) || InputManager.instance.KeyDown((InputKey)15) || InputManager.instance.KeyDown((InputKey)12) || InputManager.instance.KeyDown((InputKey)14)) { return true; } return false; } public void OnDestroy() { if ((Object)(object)emoteLauncher != (Object)null) { Object.Destroy((Object)(object)((Component)emoteLauncher).gameObject); } } } [HarmonyPatch(typeof(FlashlightController))] internal class FlashlightControllerPatch { [HarmonyPrefix] [HarmonyPatch("Update")] private static bool Update_Prefix(FlashlightController __instance) { EmoteSystem component = ((Component)__instance.PlayerAvatar).GetComponent<EmoteSystem>(); if ((Object)(object)component == (Object)null) { return true; } if (component.IsEmoting) { ((Renderer)__instance.mesh).enabled = false; ((Behaviour)__instance.spotlight).enabled = false; __instance.halo.enabled = false; __instance.LightActive = false; return false; } return true; } } public static class HierarchyLogger { public static void LogFullHierarchy(GameObject go) { Transform val = go.transform; while ((Object)(object)val.parent != (Object)null) { val = val.parent; } StringBuilder stringBuilder = new StringBuilder(); BuildHierarchyString(val, 0, stringBuilder, go.transform); SomeEmotesREPO.Logger.LogInfo((object)stringBuilder.ToString()); } private static void BuildHierarchyString(Transform t, int indent, StringBuilder sb, Transform initial) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown sb.Append(' ', indent * 2); string text = (((Object)(object)t == (Object)(object)initial) ? " [INITIAL GAME OBJECT]" : ""); Component[] components = ((Component)t).GetComponents<Component>(); string text2 = string.Join(", ", from c in components where !(c is Transform) select ((object)c).GetType().Name); if (!string.IsNullOrEmpty(text2)) { text2 = " [" + text2 + "]"; } sb.AppendLine("- " + ((Object)t).name + text + text2); foreach (Transform item in t) { Transform t2 = item; BuildHierarchyString(t2, indent + 1, sb, initial); } } } [HarmonyPatch(typeof(PlayerAvatarVisuals), "Update")] internal static class PlayerAvatarVisualsUpdatePatch { private static bool Prefix(PlayerAvatarVisuals __instance) { if ((Object)(object)__instance.playerAvatar != (Object)null && __instance.playerAvatar.photonView.IsMine && (Object)(object)EmoteSystem.Instance != (Object)null && EmoteSystem.Instance.IsEmoting) { return false; } return true; } } [HarmonyPatch(typeof(PlayerAvatarVisuals), "Revive")] internal static class PlayerAvatarVisualsRevivePatch { private static void Prefix(PlayerAvatarVisuals __instance) { EmoteSystem.Instance.StopEmote(); } } [HarmonyPatch(typeof(PlayerNameChecker))] internal class PlayerNameCheckerPatch { [HarmonyPrefix] [HarmonyPatch("Update")] public static void Update_Prefix(PlayerNameChecker __instance) { if (Object.op_Implicit((Object)(object)EmoteSystem.Instance) && EmoteSystem.Instance.IsEmoting) { __instance.checkTimer = 0.25f; } } } [BepInPlugin("ImGogole.SomeEmotesREPO", "SomeEmotesREPO", "1.0.4")] public class SomeEmotesREPO : BaseUnityPlugin { internal static SomeEmotesREPO 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; if (!Object.op_Implicit((Object)(object)((Component)this).GetComponent<EmoteSelectionManager>())) { ((Component)this).gameObject.AddComponent<EmoteSelectionManager>(); } if (!Object.op_Implicit((Object)(object)((Component)this).GetComponent<EmoteLoader>())) { ((Component)this).gameObject.AddComponent<EmoteLoader>(); } 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(); } } } } namespace SomeEmotesREPO.Utils { public static class ChatReflection { private static readonly FieldRef<ChatManager, bool> _chatActiveGetter = AccessTools.FieldRefAccess<ChatManager, bool>("chatActive"); public static bool IsChatActive() { if ((Object)(object)ChatManager.instance == (Object)null) { return false; } return _chatActiveGetter.Invoke(ChatManager.instance); } } }