Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of CompanyDeskFix v1.3.0
CompanyDeskFix.dll
Decompiled 6 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CompanyDeskFix { [BepInPlugin("local.companydeskfix", "CompanyDeskFix", "1.3.0")] public class CompanyDeskFixPlugin : BaseUnityPlugin { public const string PluginGuid = "local.companydeskfix"; public const string PluginName = "CompanyDeskFix"; public const string PluginVersion = "1.3.0"; private ManualLogSource _log; private ConfigEntry<bool> _enabled; private ConfigEntry<bool> _logOnly; private ConfigEntry<bool> _verbose; private ConfigEntry<float> _zoneMargin; private ConfigEntry<float> _minTimeInZone; private ConfigEntry<float> _grabDelay; private ConfigEntry<bool> _useManualZone; private ConfigEntry<float> _manualCenterX; private ConfigEntry<float> _manualCenterY; private ConfigEntry<float> _manualCenterZ; private ConfigEntry<float> _manualSizeX; private ConfigEntry<float> _manualSizeY; private ConfigEntry<float> _manualSizeZ; private ConfigEntry<bool> _fallbackDamage; private ConfigEntry<float> _verifySeconds; private ConfigEntry<string> _captureKey; private ConfigEntry<string> _diagnosticKey; private Key _captureKeyParsed = (Key)101; private Key _diagnosticKeyParsed = (Key)100; private DepositItemsDesk _desk; private float _nextDeskSearch; private bool _wasAttacking; private bool _warnedNotHosting; private readonly Dictionary<int, float> _timeInZone = new Dictionary<int, float>(); private readonly HashSet<int> _alreadyGrabbed = new HashSet<int>(); private readonly Dictionary<int, float> _nextStatusLog = new Dictionary<int, float>(); private float _attackTime; private void Awake() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) _log = ((BaseUnityPlugin)this).Logger; _enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "Enabled", true, "Master switch. false = the mod does nothing at all."); _logOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "LogOnly", false, "true = never actually kill anybody, just write to the log who WOULD have been caught."); _verbose = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "Verbose", true, "true = explain in the log exactly what happened during every attack: who was in the zone, what was decided, and whether it worked. Leave this on until you have seen it catch somebody, then turn it off to quieten the log."); _zoneMargin = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Zone", "ZoneMargin", 1f, new ConfigDescription("How far, in metres, to extend the counter area outwards when deciding who the monster should be able to reach. The game already has a trigger volume covering the counter; this grows it so a player tucked into a pocket just outside it still counts. Use the CaptureKey to check your spot is inside.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>())); _minTimeInZone = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Zone", "MinTimeInZone", 0.75f, new ConfigDescription("How many seconds a player must have spent inside the zone during this attack before they can be caught. Stops somebody merely running past the counter mid-attack from being killed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); _grabDelay = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Zone", "GrabDelay", 1f, new ConfigDescription("Seconds to wait after the attack starts before stepping in, so the monster's own animation gets first go and this only covers what the game missed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); _useManualZone = ((BaseUnityPlugin)this).Config.Bind<bool>("3 - Manual zone", "UseManualZone", false, "true = ignore the automatic zone and use the box defined by the six numbers below, which are measured relative to the desk so they work on every visit."); _manualCenterX = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Manual zone", "CenterX", 0f, "Centre of the manual box, relative to the desk. The CaptureKey prints this number for wherever you are standing."); _manualCenterY = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Manual zone", "CenterY", 0f, "Centre of the manual box, relative to the desk (up and down)."); _manualCenterZ = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Manual zone", "CenterZ", 0f, "Centre of the manual box, relative to the desk."); _manualSizeX = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Manual zone", "SizeX", 3f, "Full width of the manual box in metres."); _manualSizeY = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Manual zone", "SizeY", 3f, "Full height of the manual box in metres."); _manualSizeZ = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Manual zone", "SizeZ", 3f, "Full depth of the manual box in metres."); _fallbackDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("4 - Backstop", "FallbackDamageIfGrabFails", true, "true = if the monster's grab has not killed them VerifySeconds later, kill them a second way instead. The grab animation is the nicer looking option, but it depends on the monster's animation behaving; this guarantees the hiding spot stops working either way."); _verifySeconds = ((BaseUnityPlugin)this).Config.Bind<float>("4 - Backstop", "VerifySeconds", 2.5f, new ConfigDescription("How long to wait after handing somebody to the monster before checking whether they actually died.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 15f), Array.Empty<object>())); _captureKey = ((BaseUnityPlugin)this).Config.Bind<string>("5 - Calibration", "CaptureKey", "F8", "Press this while standing at the Company to print your position and whether you count as inside the zone. Write it like F8, F9, K, Numpad0. Set to None to disable."); _diagnosticKey = ((BaseUnityPlugin)this).Config.Bind<string>("5 - Calibration", "DiagnosticKey", "F7", "Press this at the Company to dump everything the mod can currently see: whether you are hosting, whether the monster is attacking, the state of each of its animations, and where every player stands. Press it DURING an attack if something is not working. Set to None to disable."); _captureKeyParsed = ParseKey(_captureKey.Value, (Key)101); _diagnosticKeyParsed = ParseKey(_diagnosticKey.Value, (Key)100); _log.LogInfo((object)("CompanyDeskFix 1.3.0 loaded. " + (_enabled.Value ? "Active when hosting." : "Disabled in config.") + (_logOnly.Value ? " LOG ONLY - nobody will actually be caught." : ""))); } private Key ParseKey(string text, Key fallback) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (Enum.TryParse<Key>(text, ignoreCase: true, out Key result)) { return result; } _log.LogWarning((object)string.Format("[{0}] '{1}' is not a key name I recognise, using {2} instead.", "CompanyDeskFix", text, fallback)); return fallback; } private void Update() { //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) if (!_enabled.Value) { return; } if ((Object)(object)_desk == (Object)null) { ForgetAttack(); _wasAttacking = false; if ((Object)(object)StartOfRound.Instance == (Object)null || Time.time < _nextDeskSearch) { return; } _nextDeskSearch = Time.time + 1f; _desk = Object.FindObjectOfType<DepositItemsDesk>(); if ((Object)(object)_desk == (Object)null) { return; } if (_verbose.Value) { _log.LogInfo((object)"[CompanyDeskFix] Company desk found - now watching it."); } } HandleKeys(); bool attacking = _desk.attacking; bool flag = (Object)(object)StartOfRound.Instance != (Object)null && ((NetworkBehaviour)StartOfRound.Instance).IsServer; if (attacking && !flag) { if (!_warnedNotHosting) { _warnedNotHosting = true; _log.LogWarning((object)"[CompanyDeskFix] The monster is attacking, but you are NOT hosting this lobby, so this mod cannot do anything. Only the host can tell the game somebody was caught."); } } else { if (!flag) { return; } if (attacking && !_wasAttacking) { ForgetAttack(); if (_verbose.Value) { LogAttackStart(); } } _wasAttacking = attacking; if (!attacking) { return; } _attackTime += Time.deltaTime; Bounds zone = GetZone(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; for (int i = 0; i < allPlayerScripts.Length; i++) { PlayerControllerB val = allPlayerScripts[i]; if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead && !_alreadyGrabbed.Contains(i)) { bool flag2 = IsInsideZone(zone, val); if (!_timeInZone.ContainsKey(i)) { _timeInZone[i] = 0f; } _timeInZone[i] = (flag2 ? (_timeInZone[i] + Time.deltaTime) : Mathf.Max(0f, _timeInZone[i] - Time.deltaTime * 2f)); if (_verbose.Value) { LogPlayerStatus(val, i, flag2, zone); } if (flag2 && !(_attackTime < _grabDelay.Value) && !(_timeInZone[i] < _minTimeInZone.Value)) { TryGrab(val, i); } } } } } private Bounds GetZone() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (_useManualZone.Value) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(_manualCenterX.Value, _manualCenterY.Value, _manualCenterZ.Value); return new Bounds(((Component)_desk).transform.TransformPoint(val), new Vector3(_manualSizeX.Value, _manualSizeY.Value, _manualSizeZ.Value)); } if ((Object)(object)_desk.triggerCollider != (Object)null) { Bounds bounds = ((Collider)_desk.triggerCollider).bounds; ((Bounds)(ref bounds)).Expand(_zoneMargin.Value * 2f); return bounds; } return new Bounds(((Component)_desk).transform.position, new Vector3(6f, 4f, 6f)); } private static bool IsInsideZone(Bounds zone, PlayerControllerB player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)player).transform.position; Vector3 val = position + Vector3.up * 1.2f; if (!((Bounds)(ref zone)).Contains(position)) { return ((Bounds)(ref zone)).Contains(val); } return true; } private void TryGrab(PlayerControllerB player, int slot) { _alreadyGrabbed.Add(slot); if (_logOnly.Value) { _log.LogWarning((object)("[CompanyDeskFix] LOG ONLY - would have caught " + player.playerUsername + " hiding at the counter.")); return; } string whyNot; int num = FindFreeAnimation(out whyNot); if (num < 0) { _log.LogWarning((object)("[CompanyDeskFix] " + player.playerUsername + " is hiding at the counter but the monster's grab cannot be used: " + whyNot + ".")); if (_fallbackDamage.Value) { KillTheOtherWay(player, slot, "no grab animation was free"); } } else { _log.LogInfo((object)("[CompanyDeskFix] " + player.playerUsername + " was hiding in an unreachable spot during an attack " + $"- handing them to the monster (animation {num}).")); _desk.monsterAnimations[num].animatorCollidedOnClient = true; _desk.ConfirmAnimationGrabPlayerClientRpc(num, slot); ((MonoBehaviour)this).StartCoroutine(VerifyKill(player, slot)); } } private IEnumerator VerifyKill(PlayerControllerB player, int slot) { ulong grabbedId = player.actualClientId; yield return (object)new WaitForSeconds(_verifySeconds.Value); if ((Object)(object)player == (Object)null || (Object)(object)_desk == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null) { yield break; } if (player.isPlayerDead) { if (_verbose.Value) { _log.LogInfo((object)("[CompanyDeskFix] Confirmed: " + player.playerUsername + " was killed by the monster.")); } yield break; } if (!player.isPlayerControlled || player.actualClientId != grabbedId) { if (_verbose.Value) { _log.LogInfo((object)("[CompanyDeskFix] " + player.playerUsername + " left before the grab could be confirmed - no backstop needed.")); } yield break; } _log.LogWarning((object)("[CompanyDeskFix] " + player.playerUsername + " survived the monster's grab " + $"({_verifySeconds.Value:F1}s later they are still alive).")); if (_fallbackDamage.Value) { KillTheOtherWay(player, slot, "they survived the grab"); } else { _log.LogWarning((object)"[CompanyDeskFix] FallbackDamageIfGrabFails is off, so they got away with it."); } } private void KillTheOtherWay(PlayerControllerB player, int slot, string why) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (_logOnly.Value || (Object)(object)player == (Object)null || (Object)(object)_desk == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null) { return; } PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if (!((Object)(object)localPlayerController == (Object)null)) { _log.LogInfo((object)("[CompanyDeskFix] Using the backstop on " + player.playerUsername + " because " + why + ".")); Vector3 val = ((Component)player).transform.position - ((Component)_desk).transform.position; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } val = ((Vector3)(ref val)).normalized; player.DamagePlayerFromOtherClientServerRpc(200, val, (int)localPlayerController.playerClientId); } } private int FindFreeAnimation(out string whyNot) { if (_desk.monsterAnimations == null || _desk.monsterAnimations.Length == 0) { whyNot = "the desk has no monster animations at all"; return -1; } int[] array = (((Object)(object)_desk.currentMood != (Object)null) ? _desk.currentMood.enableMonsterAnimationIndex : null); if (array != null) { int num = Mathf.Min(_desk.monsterAnimations.Length, array.Length); for (int i = 0; i < num; i++) { if (array[i] == i && _desk.monsterAnimations[i] != null && !_desk.monsterAnimations[i].animatorCollidedOnClient) { whyNot = null; return i; } } } for (int j = 0; j < _desk.monsterAnimations.Length; j++) { if (_desk.monsterAnimations[j] != null && !_desk.monsterAnimations[j].animatorCollidedOnClient) { whyNot = null; return j; } } whyNot = "every one of the monster's animations is already holding somebody"; return -1; } private void ForgetAttack() { _timeInZone.Clear(); _alreadyGrabbed.Clear(); _nextStatusLog.Clear(); _attackTime = 0f; } private void LogAttackStart() { _log.LogInfo((object)("[CompanyDeskFix] --- monster attack started --- mood: " + (((Object)(object)_desk.currentMood != (Object)null) ? ((Object)_desk.currentMood).name : "none") + ", manifestation: " + (((Object)(object)_desk.currentMood != (Object)null) ? ((object)Unsafe.As<CompanyMonster, CompanyMonster>(ref _desk.currentMood.manifestation)/*cast due to .constrained prefix*/).ToString() : "?") + ", " + $"kill timer: {_desk.killAnimationTimer:F2}s, " + "animations: " + DescribeAnimations())); } private void LogPlayerStatus(PlayerControllerB player, int slot, bool inZone, Bounds zone) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if (!_nextStatusLog.TryGetValue(slot, out var value) || !(Time.time < value)) { _nextStatusLog[slot] = Time.time + 0.5f; if (inZone) { _log.LogInfo((object)("[CompanyDeskFix] " + player.playerUsername + " is inside the zone " + $"({_timeInZone[slot]:F2}s of the {_minTimeInZone.Value:F2}s needed, " + $"attack running {_attackTime:F2}s of the {_grabDelay.Value:F2}s delay).")); } else { float num = Vector3.Distance(((Component)player).transform.position, ((Bounds)(ref zone)).center); _log.LogInfo((object)("[CompanyDeskFix] " + player.playerUsername + " is OUTSIDE the zone " + $"({num:F2}m from its centre). If they are in the hiding spot right now, " + "raise ZoneMargin or switch to the manual zone.")); } } } private string DescribeAnimations() { if (_desk.monsterAnimations == null) { return "none"; } StringBuilder stringBuilder = new StringBuilder(); int[] array = (((Object)(object)_desk.currentMood != (Object)null) ? _desk.currentMood.enableMonsterAnimationIndex : null); for (int i = 0; i < _desk.monsterAnimations.Length; i++) { bool flag = array != null && i < array.Length && array[i] == i; bool flag2 = _desk.monsterAnimations[i] != null && _desk.monsterAnimations[i].animatorCollidedOnClient; stringBuilder.Append(string.Format("[{0}:{1}{2}]", i, flag ? "on" : "off", flag2 ? ",used" : ",free")); } return stringBuilder.ToString(); } private void HandleKeys() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current == null) { return; } if ((int)_captureKeyParsed != 0) { KeyControl val = current[_captureKeyParsed]; if (val != null && ((ButtonControl)val).wasPressedThisFrame) { PrintCapture(); } } if ((int)_diagnosticKeyParsed != 0) { KeyControl val2 = current[_diagnosticKeyParsed]; if (val2 != null && ((ButtonControl)val2).wasPressedThisFrame) { PrintDiagnostics(); } } } private void PrintCapture() { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.localPlayerController : null); if (!((Object)(object)val == (Object)null)) { Vector3 position = ((Component)val).transform.position; Vector3 val2 = ((Component)_desk).transform.InverseTransformPoint(position); Bounds zone = GetZone(); _log.LogInfo((object)"======================================================="); _log.LogInfo((object)"[CompanyDeskFix] position capture"); _log.LogInfo((object)$" world position : {position.x:F2}, {position.y:F2}, {position.z:F2}"); _log.LogInfo((object)$" relative to the desk : {val2.x:F2}, {val2.y:F2}, {val2.z:F2}"); _log.LogInfo((object)" ^ these three numbers are CenterX, CenterY, CenterZ for the manual zone"); _log.LogInfo((object)(" currently inside zone? : " + (IsInsideZone(zone, val) ? "YES - this spot is already covered" : "NO - widen ZoneMargin or use the manual zone"))); _log.LogInfo((object)$" zone centre (world) : {((Bounds)(ref zone)).center.x:F2}, {((Bounds)(ref zone)).center.y:F2}, {((Bounds)(ref zone)).center.z:F2}"); _log.LogInfo((object)$" zone size : {((Bounds)(ref zone)).size.x:F2} x {((Bounds)(ref zone)).size.y:F2} x {((Bounds)(ref zone)).size.z:F2}"); _log.LogInfo((object)$" distance to zone centre : {Vector3.Distance(position, ((Bounds)(ref zone)).center):F2} m"); _log.LogInfo((object)"======================================================="); } } private void PrintDiagnostics() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; bool flag = (Object)(object)instance != (Object)null && ((NetworkBehaviour)instance).IsServer; Bounds zone = GetZone(); _log.LogInfo((object)"======================================================="); _log.LogInfo((object)"[CompanyDeskFix] diagnostics"); _log.LogInfo((object)(" are you hosting? : " + (flag ? "YES" : "NO - this mod can only act as host"))); _log.LogInfo((object)$" monster attacking now? : {_desk.attacking}"); _log.LogInfo((object)$" kill animation timer : {_desk.killAnimationTimer:F2}s"); _log.LogInfo((object)$" patience level : {_desk.patienceLevel:F2}"); _log.LogInfo((object)$" door open? : {_desk.doorOpen}"); _log.LogInfo((object)(" current mood : " + (((Object)(object)_desk.currentMood != (Object)null) ? ((Object)_desk.currentMood).name : "none"))); _log.LogInfo((object)(" manifestation : " + (((Object)(object)_desk.currentMood != (Object)null) ? ((object)Unsafe.As<CompanyMonster, CompanyMonster>(ref _desk.currentMood.manifestation)/*cast due to .constrained prefix*/).ToString() : "?"))); _log.LogInfo((object)(" animations : " + DescribeAnimations())); _log.LogInfo((object)$" time this attack : {_attackTime:F2}s"); _log.LogInfo((object)$" settings : GrabDelay {_grabDelay.Value:F2}s, MinTimeInZone {_minTimeInZone.Value:F2}s, LogOnly {_logOnly.Value}, Backstop {_fallbackDamage.Value}"); if ((Object)(object)instance != (Object)null && instance.allPlayerScripts != null) { for (int i = 0; i < instance.allPlayerScripts.Length; i++) { PlayerControllerB val = instance.allPlayerScripts[i]; if (!((Object)(object)val == (Object)null) && val.isPlayerControlled) { float num = (_timeInZone.ContainsKey(i) ? _timeInZone[i] : 0f); _log.LogInfo((object)($" player {i} {val.playerUsername}: " + (val.isPlayerDead ? "DEAD" : "alive") + ", in zone: " + (IsInsideZone(zone, val) ? "YES" : "no") + ", " + $"time in zone this attack: {num:F2}s, " + $"already handled: {_alreadyGrabbed.Contains(i)}")); } } } _log.LogInfo((object)"======================================================="); } } }