Decompiled source of LycansNewRoles v0.16.2
plugins/LycansNewRoles/LycansNewRoles.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using DynamicSmokeSystem; using Fusion; using Fusion.Sockets; using HarmonyLib; using HarmonyLib.Tools; using Helpers.Collections; using LycansNewRoles.NewEffects; using Managers; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Localization; using UnityEngine.Localization.Components; using UnityEngine.Localization.Settings; using UnityEngine.Localization.Tables; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.Scripting; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LycansNewRoles")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("My first plugin")] [assembly: AssemblyTitle("LycansNewRoles")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LycansNewRoles { public static class BalancingValues { public const float EffectDurationStunned = 5f; public const float EffectDurationChasing = 1.5f; public const float EffectDurationSprinting = 5f; public const float EffectDurationReverting = 20f; public const float EffectDurationMuddling = 8f; public const float EffectDurationInfected = 6f; public const float EffectDurationStealthing = 6f; public const float EffectDurationInnocent = 4f; public const float EffectDurationMurderer = 4f; public const float EffectDurationStarvationActive = 120f; public const float EffectDurationShouting = 6f; public const float EffectDurationBlind = 3f; public const float EffectDurationIllusion = 15f; public const float EffectDurationPotionDeaf = 75f; public const float CannibalEatDuration = 3f; public const float CorrupterHungerAfterConversion = 0.65f; public const float ShapeshifterRegenInHumanForm = 2f; public const float ShapeshifterHungerMultiplierInWolfForm = 1.15f; public const float AlcoholicPotionDurationMultiplier = 1.25f; public const float AlcoholicPotionHealWolf = 0.45f; public const float DetectiveInspectRange = 1.5f; public const float EngineerTrappedDuration = 4f; public const float EngineerTrapDisarmTime = 1f; public const int EngineerDoorBashBonusDamageWolf = 40; public const int EngineerDoorBashBonusDamageNonWolf = 20; public const int EngineerSmokeRadius = 250; public const float GamblerSecondKillChance = 0.5f; public const float MetabolicWolfStarvationRange = 10f; public const float MetabolicVillagerHungerMultiplier = 0.5f; public const float MetabolicStarvationAdditionalHunger = 0.9f; public const float PoliticianDenyVoteRange = 10f; public const float SherifKillRange = 2.5f; public const float SherifWolfHealthAfterBeingShot = 0.4f; public const float SprinterSprintingAdditionalHunger = 4.5f; public const float StealtherWolfDetectionRadiusMultiplier = 0.65f; public const int EngineerItemCreationCooldown = 60; public const int GamblerSwitchCooldown = 300; public const int HowlerWolfHowlCooldown = 240; public const int TeleporterPortalsCooldown = 300; public const float PlayerRaycastRange = 10f; public const float TrapSetupTime = 1f; public const float TrapDisarmTime = 4f; } [HarmonyPatch(typeof(GameManager), "Rpc_EndGame")] internal class EndgameChangesPatch { private unsafe static bool Prefix(NetworkRunner runner, bool wolfWin) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: 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_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Invalid comparison between Unknown and I4 //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) try { if (NetworkBehaviourUtils.InvokeRpc) { NetworkBehaviourUtils.InvokeRpc = false; } else { if ((Object)(object)runner == (Object)null) { throw new ArgumentNullException("runner"); } if ((int)runner.Stage == 4) { return false; } if (runner.HasAnyActiveConnections()) { int num = 8; num += 4; SimulationMessage* ptr = SimulationMessage.Allocate(runner.Simulation, num); byte* data = SimulationMessage.GetData(ptr); int num2 = RpcHeader.Write(RpcHeader.Create(NetworkBehaviourUtils.GetRpcStaticIndexOrThrow("System.Void GameManager::Rpc_EndGame(Fusion.NetworkRunner,System.Boolean)")), data); ReadWriteUtilsForWeaver.WriteBoolean((int*)(data + num2), wolfWin); num2 += 4; ((SimulationMessage)ptr).Offset = num2 * 8; ((SimulationMessage)ptr).SetStatic(); runner.SendRpc(ptr); } } bool flag = false; PlayerCustom specificNewPrimaryRole = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Cannibal); if ((Object)(object)specificNewPrimaryRole != (Object)null && specificNewPrimaryRole.CannibalEatenCorpsesCount >= PlayerCustom.CannibalTargetAmount) { flag = true; } bool flag2 = false; PlayerCustom specificNewPrimaryRole2 = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.VillageIdiot); if ((Object)(object)specificNewPrimaryRole2 != (Object)null) { PlayerController player = PlayerRegistry.GetPlayer(specificNewPrimaryRole2.Ref); if (NetworkBool.op_Implicit(player.IsDead) && NetworkBool.op_Implicit(specificNewPrimaryRole2.KilledDuringVote)) { flag2 = true; } } if (runner.IsServer) { GameManager.Instance.IsFinished = NetworkBool.op_Implicit(true); PlayerRegistry.ForEach((Action<PlayerController>)delegate(PlayerController pObj) { //IL_0003: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) pObj.CanMove = NetworkBool.op_Implicit(false); PlayerCustom player6 = PlayerCustomRegistry.GetPlayer(pObj.Ref); if ((Object)(object)player6 != (Object)null) { player6.CannibalEatTimer = TickTimer.None; player6.PowerCooldownTimer = TickTimer.None; player6.TrapDisarmTimer = TickTimer.None; } }); GameManager.State.Server_DelaySetState((EGameState)5, 3f); } if (runner.IsPlayer) { Color villagerColor = GameUI.VillagerColor; Color wolfColor = GameUI.WolfColor; PlayerCustom player2 = PlayerCustomRegistry.GetPlayer(PlayerController.Local.Ref); string text; Color val; string text2; if (flag) { PlayerController player3 = PlayerRegistry.GetPlayer(specificNewPrimaryRole.Ref); GameManager.Instance.gameUI.UpdateWolvesRecap(((object)player3.PlayerData.Username).ToString()); text = "NALES_UI_CANNIBAL_WIN"; if (player2.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Cannibal) { val = villagerColor; text2 = "VICTORY"; } else { val = wolfColor; text2 = "DEFEAT"; } } else if (flag2) { PlayerController player4 = PlayerRegistry.GetPlayer(specificNewPrimaryRole2.Ref); GameManager.Instance.gameUI.UpdateWolvesRecap(((object)player4.PlayerData.Username).ToString()); text = "NALES_UI_VILLAGE_IDIOT_WIN"; if (player2.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.VillageIdiot) { val = villagerColor; text2 = "VICTORY"; } else { val = wolfColor; text2 = "DEFEAT"; } } else { string text3 = UpdateRoleUtility.ListWolvesAsString(PlayerRef.None); PlayerCustom playerCustom = PlayerCustomRegistry.Where((PlayerCustom o) => o.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Traitor).FirstOrDefault(); if ((Object)(object)playerCustom != (Object)null) { PlayerController player5 = PlayerRegistry.GetPlayer(playerCustom.Ref); string text4 = text3; NetworkString<_32> username = player5.PlayerData.Username; text3 = text4 + " + " + ((object)username).ToString(); } GameManager.Instance.gameUI.UpdateWolvesRecap(text3); text = (wolfWin ? "UI_WOLVES_WIN" : "UI_VILLAGERS_WIN"); if (player2.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.VillageIdiot || player2.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Cannibal) { val = wolfColor; text2 = "DEFEAT"; } else { bool flag3 = (int)PlayerController.Local.Role == 1 || player2.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Traitor; if (wolfWin) { if (flag3) { val = villagerColor; text2 = "VICTORY"; } else { val = wolfColor; text2 = "DEFEAT"; } } else if (flag3) { val = wolfColor; text2 = "DEFEAT"; } else { val = villagerColor; text2 = "VICTORY"; } } } AudioManager.Play(text2, (MixerTarget)2, 0.5f, 1f); GameManager.Instance.gameUI.UpdateTransitionText(text, val); GameManager.Instance.gameUI.ShowWolvesRecap(true); GameManager.Instance.gameUI.StartFade(true); } return false; } catch (Exception ex) { Plugin.Logger.LogError((object)("EndgameChangesPatch error: " + ex)); return true; } } } public class ExtraSettings : MonoBehaviour { private static ExtraSettings _instance; public bool ReduceWolfRed; public bool CheckModInstall; public static ExtraSettings Instance { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { GameObject val = new GameObject("ExtraSettings"); val.AddComponent<ExtraSettings>(); GameObject val2 = Object.Instantiate<GameObject>(val); _instance = val2.GetComponent<ExtraSettings>(); } return _instance; } } private void Start() { ReduceWolfRed = PlayerPrefs.GetInt("EXTRA_SETTINGS_REDUCE_WOLF_RED") == 1; CheckModInstall = PlayerPrefs.GetInt("EXTRA_SETTINGS_CHECK_MOD_INSTALL") == 1; } public static void OnReduceWolfRedChanged(bool value) { PlayerPrefs.SetInt("EXTRA_SETTINGS_REDUCE_WOLF_RED", value ? 1 : 0); Instance.ReduceWolfRed = value; } public static void OnCheckModInstallChanged(bool value) { PlayerPrefs.SetInt("EXTRA_SETTINGS_CHECK_MOD_INSTALL", value ? 1 : 0); Instance.CheckModInstall = value; } } [HarmonyPatch(typeof(SettingsUI), "Start")] internal class ExtraSettingsPatch { private static void Postfix(SettingsUI __instance) { try { Toggle checkbox = GetCheckbox(__instance, "NALES_SETTING_REDUCE_WOLF_RED", "EXTRA_SETTINGS_REDUCE_WOLF_RED"); ((UnityEvent<bool>)(object)checkbox.onValueChanged).AddListener((UnityAction<bool>)ExtraSettings.OnReduceWolfRedChanged); Toggle checkbox2 = GetCheckbox(__instance, "NALES_SETTING_CHECK_MOD_INSTALL", "EXTRA_SETTINGS_CHECK_MOD_INSTALL"); ((UnityEvent<bool>)(object)checkbox2.onValueChanged).AddListener((UnityAction<bool>)ExtraSettings.OnCheckModInstallChanged); } catch (Exception ex) { Plugin.Logger.LogError((object)("ExtraSettingsPatch error: " + ex)); } } private static Toggle GetCheckbox(SettingsUI settingsUI, string textKey, string playerPref) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) Toggle value = Traverse.Create((object)settingsUI).Field<Toggle>("reverseYAxisToggle").Value; Transform parent = ((Component)value).transform.parent.parent.parent; Transform parent2 = ((Component)value).transform.parent.parent.parent.parent; Transform val = Object.Instantiate<Transform>(parent, parent2); LocalizeStringEvent val2 = ((Component)val).GetComponentsInChildren<LocalizeStringEvent>().First((LocalizeStringEvent o) => ((Object)o).name == "SettingNameText"); ((LocalizedReference)val2.StringReference).SetReference(TableReference.op_Implicit("UI Text"), TableEntryReference.op_Implicit(textKey)); Toggle componentInChildren = ((Component)val).GetComponentInChildren<Toggle>(); GameObject gameObject = ((Component)componentInChildren).gameObject; Object.DestroyImmediate((Object)(object)componentInChildren); componentInChildren = gameObject.AddComponent<Toggle>(); componentInChildren.graphic = ((Component)((Component)componentInChildren).transform.Find("Background").Find("Checkmark")).GetComponent<Graphic>(); componentInChildren.isOn = PlayerPrefs.GetInt(playerPref) == 1; return componentInChildren; } } [HarmonyPatch(typeof(LightingManager), "DisplayWolfLight")] internal class ExtraSettingsReduceWolfRedPatch { private static Color ReducedWolfColor = new Color(1f, 0.8f, 0.8f, 1f); private static bool Prefix(bool active, LightingManager __instance) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) try { if (active && ExtraSettings.Instance.ReduceWolfRed) { ColorAdjustments value = Traverse.Create((object)__instance).Field<ColorAdjustments>("_colorAdjustments").Value; ((VolumeParameter<Color>)(object)value.colorFilter).value = ReducedWolfColor; return false; } return true; } catch (Exception ex) { Plugin.Logger.LogError((object)("ExtraSettingsReduceWolfRedPatch error: " + ex)); return true; } } } [NetworkBehaviourWeaved(3)] public class GameConfig : NetworkBehaviour { public static Dictionary<PlayerCustom.PlayerNewPrimaryRole, TMP_Dropdown> NewPrimaryRolesConfig = new Dictionary<PlayerCustom.PlayerNewPrimaryRole, TMP_Dropdown>(); public static Dictionary<PlayerCustom.PlayerSecondaryRole, TMP_Dropdown> SecondaryRolesConfig = new Dictionary<PlayerCustom.PlayerSecondaryRole, TMP_Dropdown>(); public Dictionary<PlayerCustom.PlayerNewPrimaryRole, float> NewPrimaryRoleChance = new Dictionary<PlayerCustom.PlayerNewPrimaryRole, float>(); public Dictionary<PlayerCustom.PlayerSecondaryRole, int> SecondaryRoleNumbers = new Dictionary<PlayerCustom.PlayerSecondaryRole, int>(); public static Toggle TrapsModifiedToggle; [Networked] [NetworkedWeaved(0, 1)] public unsafe NetworkBool TrapsModified { get { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing GameManager.TrapsModified. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)(*base.Ptr); } private set { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing GameManager.TrapsModified. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr, value); } } private void Start() { FillTrapsModifiedToggle(); } public override void Spawned() { if (((SimulationBehaviour)this).Runner.IsClient) { Plugin.NetworkObject = ((Component)this).GetComponent<NetworkObject>(); } try { foreach (KeyValuePair<PlayerCustom.PlayerNewPrimaryRole, TMP_Dropdown> item in NewPrimaryRolesConfig) { NewPrimaryRoleChance[item.Key] = float.Parse(item.Value.options[item.Value.value].text.Replace("%", "")) / 100f; } foreach (KeyValuePair<PlayerCustom.PlayerSecondaryRole, TMP_Dropdown> item2 in SecondaryRolesConfig) { SecondaryRoleNumbers[item2.Key] = int.Parse(item2.Value.options[item2.Value.value].text); } } catch (Exception ex) { Plugin.Logger.LogError((object)("GameConfigSetGameSettingsPatch error: " + ex)); } } public override void Despawned(NetworkRunner runner, bool hasState) { } public static void CreateAndAttachNewPrimaryRoleConfigDropdown(GameSettingsUI gameSettingsUI, PlayerCustom.PlayerNewPrimaryRole role, string key) { TMP_Dropdown dropdownForPrimaryRole = GetDropdownForPrimaryRole(gameSettingsUI, role, key); NewPrimaryRolesConfig[role] = dropdownForPrimaryRole; FillNewPrimaryRoleDropdown(dropdownForPrimaryRole, role); } public static void CreateAndAttachSecondaryRoleConfigDropdown(GameSettingsUI gameSettingsUI, PlayerCustom.PlayerSecondaryRole role, string key) { TMP_Dropdown dropdownForSecondaryRole = GetDropdownForSecondaryRole(gameSettingsUI, key); SecondaryRolesConfig[role] = dropdownForSecondaryRole; FillSecondaryRoleDropdown(dropdownForSecondaryRole, role); } public static Toggle CreateAndAttachConfigToggle(GameSettingsUI gameSettingsUI, string key) { return GetToggle(gameSettingsUI, key); } public static void FillNewPrimaryRoleDropdown(TMP_Dropdown dropdown, PlayerCustom.PlayerNewPrimaryRole role) { ((UnityEventBase)dropdown.onValueChanged).RemoveAllListeners(); ((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int index) { Plugin.CustomConfig.NewPrimaryRoleChance[role] = float.Parse(dropdown.options[index].text.Replace("%", "")) / 100f; PlayerPrefs.SetInt("GAME_SETTINGS_NALES_ROLE_" + role, index); }); if (PlayerPrefs.HasKey("GAME_SETTINGS_NALES_ROLE_" + role)) { int @int = PlayerPrefs.GetInt("GAME_SETTINGS_NALES_ROLE_" + role); if (@int < dropdown.options.Count) { dropdown.SetValueWithoutNotify(@int); } } } public static void FillSecondaryRoleDropdown(TMP_Dropdown dropdown, PlayerCustom.PlayerSecondaryRole role) { ((UnityEventBase)dropdown.onValueChanged).RemoveAllListeners(); ((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int index) { Plugin.CustomConfig.SecondaryRoleNumbers[role] = int.Parse(dropdown.options[index].text); PlayerPrefs.SetInt("GAME_SETTINGS_NALES_ROLE_" + role, index); }); if (PlayerPrefs.HasKey("GAME_SETTINGS_NALES_ROLE_" + role)) { int @int = PlayerPrefs.GetInt("GAME_SETTINGS_NALES_ROLE_" + role); if (@int < dropdown.options.Count) { dropdown.SetValueWithoutNotify(@int); } } } public void FillTrapsModifiedToggle() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (PlayerPrefs.HasKey("GAME_SETTINGS_TRAPS_MODIFIED") && PlayerPrefs.GetInt("GAME_SETTINGS_TRAPS_MODIFIED") == 1) { TrapsModified = NetworkBool.op_Implicit(true); TrapsModifiedToggle.SetIsOnWithoutNotify(PlayerPrefs.GetInt("GAME_SETTINGS_TRAPS_MODIFIED") == 1); } } public static void UpdateTrapsModified(bool value) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Plugin.CustomConfig.TrapsModified = NetworkBool.op_Implicit(value); PlayerPrefs.SetInt("GAME_SETTINGS_TRAPS_MODIFIED", value ? 1 : 0); } public void UpdateTrapsModifiedSetting(bool value) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (((SimulationBehaviour)this).Runner.IsServer && (int)GameManager.State.Current == 1) { TrapsModified = NetworkBool.op_Implicit(value); } } private static TMP_Dropdown GetDropdownForPrimaryRole(GameSettingsUI gameSettingsUI, PlayerCustom.PlayerNewPrimaryRole role, string key) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) TMP_Dropdown value = Traverse.Create((object)gameSettingsUI).Field<TMP_Dropdown>("alchemistsCountDropdown").Value; Transform parent = ((Component)value).transform.parent.parent.parent; Transform parent2 = ((Component)value).transform.parent.parent.parent.parent; Transform val = Object.Instantiate<Transform>(parent, parent2); LocalizeStringEvent val2 = ((Component)val).GetComponentsInChildren<LocalizeStringEvent>().First((LocalizeStringEvent o) => ((Object)o).name == "SettingNameText"); val2.StringReference.Arguments = new List<object> { TranslationManager.Instance.GetTranslation(key) }; string text = ""; switch (role) { case PlayerCustom.PlayerNewPrimaryRole.VillageIdiot: case PlayerCustom.PlayerNewPrimaryRole.Cannibal: text = "NALES_ROLE_TYPE_MAIN_SOLO"; break; case PlayerCustom.PlayerNewPrimaryRole.Corrupter: case PlayerCustom.PlayerNewPrimaryRole.Shapeshifter: text = "NALES_ROLE_TYPE_MAIN_WOLF"; break; case PlayerCustom.PlayerNewPrimaryRole.Traitor: text = "NALES_ROLE_TYPE_MAIN_SPECIAL"; break; } ((LocalizedReference)val2.StringReference).SetReference(TableReference.op_Implicit("UI Text"), TableEntryReference.op_Implicit(text)); TMP_Dropdown componentInChildren = ((Component)val).GetComponentInChildren<TMP_Dropdown>(); componentInChildren.ClearOptions(); List<string> list = new List<string>(); for (int i = 0; i <= 100; i += 10) { list.Add(i + "%"); } componentInChildren.AddOptions(list); return componentInChildren; } private static TMP_Dropdown GetDropdownForSecondaryRole(GameSettingsUI gameSettingsUI, string key) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) TMP_Dropdown value = Traverse.Create((object)gameSettingsUI).Field<TMP_Dropdown>("alchemistsCountDropdown").Value; Transform parent = ((Component)value).transform.parent.parent.parent; Transform parent2 = ((Component)value).transform.parent.parent.parent.parent; Transform val = Object.Instantiate<Transform>(parent, parent2); LocalizeStringEvent val2 = ((Component)val).GetComponentsInChildren<LocalizeStringEvent>().First((LocalizeStringEvent o) => ((Object)o).name == "SettingNameText"); val2.StringReference.Arguments = new List<object> { TranslationManager.Instance.GetTranslation(key) }; ((LocalizedReference)val2.StringReference).SetReference(TableReference.op_Implicit("UI Text"), TableEntryReference.op_Implicit("NALES_ROLE_TYPE_SECONDARY")); return ((Component)val).GetComponentInChildren<TMP_Dropdown>(); } private static Toggle GetToggle(GameSettingsUI gameSettingsUI, string key) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) Toggle value = Traverse.Create((object)gameSettingsUI).Field<Toggle>("showAllyToggle").Value; Transform parent = ((Component)value).transform.parent.parent.parent; Transform parent2 = ((Component)value).transform.parent.parent.parent.parent; Transform val = Object.Instantiate<Transform>(parent, parent2); LocalizeStringEvent val2 = ((Component)val).GetComponentsInChildren<LocalizeStringEvent>().First((LocalizeStringEvent o) => ((Object)o).name == "SettingNameText"); ((LocalizedReference)val2.StringReference).SetReference(TableReference.op_Implicit("UI Text"), TableEntryReference.op_Implicit(key)); Toggle componentInChildren = ((Component)val).GetComponentInChildren<Toggle>(); GameObject gameObject = ((Component)componentInChildren).gameObject; Object.DestroyImmediate((Object)(object)componentInChildren); componentInChildren = gameObject.AddComponent<Toggle>(); componentInChildren.graphic = ((Component)((Component)componentInChildren).transform.Find("Background").Find("Checkmark")).GetComponent<Graphic>(); return componentInChildren; } } [HarmonyPatch(typeof(GameSettingsUI), "Start")] internal class GameConfigAddNewSettingsPatch { private static void Postfix(ref GameSettingsUI __instance) { try { List<PlayerCustom.PlayerNewPrimaryRole> list = (from PlayerCustom.PlayerNewPrimaryRole o in Enum.GetValues(typeof(PlayerCustom.PlayerNewPrimaryRole)) where o != PlayerCustom.PlayerNewPrimaryRole.None select o).ToList(); foreach (PlayerCustom.PlayerNewPrimaryRole item in list) { GameConfig.CreateAndAttachNewPrimaryRoleConfigDropdown(__instance, item, "NALES_ROLE_" + PlayerCustom.GetNewPrimaryRoleString(item)); } List<PlayerCustom.PlayerSecondaryRole> list2 = (from PlayerCustom.PlayerSecondaryRole o in Enum.GetValues(typeof(PlayerCustom.PlayerSecondaryRole)) where o != 0 && !PlayerCustom.IsRoleDisabled(o) select o).ToList(); foreach (PlayerCustom.PlayerSecondaryRole item2 in list2) { GameConfig.CreateAndAttachSecondaryRoleConfigDropdown(__instance, item2, "NALES_ROLE_" + PlayerCustom.GetSecondaryRoleString(item2)); } GameConfig.TrapsModifiedToggle = GameConfig.CreateAndAttachConfigToggle(__instance, "NALES_CONFIG_TRAP_CHANGES"); ((UnityEvent<bool>)(object)GameConfig.TrapsModifiedToggle.onValueChanged).AddListener((UnityAction<bool>)GameConfig.UpdateTrapsModified); } catch (Exception ex) { Plugin.Logger.LogError((object)("GameConfigAddNewSettingsPatch error: " + ex)); } } } [HarmonyPatch(typeof(GameSettingsUI), "ResetSettings")] internal class GameConfigResetSettingsPatch { private static void Postfix(ref GameSettingsUI __instance) { try { foreach (KeyValuePair<PlayerCustom.PlayerNewPrimaryRole, TMP_Dropdown> item in GameConfig.NewPrimaryRolesConfig) { item.Value.value = 5; } foreach (KeyValuePair<PlayerCustom.PlayerSecondaryRole, TMP_Dropdown> item2 in GameConfig.SecondaryRolesConfig) { item2.Value.value = 1; } GameConfig.TrapsModifiedToggle.SetIsOnWithoutNotify(true); } catch (Exception ex) { Plugin.Logger.LogError((object)("GameConfigResetSettingsPatch error: " + ex)); } } } public static class GlobalManager { public static string GlobalManagerName => "LycansNewRoles.GlobalManager"; public static string PlayerCustomRegistryName => "LycansNewRoles.PlayerCustomRegistry"; public static string PlayerCustomName => "LycansNewRoles.PlayerCustom"; public static string ChasingEffectName => "LycansNewRoles.EffectChasing"; public static string StunnedEffectName => "LycansNewRoles.EffectStunned"; public static string SprintingEffectName => "LycansNewRoles.EffectSprinting"; public static string RevertingEffectName => "LycansNewRoles.EffectReverting"; public static string MuddlingEffectName => "LycansNewRoles.EffectMuddling"; public static string InfectedEffectName => "LycansNewRoles.EffectInfected"; public static string StealthingEffectName => "LycansNewRoles.EffectStealthing"; public static string DeafnessEffectName => "LycansNewRoles.EffectDeafness"; public static string InnocentEffectName => "LycansNewRoles.EffectInnocent"; public static string MurdererEffectName => "LycansNewRoles.EffectMurderer"; public static string StarvationActiveEffectName => "LycansNewRoles.EffectStarvationActive"; public static string ShoutingEffectName => "LycansNewRoles.EffectShouting"; public static string BlindEffectName => "LycansNewRoles.EffectBlind"; public static string IllusionEffectName => "LycansNewRoles.EffectIllusion"; public static string GetPrefabName(string baseName) { return baseName; } } [HarmonyPatch(typeof(GameManager), "Spawned")] internal class GlobalManagerGameManagerSpawnedPatch { private static void Postfix(ref GameManager __instance) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (((SimulationBehaviour)__instance).Runner.SessionInfo.IsOpen && ((SimulationBehaviour)__instance).Runner.IsServer) { try { NetworkPrefabId networkObject = NetworkObjectService.Instance.GetNetworkObject(GlobalManager.GetPrefabName(GlobalManager.GlobalManagerName)); Plugin.NetworkObject = ((SimulationBehaviour)__instance).Runner.Spawn(networkObject, (Vector3?)null, (Quaternion?)null, (PlayerRef?)null, (OnBeforeSpawned)null, (NetworkObjectPredictionKey?)null, true, (NetworkObject)null); networkObject = NetworkObjectService.Instance.GetNetworkObject(GlobalManager.GetPrefabName(GlobalManager.PlayerCustomRegistryName)); ((SimulationBehaviour)__instance).Runner.Spawn(networkObject, (Vector3?)null, (Quaternion?)null, (PlayerRef?)null, (OnBeforeSpawned)null, (NetworkObjectPredictionKey?)null, true, (NetworkObject)null); } catch (Exception ex) { Plugin.Logger.LogError((object)("Error: " + ex)); } } } } [HarmonyPatch(typeof(NetworkRunner), "Awake")] internal class GlobalManagerNetworkRunnerAwakeCreatePrefabsPatch { private static void Prefix(NetworkRunner __instance) { try { Plugin.CreatePrefabs(); } catch (Exception ex) { Plugin.Logger.LogError((object)("GameManager Awake error: " + ex)); } } } [HarmonyPatch(typeof(PlayerController), "CheckHunger")] internal class CheckHungerPatch { private static bool Prefix(ref PlayerController __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Invalid comparison between Unknown and I4 //IL_0043: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_01b4: Unknown result type (might be due to invalid IL or missing references) try { if ((int)GameManager.State.Current == 2 && !NetworkBool.op_Implicit(GameManager.LightingManager.IsTransition) && !NetworkBool.op_Implicit(__instance.IsDead) && __instance.Hunger > 0f && !NetworkBool.op_Implicit(__instance.PlayerEffectManager.Satiated)) { if (!NetworkBool.op_Implicit(__instance.IsWolf)) { if ((int)__instance.Role != 1) { float num = 0.2f; if (NetworkBool.op_Implicit(__instance.IsTrapped)) { num = 2f; } if (NetworkBool.op_Implicit(__instance.IsMoving)) { num = 0.35f; if (__instance.MovementAction == 2) { num = 1.5f; } else if (__instance.MovementAction == 1) { num = 0.25f; } if (NetworkBool.op_Implicit(__instance.IsClimbing)) { num *= 1.5f; } } PlayerCustom player = PlayerCustomRegistry.GetPlayer(__instance.Ref); if (player.SecondaryRole == PlayerCustom.PlayerSecondaryRole.BothMetabolic) { num *= 0.5f; } if (NetworkBool.op_Implicit(player.StarvationActive)) { num += 0.9f; } if (NetworkBool.op_Implicit(player.Sprinting)) { num += 4.5f; } PlayerController obj = __instance; obj.Hunger -= num * ((SimulationBehaviour)__instance).Runner.DeltaTime; if (__instance.Hunger <= 0f) { __instance.Hunger = 0f; __instance.Rpc_Kill(PlayerRef.None); return false; } } else { PlayerCustom player2 = PlayerCustomRegistry.GetPlayer(__instance.Ref); if (player2.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Shapeshifter) { float num2 = 2f * ((SimulationBehaviour)__instance).Runner.DeltaTime; __instance.Hunger = Math.Min(__instance.Hunger + num2, GameManager.Instance.MaxHunger); } } } else if (!__instance.IsStarving()) { float num3 = 0.5f; if (NetworkBool.op_Implicit(__instance.IsTrapped)) { num3 = 6f; } if (NetworkBool.op_Implicit(__instance.IsMoving)) { num3 = 1f; if (__instance.MovementAction == 2) { num3 = 2.5f; } else if (__instance.MovementAction == 1) { num3 = 0.5f; } if (NetworkBool.op_Implicit(__instance.IsClimbing)) { num3 *= 1.5f; } } PlayerCustom player3 = PlayerCustomRegistry.GetPlayer(__instance.Ref); if (player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Shapeshifter) { num3 *= 1.15f; } PlayerController obj2 = __instance; obj2.Hunger -= num3 * ((SimulationBehaviour)__instance).Runner.DeltaTime; } } return false; } catch (Exception ex) { Plugin.Logger.LogError((object)("SecondaryRoleMetabolicLessHungerPatch error: " + ex)); return true; } } } [HarmonyPatch(typeof(TrapItem), "Spawned")] internal class TrapAnimationAddDelayPatch { private static bool Prefix(ref TrapItem __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) try { if (!NetworkBool.op_Implicit(Plugin.CustomConfig.TrapsModified)) { return true; } Traverse.Create((object)__instance).Field("triggerDelay").SetValue((object)1f); Traverse.Create((object)__instance).Field("animationDuration").SetValue((object)1f); return true; } catch (Exception ex) { Plugin.Logger.LogError((object)("TrapAnimationAddDelayPatch error: " + ex)); return true; } } } [HarmonyPatch(typeof(TrapItem), "AnimationStarted")] internal class TrapAnimationStartedPatch { private static bool Prefix(ref TrapItem __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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) try { if (!NetworkBool.op_Implicit(Plugin.CustomConfig.TrapsModified)) { return true; } PlayerController player = PlayerRegistry.GetPlayer(((Item)__instance).Owner); if ((Object)(object)player == (Object)null) { return false; } player.MovementAction = 1; player.CanMoveAnimation = NetworkBool.op_Implicit(false); player.IsAiming = NetworkBool.op_Implicit(false); player.UpdateAnimation(Animator.StringToHash("Crouching"), true); return false; } catch (Exception ex) { Plugin.Logger.LogError((object)("TrapAnimationStartedPatch error: " + ex)); return true; } } } [HarmonyPatch(typeof(TrapItem), "AnimationEnded")] internal class TrapAnimationEndedPatch { private static bool Prefix(ref TrapItem __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) try { if (!NetworkBool.op_Implicit(Plugin.CustomConfig.TrapsModified)) { return true; } PlayerController player = PlayerRegistry.GetPlayer(((Item)__instance).Owner); if ((Object)(object)player == (Object)null) { return false; } player.MovementAction = 0; player.UpdateAnimation(Animator.StringToHash("Crouching"), false); player.CanMoveAnimation = NetworkBool.op_Implicit(true); return false; } catch (Exception ex) { Plugin.Logger.LogError((object)("TrapAnimationEndedPatch error: " + ex)); return true; } } } [HarmonyPatch(typeof(TrapItem), "AnimationCancelled")] internal class TrapAnimationCancelledPatch { private static bool Prefix(ref TrapItem __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) try { if (!NetworkBool.op_Implicit(Plugin.CustomConfig.TrapsModified)) { return true; } PlayerController player = PlayerRegistry.GetPlayer(((Item)__instance).Owner); if ((Object)(object)player == (Object)null) { return false; } player.UpdateAnimation(Animator.StringToHash("Crouching"), false); player.CanMoveAnimation = NetworkBool.op_Implicit(true); return false; } catch (Exception ex) { Plugin.Logger.LogError((object)("TrapAnimationCancelledPatch error: " + ex)); return true; } } } [HarmonyPatch(typeof(PlayerController), "UpdateRayCast")] internal class TrapDisarmTooltipPatch { private static void Postfix(GameObject raycastTargetObject, float distance, ref PlayerController __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) Trap trap = default(Trap); if (NetworkBool.op_Implicit(Plugin.CustomConfig.TrapsModified) && ((SimulationBehaviour)__instance).HasInputAuthority && !NetworkBool.op_Implicit(__instance.IsAiming) && !NetworkBool.op_Implicit(__instance.IsZooming) && NetworkBool.op_Implicit(__instance.CanMoveAnimation) && distance < 2.5f && (int)GameManager.LocalGameState == 2 && raycastTargetObject.TryGetComponent<Trap>(ref trap) && trap.TrapCanBeDisarmed()) { GameManager.Instance.gameUI.UpdateInteraction("NALES_UI_DISARM", Color.white, (InputActionName)3, Array.Empty<object>()); Traverse.Create((object)__instance).Field("_targetObject").SetValue((object)raycastTargetObject); GameManager.Instance.gameUI.ChangeCrossHairOpacity(NetworkBool.op_Implicit(__instance.IsAiming) ? 0.1f : 1f); } } } [HarmonyPatch(typeof(PlayerController), "Interact")] internal class TrapDisarmActionPatch { private static void Postfix(bool isPrimary, ref PlayerController __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (NetworkBool.op_Implicit(Plugin.CustomConfig.TrapsModified) && !NetworkBool.op_Implicit(__instance.IsAiming) && !((Object)(object)__instance.targetObject == (Object)null) && (int)GameManager.State.Current == 2) { Trap component = __instance.targetObject.GetComponent<Trap>(); if ((Object)(object)component != (Object)null && component.TrapCanBeDisarmed()) { PlayerCustom.Rpc_Disarm_Trap(((SimulationBehaviour)__instance).Runner, __instance.Index, ((SimulationBehaviour)component).Object.Id); } } } } public static class ImprovedTrapsExtensions { public static bool TrapCanBeDisarmed(this Trap trap) { Traverse<Animator> val = Traverse.Create((object)trap).Field<Animator>("animator"); return !val.Value.GetBool("Closing") && !val.Value.GetBool("Breaking"); } } internal class NetworkObjectService { private static NetworkObjectService? _instance; private Dictionary<string, NetworkPrefabId> _prefabs; public static NetworkObjectService Instance { get { if (_instance == null) { _instance = new NetworkObjectService(); } return _instance; } } private NetworkObjectService() { _prefabs = new Dictionary<string, NetworkPrefabId>(); } public void RegisterNetworkObject(GameObject prefab, string uniqueKey) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_0090: 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_00b8: Unknown result type (might be due to invalid IL or missing references) if (_prefabs.ContainsKey(uniqueKey)) { throw new InvalidOperationException("Key '" + uniqueKey + "' already exists"); } NetworkObject component = prefab.GetComponent<NetworkObject>(); if ((Object)(object)component == (Object)null) { throw new MissingComponentException("Prefab is missing 'NetworkObject' component!"); } component.NetworkedBehaviours = prefab.GetComponents<NetworkBehaviour>(); component.NetworkGuid = new NetworkObjectGuid(uniqueKey.ToGuid().ToString()); NetworkPrefabSourceUnityStatic val = new NetworkPrefabSourceUnityStatic { PrefabReference = ((Component)component).gameObject }; NetworkPrefabId value = default(NetworkPrefabId); if (!NetworkProjectConfig.Global.PrefabTable.TryAdd(component.NetworkGuid, (INetworkPrefabSource)(object)val, ref value)) { throw new ApplicationException("Could not add prefab to registered prefabs, was it already present?"); } _prefabs.Add(uniqueKey, value); } public NetworkPrefabId GetNetworkObject(string uniqueKey) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (_prefabs.TryGetValue(uniqueKey, out var value)) { return value; } throw new KeyNotFoundException("No prefab registered with '" + uniqueKey + "' as identifier!"); } public void Clear() { _prefabs.Clear(); } } internal static class StringExtensions { public static Guid ToGuid(this string value) { return new Guid(MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(value))); } } [NetworkBehaviourWeaved(136)] public class PlayerCustom : NetworkBehaviour { public enum PlayerSecondaryRole { None, BothHowler, BothAlcoholic, BothDetective, BothSprinter, BothInfected, BothTeleporter, BothTracker, BothEngineer, BothStealther, BothPolitician, BothMetabolic, BothIllusionist, BothSherif, BothGambler } public enum PlayerNewPrimaryRole { None, VillageIdiot, Cannibal, Corrupter, Shapeshifter, Traitor } public enum PrimaryRoleTarget { Villager, Wolf } private static Color NewPrimaryRoleVillageIdiotColor = new Color(0f, 1f, 0f, 1f); private static Color NewPrimaryRoleTraitorColor = new Color(1f, 0.5f, 0f, 1f); private static Color NewPrimaryRoleCannibalColor = new Color(0f, 1f, 0.5f, 1f); private static Color NewPrimaryRoleCorrupterColor = new Color(0.6f, 0f, 0f, 1f); private static Color NewPrimaryRoleShapeshifterColor = new Color(1f, 0.25f, 0.25f, 1f); public int? PowerCooldownTimerTicksBeforeMeeting = null; public Trap TrapToDisarm; private static Light _trackerLightComponent = null; [Networked(OnChanged = "SecondaryRoleChanged")] [NetworkedWeaved(0, 1)] public unsafe PlayerSecondaryRole SecondaryRole { get { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.SecondaryRole. Networked properties can only be accessed when Spawned() has been called."); } return (PlayerSecondaryRole)(*base.Ptr); } set { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.SecondaryRole. Networked properties can only be accessed when Spawned() has been called."); } *base.Ptr = (int)value; } } [Networked] [NetworkedWeaved(1, 1)] public unsafe NetworkBool Stunned { get { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Stunned. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[1]; } set { //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) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Stunned. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 1, value); } } [Networked(OnChanged = "SecondaryRoleFirstRemainingUsesChanged")] [NetworkedWeaved(2, 1)] public unsafe int SecondaryRoleFirstRemainingUses { get { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.HowlerRemainingUses. Networked properties can only be accessed when Spawned() has been called."); } return base.Ptr[2]; } set { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.HowlerRemainingUses. Networked properties can only be accessed when Spawned() has been called."); } base.Ptr[2] = value; } } [Networked(OnChanged = "SecondaryRoleSecondRemainingUsesChanged")] [NetworkedWeaved(3, 1)] public unsafe int SecondaryRoleSecondRemainingUses { get { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.SprinterWolfRemainingUses. Networked properties can only be accessed when Spawned() has been called."); } return base.Ptr[3]; } set { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.SprinterWolfRemainingUses. Networked properties can only be accessed when Spawned() has been called."); } base.Ptr[3] = value; } } [NetworkedWeaved(4, 1)] public unsafe NetworkBool Chasing { get { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Chasing. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[4]; } set { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Chasing. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 4, value); } } [NetworkedWeaved(5, 1)] public unsafe NetworkBool KilledLastNight { get { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.KilledLastNight. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[5]; } set { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.KilledLastNight. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 5, value); } } [Networked] [NetworkedWeaved(6, 1)] public unsafe NetworkBool Sprinting { get { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Sprinting. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[6]; } set { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Sprinting. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 6, value); } } [Networked(OnChanged = "RevertingChanged")] [NetworkedWeaved(7, 1)] public unsafe NetworkBool Reverting { get { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Reverting. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[7]; } set { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Reverting. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 7, value); } } [Networked(OnChanged = "MuddlingChanged")] [NetworkedWeaved(8, 1)] public unsafe NetworkBool Muddling { get { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Muddling. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[8]; } set { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Muddling. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 8, value); } } [Networked] [NetworkedWeaved(9, 1)] public unsafe PlayerRef Ref { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Ref. Networked properties can only be accessed when Spawned() has been called."); } return (PlayerRef)base.Ptr[9]; } private set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Ref. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 9, value); } } [Networked] [NetworkedWeaved(10, 1)] public unsafe byte Index { get { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Index. Networked properties can only be accessed when Spawned() has been called."); } return *(byte*)(base.Ptr + 10); } private set { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Index. Networked properties can only be accessed when Spawned() has been called."); } *(byte*)(base.Ptr + 10) = value; } } [Networked(OnChanged = "NewPrimaryRoleChanged")] [NetworkedWeaved(11, 1)] public unsafe PlayerNewPrimaryRole NewPrimaryRole { get { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.NewPrimaryRole. Networked properties can only be accessed when Spawned() has been called."); } return (PlayerNewPrimaryRole)base.Ptr[11]; } set { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.NewPrimaryRole. Networked properties can only be accessed when Spawned() has been called."); } base.Ptr[11] = (int)value; } } [NetworkedWeaved(12, 1)] public unsafe NetworkBool KilledDuringVote { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.KilledDuringVote. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[12]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.KilledDuringVote. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 12, value); } } [Networked(OnChanged = "StealthingChanged")] [NetworkedWeaved(13, 1)] public unsafe NetworkBool Stealthing { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Stealthing. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[13]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Stealthing. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 13, value); } } [Networked(OnChanged = "DeafChanged")] [NetworkedWeaved(14, 1)] public unsafe NetworkBool Deaf { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Deaf. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[14]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Deaf. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 14, value); } } [NetworkedWeaved(15, 1)] public unsafe NetworkBool StarvationDormant { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.StarvationDormant. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[15]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.StarvationDormant. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 15, value); } } [NetworkedWeaved(16, 1)] public unsafe NetworkBool StarvationActive { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.StarvationActive. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[16]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.StarvationActive. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 16, value); } } [Networked] [NetworkedWeaved(17, 1)] public unsafe NetworkBool Shouting { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Shouting. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[17]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Shouting. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 17, value); } } [Networked] [NetworkedWeaved(18, 1)] public unsafe TickTimer VersionValidationTimer { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.VersionValidationTimer. Networked properties can only be accessed when Spawned() has been called."); } return (TickTimer)base.Ptr[18]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.VersionValidationTimer. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 18, value); } } [Networked(OnChanged = "BlindChanged")] [NetworkedWeaved(19, 1)] public unsafe NetworkBool Blind { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Blind. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[19]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Blind. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 19, value); } } [Networked(OnChanged = "IllusionTargetChanged")] [NetworkedWeaved(20, 1)] public unsafe PlayerRef IllusionTarget { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.IllusionTarget. Networked properties can only be accessed when Spawned() has been called."); } return (PlayerRef)base.Ptr[20]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.IllusionTarget. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 20, value); } } [Networked] [NetworkedWeaved(21, 1)] public unsafe TickTimer CannibalEatTimer { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.CannibalEatTimer. Networked properties can only be accessed when Spawned() has been called."); } return (TickTimer)base.Ptr[21]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.CannibalEatTimer. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 21, value); } } [Networked(OnChanged = "CannibalEatenCorpsesCountChanged")] [NetworkedWeaved(22, 1)] public unsafe int CannibalEatenCorpsesCount { get { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.CannibalEatenCorpsesCount. Networked properties can only be accessed when Spawned() has been called."); } return base.Ptr[22]; } set { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.CannibalEatenCorpsesCount. Networked properties can only be accessed when Spawned() has been called."); } base.Ptr[22] = value; } } [Networked] [NetworkedWeaved(23, 1)] public unsafe PlayerRef CannibalTargetRef { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.CannibalTargetRef. Networked properties can only be accessed when Spawned() has been called."); } return (PlayerRef)base.Ptr[23]; } private set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.CannibalTargetRef. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 23, value); } } [Networked(OnChanged = "EatenChanged")] [NetworkedWeaved(24, 1)] public unsafe NetworkBool Eaten { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Eaten. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[24]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.Eaten. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 24, value); } } [Networked] [NetworkedWeaved(25, 1)] public unsafe int NewPrimaryRoleRemainingUses { get { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.NewPrimaryRoleRemainingUses. Networked properties can only be accessed when Spawned() has been called."); } return base.Ptr[25]; } set { if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.NewPrimaryRoleRemainingUses. Networked properties can only be accessed when Spawned() has been called."); } base.Ptr[25] = value; } } [Networked] [NetworkedWeaved(26, 1)] public unsafe TickTimer TrapDisarmTimer { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.TrapDisarmTimer. Networked properties can only be accessed when Spawned() has been called."); } return (TickTimer)base.Ptr[26]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.TrapDisarmTimer. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 26, value); } } [Networked] [NetworkedWeaved(27, 1)] public unsafe TickTimer PowerCooldownTimer { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.PowerCooldownTimer. Networked properties can only be accessed when Spawned() has been called."); } return (TickTimer)base.Ptr[27]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.PowerCooldownTimer. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 27, value); } } [Networked] [NetworkedWeaved(28, 1)] public unsafe NetworkBool NextVoteDenied { get { //IL_0027: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.NextVoteDenied. Networked properties can only be accessed when Spawned() has been called."); } return (NetworkBool)base.Ptr[28]; } set { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (base.Ptr == null) { throw new InvalidOperationException("Error when accessing PlayerCustom.NextVoteDenied. Networked properties can only be accessed when Spawned() has been called."); } Unsafe.Write(base.Ptr + 28, value); } } public static int CannibalTargetAmount { get { int count = PlayerRegistry.Count; if (count <= 3) { return 1; } if (count <= 6) { return 2; } if (count <= 9) { return 3; } return 4; } } public static Light TrackerLightComponent => _trackerLightComponent; public static bool IsRoleDisabled(PlayerSecondaryRole role) { if (role == PlayerSecondaryRole.BothTracker) { return true; } return false; } public static PrimaryRoleTarget GetPrimaryRoleTarget(PlayerNewPrimaryRole newPrimaryRole) { switch (newPrimaryRole) { case PlayerNewPrimaryRole.VillageIdiot: case PlayerNewPrimaryRole.Cannibal: case PlayerNewPrimaryRole.Traitor: return PrimaryRoleTarget.Villager; case PlayerNewPrimaryRole.Corrupter: case PlayerNewPrimaryRole.Shapeshifter: return PrimaryRoleTarget.Wolf; default: return PrimaryRoleTarget.Villager; } } public static string GetNewPrimaryRoleString(PlayerNewPrimaryRole newPrimaryRole) { return newPrimaryRole switch { PlayerNewPrimaryRole.VillageIdiot => "VILLAGE_IDIOT", PlayerNewPrimaryRole.Traitor => "TRAITOR", PlayerNewPrimaryRole.Cannibal => "CANNIBAL", PlayerNewPrimaryRole.Corrupter => "CORRUPTER", PlayerNewPrimaryRole.Shapeshifter => "SHAPESHIFTER", _ => "NONE", }; } public static string GetSecondaryRoleString(PlayerSecondaryRole secondaryRole) { return secondaryRole switch { PlayerSecondaryRole.BothHowler => "HOWLER", PlayerSecondaryRole.BothAlcoholic => "ALCOHOLIC", PlayerSecondaryRole.BothDetective => "DETECTIVE", PlayerSecondaryRole.BothSprinter => "SPRINTER", PlayerSecondaryRole.BothInfected => "INFECTED", PlayerSecondaryRole.BothTeleporter => "TELEPORTER", PlayerSecondaryRole.BothTracker => "TRACKER", PlayerSecondaryRole.BothEngineer => "ENGINEER", PlayerSecondaryRole.BothStealther => "STEALTHER", PlayerSecondaryRole.BothPolitician => "POLITICIAN", PlayerSecondaryRole.BothMetabolic => "METABOLIC", PlayerSecondaryRole.BothIllusionist => "ILLUSIONIST", PlayerSecondaryRole.BothSherif => "SHERIF", PlayerSecondaryRole.BothGambler => "GAMBLER", _ => "NONE", }; } public static Color GetNewPrimaryRoleColor(PlayerNewPrimaryRole newPrimaryRole) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) return (Color)(newPrimaryRole switch { PlayerNewPrimaryRole.VillageIdiot => NewPrimaryRoleVillageIdiotColor, PlayerNewPrimaryRole.Traitor => NewPrimaryRoleTraitorColor, PlayerNewPrimaryRole.Cannibal => NewPrimaryRoleCannibalColor, PlayerNewPrimaryRole.Corrupter => NewPrimaryRoleCorrupterColor, PlayerNewPrimaryRole.Shapeshifter => NewPrimaryRoleShapeshifterColor, _ => Color.white, }); } public static List<PlayerSecondaryRole> GetAvailableSecondaryRoles(PlayerRole basePrimaryRole, PlayerNewPrimaryRole newPrimaryRole) { //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected I4, but got Unknown switch (newPrimaryRole) { case PlayerNewPrimaryRole.VillageIdiot: return new List<PlayerSecondaryRole> { PlayerSecondaryRole.BothAlcoholic, PlayerSecondaryRole.BothDetective, PlayerSecondaryRole.BothEngineer, PlayerSecondaryRole.BothHowler, PlayerSecondaryRole.BothIllusionist, PlayerSecondaryRole.BothMetabolic, PlayerSecondaryRole.BothSherif, PlayerSecondaryRole.BothSprinter, PlayerSecondaryRole.BothStealther, PlayerSecondaryRole.BothTeleporter, PlayerSecondaryRole.BothGambler, PlayerSecondaryRole.BothTracker }; case PlayerNewPrimaryRole.Traitor: return new List<PlayerSecondaryRole> { PlayerSecondaryRole.BothAlcoholic, PlayerSecondaryRole.BothDetective, PlayerSecondaryRole.BothEngineer, PlayerSecondaryRole.BothHowler, PlayerSecondaryRole.BothMetabolic, PlayerSecondaryRole.BothSprinter, PlayerSecondaryRole.BothStealther, PlayerSecondaryRole.BothTeleporter, PlayerSecondaryRole.BothGambler, PlayerSecondaryRole.BothTracker }; case PlayerNewPrimaryRole.Cannibal: return new List<PlayerSecondaryRole> { PlayerSecondaryRole.BothAlcoholic, PlayerSecondaryRole.BothDetective, PlayerSecondaryRole.BothEngineer, PlayerSecondaryRole.BothHowler, PlayerSecondaryRole.BothMetabolic, PlayerSecondaryRole.BothSherif, PlayerSecondaryRole.BothSprinter, PlayerSecondaryRole.BothStealther, PlayerSecondaryRole.BothTeleporter, PlayerSecondaryRole.BothGambler, PlayerSecondaryRole.BothTracker }; case PlayerNewPrimaryRole.Corrupter: return new List<PlayerSecondaryRole> { PlayerSecondaryRole.BothAlcoholic, PlayerSecondaryRole.BothDetective, PlayerSecondaryRole.BothEngineer, PlayerSecondaryRole.BothHowler, PlayerSecondaryRole.BothIllusionist, PlayerSecondaryRole.BothInfected, PlayerSecondaryRole.BothMetabolic, PlayerSecondaryRole.BothPolitician, PlayerSecondaryRole.BothSherif, PlayerSecondaryRole.BothSprinter, PlayerSecondaryRole.BothStealther, PlayerSecondaryRole.BothTeleporter, PlayerSecondaryRole.BothGambler, PlayerSecondaryRole.BothTracker }; case PlayerNewPrimaryRole.Shapeshifter: return new List<PlayerSecondaryRole> { PlayerSecondaryRole.BothAlcoholic, PlayerSecondaryRole.BothDetective, PlayerSecondaryRole.BothEngineer, PlayerSecondaryRole.BothHowler, PlayerSecondaryRole.BothIllusionist, PlayerSecondaryRole.BothInfected, PlayerSecondaryRole.BothMetabolic, PlayerSecondaryRole.BothPolitician, PlayerSecondaryRole.BothSherif, PlayerSecondaryRole.BothSprinter, PlayerSecondaryRole.BothStealther, PlayerSecondaryRole.BothTeleporter, PlayerSecondaryRole.BothGambler, PlayerSecondaryRole.BothTracker }; case PlayerNewPrimaryRole.None: switch ((int)basePrimaryRole) { case 0: case 1: case 3: return new List<PlayerSecondaryRole> { PlayerSecondaryRole.BothAlcoholic, PlayerSecondaryRole.BothDetective, PlayerSecondaryRole.BothEngineer, PlayerSecondaryRole.BothHowler, PlayerSecondaryRole.BothIllusionist, PlayerSecondaryRole.BothInfected, PlayerSecondaryRole.BothMetabolic, PlayerSecondaryRole.BothPolitician, PlayerSecondaryRole.BothSherif, PlayerSecondaryRole.BothSprinter, PlayerSecondaryRole.BothStealther, PlayerSecondaryRole.BothTeleporter, PlayerSecondaryRole.BothGambler, PlayerSecondaryRole.BothTracker }; case 2: return new List<PlayerSecondaryRole>(); } break; } return new List<PlayerSecondaryRole>(); } [Rpc] public unsafe static void Rpc_Disarm_Trap(NetworkRunner runner, int playerIndex, NetworkId trapId) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_00e5: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) try { if (NetworkBehaviourUtils.InvokeRpc) { NetworkBehaviourUtils.InvokeRpc = false; } else { if ((Object)(object)runner == (Object)null) { throw new ArgumentNullException("runner"); } if ((int)runner.Stage == 4) { return; } if (runner.HasAnyActiveConnections()) { int num = 24; SimulationMessage* ptr = SimulationMessage.Allocate(runner.Simulation, num); byte* data = SimulationMessage.GetData(ptr); int num2 = RpcHeader.Write(RpcHeader.Create(NetworkBehaviourUtils.GetRpcStaticIndexOrThrow("System.Void LycansNewRoles.PlayerCustom::Rpc_Disarm_Trap(Fusion.NetworkRunner,System.Int32,Fusion.NetworkId)")), data); *(int*)(data + num2) = playerIndex; num2 += 4; Unsafe.Write(data + num2, trapId); num2 += 4; ((SimulationMessage)ptr).Offset = num2 * 8; ((SimulationMessage)ptr).SetStatic(); runner.SendRpc(ptr); } } if (runner.IsServer) { PlayerCustom player = PlayerCustomRegistry.GetPlayer(playerIndex); PlayerController player2 = PlayerRegistry.GetPlayer(player.Ref); player.TrapToDisarm = ((Component)runner.FindObject(trapId)).GetComponent<Trap>(); player2.MovementAction = 0; player2.CanMoveAnimation = NetworkBool.op_Implicit(false); player2.IsAiming = NetworkBool.op_Implicit(false); float num3 = ((player.SecondaryRole == PlayerSecondaryRole.BothEngineer) ? 1f : 4f); player.TrapDisarmTimer = TickTimer.CreateFromSeconds(runner, num3); } } catch (Exception ex) { Plugin.Logger.LogError((object)("Rpc_Disarm_Trap error: " + ex)); } } [NetworkRpcStaticWeavedInvoker("System.Void LycansNewRoles.PlayerCustom::Rpc_Disarm_Trap(Fusion.NetworkRunner,System.Int32,Fusion.NetworkId)")] [Preserve] protected unsafe static void Rpc_Disarm_Trap_0040Invoker(NetworkRunner runner, SimulationMessage* message) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) byte* data = SimulationMessage.GetData(message); int num = (RpcHeader.ReadSize(data) + 3) & -4; int playerIndex = *(int*)(data + num); num += 4; NetworkId trapId = (NetworkId)data[num]; num += 4; NetworkBehaviourUtils.InvokeRpc = true; Rpc_Disarm_Trap(runner, playerIndex, trapId); } private void TrapDisarmTimerExpired() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_00b0: 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_00eb: Unknown result type (might be due to invalid IL or missing references) try { PlayerController player = PlayerRegistry.GetPlayer(Ref); player.MovementAction = 0; player.CanMoveAnimation = NetworkBool.op_Implicit(true); TrapDisarmTimer = TickTimer.None; if (!NetworkBool.op_Implicit(player.IsDead) && !((Object)(object)TrapToDisarm == (Object)null) && (int)GameManager.LocalGameState == 2 && TrapToDisarm.TrapCanBeDisarmed()) { Traverse<PlayerRef> val = Traverse.Create((object)TrapToDisarm).Field<PlayerRef>("_TrappedPlayer"); Traverse.Create((object)TrapToDisarm).Field<Animator>("animator").Value.SetBool(Animator.StringToHash("Closing"), true); val.Value = player.Ref; if (((SimulationBehaviour)TrapToDisarm).HasStateAuthority) { GameManager.Rpc_BroadcastFollowSound(((SimulationBehaviour)TrapToDisarm).Runner, NetworkString<_16>.op_Implicit("TRAP_CLOSING"), ((Component)TrapToDisarm).transform.position, 20f, 1f); } ((NetworkBehaviour)TrapToDisarm).CopyBackingFieldsToState(true); } } catch (Exception ex) { Plugin.Logger.LogError((object)("TrapDisarmTimerExpired error: " + ex)); } } private void PowerCooldownTimerExpired() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) try { PowerCooldownTimer = TickTimer.None; switch (SecondaryRole) { case PlayerSecondaryRole.BothEngineer: SecondaryRoleFirstRemainingUses++; break; case PlayerSecondaryRole.BothGambler: SecondaryRoleFirstRemainingUses++; break; case PlayerSecondaryRole.BothHowler: SecondaryRoleSecondRemainingUses++; break; case PlayerSecondaryRole.BothTeleporter: SecondaryRoleFirstRemainingUses++; break; } PlayerController player = PlayerRegistry.GetPlayer(Ref); if ((Object)(object)player == (Object)(object)PlayerController.Local) { AudioManager.Play("RELOAD", (MixerTarget)2, 0.5f, 1f); } } catch (Exception ex) { Plugin.Logger.LogError((object)("TrapDisarmTimerExpired error: " + ex)); } } public override void Spawned() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).Spawned(); try { if (!((SimulationBehaviour)this).Runner.IsServer) { if (((SimulationBehaviour)this).HasInputAuthority) { Rpc_Set_Validation(((SimulationBehaviour)this).Runner, Index, float.Parse("0.16", CultureInfo.InvariantCulture.NumberFormat)); } } else if (!((SimulationBehaviour)this).HasInputAuthority && ExtraSettings.Instance.CheckModInstall) { VersionValidationTimer = TickTimer.CreateFromSeconds(((SimulationBehaviour)this).Runner, 3f); } } catch (Exception ex) { Plugin.Logger.LogError((object)("PlayerCustom Spawned error: " + ex)); } } public override void FixedUpdateNetwork() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) try { TickTimer val = VersionValidationTimer; if (((TickTimer)(ref val)).Expired(((SimulationBehaviour)this).Runner)) { Plugin.Logger.LogInfo((object)"VersionValidationTimer expired -> kick"); VersionValidationTimer = TickTimer.None; ((SimulationBehaviour)this).Runner.Disconnect(Ref); } val = CannibalEatTimer; if (((TickTimer)(ref val)).Expired(((SimulationBehaviour)this).Runner)) { CannibalEatTimerExpired(); } val = TrapDisarmTimer; if (((TickTimer)(ref val)).Expired(((SimulationBehaviour)this).Runner)) { TrapDisarmTimerExpired(); } val = PowerCooldownTimer; if (((TickTimer)(ref val)).Expired(((SimulationBehaviour)this).Runner)) { PowerCooldownTimerExpired(); } val = PowerCooldownTimer; if (((TickTimer)(ref val)).IsRunning && (Object)(object)PlayerRegistry.GetPlayer(Ref) == (Object)(object)PlayerController.Local) { val = PowerCooldownTimer; ShowRoleDescriptionPatch.UpdatePowerCooldownSeconds(Mathf.CeilToInt(((TickTimer)(ref val)).RemainingTime(((SimulationBehaviour)this).Runner).Value)); } } catch (Exception ex) { Plugin.Logger.LogError((object)("FixedUpdateNetwork error: " + ex)); } } [Rpc] public unsafe static void Rpc_Set_Validation(NetworkRunner runner, int playerIndex, float version) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) try { if (NetworkBehaviourUtils.InvokeRpc) { NetworkBehaviourUtils.InvokeRpc = false; } else { if ((Object)(object)runner == (Object)null) { throw new ArgumentNullException("runner"); } if ((int)runner.Stage == 4) { return; } if (runner.HasAnyActiveConnections()) { int num = 24; SimulationMessage* ptr = SimulationMessage.Allocate(runner.Simulation, num); byte* data = SimulationMessage.GetData(ptr); int num2 = RpcHeader.Write(RpcHeader.Create(NetworkBehaviourUtils.GetRpcStaticIndexOrThrow("System.Void LycansNewRoles.PlayerCustom::Rpc_Set_Validation(Fusion.NetworkRunner,System.Int32,System.Single)")), data); *(int*)(data + num2) = playerIndex; num2 += 4; *(float*)(data + num2) = version; num2 += 4; ((SimulationMessage)ptr).Offset = num2 * 8; ((SimulationMessage)ptr).SetStatic(); runner.SendRpc(ptr); } } if (runner.IsServer) { Plugin.Logger.LogInfo((object)("Rpc_Set_Validation, playerIndex " + playerIndex + ", version " + version)); PlayerCustom player = PlayerCustomRegistry.GetPlayer(playerIndex); ManualLogSource logger = Plugin.Logger; NetworkString<_32> username = PlayerRegistry.GetPlayer(player.Ref).PlayerData.Username; logger.LogInfo((object)("Player username: " + ((object)username).ToString())); if (version == float.Parse("0.16", CultureInfo.InvariantCulture.NumberFormat)) { player.VersionValidationTimer = TickTimer.None; return; } Plugin.Logger.LogInfo((object)"Wrong version -> kick"); runner.Disconnect(player.Ref); } } catch (Exception ex) { Plugin.Logger.LogError((object)("Rpc_Set_Validation error: " + ex)); } } [NetworkRpcStaticWeavedInvoker("System.Void LycansNewRoles.PlayerCustom::Rpc_Set_Validation(Fusion.NetworkRunner,System.Int32,System.Single)")] [Preserve] protected unsafe static void Rpc_Set_Validation_0040Invoker(NetworkRunner runner, SimulationMessage* message) { byte* data = SimulationMessage.GetData(message); int num = (RpcHeader.ReadSize(data) + 3) & -4; int playerIndex = *(int*)(data + num); num += 4; float version = *(float*)(data + num); num += 4; NetworkBehaviourUtils.InvokeRpc = true; Rpc_Set_Validation(runner, playerIndex, version); } public void Server_Init(PlayerRef pRef, byte index) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Ref = pRef; Index = index; } public void Reset() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) NewPrimaryRole = PlayerNewPrimaryRole.None; SecondaryRole = PlayerSecondaryRole.None; KilledLastNight = NetworkBool.op_Implicit(false); KilledDuringVote = NetworkBool.op_Implicit(false); SecondaryRoleFirstRemainingUses = 0; SecondaryRoleSecondRemainingUses = 0; PowerCooldownTimer = TickTimer.None; CannibalEatenCorpsesCount = 0; Eaten = NetworkBool.op_Implicit(false); } [Preserve] public static void SecondaryRoleFirstRemainingUsesChanged(Changed<PlayerCustom> changed) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) try { PlayerCustom behaviour = changed.Behaviour; PlayerController player = PlayerRegistry.GetPlayer(behaviour.Ref); if ((Object)(object)player == (Object)(object)PlayerController.Local) { ShowRoleDescriptionPatch.NeedsUpdate = true; } } catch (Exception ex) { Plugin.Logger.LogError((object)("SecondaryRoleFirstRemainingUsesChanged error: " + ex)); } } [Preserve] public static void SecondaryRoleSecondRemainingUsesChanged(Changed<PlayerCustom> changed) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) try { PlayerCustom behaviour = changed.Behaviour; PlayerController player = PlayerRegistry.GetPlayer(behaviour.Ref); if ((Object)(object)player == (Object)(object)PlayerController.Local) { ShowRoleDescriptionPatch.NeedsUpdate = true; } } catch (Exception ex) { Plugin.Logger.LogError((object)("SecondaryRoleSecondRemainingUsesChanged error: " + ex)); } } [Preserve] public static void NewPrimaryRoleChanged(Changed<PlayerCustom> changed) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00