using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace VloplandImpostorMode { [HarmonyPatch(typeof(RunManager), "ChangeLevel")] internal static class RunManagerChangeLevelPatch { private static void Prefix(RunManager __instance, ref ChangeLevelType _changeLevelType) { VloplandImpostorModePlugin instance = VloplandImpostorModePlugin.Instance; if (instance != null && instance.ModeEnabled.Value && PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient && ((Object)(object)__instance.levelCurrent == (Object)(object)__instance.levelLobby || (Object)(object)__instance.levelCurrent == (Object)(object)__instance.levelLobbyMenu) && __instance.levelsCompleted == 0 && ((int)_changeLevelType == 0 || (int)_changeLevelType == 1) && VloplandImpostorModePlugin.Instance.Runtime.ShouldStartInShop) { _changeLevelType = (ChangeLevelType)5; } } private static void Postfix(RunManager __instance, bool _completedLevel, bool _levelFailed) { VloplandImpostorModePlugin.Instance?.Runtime?.OnLevelTransition(__instance, _completedLevel, _levelFailed); } } [HarmonyPatch(typeof(LevelGenerator), "EnemySpawnBudgeted")] internal static class DisableAutomaticEnemySpawnPatch { private static bool Prefix(ref IEnumerator __result) { VloplandImpostorModePlugin instance = VloplandImpostorModePlugin.Instance; if (instance == null || !instance.ModeEnabled.Value || !PhotonNetwork.InRoom) { return true; } __result = Empty(); return false; } private static IEnumerator Empty() { yield break; } } internal sealed class ModeRpc : MonoBehaviour { private PhotonView _view; private ModeRuntime _runtime; internal void Bind(PhotonView view, ModeRuntime runtime) { _view = view; _runtime = runtime; } internal void ReportReady() { if (!((Object)(object)_view == (Object)null) && PhotonNetwork.InRoom && PhotonNetwork.LocalPlayer != null) { if (PhotonNetwork.IsMasterClient) { _runtime.OnClientReady(PhotonNetwork.LocalPlayer.ActorNumber); } else { _view.RPC("RpcClientReady", (RpcTarget)2, Array.Empty()); } } } internal void AssignRole(Player target, PlayerRole role) { if (!((Object)(object)_view == (Object)null) && target != null) { if (PhotonNetwork.LocalPlayer != null && target.ActorNumber == PhotonNetwork.LocalPlayer.ActorNumber) { _runtime.ReceiveRole(role); return; } _view.RPC("RpcAssignRole", target, new object[1] { (byte)role }); } } internal void SendProgress(Player target, PlayerRole role, int points, float energy, float energyMax, int voteWeight, int shields, int meetingBonus, int knifeLevel) { if (!((Object)(object)_view == (Object)null) && target != null) { if (PhotonNetwork.LocalPlayer != null && target.ActorNumber == PhotonNetwork.LocalPlayer.ActorNumber) { _runtime.ReceiveProgress(role, points, energy, energyMax, voteWeight, shields, meetingBonus, knifeLevel); return; } _view.RPC("RpcProgress", target, new object[8] { (byte)role, points, energy, energyMax, voteWeight, shields, meetingBonus, knifeLevel }); } } internal void StartMeeting(double deadline, int[] eligibleActors) { if ((Object)(object)_view != (Object)null) { _view.RPC("RpcMeetingStarted", (RpcTarget)0, new object[2] { deadline, eligibleActors }); } } internal void BroadcastTrapPlaced(int trapId, Vector3 position, double expiresAt, int kind) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_view != (Object)null) { _view.RPC("RpcTrapPlaced", (RpcTarget)0, new object[4] { trapId, position, expiresAt, kind }); } } internal void BroadcastTrapTriggered(int trapId, int actor) { if ((Object)(object)_view != (Object)null) { _view.RPC("RpcTrapTriggered", (RpcTarget)0, new object[2] { trapId, actor }); } } internal void BroadcastTrapRemoved(int trapId) { if ((Object)(object)_view != (Object)null) { _view.RPC("RpcTrapRemoved", (RpcTarget)0, new object[1] { trapId }); } } internal void ResolveMeeting(int ejectedActor, bool correct, string resultText) { if ((Object)(object)_view != (Object)null) { _view.RPC("RpcMeetingResolved", (RpcTarget)0, new object[3] { ejectedActor, correct, resultText }); } } internal void SetOutcome(SessionOutcome outcome, string resultText) { if ((Object)(object)_view != (Object)null) { _view.RPC("RpcSetOutcome", (RpcTarget)0, new object[2] { (byte)outcome, resultText }); } } internal void RequestVote(int candidateActor) { if (!((Object)(object)_view == (Object)null)) { if (PhotonNetwork.IsMasterClient && PhotonNetwork.LocalPlayer != null) { _runtime.OnVoteReceived(PhotonNetwork.LocalPlayer.ActorNumber, candidateActor); return; } _view.RPC("RpcVoteRequest", (RpcTarget)2, new object[1] { candidateActor }); } } internal void RequestKill(int targetActor) { if (!((Object)(object)_view == (Object)null)) { if (PhotonNetwork.IsMasterClient && PhotonNetwork.LocalPlayer != null) { _runtime.HostHandleKill(PhotonNetwork.LocalPlayer.ActorNumber, targetActor); return; } _view.RPC("RpcKillRequest", (RpcTarget)2, new object[1] { targetActor }); } } internal void RequestPlaceTrap(int kind, Vector3 position) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_view == (Object)null)) { if (PhotonNetwork.IsMasterClient && PhotonNetwork.LocalPlayer != null) { _runtime.HostHandlePlaceTrap(PhotonNetwork.LocalPlayer.ActorNumber, kind, position); return; } _view.RPC("RpcPlaceTrapRequest", (RpcTarget)2, new object[2] { kind, position }); } } internal void RequestSpawnMonster(string monsterName = null) { if (!((Object)(object)_view == (Object)null)) { if (PhotonNetwork.IsMasterClient && PhotonNetwork.LocalPlayer != null) { _runtime.HostHandleSpawnMonster(PhotonNetwork.LocalPlayer.ActorNumber, monsterName); return; } _view.RPC("RpcSpawnMonsterRequest", (RpcTarget)2, new object[1] { monsterName ?? string.Empty }); } } internal void RequestMonsterCatalog() { if (!((Object)(object)_view == (Object)null) && PhotonNetwork.LocalPlayer != null) { if (PhotonNetwork.IsMasterClient) { _runtime.HostSendMonsterCatalog(PhotonNetwork.LocalPlayer.ActorNumber); } else { _view.RPC("RpcMonsterCatalogRequest", (RpcTarget)2, Array.Empty()); } } } internal void SendMonsterCatalog(Player target, string[] names, int[] costs, int[] categories) { if (target != null && !((Object)(object)_view == (Object)null)) { if (PhotonNetwork.LocalPlayer != null && target.ActorNumber == PhotonNetwork.LocalPlayer.ActorNumber) { _runtime.ReceiveMonsterCatalog(names, costs, categories); return; } _view.RPC("RpcMonsterCatalog", target, new object[3] { names, costs, categories }); } } [PunRPC] public void RpcMonsterCatalogRequest(PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient && info.Sender != null) { _runtime.HostSendMonsterCatalog(info.Sender.ActorNumber); } } [PunRPC] public void RpcMonsterCatalog(string[] names, int[] costs, int[] categories, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (IsMasterSender(info)) { _runtime.ReceiveMonsterCatalog(names, costs, categories); } } internal void NotifyPlayer(Player target, string message) { if ((Object)(object)_view != (Object)null && target != null) { _view.RPC("RpcPlayerNotice", target, new object[1] { message ?? string.Empty }); } } [PunRPC] public void RpcClientReady(PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient && info.Sender != null) { _runtime.OnClientReady(info.Sender.ActorNumber); } } [PunRPC] public void RpcAssignRole(byte role, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (IsMasterSender(info)) { _runtime.ReceiveRole((PlayerRole)role); } } [PunRPC] public void RpcProgress(byte role, int points, float energy, float energyMax, int voteWeight, int shields, int meetingBonus, int knifeLevel, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (IsMasterSender(info)) { _runtime.ReceiveProgress((PlayerRole)role, points, energy, energyMax, voteWeight, shields, meetingBonus, knifeLevel); } } [PunRPC] public void RpcMeetingStarted(double deadline, int[] eligibleActors, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (IsMasterSender(info)) { _runtime.ReceiveMeetingStarted(deadline, eligibleActors); } } [PunRPC] public void RpcMeetingResolved(int ejectedActor, bool correct, string resultText, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (IsMasterSender(info)) { _runtime.ReceiveMeetingResolved(ejectedActor, correct, resultText); } } [PunRPC] public void RpcSetOutcome(byte outcome, string resultText, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (IsMasterSender(info)) { _runtime.ReceiveOutcome((SessionOutcome)outcome, resultText); } } [PunRPC] public void RpcVoteRequest(int candidateActor, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient && info.Sender != null) { _runtime.OnVoteReceived(info.Sender.ActorNumber, candidateActor); } } [PunRPC] public void RpcKillRequest(int targetActor, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient && info.Sender != null) { _runtime.HostHandleKill(info.Sender.ActorNumber, targetActor); } } [PunRPC] public void RpcPlaceTrapRequest(int kind, Vector3 position, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient && info.Sender != null) { _runtime.HostHandlePlaceTrap(info.Sender.ActorNumber, kind, position); } } [PunRPC] public void RpcSpawnMonsterRequest(string monsterName, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient && info.Sender != null) { _runtime.HostHandleSpawnMonster(info.Sender.ActorNumber, monsterName); } } [PunRPC] public void RpcTrapPlaced(int trapId, Vector3 position, double expiresAt, int kind, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (IsMasterSender(info)) { _runtime.ReceiveTrapPlaced(trapId, position, expiresAt, kind); } } [PunRPC] public void RpcTrapTriggered(int trapId, int actor, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (IsMasterSender(info)) { _runtime.ReceiveTrapTriggered(trapId, actor); } } [PunRPC] public void RpcTrapRemoved(int trapId, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (IsMasterSender(info)) { _runtime.ReceiveTrapRemoved(trapId); } } [PunRPC] public void RpcPlayerNotice(string message, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (IsMasterSender(info)) { _runtime.ReceiveNotice(message); } } private static bool IsMasterSender(PhotonMessageInfo info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (info.Sender != null) { return info.Sender.IsMasterClient; } return false; } } internal sealed class ModeRuntime { private sealed class PlayerData { internal PlayerRole Role; internal int Points; internal float Energy = 100f; internal float EnergyMax = 100f; internal int VoteWeight = 1; internal int Shields; internal int MeetingBonus; internal int KnifeLevel; } private sealed class TrapState { internal int Id; internal Vector3 Position; internal double ExpiresAt; internal int Kind; internal GameObject Visual; } private readonly VloplandImpostorModePlugin _plugin; private readonly HashSet _readyActors = new HashSet(); private readonly HashSet _eligibleActors = new HashSet(); private readonly HashSet _eliminatedActors = new HashSet(); private readonly Dictionary _votes = new Dictionary(); private readonly Dictionary _players = new Dictionary(); private readonly Dictionary _killReadyAt = new Dictionary(); private readonly Dictionary _activeTraps = new Dictionary(); private static readonly FieldInfo DeadSetField = typeof(PlayerAvatar).GetField("deadSet", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static List _enemyCache; private static float _enemyCacheUntil; private ModeRpc _rpc; private string _roomKey = string.Empty; private bool _reportedReady; private bool _sessionStarted; private bool _pendingMeeting; private bool _meetingActive; private bool _localHasVoted; private bool _localRoleSet; private PlayerRole _localRole; private SessionOutcome _outcome; private int _impostorActor = -1; private int _localPoints; private float _localEnergy; private float _localEnergyMax; private int _localVoteWeight = 1; private int _localShields; private int _localMeetingBonus; private int _localKnifeLevel; private double _meetingDeadline; private float _meetingStartAt; private float _meetingResultUntil; private float _nextEnergySync; private float _nextReadyReport; private int _lastLevelsCompleted = -1; private int _trapSequence; private float _trapReadyAt; private float _monsterReadyAt; private string _notice = string.Empty; private string _meetingResult = string.Empty; private string _outcomeText = string.Empty; private float _roleRevealUntil; private bool _roleRevealPending; private float _nextRoundAt; private float _roundGraceUntil; private bool _returningToShop; private Texture2D _anomalyIcon; private TextMeshProUGUI _nativeEnergyText; private VoteView _voteView; private bool _menuCursorActive; private float _nextHudWarningAt; private static readonly FieldInfo EnergyTextField = typeof(EnergyUI).GetField("Text", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo HudHiddenField = typeof(HUD).GetField("hidden", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private int _abilityMenu; private string[] _monsterNames = Array.Empty(); private int[] _monsterCosts = Array.Empty(); private int[] _monsterCategories = Array.Empty(); private int _monsterCategory; private int _monsterPage; private int _placementKind = -1; private GameObject _placementPreview; private Vector3 _placementPosition; private bool _placementValid; private Texture2D _menuDisc; private static List AvailableEnemies { get { if (_enemyCache != null && Time.realtimeSinceStartup < _enemyCacheUntil) { return _enemyCache; } List list = new List(); if ((Object)(object)EnemyDirector.instance != (Object)null) { string[] array = new string[3] { "enemiesDifficulty1", "enemiesDifficulty2", "enemiesDifficulty3" }; foreach (string name in array) { if (typeof(EnemyDirector).GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(EnemyDirector.instance) is List collection) { list.AddRange(collection); } } } list.AddRange(Resources.FindObjectsOfTypeAll()); _enemyCache = (from x in list where (Object)(object)x != (Object)null && x.spawnObjects != null && x.spawnObjects.Count > 0 group x by ((Object)x).name into g select g.First() into x orderby ((Object)x).name select x).ToList(); _enemyCacheUntil = Time.realtimeSinceStartup + 5f; return _enemyCache; } } internal bool ShouldStartInShop => !_sessionStarted; private Texture2D MenuDisc { get { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_menuDisc != (Object)null) { return _menuDisc; } _menuDisc = new Texture2D(128, 128, (TextureFormat)4, false); ((Object)_menuDisc).name = "VloplandMenuDisc"; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { Vector2 val = new Vector2((float)j + 0.5f - 64f, (float)i + 0.5f - 64f); float num = ((Vector2)(ref val)).magnitude / 64f; float num2 = Mathf.Clamp01((1f - num) * 45f); _menuDisc.SetPixel(j, i, new Color(1f, 1f, 1f, num2)); } } _menuDisc.Apply(); return _menuDisc; } } private static bool IsGameplayHudVisible() { if ((Object)(object)LoadingUI.instance != (Object)null && ((Component)LoadingUI.instance).gameObject.activeInHierarchy) { return false; } if ((Object)(object)HUD.instance == (Object)null || !((Component)HUD.instance).gameObject.activeInHierarchy) { return false; } if (HudHiddenField != null && (bool)HudHiddenField.GetValue(HUD.instance)) { return false; } if ((Object)(object)EnergyUI.instance != (Object)null) { return ((Component)EnergyUI.instance).gameObject.activeInHierarchy; } return false; } internal ModeRuntime(VloplandImpostorModePlugin plugin) { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown _plugin = plugin; using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Vlopland.Anomaly.png"); if (stream == null) { return; } byte[] array = new byte[stream.Length]; int num; for (int i = 0; i < array.Length; i += num) { num = stream.Read(array, i, array.Length - i); if (num <= 0) { break; } } _anomalyIcon = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(_anomalyIcon, array)) { _anomalyIcon = null; } } internal void Tick() { if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { ResetRoom(); return; } string text = PhotonNetwork.CurrentRoom.Name + ":" + PhotonNetwork.MasterClient.ActorNumber; if (!string.Equals(text, _roomKey, StringComparison.Ordinal)) { ResetRoom(text); } UpdateNativeEnergy(); BindRpc(); if ((Object)(object)_rpc == (Object)null) { return; } if (_roleRevealPending && IsGameplayHudVisible()) { _roleRevealPending = false; _roleRevealUntil = Time.time + 5f; } if (!SemiFunc.RunIsLevel() && _activeTraps.Count > 0) { ClearLocalTraps(); } if (_placementKind >= 0 && (!SemiFunc.RunIsLevel() || _outcome != SessionOutcome.None || _meetingActive || (Object)(object)_placementPreview == (Object)null)) { CancelTrapPlacement(); } int actorNumber = PhotonNetwork.LocalPlayer.ActorNumber; if (!_reportedReady || (!_sessionStarted && Time.unscaledTime >= _nextReadyReport)) { _reportedReady = true; _nextReadyReport = Time.unscaledTime + 3f; _rpc.ReportReady(); } if (PhotonNetwork.IsMasterClient) { TryStartSession(); if (_sessionStarted) { foreach (int item in _players.Keys.Where((int actor) => PhotonNetwork.CurrentRoom.GetPlayer(actor, false) == null).ToList()) { if (item == _impostorActor && _outcome == SessionOutcome.None) { SetOutcome(SessionOutcome.CrewVictory, "Победа мирных — импостер покинул игру."); } _players.Remove(item); _eligibleActors.Remove(item); _votes.Remove(item); _readyActors.Remove(item); } AddLatePlayers(); RegenerateEnergy(); UpdateTraps(); MaintainEliminations(); CheckVictory(); if (_outcome != SessionOutcome.None && Time.time >= _nextRoundAt) { if (SemiFunc.RunIsShop()) { StartNextRound(); } else if (!_returningToShop && (Object)(object)RunManager.instance != (Object)null) { _returningToShop = true; RunManager.instance.ChangeLevel(false, false, (ChangeLevelType)5); } } if (_pendingMeeting && SemiFunc.RunIsShop() && IsGameplayHudVisible() && Time.time >= _meetingStartAt) { BeginMeeting(); } if (_meetingActive && PhotonNetwork.Time >= _meetingDeadline) { ResolveVotes(); } } } if (_sessionStarted && _localRoleSet && _outcome == SessionOutcome.None && !_meetingActive && SemiFunc.RunIsLevel() && SemiFunc.NoTextInputsActive() && _localRole == PlayerRole.Impostor) { if (Input.GetKeyDown((KeyCode)102)) { if (_placementKind >= 0) { CancelTrapPlacement(); } else { _abilityMenu = ((_abilityMenu == 0) ? 1 : 0); } } UpdateTrapPlacement(); } if (_localRoleSet && _localRole == PlayerRole.Impostor && Time.time >= _nextEnergySync) { _nextEnergySync = Time.time + 1f; if (PhotonNetwork.IsMasterClient) { SendProgress(actorNumber); } } UpdateVoteInterface(); if (_abilityMenu != 0 && !_meetingActive && IsGameplayHudVisible()) { SemiFunc.CursorUnlock(0.2f); Cursor.visible = true; _menuCursorActive = true; } else if (_menuCursorActive) { _menuCursorActive = false; if (!_meetingActive) { Cursor.visible = false; } } } private void BindRpc() { if ((Object)(object)_rpc != (Object)null || (Object)(object)PunManager.instance == (Object)null) { return; } PhotonView component = ((Component)PunManager.instance).GetComponent(); if (!((Object)(object)component == (Object)null)) { _rpc = ((Component)PunManager.instance).gameObject.GetComponent(); if ((Object)(object)_rpc == (Object)null) { _rpc = ((Component)PunManager.instance).gameObject.AddComponent(); } _rpc.Bind(component, this); component.RefreshRpcMonoBehaviourCache(); } } private void ResetRoom(string newKey = "") { CloseVoteInterface(); if (_menuCursorActive) { Cursor.visible = false; } _menuCursorActive = false; if ((Object)(object)_nativeEnergyText != (Object)null) { Object.Destroy((Object)(object)((Component)_nativeEnergyText).gameObject); } _nativeEnergyText = null; ClearLocalTraps(); _roomKey = newKey; _rpc = null; _readyActors.Clear(); _eligibleActors.Clear(); _eliminatedActors.Clear(); _votes.Clear(); _players.Clear(); _killReadyAt.Clear(); _reportedReady = false; _nextReadyReport = 0f; _sessionStarted = false; _pendingMeeting = false; _meetingActive = false; _localHasVoted = false; _localRoleSet = false; _localRole = PlayerRole.Unknown; _outcome = SessionOutcome.None; _impostorActor = -1; _lastLevelsCompleted = -1; _trapSequence = 0; _trapReadyAt = 0f; _monsterReadyAt = 0f; _localPoints = 0; _localEnergy = 0f; _localEnergyMax = 0f; _localVoteWeight = 1; _localShields = 0; _localMeetingBonus = 0; _localKnifeLevel = 0; _meetingResult = string.Empty; _outcomeText = string.Empty; _roleRevealUntil = 0f; _roleRevealPending = false; _nextRoundAt = 0f; _roundGraceUntil = 0f; _returningToShop = false; _abilityMenu = 0; _monsterNames = Array.Empty(); _monsterCosts = Array.Empty(); CancelTrapPlacement(); _monsterPage = 0; _notice = string.Empty; } private void TryStartSession() { if (_sessionStarted || PhotonNetwork.PlayerList == null || PhotonNetwork.PlayerList.Length < 1 || (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop())) { return; } Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val in playerList) { if (!_readyActors.Contains(val.ActorNumber)) { _notice = "Waiting for all players to install Vlop Impostor Mode."; return; } } List list = PhotonNetwork.PlayerList.OrderBy((Player p) => p.ActorNumber).ToList(); Player val2 = list[Random.Range(0, list.Count)]; _impostorActor = val2.ActorNumber; _sessionStarted = true; _lastLevelsCompleted = ((!((Object)(object)RunManager.instance == (Object)null)) ? RunManager.instance.levelsCompleted : 0); _notice = string.Empty; foreach (Player item in list) { if (!_players.TryGetValue(item.ActorNumber, out var value)) { value = new PlayerData(); } value.Role = ((item.ActorNumber != _impostorActor) ? PlayerRole.Crew : PlayerRole.Impostor); value.Energy = value.EnergyMax; _players[item.ActorNumber] = value; _rpc.AssignRole(item, value.Role); SendProgress(item.ActorNumber); } _plugin.Log.LogInfo((object)("Started Vlopland impostor session with " + list.Count + " players.")); } internal void OnClientReady(int actor) { if (!PhotonNetwork.IsMasterClient) { return; } _readyActors.Add(actor); if (_sessionStarted && !_players.ContainsKey(actor)) { PlayerData playerData = new PlayerData { Role = PlayerRole.Crew }; _players[actor] = playerData; Player player = PhotonNetwork.CurrentRoom.GetPlayer(actor, false); if (player != null) { _rpc.AssignRole(player, playerData.Role); SendProgress(actor); } } TryStartSession(); } private void AddLatePlayers() { Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val in playerList) { if (_readyActors.Contains(val.ActorNumber) && !_players.ContainsKey(val.ActorNumber)) { PlayerData playerData = new PlayerData { Role = PlayerRole.Crew }; _players[val.ActorNumber] = playerData; _rpc.AssignRole(val, playerData.Role); SendProgress(val.ActorNumber); } } } internal void ReceiveRole(PlayerRole role) { _outcome = SessionOutcome.None; _outcomeText = string.Empty; _meetingActive = false; _pendingMeeting = false; _abilityMenu = 0; _localRole = role; _localRoleSet = role != PlayerRole.Unknown; _sessionStarted = true; _roleRevealPending = true; _roleRevealUntil = 0f; } internal void ReceiveProgress(PlayerRole role, int points, float energy, float energyMax, int voteWeight, int shields, int meetingBonus, int knifeLevel) { _localRole = role; _localRoleSet = role != PlayerRole.Unknown; _localPoints = points; _localEnergy = energy; _localEnergyMax = energyMax; _localVoteWeight = voteWeight; _localShields = shields; _localMeetingBonus = meetingBonus; _localKnifeLevel = knifeLevel; _sessionStarted = true; } private void SendProgress(int actor) { if (_players.TryGetValue(actor, out var value) && !((Object)(object)_rpc == (Object)null)) { Player player = PhotonNetwork.CurrentRoom.GetPlayer(actor, false); if (player != null) { _rpc.SendProgress(player, value.Role, value.Points, value.Energy, value.EnergyMax, value.VoteWeight, value.Shields, value.MeetingBonus, value.KnifeLevel); } } } internal void OnLevelTransition(RunManager manager, bool completed, bool failed) { if (!PhotonNetwork.IsMasterClient || !_sessionStarted || !completed || failed || (Object)(object)manager == (Object)null || manager.levelsCompleted <= _lastLevelsCompleted) { return; } _lastLevelsCompleted = manager.levelsCompleted; _pendingMeeting = true; _meetingStartAt = Time.time + 2.5f; foreach (KeyValuePair player in _players) { player.Value.Points += ((player.Value.Role != PlayerRole.Impostor) ? 1 : 2); SendProgress(player.Key); } _notice = "Expedition completed. Meeting starts in the truck."; } private void BeginMeeting() { if (GetAvatars().Count < PhotonNetwork.PlayerList.Length) { return; } _pendingMeeting = false; _votes.Clear(); _eligibleActors.Clear(); _meetingActive = true; _localHasVoted = false; foreach (PlayerAvatar avatar in GetAvatars()) { if (IsAlive(avatar) && ActorOf(avatar) > 0 && !_eliminatedActors.Contains(ActorOf(avatar))) { _eligibleActors.Add(ActorOf(avatar)); } } if (_eligibleActors.Count == 0) { _meetingActive = false; CheckVictory(); return; } int num = 0; foreach (PlayerData value in _players.Values) { if (value.Role == PlayerRole.Crew) { num = Math.Max(num, value.MeetingBonus); } } _meetingDeadline = PhotonNetwork.Time + (double)_plugin.MeetingDuration.Value + (double)((float)num * 5f); _rpc.StartMeeting(_meetingDeadline, _eligibleActors.ToArray()); _plugin.Log.LogInfo((object)"Started crew meeting."); } internal void ReceiveMeetingStarted(double deadline, int[] eligibleActors) { _meetingActive = true; _localHasVoted = false; _meetingDeadline = deadline; _votes.Clear(); _eligibleActors.Clear(); if (eligibleActors != null) { foreach (int item in eligibleActors) { _eligibleActors.Add(item); } } _meetingResult = string.Empty; } internal void OnVoteReceived(int voterActor, int candidateActor) { if (PhotonNetwork.IsMasterClient && _meetingActive && _eligibleActors.Contains(voterActor) && !_votes.ContainsKey(voterActor) && (candidateActor == -1 || _eligibleActors.Contains(candidateActor))) { _votes[voterActor] = candidateActor; if (_votes.Count >= _eligibleActors.Count) { ResolveVotes(); } } } private void ResolveVotes() { if (!_meetingActive) { return; } _meetingActive = false; Dictionary dictionary = new Dictionary(); foreach (KeyValuePair vote in _votes) { PlayerData value; int num = ((!_players.TryGetValue(vote.Key, out value)) ? 1 : Math.Max(1, value.VoteWeight)); dictionary[vote.Value] = dictionary.GetValueOrDefault(vote.Value) + num; } int num2 = -1; bool flag = false; string resultText = "No one was ejected."; if (dictionary.Count > 0) { int max = dictionary.Values.Max(); int[] array = (from pair in dictionary where pair.Value == max select pair.Key).ToArray(); if (array.Length == 1 && array[0] != -1) { num2 = array[0]; flag = num2 == _impostorActor; resultText = PlayerLabel(num2) + (flag ? " was the impostor!" : " was ejected. The impostor remains."); if (flag) { SetOutcome(SessionOutcome.CrewVictory, "Crew victory — the impostor was caught."); } else { _eliminatedActors.Add(num2); PlayerAvatar val = FindAvatar(num2); if ((Object)(object)val != (Object)null && IsAlive(val)) { val.PlayerDeath(-1); } CheckVictory(); } } else if (array.Length > 1) { resultText = "The vote was tied. No one was ejected."; } } _rpc.ResolveMeeting(num2, flag, resultText); } internal void ReceiveMeetingResolved(int ejectedActor, bool correct, string resultText) { _meetingActive = false; _localHasVoted = false; _meetingResult = resultText ?? string.Empty; _meetingResultUntil = Time.time + 8f; if (ejectedActor > 0 && correct && _localRole == PlayerRole.Impostor) { _localRole = PlayerRole.Impostor; } } internal void HostHandleKill(int sourceActor, int targetActor) { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient || !_sessionStarted || _outcome != SessionOutcome.None || _meetingActive || !SemiFunc.RunIsLevel() || !_players.TryGetValue(sourceActor, out var value) || value.Role != PlayerRole.Impostor || value.Energy < 35f) { return; } float valueOrDefault = _killReadyAt.GetValueOrDefault(sourceActor); if (Time.time < valueOrDefault) { return; } PlayerAvatar val = FindAvatar(targetActor); PlayerAvatar val2 = FindAvatar(sourceActor); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || !IsAlive(val) || ActorOf(val) == sourceActor || !_players.TryGetValue(targetActor, out var value2) || value2.Role != PlayerRole.Crew) { return; } float num = Mathf.Max(0.5f, _plugin.KillRange.Value); if (!(Vector3.Distance(((Component)val2).transform.position, ((Component)val).transform.position) > num)) { if (value2.Shields > 0) { value2.Shields--; SendProgress(targetActor); Notify(targetActor, "Your shield blocked an impostor attack."); Notify(sourceActor, "The target's shield blocked your attack."); } else { value.Energy -= 35f; int num2 = Math.Min(4, value.KnifeLevel) * 4; _killReadyAt[sourceActor] = Time.time + Mathf.Max(8f, _plugin.KillCooldown.Value - (float)num2); SendProgress(sourceActor); val.PlayerDeath(-1); _plugin.Log.LogInfo((object)("Impostor eliminated actor " + targetActor + ".")); CheckVictory(); } } } internal void HostHandlePlaceTrap(int sourceActor, int kind, Vector3 requestedPosition) { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient || !_sessionStarted || _outcome != SessionOutcome.None || _meetingActive || !SemiFunc.RunIsLevel() || !_players.TryGetValue(sourceActor, out var value) || value.Role != PlayerRole.Impostor || kind < 0 || kind > 1) { return; } float num = Mathf.Clamp(_plugin.TrapEnergyCost.Value + ((kind == 1) ? 25f : 0f), 1f, 100f); if (value.Energy < num) { Notify(sourceActor, "Недостаточно энергии: нужно " + Mathf.CeilToInt(num) + "."); return; } if (Time.time < _trapReadyAt) { Notify(sourceActor, "Ловушки перезаряжаются: " + Mathf.CeilToInt(_trapReadyAt - Time.time) + " сек."); return; } PlayerAvatar val = FindAvatar(sourceActor); if (!((Object)(object)val == (Object)null) && IsAlive(val)) { if (float.IsNaN(requestedPosition.x) || float.IsNaN(requestedPosition.y) || float.IsNaN(requestedPosition.z) || Vector3.Distance(((Component)val).transform.position, requestedPosition) > 5f) { Notify(sourceActor, "Слишком далеко для установки."); return; } RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(requestedPosition + Vector3.up * 0.6f, Vector3.down, ref val2, 1.5f, -5, (QueryTriggerInteraction)1) || ((RaycastHit)(ref val2)).normal.y < 0.65f) { Notify(sourceActor, "Здесь нельзя поставить ловушку."); return; } Vector3 position = ((RaycastHit)(ref val2)).point + Vector3.up * 0.07f; value.Energy -= num; _trapReadyAt = Time.time + Mathf.Max(5f, _plugin.TrapCooldown.Value); SendProgress(sourceActor); int trapId = ++_trapSequence; _rpc.BroadcastTrapPlaced(trapId, position, PhotonNetwork.Time + (double)Mathf.Max(10f, _plugin.TrapLifetime.Value), kind); Notify(sourceActor, "Anomalous trap placed."); } } internal void HostHandleSpawnMonster(int sourceActor, string monsterName = null) { //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0288: 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_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient || !_sessionStarted || _outcome != SessionOutcome.None || _meetingActive || !SemiFunc.RunIsLevel() || !_players.TryGetValue(sourceActor, out var impostor) || impostor.Role != PlayerRole.Impostor) { return; } if (Time.time < _monsterReadyAt) { Notify(sourceActor, "Monster summon is recharging."); return; } if ((Object)(object)LevelGenerator.Instance == (Object)null || AvailableEnemies == null) { Notify(sourceActor, "Monster spawns are not ready in this level."); return; } float baseSummonCost = Mathf.Clamp(_plugin.MonsterEnergyCost.Value, 1f, 200f); float extraMonsterCost = Mathf.Clamp(_plugin.MonsterExtraEnemyEnergyCost.Value, 0f, 100f); List list = (from setup in AvailableEnemies where (Object)(object)setup != (Object)null && setup.spawnObjects != null && setup.spawnObjects.Count > 0 where string.IsNullOrEmpty(monsterName) || ((Object)setup).name == monsterName where GetMonsterSummonCost(setup, baseSummonCost, extraMonsterCost) <= impostor.Energy select setup).ToList(); if (list.Count == 0) { bool flag = AvailableEnemies.Any((EnemySetup setup) => (Object)(object)setup != (Object)null && setup.spawnObjects != null && setup.spawnObjects.Count > 0); Notify(sourceActor, flag ? "Not enough anomalous energy for any available monster group." : "There are no monsters available to summon in this level."); return; } PlayerAvatar source = FindAvatar(sourceActor); PlayerData value; PlayerAvatar val = (from avatar in GetAvatars() where IsAlive(avatar) && ActorOf(avatar) != sourceActor && _players.TryGetValue(ActorOf(avatar), out value) && value.Role == PlayerRole.Crew orderby (!((Object)(object)source == (Object)null)) ? Vector3.Distance(((Component)source).transform.position, ((Component)avatar).transform.position) : 0f select avatar).FirstOrDefault(); if ((Object)(object)val == (Object)null && PhotonNetwork.PlayerList.Length == 1) { val = source; } if ((Object)(object)source == (Object)null || (Object)(object)val == (Object)null) { Notify(sourceActor, "There is no living crew member to hunt."); return; } EnemySetup val2 = list[Random.Range(0, list.Count)]; float monsterSummonCost = GetMonsterSummonCost(val2, baseSummonCost, extraMonsterCost); Vector3 forward = ((Component)val).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.01f) { forward = Vector3.forward; } Vector3 val3 = ((Component)val).transform.position + ((Vector3)(ref forward)).normalized * 8f + Vector3.up * 1.5f; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3, Vector3.down, ref val4, 5f, -5, (QueryTriggerInteraction)1)) { val3 = ((RaycastHit)(ref val4)).point + Vector3.up * 0.5f; } try { LevelGenerator.Instance.EnemySpawn(val2, val3); } catch (Exception ex) { _plugin.Log.LogError((object)("Monster summon failed: " + ex)); Notify(sourceActor, "The monster could not be summoned."); return; } impostor.Energy -= monsterSummonCost; _monsterReadyAt = Time.time + Mathf.Max(15f, _plugin.MonsterCooldown.Value); SendProgress(sourceActor); Notify(sourceActor, "Monster group summoned. Anomalous energy spent: " + Mathf.CeilToInt(monsterSummonCost) + "."); } private static float GetMonsterSummonCost(EnemySetup setup, float baseCost, float extraMonsterCost) { int num = ((!((Object)(object)setup == (Object)null) && setup.spawnObjects != null) ? setup.spawnObjects.Count : 0); return Mathf.Clamp(MonsterDifficulty(setup) switch { 3 => 90f, 1 => 40f, _ => 65f, } + (float)Mathf.Max(0, num - 1) * extraMonsterCost, 1f, 200f); } private static int MonsterDifficulty(EnemySetup setup) { if ((Object)(object)setup == (Object)null || (Object)(object)EnemyDirector.instance == (Object)null) { return 2; } for (int i = 1; i <= 3; i++) { if (typeof(EnemyDirector).GetField("enemiesDifficulty" + i, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(EnemyDirector.instance) is List list && list.Contains(setup)) { return i; } } return 2; } internal void HostSendMonsterCatalog(int actor) { if (PhotonNetwork.IsMasterClient && _players.TryGetValue(actor, out var value) && value.Role == PlayerRole.Impostor) { List availableEnemies = AvailableEnemies; _rpc.SendMonsterCatalog(PhotonNetwork.CurrentRoom.GetPlayer(actor, false), availableEnemies.Select((EnemySetup x) => ((Object)x).name).ToArray(), availableEnemies.Select((EnemySetup x) => Mathf.CeilToInt(GetMonsterSummonCost(x, _plugin.MonsterEnergyCost.Value, _plugin.MonsterExtraEnemyEnergyCost.Value))).ToArray(), availableEnemies.Select(MonsterDifficulty).ToArray()); } } internal void ReceiveMonsterCatalog(string[] names, int[] costs, int[] categories) { _monsterNames = names ?? Array.Empty(); _monsterCosts = costs ?? Array.Empty(); _monsterCategories = categories ?? Array.Empty(); } internal void ReceiveTrapPlaced(int trapId, Vector3 position, double expiresAt, int kind) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (_activeTraps.TryGetValue(trapId, out var value) && (Object)(object)value.Visual != (Object)null) { Object.Destroy((Object)(object)value.Visual); } _activeTraps[trapId] = new TrapState { Id = trapId, Position = position, ExpiresAt = expiresAt, Kind = kind, Visual = CreateTrapVisual(trapId, position, kind) }; } internal void ReceiveTrapTriggered(int trapId, int actor) { RemoveLocalTrap(trapId); if (PhotonNetwork.LocalPlayer != null && PhotonNetwork.LocalPlayer.ActorNumber == actor) { _notice = "An impostor trap caught you."; } } internal void ReceiveTrapRemoved(int trapId) { RemoveLocalTrap(trapId); } private void CancelTrapPlacement() { if ((Object)(object)_placementPreview != (Object)null) { Object.Destroy((Object)(object)_placementPreview); } _placementPreview = null; _placementKind = -1; _placementValid = false; } private void BeginTrapPlacement(int kind) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) CancelTrapPlacement(); _abilityMenu = 0; _placementKind = kind; _placementPreview = CreateTrapVisual(-1, Vector3.zero, kind); } private void UpdateTrapPlacement() { //IL_0052: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) if (_placementKind < 0) { return; } if (Input.GetMouseButtonDown(1) || Input.GetKeyDown((KeyCode)27)) { CancelTrapPlacement(); return; } Camera main = Camera.main; PlayerAvatar val = FindAvatar(PhotonNetwork.LocalPlayer.ActorNumber); RaycastHit val2 = default(RaycastHit); _placementValid = (Object)(object)main != (Object)null && (Object)(object)val != (Object)null && Physics.Raycast(((Component)main).transform.position, ((Component)main).transform.forward, ref val2, 5f, -5, (QueryTriggerInteraction)1) && ((RaycastHit)(ref val2)).normal.y >= 0.65f && Vector3.Distance(((Component)val).transform.position, ((RaycastHit)(ref val2)).point) <= 4.5f; if (_placementValid) { RaycastHit val3 = default(RaycastHit); Physics.Raycast(((Component)main).transform.position, ((Component)main).transform.forward, ref val3, 5f, -5, (QueryTriggerInteraction)1); _placementPosition = ((RaycastHit)(ref val3)).point + Vector3.up * 0.07f; _placementPreview.transform.position = _placementPosition; } _placementPreview.SetActive(_placementValid); if (_placementValid) { Renderer[] componentsInChildren = _placementPreview.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].material.color = new Color(0.08f, 1f, 0.2f, 1f); } } if (_placementValid && Input.GetMouseButtonDown(0)) { _rpc.RequestPlaceTrap(_placementKind, _placementPosition); CancelTrapPlacement(); } } private void UpdateTraps() { //IL_00ce: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient || !_sessionStarted || _activeTraps.Count == 0) { return; } foreach (TrapState item in _activeTraps.Values.ToList()) { if (PhotonNetwork.Time >= item.ExpiresAt) { _rpc.BroadcastTrapRemoved(item.Id); RemoveLocalTrap(item.Id); continue; } foreach (PlayerAvatar avatar in GetAvatars()) { int num = ActorOf(avatar); if (num == _impostorActor || !IsAlive(avatar) || !_players.TryGetValue(num, out var value) || value.Role != PlayerRole.Crew) { continue; } Vector3 val = ((Component)avatar).transform.position - item.Position; float num2 = ((item.Kind == 1) ? 2.25f : 1.15f); Vector2 val2 = new Vector2(val.x, val.z); if (!(((Vector2)(ref val2)).sqrMagnitude > num2 * num2) && !(Mathf.Abs(val.y) > 1.4f)) { if (value.Shields > 0) { value.Shields--; SendProgress(num); Notify(num, "Your shield absorbed the anomalous trap."); } else { avatar.PlayerDeath(-1); Notify(num, "An anomalous trap eliminated you."); _plugin.Log.LogInfo((object)("An impostor trap eliminated actor " + num + ".")); } _rpc.BroadcastTrapTriggered(item.Id, num); RemoveLocalTrap(item.Id); CheckVictory(); break; } } } } private GameObject CreateTrapVisual(int trapId, Vector3 position, int kind) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0023: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(); ((Object)val).name = "VloplandAnomalousTrap_" + trapId; val.transform.position = position; float num = ((kind == 1) ? 1.15f : 0.72f); GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2); obj.transform.SetParent(val.transform, false); obj.transform.localScale = new Vector3(num, 0.08f, num); Object.Destroy((Object)(object)obj.GetComponent()); obj.GetComponent().material.color = new Color(0.13f, 0.16f, 0.17f); GameObject obj2 = GameObject.CreatePrimitive((PrimitiveType)2); obj2.transform.SetParent(val.transform, false); obj2.transform.localPosition = new Vector3(0f, 0.095f, 0f); obj2.transform.localScale = new Vector3(num * 0.72f, 0.035f, num * 0.72f); Object.Destroy((Object)(object)obj2.GetComponent()); obj2.GetComponent().material.color = new Color(0.28f, 0.31f, 0.29f); GameObject obj3 = GameObject.CreatePrimitive((PrimitiveType)0); obj3.transform.SetParent(val.transform, false); obj3.transform.localPosition = new Vector3(0f, 0.17f, 0f); obj3.transform.localScale = new Vector3(0.13f, 0.08f, 0.13f); Object.Destroy((Object)(object)obj3.GetComponent()); obj3.GetComponent().material.color = (Color)((kind == 1) ? Color.red : new Color(0.7f, 0.1f, 1f)); for (int i = 0; i < 4; i++) { float num2 = (float)i * 90f * (MathF.PI / 180f); GameObject obj4 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj4).name = "VloplandTrapSpike"; obj4.transform.SetParent(val.transform, false); obj4.transform.localPosition = new Vector3(Mathf.Cos(num2) * num * 0.34f, 0.12f, Mathf.Sin(num2) * num * 0.34f); obj4.transform.localScale = new Vector3(0.08f, 0.08f, 0.08f); Collider component = obj4.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = obj4.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.material.color = new Color(0.06f, 0.07f, 0.07f, 1f); } } return val; } private void RemoveLocalTrap(int trapId) { if (_activeTraps.TryGetValue(trapId, out var value)) { if ((Object)(object)value.Visual != (Object)null) { Object.Destroy((Object)(object)value.Visual); } _activeTraps.Remove(trapId); } } private void ClearLocalTraps() { foreach (TrapState value in _activeTraps.Values) { if ((Object)(object)value.Visual != (Object)null) { Object.Destroy((Object)(object)value.Visual); } } _activeTraps.Clear(); } private void Notify(int actor, string message) { Player player = PhotonNetwork.CurrentRoom.GetPlayer(actor, false); if (player != null) { _rpc.NotifyPlayer(player, message); } } internal void ReceiveNotice(string message) { _notice = message ?? string.Empty; } private void RegenerateEnergy() { if ((SemiFunc.RunIsLevel() || SemiFunc.RunIsShop()) && _players.TryGetValue(_impostorActor, out var value) && !(value.Energy >= value.EnergyMax)) { float num = Mathf.Clamp(_plugin.AnomalousEnergyRegen.Value, 0f, 3f); value.Energy = Mathf.Min(value.EnergyMax, value.Energy + Time.deltaTime * num); if (Time.time >= _nextEnergySync) { _nextEnergySync = Time.time + 1f; SendProgress(_impostorActor); } } } private void CheckVictory() { if (!_sessionStarted || _outcome != SessionOutcome.None || _players.Count == 0 || Time.time < _roundGraceUntil || (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop())) { return; } bool flag = false; bool flag2 = false; List avatars = GetAvatars(); if (avatars.Count < _players.Count || avatars.Count < 2) { return; } bool flag3 = false; foreach (PlayerAvatar item in avatars) { if (!_players.TryGetValue(ActorOf(item), out var value)) { continue; } flag3 = true; if (IsAlive(item) && !_eliminatedActors.Contains(ActorOf(item))) { if (value.Role == PlayerRole.Impostor) { flag = true; } else if (value.Role == PlayerRole.Crew) { flag2 = true; } } } if (flag3) { if (!flag) { SetOutcome(SessionOutcome.CrewVictory, "Crew victory — the impostor is out."); } else if (!flag2) { SetOutcome(SessionOutcome.ImpostorVictory, "Impostor victory — the crew is out."); } } } private void SetOutcome(SessionOutcome outcome, string text) { if (!PhotonNetwork.IsMasterClient || _outcome != SessionOutcome.None) { return; } _nextRoundAt = Time.time + 5f; foreach (KeyValuePair player in _players) { if ((outcome == SessionOutcome.CrewVictory && player.Value.Role == PlayerRole.Crew) || (outcome == SessionOutcome.ImpostorVictory && player.Value.Role == PlayerRole.Impostor)) { player.Value.Points++; } SendProgress(player.Key); } _rpc.SetOutcome(outcome, text); ReceiveOutcome(outcome, text); } internal void ReceiveOutcome(SessionOutcome outcome, string text) { _outcome = outcome; _outcomeText = text ?? string.Empty; _meetingActive = false; _pendingMeeting = false; ClearLocalTraps(); } private void MaintainEliminations() { if (_outcome != SessionOutcome.None || Time.time < _roundGraceUntil || (!SemiFunc.RunIsLevel() && !SemiFunc.RunIsShop())) { return; } List avatars = GetAvatars(); if (avatars.Count < _players.Count) { return; } foreach (PlayerAvatar item in avatars) { int num = ActorOf(item); if (_players.ContainsKey(num)) { if (!IsAlive(item)) { _eliminatedActors.Add(num); } else if (_eliminatedActors.Contains(num)) { item.PlayerDeath(-1); } } } } private void StartNextRound() { if (!PhotonNetwork.IsMasterClient || !_sessionStarted || _outcome == SessionOutcome.None) { return; } _eliminatedActors.Clear(); _roundGraceUntil = Time.time + 8f; foreach (PlayerAvatar avatar in GetAvatars()) { if (!IsAlive(avatar)) { avatar.Revive(true); } } foreach (int item in _players.Keys.Where((int actor) => PhotonNetwork.CurrentRoom.GetPlayer(actor, false) == null).ToList()) { _players.Remove(item); } _votes.Clear(); _eligibleActors.Clear(); _outcome = SessionOutcome.None; _outcomeText = string.Empty; _returningToShop = false; _sessionStarted = false; _localRoleSet = false; _killReadyAt.Clear(); _trapReadyAt = 0f; _monsterReadyAt = 0f; TryStartSession(); } private void TryLocalKill(int sourceActor) { //IL_0067: 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) PlayerAvatar val = FindAvatar(sourceActor); if ((Object)(object)val == (Object)null) { return; } float num = Mathf.Max(0.5f, _plugin.KillRange.Value); int num2 = -1; foreach (PlayerAvatar avatar in GetAvatars()) { int num3 = ActorOf(avatar); if (num3 > 0 && num3 != sourceActor && IsAlive(avatar)) { float num4 = Vector3.Distance(((Component)val).transform.position, ((Component)avatar).transform.position); if (num4 <= num) { num = num4; num2 = num3; } } } if (num2 > 0) { _rpc.RequestKill(num2); } else { _notice = "No crew member is in attack range."; } } private PlayerAvatar FindAvatar(int actor) { return ((IEnumerable)GetAvatars()).FirstOrDefault((Func)((PlayerAvatar avatar) => ActorOf(avatar) == actor)); } private static List GetAvatars() { if ((Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList == null) { return new List(); } return GameDirector.instance.PlayerList.Where((PlayerAvatar avatar) => (Object)(object)avatar != (Object)null).ToList(); } private static int ActorOf(PlayerAvatar avatar) { if (!((Object)(object)avatar != (Object)null) || !((Object)(object)avatar.photonView != (Object)null) || avatar.photonView.Owner == null) { return -1; } return avatar.photonView.Owner.ActorNumber; } private static bool IsAlive(PlayerAvatar avatar) { if ((Object)(object)avatar == (Object)null) { return false; } if (!(DeadSetField == null)) { return !(bool)DeadSetField.GetValue(avatar); } return true; } private string PlayerLabel(int actor) { Player val = ((PhotonNetwork.CurrentRoom == null) ? null : PhotonNetwork.CurrentRoom.GetPlayer(actor, false)); if (val != null) { if (!string.IsNullOrEmpty(val.NickName)) { return val.NickName; } return "Player " + actor; } return "Player " + actor; } private void UpdateVoteInterface() { if (!_meetingActive || _outcome != SessionOutcome.None || !IsGameplayHudVisible()) { CloseVoteInterface(); return; } if ((Object)(object)_voteView == (Object)null) { EnergyUI instance = EnergyUI.instance; TextMeshProUGUI val = (TextMeshProUGUI)(((Object)(object)instance == (Object)null) ? null : /*isinst with value type is only supported in some contexts*/); int[] array = _eligibleActors.OrderBy((int actor) => actor).ToArray(); string[] names = array.Select((int actor) => PlayerLabel(actor) + ((actor == PhotonNetwork.LocalPlayer.ActorNumber) ? " (ВЫ)" : "")).ToArray(); _voteView = VoteView.Create(((Object)(object)val == (Object)null) ? null : ((TMP_Text)val).font, names, array, _eligibleActors.Contains(PhotonNetwork.LocalPlayer.ActorNumber), CastVote); } SemiFunc.CursorUnlock(0.2f); Cursor.visible = true; _voteView.UpdateVote(Math.Max(0.0, _meetingDeadline - PhotonNetwork.Time)); } private void CloseVoteInterface() { if (!((Object)(object)_voteView == (Object)null)) { Object.Destroy((Object)(object)((Component)_voteView).gameObject); _voteView = null; Cursor.visible = false; } } internal void DrawGUI() { //IL_003d: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Expected O, but got Unknown //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Expected O, but got Unknown //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.InRoom) { return; } if (!_sessionStarted || !_localRoleSet) { if (PhotonNetwork.PlayerList != null && PhotonNetwork.PlayerList.Length > 1) { GUI.Label(new Rect(14f, 14f, 520f, 30f), string.IsNullOrEmpty(_notice) ? "Vlopland mode: waiting for the host and all clients..." : _notice); } } else { if (!IsGameplayHudVisible()) { return; } if (!string.IsNullOrEmpty(_notice)) { GUI.Label(new Rect(14f, 14f, 600f, 28f), _notice); } if (_placementKind >= 0) { GUI.Label(new Rect((float)Screen.width / 2f - 180f, (float)Screen.height - 90f, 360f, 30f), "ЛКМ — поставить · ПКМ / F — отмена"); } if (_abilityMenu != 0 && _localRole == PlayerRole.Impostor && SemiFunc.RunIsLevel() && !_meetingActive) { DrawAbilityMenu(); } if (Time.time < _roleRevealUntil) { float num = _roleRevealUntil - Time.time; float num2 = Mathf.Clamp01(Mathf.Min(num, 5f - num) * 2f); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, num2); GUI.color = new Color(0.01f, 0.015f, 0.025f, num2 * 0.92f); GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Texture2D.whiteTexture); bool flag = _localRole == PlayerRole.Impostor; Color val = (flag ? new Color(0.8f, 0.15f, 0.9f, num2) : new Color(0.35f, 0.9f, 0.8f, num2)); float num3 = Mathf.Clamp01((5f - num) * 1.5f); float num4 = Mathf.Lerp(40f, 520f, num3); GUI.color = val; GUI.DrawTexture(new Rect((float)Screen.width * 0.5f - num4 * 0.5f, (float)Screen.height * 0.5f + 64f, num4, 3f), (Texture)(object)Texture2D.whiteTexture); GUIStyle val2 = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = Mathf.RoundToInt(Mathf.Clamp((float)Screen.height * 0.07f, 32f, 80f)), fontStyle = (FontStyle)1 }; val2.normal.textColor = val; GUI.Label(new Rect(0f, (float)Screen.height * 0.5f - 50f, (float)Screen.width, 100f), flag ? "ИМПОСТЕР" : "МИРНЫЙ", val2); GUIStyle val3 = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = Mathf.RoundToInt(Mathf.Clamp((float)Screen.height * 0.02f, 14f, 24f)) }; val3.normal.textColor = new Color(1f, 1f, 1f, num2); GUI.Label(new Rect(0f, (float)Screen.height * 0.5f + 80f, (float)Screen.width, 35f), flag ? "СОХРАНЯЙ ТАЙНУ. УСТРАНИ КОМАНДУ." : "ВЫЖИВИ. НАЙДИ ИМПОСТЕРА.", val3); if ((Object)(object)_anomalyIcon != (Object)null && flag) { float num5 = 100f + 8f * Mathf.Sin(Time.time * 4f); GUI.color = new Color(1f, 1f, 1f, num2); GUI.DrawTexture(new Rect((float)Screen.width * 0.5f - num5 * 0.5f, (float)Screen.height * 0.5f - 180f, num5, num5), (Texture)(object)_anomalyIcon, (ScaleMode)2); } GUI.color = color; } if (_outcome != SessionOutcome.None) { GUI.Box(new Rect((float)Screen.width / 2f - 190f, 22f, 380f, 68f), _outcomeText); return; } if (_meetingActive && (Object)(object)_voteView != (Object)null) { SemiFunc.CursorUnlock(0.2f); Cursor.visible = true; } if (!string.IsNullOrEmpty(_meetingResult) && Time.time < _meetingResultUntil) { GUI.Box(new Rect((float)Screen.width / 2f - 220f, 96f, 440f, 42f), _meetingResult); } } } private void UpdateNativeEnergy() { //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Expected O, but got Unknown //IL_01c8: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) if (!_localRoleSet || _localRole != PlayerRole.Impostor || _outcome != SessionOutcome.None || !IsGameplayHudVisible()) { if ((Object)(object)_nativeEnergyText != (Object)null) { ((Component)_nativeEnergyText).gameObject.SetActive(false); } return; } if ((Object)(object)_nativeEnergyText == (Object)null) { EnergyUI instance = EnergyUI.instance; TextMeshProUGUI val = (TextMeshProUGUI)(((Object)(object)instance == (Object)null) ? null : /*isinst with value type is only supported in some contexts*/); RectTransform val2 = (((Object)(object)HUDCanvas.instance == (Object)null) ? null : ((Component)HUDCanvas.instance).GetComponent()); if ((Object)(object)val2 == (Object)null && (Object)(object)val != (Object)null) { Canvas componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { val2 = ((Component)componentInParent).GetComponent(); } } if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { if (Time.unscaledTime >= _nextHudWarningAt) { _nextHudWarningAt = Time.unscaledTime + 15f; _plugin.Log.LogWarning((object)("Anomalous energy HUD is waiting: energy text=" + ((Object)(object)val != (Object)null) + ", HUD canvas=" + ((Object)(object)val2 != (Object)null))); } return; } GameObject val3 = new GameObject("VloplandAnomalousEnergy", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(TextMeshProUGUI) }); val3.transform.SetParent((Transform)(object)val2, false); _nativeEnergyText = val3.GetComponent(); ((TMP_Text)_nativeEnergyText).font = ((TMP_Text)val).font; ((TMP_Text)_nativeEnergyText).fontSharedMaterial = ((TMP_Text)val).fontSharedMaterial; _plugin.Log.LogInfo((object)"Anomalous energy HUD created."); ((TMP_Text)_nativeEnergyText).rectTransform.anchorMin = Vector2.zero; ((TMP_Text)_nativeEnergyText).rectTransform.anchorMax = Vector2.zero; ((TMP_Text)_nativeEnergyText).rectTransform.pivot = Vector2.zero; ((TMP_Text)_nativeEnergyText).rectTransform.anchoredPosition = new Vector2(30f, 30f); ((TMP_Text)_nativeEnergyText).rectTransform.sizeDelta = new Vector2(260f, 54f); ((Transform)((TMP_Text)_nativeEnergyText).rectTransform).localScale = Vector3.one; ((Graphic)_nativeEnergyText).color = new Color(0.75f, 0.25f, 1f); ((TMP_Text)_nativeEnergyText).enableVertexGradient = false; ((Graphic)_nativeEnergyText).raycastTarget = false; ((TMP_Text)_nativeEnergyText).enableAutoSizing = false; ((TMP_Text)_nativeEnergyText).fontSize = 26f; ((TMP_Text)_nativeEnergyText).alignment = (TextAlignmentOptions)513; } ((Component)_nativeEnergyText).gameObject.SetActive(true); ((TMP_Text)_nativeEnergyText).text = "АНОМАЛИЯ " + Mathf.CeilToInt(_localEnergy) + "/" + Mathf.CeilToInt(_localEnergyMax); } private static GUIStyle MenuText(int size, Color color, bool bold = false, TextAnchor align = (TextAnchor)4) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = size, fontStyle = (FontStyle)(bold ? 1 : 0), alignment = align, wordWrap = true, clipping = (TextClipping)1 }; val.normal.textColor = color; return val; } private static void Fill(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); GUI.color = color2; } private bool MenuNode(Vector2 center, float radius, string title, string detail, bool affordable = true) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(center.x - radius, center.y - radius, radius * 2f, radius * 2f); int num; if (((Rect)(ref val)).Contains(Event.current.mousePosition)) { Vector2 val2 = Event.current.mousePosition - center; num = ((((Vector2)(ref val2)).sqrMagnitude <= radius * radius) ? 1 : 0); } else { num = 0; } bool flag = (byte)num != 0; Color color = GUI.color; GUI.color = ((!affordable) ? new Color(0.22f, 0.22f, 0.25f, 0.85f) : (flag ? new Color(0.72f, 0.34f, 0.94f, 0.98f) : new Color(0.31f, 0.18f, 0.42f, 0.95f))); GUI.DrawTexture(val, (Texture)(object)MenuDisc); float num2 = Mathf.Max(3f, radius * 0.06f); GUI.color = ((!affordable) ? new Color(0.07f, 0.07f, 0.08f, 0.96f) : (flag ? new Color(0.12f, 0.08f, 0.19f, 1f) : new Color(0.055f, 0.06f, 0.09f, 0.98f))); GUI.DrawTexture(new Rect(((Rect)(ref val)).x + num2, ((Rect)(ref val)).y + num2, ((Rect)(ref val)).width - num2 * 2f, ((Rect)(ref val)).height - num2 * 2f), (Texture)(object)MenuDisc); GUI.color = color; int num3 = Mathf.RoundToInt(Mathf.Clamp(radius * 0.24f, 12f, 20f)); GUI.Label(new Rect(((Rect)(ref val)).x + 8f, center.y - radius * 0.38f, ((Rect)(ref val)).width - 16f, radius * 0.48f), title, MenuText(num3, affordable ? Color.white : Color.gray, bold: true, (TextAnchor)4)); GUI.Label(new Rect(((Rect)(ref val)).x + 8f, center.y + radius * 0.1f, ((Rect)(ref val)).width - 16f, radius * 0.32f), detail, MenuText(Mathf.Max(11, num3 - 3), (Color)(affordable ? new Color(0.79f, 0.66f, 0.93f) : Color.gray), bold: false, (TextAnchor)4)); return affordable && GUI.Button(val, GUIContent.none, GUIStyle.none) && flag; } private static bool MenuSmallButton(Rect rect, string label, int fontSize) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) bool flag = ((Rect)(ref rect)).Contains(Event.current.mousePosition); Fill(rect, flag ? new Color(0.4f, 0.24f, 0.52f, 0.98f) : new Color(0.12f, 0.1f, 0.15f, 0.96f)); Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - 2f, ((Rect)(ref rect)).width, 2f), new Color(0.75f, 0.43f, 0.92f)); GUI.Label(rect, label, MenuText(fontSize, Color.white, bold: true, (TextAnchor)4)); return GUI.Button(rect, GUIContent.none, GUIStyle.none); } private void DrawAbilityMenu() { //IL_0069: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027a: 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_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_07b6: Unknown result type (might be due to invalid IL or missing references) //IL_07c4: Unknown result type (might be due to invalid IL or missing references) //IL_07e0: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_076a: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_079c: Unknown result type (might be due to invalid IL or missing references) SemiFunc.CursorUnlock(0.2f); Cursor.visible = true; float num = Mathf.Clamp((float)Screen.height / 900f, 0.6f, 1.25f); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); float radius = 72f * num; Fill(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), new Color(0.01f, 0.015f, 0.025f, 0.78f)); Color color = GUI.color; GUI.color = new Color(0.18f, 0.1f, 0.26f, 0.9f); float num2 = 100f * num; GUI.DrawTexture(new Rect(val.x - num2, val.y - num2, num2 * 2f, num2 * 2f), (Texture)(object)MenuDisc); GUI.color = color; string text = ((_abilityMenu == 1) ? "АНОМАЛИЯ" : ((_abilityMenu == 2) ? "ЛОВУШКИ" : ((_abilityMenu == 3) ? "СЛОЖНОСТЬ" : "МОНСТРЫ"))); GUI.Label(new Rect(val.x - num2, val.y - 38f * num, num2 * 2f, 30f * num), text, MenuText(Mathf.RoundToInt(20f * num), Color.white, bold: true, (TextAnchor)4)); GUI.Label(new Rect(val.x - num2, val.y - 3f * num, num2 * 2f, 26f * num), Mathf.CeilToInt(_localEnergy) + " / " + Mathf.CeilToInt(_localEnergyMax) + " ЭНЕРГИИ", MenuText(Mathf.RoundToInt(15f * num), new Color(0.79f, 0.64f, 0.96f), bold: false, (TextAnchor)4)); GUI.Label(new Rect(val.x - 220f * num, (float)Screen.height - 58f * num, 440f * num, 30f * num), "F — ЗАКРЫТЬ • ВЫБОР МЫШЬЮ", MenuText(Mathf.RoundToInt(14f * num), new Color(0.78f, 0.78f, 0.82f), bold: false, (TextAnchor)4)); float num3 = 260f * num; float num4 = 175f * num; if (_abilityMenu == 1) { if (MenuNode(val + new Vector2(0f - num3, 0f), radius, "ЛОВУШКИ", "УСТАНОВКА")) { _abilityMenu = 2; } if (MenuNode(val + new Vector2(num3, 0f), radius, "МОНСТРЫ", "ПРИЗЫВ")) { _monsterNames = Array.Empty(); _rpc.RequestMonsterCatalog(); _abilityMenu = 3; } } else if (_abilityMenu == 2) { int num5 = Mathf.CeilToInt(_plugin.TrapEnergyCost.Value); int num6 = num5 + 25; if (MenuNode(val + new Vector2(0f - num3, 0f), radius, "МИНА", num5 + " ЭНЕРГИИ", _localEnergy >= (float)num5)) { BeginTrapPlacement(0); } if (MenuNode(val + new Vector2(num3, 0f), radius, "ШИРОКАЯ", num6 + " ЭНЕРГИИ", _localEnergy >= (float)num6)) { BeginTrapPlacement(1); } } else if (_abilityMenu == 3) { string[] array = new string[3] { "ЛЁГКАЯ", "СРЕДНЯЯ", "ОПАСНАЯ" }; for (int i = 1; i <= 3; i++) { float num7 = ((float)i * 120f - 210f) * (MathF.PI / 180f); if (MenuNode(val + new Vector2(Mathf.Cos(num7) * num3, Mathf.Sin(num7) * num4), radius, array[i - 1], "ОТ " + i switch { 2 => 65, 1 => 40, _ => 90, })) { _monsterCategory = i; _monsterPage = 0; _abilityMenu = 4; } } if (_monsterNames.Length == 0) { GUI.Label(new Rect(val.x - 150f * num, val.y + 100f * num, 300f * num, 30f * num), "ОЖИДАНИЕ СПИСКА ОТ ХОСТА", MenuText(Mathf.RoundToInt(13f * num), Color.white, bold: false, (TextAnchor)4)); } } else if (_abilityMenu == 4) { int count = Mathf.Min(_monsterNames.Length, Mathf.Min(_monsterCosts.Length, _monsterCategories.Length)); int[] array2 = (from num13 in Enumerable.Range(0, count) where _monsterCategories[num13] == _monsterCategory select num13).ToArray(); int num8 = Mathf.Max(1, (array2.Length + 5) / 6); _monsterPage = Mathf.Clamp(_monsterPage, 0, num8 - 1); int num9 = Mathf.Min(6, array2.Length - _monsterPage * 6); for (int num10 = 0; num10 < num9; num10++) { int num11 = array2[_monsterPage * 6 + num10]; float num12 = ((float)num10 * 360f / (float)Mathf.Max(1, num9) - 90f) * (MathF.PI / 180f); if (MenuNode(val + new Vector2(Mathf.Cos(num12) * 310f * num, Mathf.Sin(num12) * 205f * num), radius, _monsterNames[num11], _monsterCosts[num11] + " ЭНЕРГИИ", _localEnergy >= (float)_monsterCosts[num11])) { _rpc.RequestSpawnMonster(_monsterNames[num11]); _abilityMenu = 0; } } GUI.Label(new Rect(val.x - 70f * num, val.y + 40f * num, 140f * num, 24f * num), _monsterPage + 1 + " / " + num8, MenuText(Mathf.RoundToInt(13f * num), Color.white, bold: false, (TextAnchor)4)); if (_monsterPage > 0 && MenuSmallButton(new Rect(val.x - 170f * num, val.y + 65f * num, 55f * num, 32f * num), "<", Mathf.RoundToInt(16f * num))) { _monsterPage--; } if (_monsterPage + 1 < num8 && MenuSmallButton(new Rect(val.x + 115f * num, val.y + 65f * num, 55f * num, 32f * num), ">", Mathf.RoundToInt(16f * num))) { _monsterPage++; } if (array2.Length == 0) { GUI.Label(new Rect(val.x - 140f * num, val.y + 110f * num, 280f * num, 28f * num), "НЕТ МОНСТРОВ В КАТЕГОРИИ", MenuText(Mathf.RoundToInt(13f * num), Color.white, bold: false, (TextAnchor)4)); } } if (_abilityMenu > 1 && MenuSmallButton(new Rect(val.x - 55f * num, val.y + 68f * num, 110f * num, 32f * num), "НАЗАД", Mathf.RoundToInt(13f * num))) { _abilityMenu = ((_abilityMenu != 4) ? 1 : 3); } } private void CastVote(int actor) { if (!_localHasVoted) { _localHasVoted = true; _rpc.RequestVote(actor); } } } internal enum PlayerRole : byte { Unknown, Crew, Impostor } internal enum SessionOutcome : byte { None, CrewVictory, ImpostorVictory } [BepInPlugin("com.vlyapland.repo.vloplandimpostormode", "Vlop Impostor Mode", "0.2.8")] public sealed class VloplandImpostorModePlugin : BaseUnityPlugin { public const string PluginGuid = "com.vlyapland.repo.vloplandimpostormode"; public const string PluginName = "Vlop Impostor Mode"; public const string PluginVersion = "0.2.8"; private Harmony _harmony; internal static VloplandImpostorModePlugin Instance { get; private set; } internal ModeRuntime Runtime { get; private set; } internal ManualLogSource Log => ((BaseUnityPlugin)this).Logger; internal ConfigEntry ModeEnabled { get; private set; } internal ConfigEntry KillKey { get; private set; } internal ConfigEntry TrapKey { get; private set; } internal ConfigEntry SummonKey { get; private set; } internal ConfigEntry KillRange { get; private set; } internal ConfigEntry KillCooldown { get; private set; } internal ConfigEntry MeetingDuration { get; private set; } internal ConfigEntry AnomalousEnergyRegen { get; private set; } internal ConfigEntry TrapEnergyCost { get; private set; } internal ConfigEntry MonsterEnergyCost { get; private set; } internal ConfigEntry MonsterExtraEnemyEnergyCost { get; private set; } internal ConfigEntry TrapCooldown { get; private set; } internal ConfigEntry MonsterCooldown { get; private set; } internal ConfigEntry TrapLifetime { get; private set; } private void Awake() { //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown Instance = this; ModeEnabled = ((BaseUnityPlugin)this).Config.Bind("Mode", "Enabled", true, "Enable the impostor mode in multiplayer rooms."); KillKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "KillKey", (KeyCode)107, "Impostor attack key."); TrapKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "TrapKey", (KeyCode)108, "Place an anomalous trap."); SummonKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "SummonMonsterKey", (KeyCode)109, "Summon an enemy using anomalous energy."); KillRange = ((BaseUnityPlugin)this).Config.Bind("Gameplay", "KillRange", 2.25f, "Maximum validated distance for an impostor attack."); KillCooldown = ((BaseUnityPlugin)this).Config.Bind("Gameplay", "KillCooldown", 28f, "Base cooldown between impostor attacks."); AnomalousEnergyRegen = ((BaseUnityPlugin)this).Config.Bind("Impostor", "AnomalousEnergyRegen", 0.75f, "Anomalous energy restored per second during expeditions and truck downtime."); TrapEnergyCost = ((BaseUnityPlugin)this).Config.Bind("Impostor", "TrapEnergyCost", 30f, "Anomalous energy cost to place a trap."); MonsterEnergyCost = ((BaseUnityPlugin)this).Config.Bind("Impostor", "MonsterEnergyCost", 70f, "Base anomalous energy cost to summon a monster group."); MonsterExtraEnemyEnergyCost = ((BaseUnityPlugin)this).Config.Bind("Impostor", "MonsterExtraEnemyEnergyCost", 20f, "Additional anomalous energy cost for each extra monster in the group."); TrapCooldown = ((BaseUnityPlugin)this).Config.Bind("Impostor", "TrapCooldown", 25f, "Seconds between trap placements."); MonsterCooldown = ((BaseUnityPlugin)this).Config.Bind("Impostor", "MonsterCooldown", 65f, "Seconds between monster summons."); TrapLifetime = ((BaseUnityPlugin)this).Config.Bind("Impostor", "TrapLifetime", 90f, "How long an untriggered trap remains in the level."); MeetingDuration = ((BaseUnityPlugin)this).Config.Bind("Meetings", "VoteDuration", 35f, "Voting time after a completed level."); Runtime = new ModeRuntime(this); _harmony = new Harmony("com.vlyapland.repo.vloplandimpostormode"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Vlop Impostor Mode loaded."); } private void Update() { if (ModeEnabled.Value) { Runtime.Tick(); } } private void OnGUI() { if (ModeEnabled.Value) { Runtime.DrawGUI(); } } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } } internal sealed class VoteView : MonoBehaviour { private TextMeshProUGUI _timer; private TextMeshProUGUI _status; private GameObject _options; private RectTransform _viewport; private readonly List> _hitTargets = new List>(); private Action _submit; private bool _submitted; private GameObject _createdEventSystem; internal static VoteView Create(TMP_FontAsset font, string[] names, int[] actors, bool canVote, Action submit) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown GameObject val = new GameObject("VloplandVoteCanvas", new Type[4] { typeof(RectTransform), typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster) }); Canvas component = val.GetComponent(); component.renderMode = (RenderMode)0; component.overrideSorting = true; component.sortingOrder = 30000; CanvasScaler component2 = val.GetComponent(); component2.uiScaleMode = (ScaleMode)1; component2.referenceResolution = new Vector2(1920f, 1080f); component2.matchWidthOrHeight = 0.5f; VoteView voteView = val.AddComponent(); voteView._submit = submit; if ((Object)(object)EventSystem.current == (Object)null) { voteView._createdEventSystem = new GameObject("VloplandVoteEventSystem", new Type[2] { typeof(EventSystem), typeof(StandaloneInputModule) }); } voteView.Build(font, names, actors, canVote); return voteView; } private static RectTransform Rect(string name, Transform parent, Vector2 min, Vector2 max, Vector2 offsetMin, Vector2 offsetMax) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject(name, new Type[1] { typeof(RectTransform) }).GetComponent(); ((Transform)component).SetParent(parent, false); component.anchorMin = min; component.anchorMax = max; component.offsetMin = offsetMin; component.offsetMax = offsetMax; return component; } private static Image Image(RectTransform rect, Color color, bool raycast = false) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Image obj = ((Component)rect).gameObject.AddComponent(); ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = raycast; return obj; } private static TextMeshProUGUI Text(string name, Transform parent, TMP_FontAsset font, string value, float size, TextAlignmentOptions alignment, Color color, Vector2 min, Vector2 max, Vector2 offsetMin, Vector2 offsetMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = ((Component)Rect(name, parent, min, max, offsetMin, offsetMax)).gameObject.AddComponent(); if ((Object)(object)font != (Object)null) { ((TMP_Text)val).font = font; } ((TMP_Text)val).text = value; ((TMP_Text)val).fontSize = size; ((TMP_Text)val).fontStyle = (FontStyles)1; ((TMP_Text)val).alignment = alignment; ((Graphic)val).color = color; ((Graphic)val).raycastTarget = false; ((TMP_Text)val).enableAutoSizing = true; ((TMP_Text)val).fontSizeMin = size * 0.65f; ((TMP_Text)val).fontSizeMax = size; return val; } private void Build(TMP_FontAsset font, string[] names, int[] actors, bool canVote) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) Image(Rect("Dim", ((Component)this).transform, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero), new Color(0.01f, 0.01f, 0.01f, 0.65f), raycast: true); RectTransform val = Rect("Panel", ((Component)this).transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(-520f, -360f), new Vector2(520f, 360f)); Image(val, new Color(0.06f, 0.065f, 0.055f, 0.98f), raycast: true); Image(Rect("TopAccent", (Transform)(object)val, new Vector2(0f, 1f), Vector2.one, new Vector2(0f, -9f), Vector2.zero), new Color(0.95f, 0.62f, 0.13f)); Text("Heading", (Transform)(object)val, font, "ГОЛОСОВАНИЕ", 52f, (TextAlignmentOptions)4097, new Color(1f, 0.77f, 0.3f), new Vector2(0f, 1f), Vector2.one, new Vector2(42f, -85f), new Vector2(-210f, -24f)); _timer = Text("Timer", (Transform)(object)val, font, "", 35f, (TextAlignmentOptions)4100, Color.white, new Vector2(1f, 1f), Vector2.one, new Vector2(-210f, -85f), new Vector2(-42f, -24f)); Text("Prompt", (Transform)(object)val, font, "КТО ИМПОСТЕР?", 27f, (TextAlignmentOptions)4097, new Color(0.83f, 0.84f, 0.72f), new Vector2(0f, 1f), Vector2.one, new Vector2(42f, -128f), new Vector2(-42f, -92f)); _status = Text("Status", (Transform)(object)val, font, canVote ? "ВЫБЕРИ ИГРОКА ИЛИ ПРОПУСТИ" : "ТЫ НАБЛЮДАЕШЬ ЗА ГОЛОСОВАНИЕМ", 22f, (TextAlignmentOptions)514, Color.white, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(42f, 76f), new Vector2(-42f, 118f)); _options = new GameObject("Options", new Type[1] { typeof(RectTransform) }); RectTransform component = _options.GetComponent(); ((Transform)component).SetParent((Transform)(object)val, false); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; if (!canVote) { _options.SetActive(false); return; } _viewport = Rect("Viewport", (Transform)(object)component, Vector2.zero, Vector2.one, new Vector2(42f, 135f), new Vector2(-42f, -150f)); ((Component)_viewport).gameObject.AddComponent(); Image(_viewport, new Color(0.035f, 0.04f, 0.035f, 1f), raycast: true); ScrollRect obj = ((Component)_viewport).gameObject.AddComponent(); obj.horizontal = false; obj.vertical = true; obj.movementType = (MovementType)2; obj.viewport = _viewport; RectTransform val2 = Rect("Candidates", (Transform)(object)_viewport, new Vector2(0f, 1f), Vector2.one, Vector2.zero, Vector2.zero); val2.pivot = new Vector2(0.5f, 1f); int num = Mathf.Max(1, (actors.Length + 1) / 2); val2.sizeDelta = new Vector2(0f, (float)Mathf.Max(320, num * 76)); val2.anchoredPosition = Vector2.zero; obj.content = val2; for (int i = 0; i < actors.Length; i++) { int num2 = i % 2; int num3 = i / 2; RectTransform rect = Rect("Player_" + actors[i], (Transform)(object)val2, new Vector2((float)num2 * 0.5f, 1f), new Vector2((float)(num2 + 1) * 0.5f, 1f), new Vector2(8f, (float)(-70 - num3 * 76)), new Vector2(-8f, (float)(-8 - num3 * 76))); AddButton(rect, font, names[i], actors[i]); } RectTransform rect2 = Rect("Skip", (Transform)(object)component, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(42f, 22f), new Vector2(-42f, 68f)); AddButton(rect2, font, "ПРОПУСТИТЬ ГОЛОСОВАНИЕ", -1); } private void AddButton(RectTransform rect, TMP_FontAsset font, string label, int actor) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown Image targetGraphic = Image(rect, new Color(0.18f, 0.19f, 0.16f, 1f), raycast: true); Button obj = ((Component)rect).gameObject.AddComponent