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 Impostor Mod Among Us Style v1.2.7
plugins/ImpostorMod/ImpostorMod.dll
Decompiled 7 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading; using BepInEx; using BepInEx.Configuration; using ExitGames.Client.Photon; using HarmonyLib; using MenuLib; using MenuLib.MonoBehaviors; using Microsoft.CodeAnalysis; using MyMod.Helpers; using Photon.Pun; using Photon.Realtime; using TMPro; using Unity.VisualScripting; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SplitBrudis")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+97e9cb009d4196aad6aaf4cd93422288dc200914")] [assembly: AssemblyProduct("ImpostorMod")] [assembly: AssemblyTitle("ImpostorMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [RequireComponent(typeof(PhotonView))] public class ActiveSettings : MonoBehaviour { private static ActiveSettings _instance; public const string MOD_VERSION = "1.2.1"; public const string HAS_IMPOSTER_MOD = "hasImpostorMod"; public const string MOD_ENABLED = "modEnabled"; public const string KILL_COOLDOWN = "killCD"; public const string KILL_RANGE = "killRange"; public const string MEETING_PER_PLAYER_COUNT = "meetingsPP"; public const string MEETING_COOLDOWN = "meetingsCD"; public const string VOTE_TIMER = "voteTimer"; public const string END_GAME_TRESH = "endGameTresh"; public const string LEVEL = "level"; public bool ModEnabledActive = true; public int KillCooldownActive = 30; public int KillRangeActive = 2; public int EmergencyMeetingsPerPlayerActive = 1; public int EmergencyMeetingCooldownActive = 20; public int VoteTimerSecondsActive = 30; public int EndGameTreshActive = 1; public int LevelActive = 3; public static ActiveSettings Instance { get { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { _instance = Object.FindObjectOfType<ActiveSettings>(); if ((Object)(object)_instance == (Object)null) { MyDebug.Log("Create ActiveSettings Instance."); GameObject val = new GameObject("ActiveSettings"); _instance = val.AddComponent<ActiveSettings>(); } Object.DontDestroyOnLoad((Object)(object)((Component)_instance).gameObject); } return _instance; } } private void Awake() { if ((Object)(object)_instance == (Object)null) { _instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); InitBindings(); } else if ((Object)(object)_instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } } public void InitBindings() { REPOImpostorMod.Instance.InitBindings(); ModEnabledActive = REPOImpostorMod.Instance.ModEnabled; MyDebug.Log("InitBindings ModEnabledActive=" + ModEnabledActive); KillCooldownActive = REPOImpostorMod.Instance.KillCooldown; KillRangeActive = REPOImpostorMod.Instance.KillRange; VoteTimerSecondsActive = REPOImpostorMod.Instance.VoteTimerSeconds; EmergencyMeetingsPerPlayerActive = REPOImpostorMod.Instance.EmergencyMeetingsPerPlayer; EmergencyMeetingCooldownActive = REPOImpostorMod.Instance.EmergencyMeetingCooldown; EndGameTreshActive = REPOImpostorMod.Instance.EndGameTresh; LevelActive = REPOImpostorMod.Instance.Level; } } [RequireComponent(typeof(PhotonView))] public class AvatarRPCReceiver : MonoBehaviourPun { [PunRPC] public void RPC_Kill_Actor(int actorNumber) { MyDebug.Log($"[AvatarRPCReceiver] RPC_Kill_Actor received on {actorNumber}"); PlayerAvatar val = GameDirector.instance.PlayerList.Find((PlayerAvatar p) => p.photonView.OwnerActorNr == actorNumber); MyDebug.Log($"[AvatarRPCReceiver] playerDeathHead = {val.playerDeathHead}"); if (val.photonView.IsMine && !MyGameManager.Instance.IAmDead) { MyDebug.Log("[AvatarRPCReceiver] i got killed"); MyGameManager.Instance.MarkMeDead(); PlayerHealth playerHealth = val.playerHealth; if ((Object)(object)playerHealth != (Object)null && ((Behaviour)playerHealth).isActiveAndEnabled) { int health = playerHealth.health; playerHealth.Hurt(health, false, -1); } } } [PunRPC] public void RPC_EndGame(bool crewVictory) { MyDebug.Log($"[AvatarRPCReceiver] EndGame with crewVictory={crewVictory}"); EndGameUI.Instance.EndGame(crewVictory); } } public class EndGameUI : MonoBehaviour { [CompilerGenerated] private sealed class <>c__DisplayClass4_0 { public EndGameUI <>4__this; public Coroutine countDownCoroutine; internal void <EndGameAfterDelay>b__0() { Debug.LogError((object)"[EndGameUI] EnterArena pressed"); ((MonoBehaviour)<>4__this).StopCoroutine(countDownCoroutine); <>4__this.EnterArena(); } } [CompilerGenerated] private sealed class <ArenaCountdown>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public REPOButton button; public EndGameUI <>4__this; private int <t>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ArenaCountdown>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <t>5__1 = 50; break; case 1: <>1__state = -1; <t>5__1--; break; } if (<t>5__1 > 0) { if (SemiFunc.RunIsArena()) { MyDebug.Log("[EndGameUI] Game already moved to Arena — stopping countdown"); return false; } if ((Object)(object)button != (Object)null) { ((TMP_Text)button.labelTMP).text = $"Go to Arena ({<t>5__1} s)"; } else { Debug.LogError((object)"arena countdown button is null"); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } MyDebug.Log("[EndGameUI] Timer run out -> EnterArena"); <>4__this.EnterArena(); 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 <EndGameAfterDelay>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public bool crewVictory; public EndGameUI <>4__this; private <>c__DisplayClass4_0 <>8__1; private string <title>5__2; private Color <headerColor>5__3; private string <bodyMsg>5__4; private REPOButton <button>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EndGameAfterDelay>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <title>5__2 = null; <bodyMsg>5__4 = null; <button>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0123: 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_0161: Expected O, but got Unknown //IL_00db: 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_00e0: 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_0100: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass4_0(); <>8__1.<>4__this = <>4__this; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; MyDebug.Log("[EndGameUI] EndGameAfterDelay"); UIButtonManager.Instance.HideAll(); if ((Object)(object)PlayerController.instance != (Object)null) { MyDebug.Log("[EndGameUI] PlayerController.instance.enabled = false"); ((Behaviour)PlayerController.instance).enabled = false; } <title>5__2 = (crewVictory ? "Crewmates Win" : "Impostor Wins"); <headerColor>5__3 = (crewVictory ? Color.green : Color.red); <bodyMsg>5__4 = "Continue to Arena (Host can click or wait)"; <>2__current = (object)new WaitForSeconds(0.15f); <>1__state = 2; return true; case 2: <>1__state = -1; <>8__1.countDownCoroutine = null; ModUtils.OpenPagePopUp(<title>5__2, <headerColor>5__3, <bodyMsg>5__4, "Go to Arena", delegate { Debug.LogError((object)"[EndGameUI] EnterArena pressed"); ((MonoBehaviour)<>8__1.<>4__this).StopCoroutine(<>8__1.countDownCoroutine); <>8__1.<>4__this.EnterArena(); }, allowTextOverflow: true, 300f); <>2__current = (object)new WaitForSeconds(0.15f); <>1__state = 3; return true; case 3: <>1__state = -1; <button>5__5 = Object.FindObjectOfType<REPOButton>(); if ((Object)(object)<button>5__5 == (Object)null) { Debug.LogError((object)"[EndGameUI] No button found!"); return false; } ((Behaviour)<button>5__5.menuButton).enabled = PhotonNetwork.IsMasterClient; <>8__1.countDownCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.ArenaCountdown(<button>5__5)); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const int ARENA_TIMER_SECONDS = 50; private static EndGameUI _instance; public static EndGameUI Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { GameObject val = new GameObject("EndGameUI"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent<EndGameUI>(); } return _instance; } } [IteratorStateMachine(typeof(<EndGameAfterDelay>d__4))] private IEnumerator EndGameAfterDelay(bool crewVictory) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <EndGameAfterDelay>d__4(0) { <>4__this = this, crewVictory = crewVictory }; } public void EndGame(bool crewVictory) { ((MonoBehaviour)this).StartCoroutine(EndGameAfterDelay(crewVictory)); } [IteratorStateMachine(typeof(<ArenaCountdown>d__6))] private IEnumerator ArenaCountdown(REPOButton button) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ArenaCountdown>d__6(0) { <>4__this = this, button = button }; } private void EnterArena() { KillAllPlayers(); MenuManager.instance.PageCloseAll(); } private void KillAllPlayers() { List<PlayerAvatar> list = GameDirector.instance.PlayerList.Where((PlayerAvatar av) => !av.deadSet).ToList(); MyDebug.Log("[EndGameUI] remaining player count=" + list.Count); foreach (PlayerAvatar item in list) { MyDebug.Log("[EndGameUI] remaining player=" + item.photonView.OwnerActorNr); if ((Object)(object)item != (Object)null && !item.deadSet) { MyDebug.Log("[EndGameUI] kill player=" + item.photonView.OwnerActorNr); item.photonView.RPC("RPC_Kill_Actor", (RpcTarget)0, new object[1] { item.photonView.OwnerActorNr }); } } } } public interface ICleanupable { void Cleanup(); } [RequireComponent(typeof(PhotonView))] public class ImpostorController : MonoBehaviourPunCallbacks, ICleanupable { private bool impostorPicked = false; private PlayerAvatar localAvatar; private bool isImpostor = false; private Button killButton; private float killTimer; private Text cooldownText; private bool initialized = false; public override void OnEnable() { MyDebug.Log("[ImpostorInputListener] OnEnable"); PhotonNetwork.AddCallbackTarget((object)this); SceneManager.sceneLoaded += OnSceneLoaded; } public override void OnDisable() { MyDebug.Log("[Impostor] Impostor OnDisable."); SceneManager.sceneLoaded -= OnSceneLoaded; PhotonNetwork.RemoveCallbackTarget((object)this); } private void OnSceneLoaded(Scene s, LoadSceneMode mode) { MyDebug.Log("[Impostor] OnSceneLoaded."); impostorPicked = false; isImpostor = false; if ((Object)(object)killButton != (Object)null) { Object.Destroy((Object)(object)((Component)((Component)killButton).transform.parent).gameObject); killButton = null; } } public override void OnRoomPropertiesUpdate(Hashtable props) { if (((Dictionary<object, object>)(object)props).ContainsKey((object)"impostorActorNumber")) { CacheLocalAvatar(); if (!((Object)(object)localAvatar == (Object)null)) { MyDebug.Log("[Impostor] Room property impostorView arrived → InitNonHost()"); TryAssignImpostorRole(); } } } private void TryAssignImpostorRole() { MyDebug.Log("[Impostor] localAvatar=" + (object)localAvatar); if ((Object)(object)localAvatar == (Object)null) { return; } int num = (int)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties[(object)"impostorActorNumber"]; MyGameManager.Instance._impostorActorNumber = num; MyDebug.Log($"[Impostor] Role assigned: isImpostor={num}"); if (!((Dictionary<object, object>)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"impostorActorNumber", out object value) || !(value is int)) { return; } int num2 = (int)value; if (1 == 0) { return; } MyDebug.Log("[Impostor] Try to set impostor!"); bool flag = localAvatar.photonView.OwnerActorNr == num2; if (flag && !isImpostor) { isImpostor = true; MyDebug.Log("[Impostor] I am the impostor!"); CreateKillUI(); killTimer = ActiveSettings.Instance.KillCooldownActive; } else if (!flag && isImpostor) { isImpostor = false; if ((Object)(object)killButton != (Object)null) { ((Component)killButton).gameObject.SetActive(false); } } } private void Update() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_0120: Unknown result type (might be due to invalid IL or missing references) bool flag = MyGameManager.Instance.IAmDead || (SemiFunc.IsMultiplayer() && (Object)(object)LevelGenerator.Instance != (Object)null && LevelGenerator.Instance.Generated && (Object)(object)GameDirector.instance != (Object)null && (int)GameDirector.instance.currentState == 2 && SemiFunc.RunIsLevel()); if (MyGameManager.Instance.IAmDead || !flag) { return; } if ((Object)(object)localAvatar == (Object)null) { MyDebug.Log("[ImpostorController] initialize."); CacheLocalAvatar(); } if (!impostorPicked && PhotonNetwork.IsMasterClient) { MyDebug.Log("[ImpostorInputListener] Detected run start → Init()"); impostorPicked = true; PickImpostorAsHost(); } if (!isImpostor || !((Object)(object)killButton != (Object)null)) { return; } if (killTimer <= 0f) { PlayerAvatar val = FindTargetInCrosshair(); bool interactable = (Object)(object)val != (Object)null; ((Selectable)killButton).interactable = interactable; if (Input.GetKeyDown(REPOImpostorMod.Instance.KillKey)) { MyDebug.Log("[ImpostorInputListener] Kill hotkey pressed"); OnKillPressed(val); } } else { killTimer -= Time.deltaTime; cooldownText.text = Mathf.CeilToInt(killTimer).ToString(); if (killTimer <= 0f) { cooldownText.text = ""; } } } private void CacheLocalAvatar() { if ((Object)(object)localAvatar != (Object)null) { return; } MyDebug.Log("[ImpostorInputListener] CacheLocalAvatar()"); PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val in array) { if (val.photonView.IsMine) { localAvatar = val; initialized = true; } } } private void PickImpostorAsHost() { //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_00e5: Expected O, but got Unknown //IL_00e8: Expected O, but got Unknown MyDebug.Log("[ImpostorInputListener] PickImpostorAsHost()"); if ((Object)(object)localAvatar == (Object)null) { Debug.LogWarning((object)"[ImpostorInputListener] No local avatar!"); } else if (SemiFunc.IsMasterClientOrSingleplayer()) { Player[] playerList = PhotonNetwork.PlayerList; MyDebug.Log($"[Impostor] Found {playerList.Length} players: " + string.Join(", ", playerList.Select((Player p) => p.ActorNumber))); int seed = PhotonNetwork.ServerTimestamp ^ Environment.TickCount; Random random = new Random(seed); Player val = playerList[random.Next(playerList.Length)]; int actorNumber = val.ActorNumber; MyDebug.Log($"[Impostor] Chosen impostorActorNumber = {actorNumber}"); Hashtable val2 = new Hashtable(); ((Dictionary<object, object>)val2).Add((object)"impostorActorNumber", (object)actorNumber); Hashtable val3 = val2; PhotonNetwork.CurrentRoom.SetCustomProperties(val3, (Hashtable)null, (WebFlags)null); MyDebug.Log("[Impostor]Props set"); } } private PlayerAvatar FindTargetInCrosshair() { //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_0062: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)localAvatar == (Object)null || (Object)(object)Camera.main == (Object)null) { return null; } float num = (float)ActiveSettings.Instance.KillRangeActive * 2f; float num2 = 0f; Ray val = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); RaycastHit val2 = default(RaycastHit); if (Physics.SphereCast(val, num2, ref val2, num)) { PlayerAvatar componentInParent = ((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<PlayerAvatar>(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent != (Object)(object)localAvatar && !componentInParent.deadSet) { return componentInParent; } } return null; } private void CreateKillUI() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0044: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00cd: 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_00ed: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_0166: 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_0177: 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_01a5: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027f: 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_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) GameObject uiContainer = UIButtonManager.Instance.uiContainer; GameObject val = new GameObject("KillButton"); val.transform.SetParent(uiContainer.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(1f, 0f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(1f, 0f); val2.anchoredPosition = new Vector2(220f, -173f); val2.sizeDelta = new Vector2(60f, 60f); killButton = val.AddComponent<Button>(); UIButtonManager.Instance.killButton = killButton; UIButtonKeyLabel.AttachKeyLabel(val, killButton, REPOImpostorMod.Instance.KillKey, new Vector2(-20f, -5f)); ((Selectable)killButton).transition = (Transition)1; Texture2D val4 = new Texture2D(2, 2); ImageConversion.LoadImage(val4, ModUtils.LoadSprite("KillIcon.png")); Sprite sprite = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), Vector2.one * 0.5f); Image val5 = val.AddComponent<Image>(); val5.sprite = sprite; val5.preserveAspect = true; ((Selectable)killButton).targetGraphic = (Graphic)(object)val5; ColorBlock colors = ((Selectable)killButton).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = Color.white; ((ColorBlock)(ref colors)).pressedColor = Color.gray; ((ColorBlock)(ref colors)).disabledColor = new Color(0.3f, 0.3f, 0.3f, 1f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((Selectable)killButton).colors = colors; ((Selectable)killButton).interactable = false; GameObject val6 = new GameObject("CooldownText"); val6.transform.SetParent(val.transform, false); cooldownText = val6.AddComponent<Text>(); cooldownText.alignment = (TextAnchor)4; cooldownText.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); cooldownText.fontSize = 40; ((Graphic)cooldownText).color = Color.white; ((Graphic)cooldownText).raycastTarget = false; RectTransform rectTransform = ((Graphic)cooldownText).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; val3 = (rectTransform.offsetMin = (rectTransform.offsetMax = Vector2.zero)); rectTransform.anchoredPosition = new Vector2(10f, 0f); Outline val8 = val6.AddComponent<Outline>(); ((Shadow)val8).effectColor = Color.black; ((Shadow)val8).effectDistance = new Vector2(2f, -2f); } private byte[] LoadSprite(string name) { string location = Assembly.GetExecutingAssembly().Location; string directoryName = Path.GetDirectoryName(location); string path = Path.Combine(directoryName, "Assets", name); return File.ReadAllBytes(path); } private void OnKillPressed(PlayerAvatar victim) { MyDebug.Log("[ImpostorInputListener] Kill Pressed"); if (!((Object)(object)victim == (Object)null)) { int ownerActorNr = victim.photonView.OwnerActorNr; MyDebug.Log($"[ImpostorInputListener] Broadcasting RPC_Kill_Actor to all for ViewID={ownerActorNr}"); killTimer = ActiveSettings.Instance.KillCooldownActive; ((Selectable)killButton).interactable = false; victim.photonView.RPC("RPC_Kill_Actor", (RpcTarget)0, new object[1] { ownerActorNr }); } } public void Cleanup() { MyDebug.Log("[ImpostorController] clean up"); if ((Object)(object)killButton != (Object)null) { Object.Destroy((Object)(object)((Component)((Component)killButton).gameObject.transform.parent).gameObject); killButton = null; } impostorPicked = false; initialized = false; isImpostor = false; } } [RequireComponent(typeof(PhotonView))] public class LobbyPopupController : MonoBehaviourPunCallbacks { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<MenuPage, bool> <>9__16_0; public static Predicate<MenuPage> <>9__16_1; public static ShouldCloseMenuDelegate <>9__20_0; public static Func<TextMeshProUGUI, bool> <>9__24_0; public static ShouldCloseMenuDelegate <>9__32_0; public static Action<bool> <>9__32_2; public static ShouldCloseMenuDelegate <>9__38_0; public static Action <>9__38_4; public static Action <>9__38_5; public static Func<KeyValuePair<object, object>, string> <>9__44_0; internal bool <Update>b__16_0(MenuPage page) { return (Object)(object)page != (Object)null; } internal bool <Update>b__16_1(MenuPage page) { return (Object)(object)page == (Object)null; } internal bool <JoinRoom>b__20_0() { return false; } internal bool <GetEntryPlayerName>b__24_0(TextMeshProUGUI t) { return !string.IsNullOrWhiteSpace(((TMP_Text)t).text); } internal bool <CreateImpostorSettingsUI>b__32_0() { return false; } internal void <CreateImpostorSettingsUI>b__32_2(bool val) { if (PhotonNetwork.IsMasterClient) { SetRoomProp("modEnabled", val); } } internal bool <ShowDonatePopup>b__38_0() { return true; } internal void <ShowDonatePopup>b__38_4() { MyDebug.Log("[Donation] PayPal clicked"); Application.OpenURL("https://www.paypal.com/ncp/payment/YAJRFTRSDLXF2"); } internal void <ShowDonatePopup>b__38_5() { MyDebug.Log("[Donation] Ko-Fi clicked"); Application.OpenURL("https://ko-fi.com/Z8Z31KKWWM"); } internal string <LogHashtable>b__44_0(KeyValuePair<object, object> kvp) { return $"{kvp.Key}={kvp.Value}"; } } [CompilerGenerated] private sealed class <EnableModAfterDelay>d__19 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ModManager modManager; public LobbyPopupController <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EnableModAfterDelay>d__19(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(2f); <>1__state = 1; return true; case 1: <>1__state = -1; modManager?.EnableMod(); 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 const string PLAYER_MOD_VERSION = "impostorModVersion"; public REPOPopupPage impostorSettingsPage; private REPOToggle ModEnabledToggle; private REPOSlider KillCooldownSlider; private REPOSlider KillRangeSlider; private REPOSlider MeetingsCountSlider; private REPOSlider MeetingsCooldownSlider; private REPOSlider VoteDurationSlider; private REPOSlider EndGameTreshSlider; private REPOSlider LevelSlider; private static LobbyPopupController _instance; private bool joinedRoom = false; private GameObject donationGO; private REPOButton donateButton; private REPOButton payPalButton; private REPOButton kofiButton; private REPOButton closeDonationPopupButton; public static LobbyPopupController Instance { get { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { MyDebug.Log("Create LobbyPopupController Instance"); GameObject val = new GameObject("LobbyPopupUpdater"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent<LobbyPopupController>(); } return _instance; } } public void Cleanup() { MyDebug.Log("[LobbyPopupController] Cleanup"); if ((Object)(object)impostorSettingsPage != (Object)null && (Object)(object)impostorSettingsPage.menuPage != (Object)null) { impostorSettingsPage.ClosePage(true); impostorSettingsPage = null; } if ((Object)(object)donationGO != (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); } joinedRoom = false; } private void Update() { if (!joinedRoom || PhotonNetwork.CurrentRoom == null || !SemiFunc.RunIsLobbyMenu() || !((Object)(object)MenuHolder.instance != (Object)null)) { return; } int num = 0; if ((Object)(object)MenuManager.instance != (Object)null && MenuManager.instance.addedPagesOnTop != null) { num = MenuManager.instance.addedPagesOnTop.Count((MenuPage page) => (Object)(object)page != (Object)null); int num2 = MenuManager.instance.addedPagesOnTop.RemoveAll((MenuPage page) => (Object)(object)page == (Object)null); } if (num == 0 && ((Object)(object)impostorSettingsPage == (Object)null || (Object)(object)impostorSettingsPage.menuPage == (Object)null)) { MyDebug.Log("[LobbyPopupController] Open MenuPageLobby again"); impostorSettingsPage = CreateImpostorSettingsUI(); } } public static void AttachModIcon(GameObject entry) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)entry == (Object)null)) { Transform val = entry.transform.Find("ModIcon"); if (!((Object)(object)val != (Object)null)) { GameObject val2 = new GameObject("ModIcon", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(entry.transform, false); RectTransform component = val2.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(18f, 18f); component.anchoredPosition = new Vector2(128f, -74f); Image component2 = val2.GetComponent<Image>(); component2.sprite = ModUtils.LoadSpriteFromFile("Logo.png"); MyDebug.Log("[LobbyUIHelper] Attached mod icon to " + ((Object)entry).name); } } } public static void AttachModVersion(GameObject entry, string version) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)entry == (Object)null)) { Transform val = entry.transform.Find("ModVersion"); if (!((Object)(object)val != (Object)null)) { GameObject val2 = new GameObject("ModVersion", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); val2.transform.SetParent(entry.transform, false); RectTransform component = val2.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(18f, 18f); component.anchoredPosition = new Vector2(140f, -87f); TextMeshProUGUI component2 = val2.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component2).fontSize = 10f; ((TMP_Text)component2).alignment = (TextAlignmentOptions)513; ((TMP_Text)component2).enableWordWrapping = false; ((TMP_Text)component2).text = (string.IsNullOrEmpty(version) ? "" : ("v" + version)); MyDebug.Log("[LobbyUIHelper] Attached mod version to " + ((Object)entry).name); } } } [IteratorStateMachine(typeof(<EnableModAfterDelay>d__19))] private IEnumerator EnableModAfterDelay(ModManager modManager) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <EnableModAfterDelay>d__19(0) { <>4__this = this, modManager = modManager }; } public void JoinRoom() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_00ff: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01a6: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown ModManager[] array = Object.FindObjectsOfType<ModManager>(); ModManager modManager = Object.FindObjectOfType<ModManager>(); MyDebug.Log("[LobbyPopupController]modManager.length=" + array.Length); MyDebug.Log("[LobbyPopupController]modManager=" + (object)modManager); MyDebug.Log("[LobbyPopupController]modManager.mainGameInitialized=" + modManager.mainGameInitialized); if ((Object)(object)modManager != (Object)null && modManager.mainGameInitialized) { MyDebug.Log("[LobbyPopupController] Call controller Cleanup()..."); modManager.CleanUp(); } MyGameManager.Instance.gameOver = false; StatsManager.instance.ResetAllStats(); joinedRoom = true; if (PhotonNetwork.IsMasterClient) { MyDebug.Log("[LobbyPopupController] OnJoinedRoom Host joined."); LoadMySettings(); PushSettingsToRoom(); CreateImpostorSettingsUI(); Hashtable val = new Hashtable(); ((Dictionary<object, object>)val).Add((object)"hasImpostorMod", (object)true); ((Dictionary<object, object>)val).Add((object)"impostorModVersion", (object)"1.2.1"); Hashtable val2 = val; PhotonNetwork.LocalPlayer.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null); return; } MyDebug.Log("[LobbyPopupController] OnJoinedRoom Player joined."); if (((Dictionary<object, object>)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).ContainsKey((object)"hasImpostorMod") && (bool)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties[(object)"hasImpostorMod"]) { MyDebug.Log("[LobbyPopupController] host Has Mod."); CreateImpostorSettingsUI(); UpdateRoomProperties(((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties); Hashtable val3 = new Hashtable(); ((Dictionary<object, object>)val3).Add((object)"hasImpostorMod", (object)true); ((Dictionary<object, object>)val3).Add((object)"impostorModVersion", (object)"1.2.1"); Hashtable val4 = val3; PhotonNetwork.LocalPlayer.SetCustomProperties(val4, (Hashtable)null, (WebFlags)null); return; } MyDebug.Log("[LobbyPopupController] Host does not have the Impostor Mod"); REPOPopupPage val5 = MenuAPI.CreateREPOPopupPage("Host does not have the Impostor Mod :(", (PresetSide)1, false, false, 1.2f); val5.OpenPage(true); object obj = <>c.<>9__20_0; if (obj == null) { ShouldCloseMenuDelegate val6 = () => false; <>c.<>9__20_0 = val6; obj = (object)val6; } val5.onEscapePressed = (ShouldCloseMenuDelegate)obj; impostorSettingsPage = val5; if (ModManager.ModEnabled) { modManager.DisableMod(); } } public override void OnPlayerPropertiesUpdate(Player targetPlayer, Hashtable changedProps) { MyDebug.Log("OnPlayerPropertiesUpdate"); if (((Dictionary<object, object>)(object)changedProps).ContainsKey((object)"hasImpostorMod") || ((Dictionary<object, object>)(object)changedProps).ContainsKey((object)"impostorModVersion")) { RefreshAllPlayerModIcons(); } } private void RefreshAllPlayerModIcons() { MyDebug.Log("RefreshAllPlayerModIcons"); Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val in playerList) { MyDebug.Log("RefreshAllPlayerModIcons for player p=" + val.NickName); HandlePlayerProperties(val); } } private void HandlePlayerProperties(Player targetPlayer) { Hashtable customProperties = targetPlayer.CustomProperties; if (!((Dictionary<object, object>)(object)customProperties).ContainsKey((object)"hasImpostorMod")) { return; } List<GameObject> lobbyListPlayerEntries = GetLobbyListPlayerEntries(); MyDebug.Log("entries.Count=" + lobbyListPlayerEntries.Count); GameObject val = ((IEnumerable<GameObject>)lobbyListPlayerEntries).FirstOrDefault((Func<GameObject, bool>)delegate(GameObject e) { MyDebug.Log("GetEntryActorNumber(e)=" + targetPlayer.NickName); return string.Equals(GetEntryPlayerName(e), targetPlayer.NickName); }); if ((Object)(object)val != (Object)null) { AttachModIcon(val); if (((Dictionary<object, object>)(object)customProperties).TryGetValue((object)"impostorModVersion", out object value)) { string version = (value as string) ?? ""; AttachModVersion(val, version); } } else { Debug.LogWarning((object)("[LobbyPopupController] Could not find UI entry for actor " + targetPlayer.ActorNumber)); } } private static string GetEntryPlayerName(GameObject entry) { return ((TMP_Text)((IEnumerable<TextMeshProUGUI>)entry.GetComponentsInChildren<TextMeshProUGUI>(true)).FirstOrDefault((Func<TextMeshProUGUI, bool>)((TextMeshProUGUI t) => !string.IsNullOrWhiteSpace(((TMP_Text)t).text)))).text.Trim(); } public static MenuPage GetActiveLobbyPage() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 if ((Object)(object)MenuManager.instance == (Object)null) { return null; } MenuPage currentMenuPage = MenuManager.instance.currentMenuPage; if ((Object)(object)currentMenuPage != (Object)null && (int)currentMenuPage.menuPageIndex == 8) { return currentMenuPage; } Debug.LogWarning((object)"[LobbyUIHelper] No active Lobby page right now."); return null; } public static Transform GetPlayerListRoot() { MenuPage activeLobbyPage = GetActiveLobbyPage(); if ((Object)(object)activeLobbyPage == (Object)null) { return null; } Transform val = ((Component)activeLobbyPage).transform.Find("Player List"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"[LobbyUIHelper] Could not find 'Player List' transform"); } return val; } public static List<GameObject> GetLobbyListPlayerEntries() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown List<GameObject> list = new List<GameObject>(); Transform playerListRoot = GetPlayerListRoot(); if ((Object)(object)playerListRoot == (Object)null) { return list; } foreach (Transform item in playerListRoot) { Transform val = item; if (((Object)val).name.Contains("Menu Player Listed Lobby")) { list.Add(((Component)val).gameObject); MyDebug.Log("[LobbyUIHelper] Found player entry: " + ((Object)val).name); } } return list; } private void PushSettingsToRoom() { //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_0017: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00f1: Expected O, but got Unknown Hashtable val = new Hashtable(); ((Dictionary<object, object>)val).Add((object)"hasImpostorMod", (object)true); ((Dictionary<object, object>)val).Add((object)"modEnabled", (object)ActiveSettings.Instance.ModEnabledActive); ((Dictionary<object, object>)val).Add((object)"killCD", (object)ActiveSettings.Instance.KillCooldownActive); ((Dictionary<object, object>)val).Add((object)"killRange", (object)ActiveSettings.Instance.KillRangeActive); ((Dictionary<object, object>)val).Add((object)"meetingsPP", (object)ActiveSettings.Instance.EmergencyMeetingsPerPlayerActive); ((Dictionary<object, object>)val).Add((object)"meetingsCD", (object)ActiveSettings.Instance.EmergencyMeetingCooldownActive); ((Dictionary<object, object>)val).Add((object)"voteTimer", (object)ActiveSettings.Instance.VoteTimerSecondsActive); ((Dictionary<object, object>)val).Add((object)"endGameTresh", (object)ActiveSettings.Instance.EndGameTreshActive); ((Dictionary<object, object>)val).Add((object)"level", (object)ActiveSettings.Instance.LevelActive); Hashtable val2 = val; PhotonNetwork.CurrentRoom.SetCustomProperties(val2, (Hashtable)null, (WebFlags)null); } private static void SetRoomProp(string key, int value) { //IL_000c: 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_0022: Expected O, but got Unknown MyDebug.Log("[LobbyPopupController] SetRoomProp"); Hashtable val = new Hashtable { [(object)key] = value }; ApplySettingsFromRoom(val); PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } private static void SetRoomProp(string key, bool value) { //IL_000c: 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_0022: Expected O, but got Unknown MyDebug.Log("[LobbyPopupController] SetRoomProp"); Hashtable val = new Hashtable { [(object)key] = value }; ApplySettingsFromRoom(val); PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } public void LoadMySettings() { MyDebug.Log("[LobbyPopupController] LoadMySettings"); ActiveSettings.Instance.InitBindings(); StatsManager.instance.runStats["level"] = ActiveSettings.Instance.LevelActive - 1; RunManager.instance.levelsCompleted = ActiveSettings.Instance.LevelActive - 1; } public REPOPopupPage CreateImpostorSettingsUI() { //IL_0022: 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_0082: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown MyDebug.Log("[LobbyPopupController] CreateImpostorSettingsUI"); REPOPopupPage val2 = MenuAPI.CreateREPOPopupPage("Impostor Mod Settings", false, false, 1.2f, (Vector2?)new Vector2(55f, 0f)); val2.OpenPage(true); object obj = <>c.<>9__32_0; if (obj == null) { ShouldCloseMenuDelegate val3 = () => false; <>c.<>9__32_0 = val3; obj = (object)val3; } val2.onEscapePressed = (ShouldCloseMenuDelegate)obj; impostorSettingsPage = val2; val2.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) ModEnabledToggle = MenuAPI.CreateREPOToggle("Mod Enabled", (Action<bool>)delegate(bool val) { if (PhotonNetwork.IsMasterClient) { SetRoomProp("modEnabled", val); } }, scrollView, Vector2.zero, "On", "Off", ActiveSettings.Instance.ModEnabledActive); if (!PhotonNetwork.IsMasterClient) { Button[] componentsInChildren = ((Component)ModEnabledToggle).GetComponentsInChildren<Button>(); Button[] array = componentsInChildren; foreach (Button val4 in array) { ((Selectable)val4).interactable = false; ((Behaviour)val4).enabled = false; ((UnityEventBase)val4.onClick).RemoveAllListeners(); } Slider componentInChildren = ((Component)ModEnabledToggle).GetComponentInChildren<Slider>(); if ((Object)(object)componentInChildren != (Object)null) { ((Selectable)componentInChildren).interactable = false; } } return ((Component)ModEnabledToggle).GetComponent<RectTransform>(); }, 0f, 0f); KillCooldownSlider = CreateSlider(val2, "Kill Cooldown", "", "killCD", 1f, 600f, ActiveSettings.Instance.KillCooldownActive, " s"); KillRangeSlider = CreateSlider(val2, "Kill Distance", "", "killRange", 1f, 20f, ActiveSettings.Instance.KillRangeActive, " m"); MeetingsCountSlider = CreateSlider(val2, "Emergency Meetings Per Player", "", "meetingsPP", 0f, 10f, ActiveSettings.Instance.EmergencyMeetingsPerPlayerActive, ""); MeetingsCooldownSlider = CreateSlider(val2, "Emergency Cooldown", "", "meetingsCD", 1f, 600f, ActiveSettings.Instance.EmergencyMeetingCooldownActive, " s"); VoteDurationSlider = CreateSlider(val2, "Voting Time", "", "voteTimer", 10f, 300f, ActiveSettings.Instance.VoteTimerSecondsActive, " s"); LevelSlider = CreateSlider(val2, "Level", "", "level", 1f, 1000f, ActiveSettings.Instance.LevelActive, ""); EndGameTreshSlider = CreateSlider(val2, "End Game Threshold", "End round when X players remain (incl. impostor)", "endGameTresh", 1f, 2f, ActiveSettings.Instance.EndGameTreshActive, ""); CreateDonationIcon(val2); return val2; } private void LateUpdate() { //IL_003b: 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_00c9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)donateButton != (Object)null) { ((Graphic)((Selectable)donateButton.menuButton.button).image).color = new Color(1f, 1f, 1f, 1f); } if ((Object)(object)payPalButton != (Object)null) { ((Graphic)((Selectable)payPalButton.menuButton.button).image).color = new Color(1f, 1f, 1f, 1f); } if ((Object)(object)kofiButton != (Object)null) { ((Graphic)((Selectable)kofiButton.menuButton.button).image).color = new Color(1f, 1f, 1f, 1f); } } private void ShowDonatePopup() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown REPOPopupPage popup = MenuAPI.CreateREPOPopupPage("THANK YOU!", false, false, 0f, (Vector2?)new Vector2(410f, 80f)); RectTransform[] componentsInChildren = ((Component)popup).GetComponentsInChildren<RectTransform>(); RectTransform[] array = componentsInChildren; foreach (RectTransform val in array) { val.sizeDelta = new Vector2(10f, 10f); } popup.rectTransform.sizeDelta = new Vector2(100f, 80f); popup.maskRectTransform.sizeDelta = new Vector2(100f, 80f); RectTransform rectTransform = ((TMP_Text)popup.headerTMP).rectTransform; rectTransform.anchoredPosition -= new Vector2(2f, 105f); ((TMP_Text)popup.headerTMP).enableAutoSizing = false; ((TMP_Text)popup.headerTMP).overflowMode = (TextOverflowModes)0; ((TMP_Text)popup.headerTMP).fontSize = 15f; ((TMP_Text)popup.headerTMP).rectTransform.sizeDelta = new Vector2(80f, 20f); popup.OpenPage(true); REPOPopupPage obj = popup; object obj2 = <>c.<>9__38_0; if (obj2 == null) { ShouldCloseMenuDelegate val2 = () => true; <>c.<>9__38_0 = val2; obj2 = (object)val2; } obj.onEscapePressed = (ShouldCloseMenuDelegate)obj2; popup.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_002e: 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_0054: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) payPalButton = MenuAPI.CreateREPOButton(" ", (Action)delegate { MyDebug.Log("[Donation] PayPal clicked"); Application.OpenURL("https://www.paypal.com/ncp/payment/YAJRFTRSDLXF2"); }, parent, default(Vector2)); payPalButton.overrideButtonSize = new Vector2(90f, 40f); ((Component)payPalButton).GetComponent<RectTransform>().anchoredPosition = Vector2.zero; Image component3 = ((Component)payPalButton).GetComponent<Image>(); if ((Object)(object)component3 != (Object)null) { Texture2D val4 = new Texture2D(1, 1); ImageConversion.LoadImage(val4, ModUtils.LoadSprite("paypal-icon.png")); Sprite sprite2 = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), Vector2.one * 0.5f); component3.sprite = sprite2; component3.preserveAspect = true; ((Graphic)component3).raycastTarget = true; } RectTransform component4 = ((Component)payPalButton.menuButton).GetComponent<RectTransform>(); component4.sizeDelta = new Vector2(50f, 50f); ((Transform)component4).position = Vector2.op_Implicit(new Vector2(485f, 55f)); ((Transform)component4).SetAsLastSibling(); }); popup.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_002e: 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_0054: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) kofiButton = MenuAPI.CreateREPOButton(" ", (Action)delegate { MyDebug.Log("[Donation] Ko-Fi clicked"); Application.OpenURL("https://ko-fi.com/Z8Z31KKWWM"); }, parent, default(Vector2)); kofiButton.overrideButtonSize = new Vector2(100f, 30f); ((Component)kofiButton).GetComponent<RectTransform>().anchoredPosition = Vector2.zero; Image component = ((Component)kofiButton).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { Texture2D val3 = new Texture2D(1, 1); ImageConversion.LoadImage(val3, ModUtils.LoadSprite("kofi-icon.png")); Sprite sprite = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), Vector2.one * 0.5f); component.sprite = sprite; component.preserveAspect = true; ((Graphic)component).raycastTarget = true; } RectTransform component2 = ((Component)kofiButton.menuButton).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(50f, 50f); ((Transform)component2).position = Vector2.op_Implicit(new Vector2(480f, 35f)); ((Transform)component2).SetAsLastSibling(); }); popup.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) closeDonationPopupButton = MenuAPI.CreateREPOButton("x", (Action)delegate { popup.ClosePage(true); }, parent, new Vector2(568f, 100f)); ((TMP_Text)closeDonationPopupButton.labelTMP).fontSize = 12f; ((Selectable)closeDonationPopupButton.menuButton.button).transition = (Transition)0; }); } private void CreateDonationIcon(REPOPopupPage page) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown page.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0098: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) donateButton = MenuAPI.CreateREPOButton(" ", (Action)delegate { ShowDonatePopup(); MyDebug.Log("[Donation] Opening donation popup..."); }, parent, default(Vector2)); donateButton.overrideButtonSize = new Vector2(50f, 50f); Image component = ((Component)donateButton).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { Texture2D val = new Texture2D(1, 1); ImageConversion.LoadImage(val, ModUtils.LoadSprite("DonateIcon.png")); Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.one * 0.5f); component.sprite = sprite; component.preserveAspect = true; ((Graphic)component).raycastTarget = true; } RectTransform component2 = ((Component)donateButton.menuButton).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(50f, 50f); ((Transform)component2).position = Vector2.op_Implicit(new Vector2(400f, 35f)); ((Transform)component2).SetAsLastSibling(); GameObject tooltip = TooltipHelpers.CreateTooltip(parent, "Click to support this mod!"); TooltipTrigger tooltipTrigger = ((Component)donateButton).gameObject.GetComponent<TooltipTrigger>(); if ((Object)(object)tooltipTrigger == (Object)null) { tooltipTrigger = ((Component)donateButton).gameObject.AddComponent<TooltipTrigger>(); } tooltipTrigger.tooltip = tooltip; tooltipTrigger.offset = new Vector2(10f, 20f); tooltipTrigger.showDelay = 0.12f; MenuButtonHoverWatcher menuButtonHoverWatcher = ((Component)donateButton).gameObject.GetComponent<MenuButtonHoverWatcher>(); if ((Object)(object)menuButtonHoverWatcher == (Object)null) { menuButtonHoverWatcher = ((Component)donateButton).gameObject.AddComponent<MenuButtonHoverWatcher>(); } menuButtonHoverWatcher.tooltip = tooltip; menuButtonHoverWatcher.showDelay = 0.12f; }); } private void DisableSlider(REPOSlider slider) { Button[] componentsInChildren = ((Component)slider).GetComponentsInChildren<Button>(true); Button[] array = componentsInChildren; foreach (Button val in array) { ((Selectable)val).interactable = false; ((UnityEventBase)val.onClick).RemoveAllListeners(); } Graphic[] componentsInChildren2 = ((Component)slider).GetComponentsInChildren<Graphic>(true); Graphic[] array2 = componentsInChildren2; foreach (Graphic val2 in array2) { val2.raycastTarget = false; } Graphic component = ((Component)slider).GetComponent<Graphic>(); if ((Object)(object)component != (Object)null) { component.raycastTarget = false; } ((Behaviour)slider).enabled = false; CanvasGroup val3 = ((Component)slider).GetComponent<CanvasGroup>(); if ((Object)(object)val3 == (Object)null) { val3 = ((Component)slider).gameObject.AddComponent<CanvasGroup>(); } val3.blocksRaycasts = false; typeof(REPOSlider).GetField("onValueChanged", BindingFlags.Instance | BindingFlags.Public)?.SetValue(slider, null); } private REPOSlider CreateSlider(REPOPopupPage page, string label, string description, string propKey, float min, float max, float defaultValue, string postfix) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown REPOSlider slider = null; page.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform scrollView) { //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) string text = label; string text2 = description; Action<float> obj = delegate(float val) { if (PhotonNetwork.IsMasterClient) { SetRoomProp(propKey, (int)val); if ("level" == propKey) { StatsManager.instance.runStats["level"] = (int)val - 1; RunManager.instance.levelsCompleted = (int)val - 1; } } }; float num = min; float num2 = max; float num3 = defaultValue; string text3 = postfix; slider = MenuAPI.CreateREPOSlider(text, text2, obj, scrollView, default(Vector2), num, num2, 0, num3, "", text3, (BarBehavior)0); if (!PhotonNetwork.IsMasterClient) { DisableSlider(slider); } return ((Component)slider).GetComponent<RectTransform>(); }, 0f, 0f); return slider; } private void RefreshSlidersFromActiveSettings(REPOSlider slider, int value) { if ((Object)(object)slider == (Object)null) { Debug.LogWarning((object)$"[LobbyPopupController] RefreshSlidersFromActiveSettings: slider is null for value={value}"); return; } MyDebug.Log("slider=" + (object)slider); slider.SetValue((float)value, false); } private void RefreshToggleFromActiveSettings(bool value) { if ((Object)(object)ModEnabledToggle == (Object)null) { Debug.LogWarning((object)$"[LobbyPopupController] RefreshToggleFromActiveSettings: ModEnabledToggle is null for value={value}"); return; } MyDebug.Log("ModEnabledToggle=" + (object)ModEnabledToggle); ModEnabledToggle.SetState(value, false); } private static void LogHashtable(string prefix, Hashtable props) { if (props == null) { MyDebug.Log(prefix + ": (null)"); return; } string text = string.Join(", ", ((IEnumerable<KeyValuePair<object, object>>)props).Select((KeyValuePair<object, object> kvp) => $"{kvp.Key}={kvp.Value}")); MyDebug.Log(prefix + ": " + text); } private static void ApplySettingsFromRoom(Hashtable props) { LogHashtable("[LobbyPopupController] ApplySettingsFromRoom", props); if (((Dictionary<object, object>)(object)props).TryGetValue((object)"modEnabled", out object value)) { ActiveSettings.Instance.ModEnabledActive = (bool)value; } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"killCD", out object value2)) { ActiveSettings.Instance.KillCooldownActive = (int)value2; } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"killRange", out object value3)) { ActiveSettings.Instance.KillRangeActive = (int)value3; } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"meetingsPP", out object value4)) { ActiveSettings.Instance.EmergencyMeetingsPerPlayerActive = (int)value4; } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"meetingsCD", out object value5)) { ActiveSettings.Instance.EmergencyMeetingCooldownActive = (int)value5; } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"voteTimer", out object value6)) { ActiveSettings.Instance.VoteTimerSecondsActive = (int)value6; } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"level", out object value7)) { ActiveSettings.Instance.LevelActive = (int)value7; } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"endGameTresh", out object value8)) { ActiveSettings.Instance.EndGameTreshActive = (int)value8; } } public override void OnRoomPropertiesUpdate(Hashtable props) { MyDebug.Log("[LobbyPopupController] OnRoomPropertiesUpdate"); if (!PhotonNetwork.IsMasterClient) { UpdateRoomProperties(props); } } public void UpdateRoomProperties(Hashtable props) { MyDebug.Log("[LobbyPopupController] UpdateRoomProperties" + (object)props); LobbyPopupController[] components = ((Component)this).GetComponents<LobbyPopupController>(); MyDebug.Log($"[Diag] Found {components.Length} LobbyPopupController components on {((Object)((Component)this).gameObject).name}"); if (((Dictionary<object, object>)(object)props).TryGetValue((object)"modEnabled", out object value)) { MyDebug.Log("[LobbyPopupController] props value=" + value); ActiveSettings.Instance.ModEnabledActive = (bool)value; RefreshToggleFromActiveSettings((bool)value); } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"killCD", out object value2)) { MyDebug.Log("[LobbyPopupController] props value=" + value2); ActiveSettings.Instance.KillCooldownActive = (int)value2; RefreshSlidersFromActiveSettings(KillCooldownSlider, (int)value2); } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"killRange", out object value3)) { MyDebug.Log("[LobbyPopupController] props value=" + value3); ActiveSettings.Instance.KillRangeActive = (int)value3; RefreshSlidersFromActiveSettings(KillRangeSlider, (int)value3); } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"meetingsPP", out object value4)) { MyDebug.Log("[LobbyPopupController] props value=" + value4); ActiveSettings.Instance.EmergencyMeetingsPerPlayerActive = (int)value4; RefreshSlidersFromActiveSettings(MeetingsCountSlider, (int)value4); } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"meetingsCD", out object value5)) { MyDebug.Log("[LobbyPopupController] props value=" + value5); ActiveSettings.Instance.EmergencyMeetingCooldownActive = (int)value5; RefreshSlidersFromActiveSettings(MeetingsCooldownSlider, (int)value5); } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"voteTimer", out object value6)) { MyDebug.Log("[LobbyPopupController] props value=" + value6); ActiveSettings.Instance.VoteTimerSecondsActive = (int)value6; RefreshSlidersFromActiveSettings(VoteDurationSlider, (int)value6); } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"level", out object value7)) { MyDebug.Log("[LobbyPopupController] props value=" + value7); ActiveSettings.Instance.LevelActive = (int)value7; RefreshSlidersFromActiveSettings(LevelSlider, (int)value7); StatsManager.instance.runStats["level"] = (int)value7 - 1; RunManager.instance.levelsCompleted = (int)value7 - 1; } if (((Dictionary<object, object>)(object)props).TryGetValue((object)"endGameTresh", out object value8)) { MyDebug.Log("[LobbyPopupController] props value=" + value8); ActiveSettings.Instance.EndGameTreshActive = (int)value8; RefreshSlidersFromActiveSettings(EndGameTreshSlider, (int)value8); } } } [RequireComponent(typeof(PhotonView))] public class MeetingController : MonoBehaviourPunCallbacks, ICleanupable { private int meetingsLeft; private float meetingCooldown; private bool initialized = false; private Button meetingButton; private PlayerAvatar localAvatar; private VoteController _voteController; private Text cooldownText; private REPOPopupPage meetingPage; private void Awake() { _voteController = ((Component)this).GetComponent<VoteController>(); if ((Object)(object)_voteController == (Object)null) { Debug.LogError((object)"[ReportController] Couldn’t find VoteController!"); } } private void Update() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //IL_019f: Unknown result type (might be due to invalid IL or missing references) bool flag = MyGameManager.Instance.IAmDead || (SemiFunc.IsMultiplayer() && (Object)(object)LevelGenerator.Instance != (Object)null && LevelGenerator.Instance.Generated && (Object)(object)GameDirector.instance != (Object)null && SemiFunc.RunIsLevel() && (int)GameDirector.instance.currentState == 2); if (MyGameManager.Instance.IAmDead || !flag) { return; } if (!initialized) { CacheLocalAvatar(); SaveHostSettingsToConfig(); LobbyPopupController.Instance.Cleanup(); ModManager modManager = Object.FindObjectOfType<ModManager>(); if (!ActiveSettings.Instance.ModEnabledActive) { if (ModManager.ModEnabled) { modManager.DisableMod(); } return; } CreateMeetingButton(); meetingsLeft = ActiveSettings.Instance.EmergencyMeetingsPerPlayerActive; meetingCooldown = ActiveSettings.Instance.EmergencyMeetingCooldownActive; initialized = true; modManager.mainGameInitialized = true; SetPlayerStats(); MyDebug.Log("[MeetingController] initialize."); } bool flag2 = (Object)(object)localAvatar.RoomVolumeCheck != (Object)null && localAvatar.RoomVolumeCheck.inTruck; if (flag2) { ShowMeetingButton(); } else { HideMeetingButton(); } if (flag2 && meetingCooldown <= 0f) { ((Selectable)meetingButton).interactable = true; if ((Object)(object)MenuManager.instance?.currentMenuPage == (Object)null && Input.GetKeyDown(REPOImpostorMod.Instance.MeetingKey)) { MyDebug.Log("[MeetingController] Meeting hotkey pressed"); OnMeetingPressed(); } } if (meetingCooldown > 0f) { meetingCooldown -= Time.deltaTime; cooldownText.text = Mathf.CeilToInt(meetingCooldown).ToString(); if (meetingCooldown <= 0f) { meetingCooldown = 0f; cooldownText.text = ""; } } } private void SetPlayerStats() { int levelActive = ActiveSettings.Instance.LevelActive; string userId = PhotonNetwork.LocalPlayer.UserId; float num = 0.99f; float num2 = (1f - Mathf.Pow(num, (float)levelActive)) / (1f - num); int num3 = Mathf.FloorToInt(num2 + 1E-06f); num3 = Mathf.Max(0, num3); for (int i = 0; i < num3; i++) { PunManager.instance.UpgradePlayerHealth(userId); PunManager.instance.UpgradePlayerEnergy(userId); PunManager.instance.UpgradePlayerExtraJump(userId); PunManager.instance.UpgradePlayerTumbleLaunch(userId); PunManager.instance.UpgradePlayerGrabStrength(userId); PunManager.instance.UpgradePlayerGrabRange(userId); } for (int j = 0; j < num3 / 3; j++) { PunManager.instance.UpgradePlayerThrowStrength(userId); } for (int k = 0; k < num3 / 4; k++) { PunManager.instance.UpgradePlayerSprintSpeed(userId); } PunManager.instance.UpgradePlayerCrouchRest(userId); PunManager.instance.UpgradeMapPlayerCount(userId); PunManager.instance.UpgradePlayerTumbleWings(userId); } private void SaveHostSettingsToConfig() { ActiveSettings instance = ActiveSettings.Instance; REPOImpostorMod.Instance.SaveConfig(instance); } private void ShowMeetingButton() { ((Component)meetingButton).gameObject.SetActive(true); } private void HideMeetingButton() { ((Component)meetingButton).gameObject.SetActive(false); } private void CreateMeetingButton() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0096: 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_00d8: 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_00f3: 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_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_0162: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) MyDebug.Log("CreateMeetingButton"); GameObject uiContainer = UIButtonManager.Instance.uiContainer; GameObject val = new GameObject("MeetingButton"); val.transform.SetParent(uiContainer.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(1f, 0f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(1f, 0f); val2.anchoredPosition = new Vector2(120f, -170f); val2.sizeDelta = new Vector2(60f, 60f); meetingButton = val.AddComponent<Button>(); UIButtonManager.Instance.meetingButton = meetingButton; UIButtonKeyLabel.AttachKeyLabel(val, meetingButton, REPOImpostorMod.Instance.MeetingKey, new Vector2(-31f, -6f)); Image val4 = val.AddComponent<Image>(); Texture2D val5 = new Texture2D(2, 2); ImageConversion.LoadImage(val5, ModUtils.LoadSprite("EmergencyMeetingIcon.png")); val4.sprite = Sprite.Create(val5, new Rect(0f, 0f, (float)((Texture)val5).width, (float)((Texture)val5).height), Vector2.one * 0.5f); val4.preserveAspect = true; ((Selectable)meetingButton).targetGraphic = (Graphic)(object)val4; GameObject val6 = new GameObject("CooldownText"); val6.transform.SetParent(val.transform, false); cooldownText = val6.AddComponent<Text>(); cooldownText.alignment = (TextAnchor)4; cooldownText.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); cooldownText.fontSize = 40; ((Graphic)cooldownText).color = Color.white; ((Graphic)cooldownText).raycastTarget = false; ((Selectable)meetingButton).interactable = false; } private void OnMeetingPressed() { ((Selectable)meetingButton).interactable = false; PopupManager.Instance.OpenManagedPopupDelayed(() => MenuAPI.CreateREPOPopupPage("Emergency Meeting", false, true, 1.5f, (Vector2?)new Vector2(-110f, 0f)), delegate(REPOPopupPage meetingPage) { //IL_0035: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown UIButtonManager.Instance.HideAll(); meetingPage.rectTransform.sizeDelta = new Vector2(140f, 10f); meetingPage.maskRectTransform.sizeDelta = new Vector2(140f, 10f); RectTransform rectTransform = ((TMP_Text)meetingPage.headerTMP).rectTransform; rectTransform.anchoredPosition += new Vector2(0f, -50f); ((Graphic)meetingPage.headerTMP).color = Color.red; ((TMP_Text)meetingPage.headerTMP).enableAutoSizing = false; ((TMP_Text)meetingPage.headerTMP).overflowMode = (TextOverflowModes)0; ((TMP_Text)meetingPage.headerTMP).fontSize = 45f; ((TMP_Text)meetingPage.headerTMP).rectTransform.sizeDelta = new Vector2(300f, 75f); meetingPage.OpenPage(true); meetingPage.AddElement((BuilderDelegate)delegate(Transform parent) { //IL_006b: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) string text = "YOU HAVE\n" + $"{meetingsLeft}\n" + "EMERGENCY MEETING" + ((meetingsLeft == 1) ? "" : "S") + " LEFT"; REPOLabel val = MenuAPI.CreateREPOLabel(text, parent, new Vector2(240f, 180f)); TextMeshProUGUI labelTMP = val.labelTMP; ((TMP_Text)labelTMP).alignment = (TextAlignmentOptions)514; ((TMP_Text)labelTMP).fontSize = 29f; ((TMP_Text)labelTMP).enableAutoSizing = false; ((TMP_Text)labelTMP).fontSizeMin = 29f; ((TMP_Text)labelTMP).fontSizeMax = 29f; ((Graphic)labelTMP).color = Color.white; ((TMP_Text)labelTMP).fontStyle = (FontStyles)0; RectTransform component = ((Component)val).GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.37f, 0.5f); component.anchoredPosition = new Vector2(0f, -35f); component.sizeDelta = new Vector2(0f, 100f); if (meetingsLeft > 0) { REPOButton val2 = MenuAPI.CreateREPOButton("USE IT", (Action)delegate { meetingsLeft--; StartMeeting(); }, parent, new Vector2(260f, 75f)); ((Selectable)val2.menuButton.button).transition = (Transition)0; } REPOButton val3 = MenuAPI.CreateREPOButton("RETURN", (Action)delegate { meetingPage.ClosePage(true); ((Selectable)meetingButton).interactable = true; MyDebug.Log("[MeetingController] ShowAll triggered from MeetingController::RETURN"); UIButtonManager.Instance.ShowAll(); }, parent, new Vector2(400f, 75f)); ((Selectable)val3.menuButton.button).transition = (Transition)0; }); }); } private void StartMeeting() { ((Selectable)meetingButton).interactable = false; int actorNumber = PhotonNetwork.LocalPlayer.ActorNumber; MyDebug.Log("[MeetingController] StartMeeting clicked"); ((MonoBehaviourPun)this).photonView.RPC("RPC_EmergencyMeeting", (RpcTarget)0, new object[1] { actorNumber }); } [PunRPC] private void RPC_EmergencyMeeting(int reporterActor) { MyDebug.Log($"[MeetingController] Meeting requested by Actor {reporterActor}"); if ((Object)(object)_voteController == (Object)null) { Debug.LogError((object)"[MeetingController] ❌ VoteController not found on this GameObject!"); } MyDebug.Log("[MeetingController] RPC_EmergencyMeeting iAmAlive=" + ((Object)(object)localAvatar != (Object)null && ((Component)localAvatar).gameObject.activeInHierarchy)); if (PhotonNetwork.IsMasterClient) { _voteController.HostStartVote(reporterActor, -1); } } private void CacheLocalAvatar() { if (!((Object)(object)localAvatar != (Object)null)) { MyDebug.Log("[ReportController] CacheLocalAvatar()"); localAvatar = ((IEnumerable<PlayerAvatar>)Object.FindObjectsOfType<PlayerAvatar>()).FirstOrDefault((Func<PlayerAvatar, bool>)((PlayerAvatar a) => a.photonView.IsMine)); } } internal void ResumeAfterVote() { MyDebug.Log("[MeetingController] ShowAll triggered from MeetingController::ResumeAfterVote"); UIButtonManager.Instance.ShowAll(); ((Selectable)meetingButton).interactable = false; meetingCooldown = ActiveSettings.Instance.EmergencyMeetingCooldownActive; } public void Cleanup() { MyDebug.Log("[MeetingController] GameDirector.instance.currentState=" + ((object)(gameState)(ref GameDirector.instance.currentState)).ToString()); MyDebug.Log("[MeetingController] SemiFunc.RunIsLevel()=" + SemiFunc.RunIsLevel()); MyDebug.Log("[MeetingController] clean up"); initialized = false; if ((Object)(object)meetingButton != (Object)null) { Object.Destroy((Object)(object)((Component)((Component)meetingButton).gameObject.transform.parent).gameObject); meetingButton = null; } } } [BepInPlugin("com.splitbrudis.impostormod.MenuPageLobbyPatch", "MenuPageLobbyPatch", "1.2.0")] public class MenuPageLobbyPatch : BaseUnityPlugin { private void Awake() { Object.DontDestroyOnLoad((Object)(object)this); Harmony.CreateAndPatchAll(typeof(MenuPageLobbyPatches), (string)null); } } internal static class MenuPageLobbyPatches { [HarmonyPostfix] [HarmonyPatch(typeof(MenuPageLobby), "Start")] private static void MenuPageLobby_Start_Postfix(MenuPageLobby __instance) { LobbyPopupController.Instance.JoinRoom(); } } public class ModManager : MonoBehaviour { public static MyGameManagerController MyGameManagerController; public static bool ModEnabled; private static GameObject controllersGO; private ImpostorController impostorController; private VoteController voteController; private ReportController reportController; private MeetingController meetingController; private ActiveSettings activeSettings; private LobbyPopupController lobbyPopupController; private MyGameManagerController gameManagerController; private AvatarRPCReceiver avatarRPCReceiver; private UIButtonManager uiButtonManager; public bool mainGameInitialized = false; public void EnableMod() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown if (!((Object)(object)controllersGO != (Object)null)) { MyDebug.Log("[ModManager] Mod aktiviert – Erstelle GameControllers."); controllersGO = new GameObject("GameControllers"); Object.DontDestroyOnLoad((Object)(object)controllersGO); PhotonView val = controllersGO.AddComponent<PhotonView>(); if (!PhotonNetwork.AllocateViewID(val)) { Debug.LogError((object)"[ModManager] Failed to AllocateViewID!"); Object.Destroy((Object)(object)controllersGO); controllersGO = null; return; } MyDebug.Log($"[ModManager] Allocated controllersGO PhotonView.ViewID={val.ViewID}"); impostorController = controllersGO.AddComponent<ImpostorController>(); voteController = controllersGO.AddComponent<VoteController>(); reportController = controllersGO.AddComponent<ReportController>(); meetingController = controllersGO.AddComponent<MeetingController>(); activeSettings = controllersGO.AddComponent<ActiveSettings>(); lobbyPopupController = controllersGO.AddComponent<LobbyPopupController>(); gameManagerController = controllersGO.AddComponent<MyGameManagerController>(); avatarRPCReceiver = controllersGO.AddComponent<AvatarRPCReceiver>(); uiButtonManager = controllersGO.AddComponent<UIButtonManager>(); MyGameManagerController = gameManagerController; voteController._meetingController = meetingController; gameManagerController._voteController = voteController; ModEnabled = true; } } public void DisableMod() { if ((Object)(object)controllersGO != (Object)null) { MyDebug.Log("[ModManager] Mod deaktiviert – Zerstöre GameControllers."); CleanUp(); Object.Destroy((Object)(object)controllersGO); controllersGO = null; impostorController = null; voteController = null; reportController = null; meetingController = null; activeSettings = null; lobbyPopupController = null; gameManagerController = null; avatarRPCReceiver = null; MyGameManagerController = null; uiButtonManager = null; } ModEnabled = false; } internal void CleanUp() { if ((Object)(object)controllersGO == (Object)null) { return; } MyDebug.Log("[ModManager] Running controller Cleanup()..."); TryCallCleanup(impostorController); TryCallCleanup(voteController); TryCallCleanup(reportController); TryCallCleanup(meetingController); TryCallCleanup(MyGameManager.Instance); PhotonView component = controllersGO.GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { try { PhotonNetwork.RemoveRPCs(component); MyDebug.Log($"[ModManager] Removed buffered RPCs for controllersPV ViewID={component.ViewID}"); } catch (Exception arg) { Debug.LogWarning((object)$"[ModManager] Exception while removing buffered RPCs: {arg}"); } } mainGameInitialized = false; } private void TryCallCleanup(ICleanupable c) { if (c == null) { return; } try { c.Cleanup(); } catch (Exception arg) { Debug.LogError((object)$"Error during Cleanup() on {c.GetType().Name}: {arg}"); } } } public static class MyDebug { private static readonly bool debug; public static void Log(string message) { if (debug) { Debug.Log((object)message); } } } public class MyGameManager : MonoBehaviourPunCallbacks, ICleanupable { public bool gameOver = false; public int _impostorActorNumber; private static MyGameManager _instance; public bool IAmDead { get; private set; } public static MyGameManager Instance { get { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { MyDebug.Log("[MyGameManager] Instance getter: creating manager"); GameObject val = new GameObject("MyGameManager"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent<MyGameManager>(); _instance.IAmDead = false; } return _instance; } } public void MarkMeDead() { IAmDead = true; } public void ResetRound() { MyDebug.Log("[MyGameManager] Resetting round state"); IAmDead = false; } public void Cleanup() { gameOver = false; IAmDead = false; _impostorActorNumber = -1; } } [RequireComponent(typeof(PhotonView))] public class MyGameManagerController : MonoBehaviourPunCallbacks { [CompilerGenerated] private sealed class <StopVotingInProgress>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public MyGameManagerController <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StopVotingInProgress>d__5(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(1f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this._voteController.StopVotingInProgress(); 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 VoteController _voteController; public override void OnMasterClientSwitched(Player newMasterClient) { MyDebug.Log("[MyGameManager] Master client switched"); ModManager modManager = Object.FindObjectOfType<ModManager>(); if ((Object)(object)modManager != (Object)null) { modManager.CleanUp(); MyGameManager.Instance.gameOver = true; } } public override void OnPlayerLeftRoom(Player player) { MyDebug.Log("[MyGameManager] OnPlayerLeftRoom"); ModManager modManager = Object.FindObjectOfType<ModManager>(); if ((!((Object)(object)modManager != (Object)null) || modManager.mainGameInitialized) && PhotonNetwork.IsMasterClient && !MyGameManager.Instance.gameOver) { PlayerAvatar val = ((IEnumerable<PlayerAvatar>)Object.FindObjectsOfType<PlayerAvatar>()).FirstOrDefault((Func<PlayerAvatar, bool>)((PlayerAvatar av) => av.photonView.Owner.ActorNumber == player.ActorNumber)); CheckWinConditionsAsHost(val.photonView.OwnerActorNr); } } public void OnPlayerKilled(int victimActorNumber) { if (!MyGameManager.Instance.gameOver) { MyDebug.Log($"[MyGameManager] Player killed: {victimActorNumber}"); bool flag = CheckWinConditionsAsHost(victimActorNumber); if ((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null) { Debug.LogError((object)"RPC_ShowVoteResultAnd photonView reference is null — can't send RPC"); } else { MyDebug.Log($"Sending RPC_ShowVoteResultAnd on photonView.ViewID={((MonoBehaviourPun)this).photonView.ViewID}"); } if (flag) { ((MonoBehaviourPun)this).photonView.RPC("RPC_ShowVoteResultAndThenGameOver", (RpcTarget)0, new object[2] { victimActorNumber, _voteController.votedPlayerIsGettingKilled }); } else if (_voteController.votedPlayerIsGettingKilled) { ((MonoBehaviourPun)this).photonView.RPC("RPC_ShowVoteResultAndThenContinue", (RpcTarget)0, new object[1] { victimActorNumber }); } } } [PunRPC] private void RPC_ShowVoteResultAndThenContinue(int victimActorNumber) { //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_011d: Unknown result type (might be due to invalid IL or missing references) PhotonView photonView = ((MonoBehaviourPun)this).photonView; MyDebug.Log($"Received RPC_EndGame for viewID {((photonView != null) ? photonView.ViewID : 0)}"); PlayerAvatar playerAvatarByActorNumber = GetPlayerAvatarByActorNumber(victimActorNumber); PlayerAvatar val = ((playerAvatarByActorNumber != null) ? ((Component)playerAvatarByActorNumber).GetComponent<PlayerAvatar>() : null); bool flag = (Object)(object)val != (Object)null && (val.photonView.OwnerActorNr == MyGameManager.Instance._impostorActorNumber || val.photonView.CreatorActorNr == MyGameManager.Instance._impostorActorNumber); MyDebug.Log("[MyGameManager] ShowVoteResultAndThenContinue=" + (((Object)(object)val != (Object)null) ? val.photonView.ViewID : (-1)) + ", is impostor=" + flag); string headerText = "Vote Result"; string text = (((Object)(object)val != (Object)null) ? SemiFunc.PlayerGetName(val) : "No Name Found"); string bodyText = text + " was ejected. They were not the impostor."; Color red = Color.red; MyDebug.Log("[MyGameManager] RPC_AnnounceVoteResult open popUp"); MyDebug.Log("[MyGameManager] ShowVoteResultAndThenContinue, MenuManager.instance.currentMenuPage=" + (object)MenuManager.instance.currentMenuPage); PagePopUp(headerText, red, bodyText, "Continue", delegate { _voteController.ResumeAfterVoteResults(); }, closeThisPopup: true); ((MonoBehaviour)this).StartCoroutine(StopVotingInProgress()); } [IteratorStateMachine(typeof(<StopVotingInProgress>d__5))] private IEnumerator StopVotingInProgress() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StopVotingInProgress>d__5(0) { <>4__this = this }; } private PlayerAvatar GetPlayerAvatarByActorNumber(int actorNumber) { return GameDirector.instance.PlayerList.Find((PlayerAvatar p) => p.photonView.OwnerActorNr == actorNumber); } [PunRPC] private void RPC_ShowVoteResultAndThenGameOver(int victimActorNumber, bool lastPlayerVoted) { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) PhotonView photonView = ((MonoBehaviourPun)this).photonView; MyDebug.Log($"Received RPC_EndGame for viewID {((photonView != null) ? photonView.ViewID : 0)}"); bool flag = !lastPlayerVoted; MyGameManager.Instance.gameOver = true; bool flag2 = victimActorNumber == MyGameManager.Instance._impostorActorNumber; MyDebug.Log("[MyGameManager] ShowVoteResultAndThenGameOver=" + victimActorNumber + ", is impostor=" + flag2 + ", lastPlayerVoted=" + lastPlayerVoted); string headerText = ((!flag) ? "Vote Result" : (flag2 ? "Bye Bye, Impostor!" : "No Players left")); PlayerAvatar playerAvatarByActorNumber = GetPlayerAvatarByActorNumber(victimActorNumber); PlayerAvatar val = ((playerAvatarByActorNumber != null) ? ((Component)playerAvatarByActorNumber).GetComponent<PlayerAvatar>() : null); string text = (((Object)(object)val != (Object)null) ? SemiFunc.PlayerGetName(val) : "No Name Found"); string text2; Color headerColor; if (flag) { text2 = text + " was killed."; headerColor = Color.red; } else if (flag2) { text2 = text + " was ejected. They were the impostor!"; headerColor = Color.green; } else { text2 = text + " was ejected. They were not the impostor."; headerColor = Color.red; } MyDebug.Log("[MyGameManager] ShowVoteResultAndThenGameOver, msg=" + text2); PagePopUp(headerText, headerColor, text2, "Continue", delegate { }); } public void PagePopUp(string headerText, Color headerColor, string bodyText, string buttonText, Action onClick, bool closeThisPopup = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ModUtils.OpenPagePopUp(headerText, headerColor, bodyText, buttonText, onClick, allowTextOverflow: true, closeThisPopup); } private bool CheckWinConditionsAsHost(int playerActorNumber) { MyDebug.Log("Stored _impostorActorNumber = " + MyGameManager.Instance._impostorActorNumber); MyDebug.Log("CheckWinConditionsAsHost with playerViewID = " + playerActorNumber); if (playerActorNumber == MyGameManager.Instance._impostorActorNumber) { MyDebug.Log("[MyGameManager] Impostor left → crew victory!"); if ((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null) { Debug.LogError((object)"photonView reference is null — can't send RPC"); } else { MyDebug.Log($"Sending RPC RPC_EndGame on photonView.ViewID={((MonoBehaviourPun)this).photonView.ViewID}"); } MyGameManager.Instance.gameOver = true; ((MonoBehaviourPun)this).photonView.RPC("RPC_EndGame", (RpcTarget)0, new object[1] { true }); return true; } List<int> list = (from av in GameDirector.instance.PlayerList where !av.deadSet select av.photonView.OwnerActorNr).ToList(); Player[] playerList = PhotonNetwork.PlayerList; int endGameTreshActive = ActiveSettings.Instance.EndGameTreshActive; if (list.Count <= endGameTreshActive || playerList.Length <= endGameTreshActive) { if ((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null) { Debug.LogError((object)"photonView reference is null — can't send RPC"); } else { MyDebug.Log($"Sending RPC RPC_EndGame on photonView.ViewID={((MonoBehaviourPun)this).photonView.ViewID}"); } int[] array = playerList.Select((Player p) => p.ActorNumber).ToArray(); int impostorActorNumber = MyGameManager.Instance._impostorActorNumber; MyGameManager.Instance.gameOver = true; if (array.Length <= endGameTreshActive && Extensions.Contains(array, impostorActorNumber)) { MyDebug.Log("[MyGameManager] Only impostor remains (remainingInPhoton) → impostor wins!"); ((MonoBehaviourPun)this).photonView.RPC("RPC_EndGame", (RpcTarget)0, new object[1] { false }); } else if (list.Count <= endGameTreshActive && list.Contains(impostorActorNumber)) { MyDebug.Log("[MyGameManager] Only impostor remains (remainingAlive) → impostor wins!"); ((MonoBehaviourPun)this).photonView.RPC("RPC_EndGame", (RpcTarget)0, new object[1] { false }); } else { MyDebug.Log("[MyGameManager] Only crew player remains → crew wins!"); ((MonoBehaviourPun)this).photonView.RPC("RPC_EndGame", (RpcTarget)0, new object[1] { true }); } return true; } MyDebug.Log("[MyGameManager] remaining1 count=" + list.Count); MyDebug.Log("[MyGameManager] playerList.Length=" + playerList.Length); return false; } } [HarmonyPatch(typeof(PlayerAvatar), "Start")] internal static class Patch_PlayerAvatar_Start { private static void Postfix(PlayerAvatar __instance) { if ((Object)(object)((Component)__instance).GetComponent<AvatarRPCReceiver>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<AvatarRPCReceiver>(); } } } [HarmonyPatch(typeof(PlayerAvatar), "ReviveRPC")] internal static class Patch_PlayerAvatar_ReviveRPC { private static bool Prefix(bool _revivedByTruck, PhotonMessageInfo _info) { if (!ModManager.ModEnabled) { return true; } MyDebug.Log("[Patch] ReviveRPC suppressed"); return false; } } [HarmonyPatch(typeof(PlayerAvatar), "Revive")] internal static class Patch_PlayerAvatar_Revive { private static bool Prefix(bool _revivedByTruck = false) { if (!ModManager.ModEnabled) { return true; } MyDebug.Log("[Patch] Revive suppressed"); return false; } } public class PhotonDebug : MonoBehaviour { private void Start() { LogAllPhotonViews(); } [ContextMenu("LogPhotonViews")] public void LogAllPhotonViews() { PhotonView[] array = Object.FindObjectsOfType<PhotonView>(); MyDebug.Log($"--- PhotonViews on {PhotonNetwork.NickName} (Actor {PhotonNetwork.LocalPlayer.ActorNumber}) ---"); PhotonView[] array2 = array; foreach (PhotonView val in array2) { MyDebug.Log($"PV name:{((Object)((Component)val).gameObject).name} viewID:{val.ViewID} creator:{val.CreatorActorNr} owner:{val.OwnerActorNr}"); } } } public class PopupManager : MonoBehaviour { [CompilerGenerated] private sealed class <CleanupLoop>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PopupManager <>4__this; private object <>s__1; private bool <>s__2; private int <i>5__3; private REPOPopupPage <popup>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CleanupLoop>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = null; <popup>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; break; case 1: <>1__state = -1; break; } <>s__1 = <>4__this._lock; <>s__2 = false; try { Monitor.Enter(<>s__1, ref <>s__2); <i>5__3 = <>4__this._popups.Count - 1; while (<i>5__3 >= 0) { <popup>5__4 = <>4__this._popups[<i>5__3]; if ((Object)(object)<popup>5__4 == (Object)null || (Object)(object)<popup>5__4.menuPage == (Object)null || (Object)(object)((Component)<popup>5__4).gameObject == (Object)null) { <>4__this._popups.RemoveAt(<i>5__3); } <popup>5__4 = null; <i>5__3--; } } finally { if (<>s__2) { Monitor.Exit(<>s__1); } } <>s__1 = null; <>2__current = (object)new WaitForSeconds(1f); <>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 <OpenManagedPopupCoroutine>d__15 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Func<REPOPopupPage> createPopupFactory; public Action<REPOPopupPage> onOpened; public PopupManager <>4__this; private REPOPopupPage <popup>5__1; private Excepti