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 Bondrewd v0.1.2
plugins/BondrewdMod/BondrewdMod.dll
Decompiled 10 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BondrewdMod.States; using EntityStates; using HarmonyLib; using KinematicCharacterController; using Microsoft.CodeAnalysis; using RoR2; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ConVar; using RoR2.ContentManagement; using RoR2.Navigation; using RoR2.Networking; using RoR2.Skills; using RoR2.SurvivorMannequins; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.ResourceLocations; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BondrewdMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c0cc7efa9bba452036e525cae858f1f13964824b")] [assembly: AssemblyProduct("BondrewdMod")] [assembly: AssemblyTitle("BondrewdMod")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 BondrewdMod { public static class BondrewdAudio { private const string BankFileName = "Bondrewd_Voice.bnk"; private const string EventPrefix = "Play_Bondrewd_VO_"; private const string GainRtpc = "Bondrewd_VO_Gain"; private const float MaxGain = 4f; private const float FullVolumeDistance = 10f; private const float SilentDistance = 100f; private const string Alias = "bondrewd_voice"; private static readonly Dictionary<string, string> ClipPaths = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); private static readonly HashSet<string> ReportedMissingEvents = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private static readonly EventCallback WwiseCallback = new EventCallback(OnWwiseCallback); private static float _lastPlayTime = -999f; private static float _lastLowHpTime = -999f; private static float _lastCombatQuipTime = -999f; private static bool _bankLoaded; private static bool _bankUnavailable; private static bool _wwiseVerified; private static int _silentLocalPlays; private static uint _currentPlayingId; private static float _currentEndTime; private static bool _currentStarted; private static bool _currentIsLocal; private static bool _mciUsed; [DllImport("winmm.dll", CharSet = CharSet.Unicode)] private static extern int mciSendString(string command, StringBuilder? buffer, int bufferSize, IntPtr hwndCallback); public static void PreloadAll(MonoBehaviour _) { ClipPaths.Clear(); string path = Path.Combine(BondrewdPlugin.PluginDirectory, "Assets", "Audio"); if (Directory.Exists(path)) { string[] files = Directory.GetFiles(path, "*.mp3"); foreach (string text in files) { ClipPaths[Path.GetFileName(text)] = text; } } ManualLogSource? log = BondrewdPlugin.Log; if (log != null) { log.LogInfo((object)$"Indexed {ClipPaths.Count} voice clips."); } if (RoR2Application.loadFinished) { TryLoadBank(); return; } RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { TryLoadBank(); }); } private static bool TryLoadBank() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Invalid comparison between Unknown and I4 //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (_bankLoaded) { return true; } if (_bankUnavailable) { return false; } string path = Path.Combine(BondrewdPlugin.PluginDirectory, "Assets", "Audio", "Bondrewd_Voice.bnk"); if (!File.Exists(path)) { _bankUnavailable = true; ManualLogSource? log = BondrewdPlugin.Log; if (log != null) { log.LogWarning((object)"Bondrewd_Voice.bnk not found; voice lines will use the winmm fallback (no 3D audio)."); } return false; } try { if (!AkSoundEngine.IsInitialized()) { return false; } byte[] array = File.ReadAllBytes(path); GCHandle gCHandle = GCHandle.Alloc(array, GCHandleType.Pinned); try { uint num = default(uint); AKRESULT val = AkSoundEngine.LoadBankMemoryCopy(gCHandle.AddrOfPinnedObject(), (uint)array.Length, ref num); if ((int)val == 1 || (int)val == 69) { _bankLoaded = true; ManualLogSource? log2 = BondrewdPlugin.Log; if (log2 != null) { log2.LogInfo((object)string.Format("Loaded Wwise voice bank {0} (id {1}, {2} KB).", "Bondrewd_Voice.bnk", num, array.Length / 1024)); } } else { _bankUnavailable = true; ManualLogSource? log3 = BondrewdPlugin.Log; if (log3 != null) { log3.LogWarning((object)string.Format("Wwise refused {0}: {1}. Voice lines will use the winmm fallback.", "Bondrewd_Voice.bnk", val)); } } } finally { gCHandle.Free(); } } catch (Exception ex) { _bankUnavailable = true; ManualLogSource? log4 = BondrewdPlugin.Log; if (log4 != null) { log4.LogWarning((object)("Could not load Bondrewd_Voice.bnk: " + ex.Message + ". Voice lines will use the winmm fallback.")); } } return _bankLoaded; } public static bool IsPlaying() { if (_currentPlayingId != 0) { if (Time.unscaledTime < _currentEndTime) { return true; } _currentPlayingId = 0u; } if (_mciUsed) { return IsMciPlaying(); } return false; } public static void PlayVoice(string fileName, float volume = 0.85f, float cooldown = 0f, bool interrupt = true, GameObject? source = null) { if (!ClipPaths.ContainsKey(fileName)) { return; } float unscaledTime = Time.unscaledTime; if (!interrupt) { if (IsPlaying() || unscaledTime - _lastPlayTime < cooldown) { return; } } else if (cooldown > 0f && unscaledTime - _lastPlayTime < cooldown) { return; } float num = Mathf.Clamp(volume * BondrewdConfig.VoiceVolumeScale, 0f, 4f); if (!(num <= 0.001f) && (TryPlayWwise(fileName, num, source) || PlayMci(fileName, num, source))) { _lastPlayTime = unscaledTime; } } public static string? PickAvailableClip(params string[] fileNames) { if (fileNames == null || fileNames.Length == 0) { return null; } List<string> list = new List<string>(fileNames.Length); foreach (string text in fileNames) { if (ClipPaths.ContainsKey(text)) { list.Add(text); } } if (list.Count <= 0) { return null; } return list[Random.Range(0, list.Count)]; } public static void PlayRandomVoice(GameObject? source, float volume, float cooldown, bool interrupt, params string[] fileNames) { string text = PickAvailableClip(fileNames); if (text != null) { PlayVoice(text, volume, cooldown, interrupt, source); } } public static void PlayCombatQuip(GameObject? source, float volume, params string[] fileNames) { float unscaledTime = Time.unscaledTime; if (!(unscaledTime - _lastCombatQuipTime < 9f)) { _lastCombatQuipTime = unscaledTime; PlayRandomVoice(source, volume, 4f, interrupt: false, fileNames); } } public static void PlayLowHealthWarning(GameObject? source) { float unscaledTime = Time.unscaledTime; if (!(unscaledTime - _lastLowHpTime < 25f)) { _lastLowHpTime = unscaledTime; PlayVoice("please-come-back.mp3", 0.9f, 2f, interrupt: true, source); } } private static string EventNameFor(string fileName) { string input = Path.GetFileNameWithoutExtension(fileName).ToLowerInvariant(); return "Play_Bondrewd_VO_" + Regex.Replace(input, "[^a-z0-9]+", "_").Trim('_'); } private static bool TryPlayWwise(string fileName, float gain, GameObject? source) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!TryLoadBank()) { return false; } bool isLocal; GameObject val = ResolveEmitter(source, out isLocal); if ((Object)(object)val == (Object)null) { return false; } try { StopCurrent(); string text = EventNameFor(fileName); uint num = 9u; uint num2 = AkSoundEngine.PostEvent(text, val, num, WwiseCallback, (object)null); if (num2 == 0) { if (ReportedMissingEvents.Add(text)) { ManualLogSource? log = BondrewdPlugin.Log; if (log != null) { log.LogWarning((object)("Wwise event " + text + " did not play (rebuild the bank with tools/build_voice_bank.py?); using winmm for " + fileName + ".")); } } return false; } AkSoundEngine.SetRTPCValueByPlayingID("Bondrewd_VO_Gain", gain - 1f, num2); _currentPlayingId = num2; _currentEndTime = Time.unscaledTime + 20f; _currentStarted = false; _currentIsLocal = isLocal; return true; } catch (Exception ex) { _bankLoaded = false; _bankUnavailable = true; ManualLogSource? log2 = BondrewdPlugin.Log; if (log2 != null) { log2.LogWarning((object)("Wwise voice playback failed (" + ex.Message + "); switching to the winmm fallback.")); } return false; } } private static void StopCurrent() { if (_currentPlayingId != 0) { AkSoundEngine.StopPlayingID(_currentPlayingId, 120, (AkCurveInterpolation)4); _currentPlayingId = 0u; } if (_mciUsed) { mciSendString("close bondrewd_voice", null, 0, IntPtr.Zero); } } private static void OnWwiseCallback(object cookie, AkCallbackType type, AkCallbackInfo info) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 AkDurationCallbackInfo val = (AkDurationCallbackInfo)(object)((info is AkDurationCallbackInfo) ? info : null); if (val != null) { if (((AkEventCallbackInfo)val).playingID == _currentPlayingId) { _currentStarted = true; _currentEndTime = Time.unscaledTime + val.fEstimatedDuration / 1000f + 0.1f; } if (!_wwiseVerified && val.fDuration > 0f) { _wwiseVerified = true; ManualLogSource? log = BondrewdPlugin.Log; if (log != null) { log.LogInfo((object)$"Wwise voice bank verified: first line started ({val.fDuration:0} ms)."); } } } else { if ((int)type != 1) { return; } AkEventCallbackInfo val2 = (AkEventCallbackInfo)(object)((info is AkEventCallbackInfo) ? info : null); if (val2 == null || val2.playingID != _currentPlayingId) { return; } if (!_currentStarted && _currentIsLocal && !_wwiseVerified && ++_silentLocalPlays >= 2) { _bankUnavailable = true; _bankLoaded = false; ManualLogSource? log2 = BondrewdPlugin.Log; if (log2 != null) { log2.LogError((object)"Wwise voice events end without producing sound; switching to the winmm fallback."); } } _currentPlayingId = 0u; } } private static GameObject? ResolveEmitter(GameObject? source, out bool isLocal) { if ((Object)(object)source != (Object)null && source.activeInHierarchy) { isLocal = (Object)(object)source.GetComponent<NetworkIdentity>() == (Object)null || Util.HasEffectiveAuthority(source); return source; } isLocal = true; GameObject val = LocalPlayerBodyObject(); if ((Object)(object)val != (Object)null) { return val; } Camera main = Camera.main; if (!((Object)(object)main != (Object)null)) { return null; } return ((Component)main).gameObject; } private static GameObject? LocalPlayerBodyObject() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); GameObject val = ((firstLocalUser != null) ? firstLocalUser.cachedBodyObject : null); if (!((Object)(object)val != (Object)null) || !val.activeInHierarchy) { return null; } return val; } private static bool PlayMci(string fileName, float gain, GameObject? source) { if (!ClipPaths.TryGetValue(fileName, out string value) || !File.Exists(value)) { return false; } float num = Mathf.Clamp01(gain * GameVolume() * DistanceFalloff(source)); if (num <= 0.001f) { return false; } try { StopCurrent(); _mciUsed = true; int num2 = mciSendString("open \"" + value + "\" type mpegvideo alias bondrewd_voice", null, 0, IntPtr.Zero); if (num2 != 0) { ManualLogSource? log = BondrewdPlugin.Log; if (log != null) { log.LogWarning((object)$"mciSendString open failed ({num2}) for {fileName}"); } return false; } int num3 = Mathf.Clamp(Mathf.RoundToInt(num * 1000f), 0, 1000); mciSendString(string.Format("setaudio {0} volume to {1}", "bondrewd_voice", num3), null, 0, IntPtr.Zero); mciSendString("play bondrewd_voice from 0", null, 0, IntPtr.Zero); return true; } catch (Exception ex) { ManualLogSource? log2 = BondrewdPlugin.Log; if (log2 != null) { log2.LogWarning((object)("Audio playback failed for " + fileName + ": " + ex.Message)); } return false; } } private static bool IsMciPlaying() { try { StringBuilder stringBuilder = new StringBuilder(64); if (mciSendString("status bondrewd_voice mode", stringBuilder, stringBuilder.Capacity, IntPtr.Zero) == 0) { return string.Equals(stringBuilder.ToString().Trim(), "playing", StringComparison.OrdinalIgnoreCase); } } catch { } return false; } private static float GameVolume() { return ConVarFraction("volume_master") * ConVarFraction("volume_sfx"); } private static float ConVarFraction(string name) { try { Console instance = Console.instance; object obj; if (instance == null) { obj = null; } else { BaseConVar obj2 = instance.FindConVar(name); obj = ((obj2 != null) ? obj2.GetString() : null); } string text = (string)obj; if (text != null && float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return Mathf.Clamp01(result / 100f); } } catch { } return 1f; } private static float DistanceFalloff(GameObject? source) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)source == (Object)null) { return 1f; } GameObject val = LocalPlayerBodyObject(); Vector3? obj; if (!((Object)(object)val != (Object)null)) { Camera main = Camera.main; obj = ((main != null) ? new Vector3?(((Component)main).transform.position) : ((Vector3?)null)); } else { obj = val.transform.position; } Vector3? val2 = obj; if (!val2.HasValue) { return 1f; } float num = Vector3.Distance(val2.Value, source.transform.position); if (!(num <= 10f)) { return Mathf.Clamp01(1f - (num - 10f) / 90f); } return 1f; } } public static class BondrewdConfig { private static ConfigEntry<float>? _abyssalChargeMultiplier; private static ConfigEntry<float>? _cartridgeEjectBurst; private static ConfigEntry<float>? _blessedDuration; private static ConfigEntry<float>? _cartridgeSaveThreshold; private static ConfigEntry<float>? _cartridgeSaveCooldown; private static ConfigEntry<float>? _contagionChance; private static ConfigEntry<bool>? _umbraAutoPickup; private static ConfigEntry<float>? _umbraPickupRange; private static ConfigEntry<bool>? _persistentUmbraHands; private static ConfigEntry<bool>? _multiplayerSharedZoaholic; private static ConfigEntry<bool>? _showHudBars; private static ConfigEntry<float>? _hudScale; private static ConfigEntry<float>? _hudVerticalOffset; private static ConfigEntry<float>? _voiceVolumeScale; public static float AbyssalChargeGainMultiplier => Mathf.Clamp(_abyssalChargeMultiplier?.Value ?? 1f, 0.1f, 5f); public static float CartridgeEjectChargeBurst => Mathf.Clamp(_cartridgeEjectBurst?.Value ?? 15f, 0f, 100f); public static float BlessedFormDuration => Mathf.Clamp(_blessedDuration?.Value ?? 8f, 2f, 30f); public static float CartridgeSaveThreshold => Mathf.Clamp(_cartridgeSaveThreshold?.Value ?? 75f, 25f, 100f); public static float CartridgeSaveCooldown => Mathf.Clamp(_cartridgeSaveCooldown?.Value ?? 45f, 5f, 180f); public static float ContagionProcChance => Mathf.Clamp01(_contagionChance?.Value ?? 0.03f); public static bool UmbraAutoPickupItems => _umbraAutoPickup?.Value ?? true; public static float UmbraPickupRange => Mathf.Clamp(_umbraPickupRange?.Value ?? 36f, 5f, 80f); public static bool PersistentUmbraHands => _persistentUmbraHands?.Value ?? false; public static bool MultiplayerSharedZoaholic => _multiplayerSharedZoaholic?.Value ?? true; public static bool ShowHudBars => _showHudBars?.Value ?? true; public static float HudScale => Mathf.Clamp(_hudScale?.Value ?? 1f, 0.5f, 2f); public static float HudVerticalOffset => Mathf.Clamp(_hudVerticalOffset?.Value ?? 0f, -300f, 400f); public static float VoiceVolumeScale => Mathf.Clamp(_voiceVolumeScale?.Value ?? 1f, 0f, 2f); public static void Init(ConfigFile config) { _abyssalChargeMultiplier = config.Bind<float>("Gameplay", "AbyssalChargeGainMultiplier", 1f, "Multiplier for all Abyssal Charge gained from hits and skills (lower = slower Blessed Form buildup)."); _cartridgeEjectBurst = config.Bind<float>("Gameplay", "CartridgeEjectChargeBurst", 15f, "Flat Abyssal Charge gained when casting Cartridge Eject (Utility Alt)."); _blessedDuration = config.Bind<float>("Gameplay", "BlessedFormDuration", 8f, "Duration in seconds of Blessed Form Overdrive once Abyssal Charge reaches 100%."); _cartridgeSaveThreshold = config.Bind<float>("Gameplay", "CartridgeSaveThreshold", 75f, "Minimum Abyssal Charge percentage required to absorb a lethal blow when no Umbra Hand is active."); _cartridgeSaveCooldown = config.Bind<float>("Gameplay", "CartridgeSaveCooldown", 45f, "Cooldown in seconds after expending a Cartridge Save."); _contagionChance = config.Bind<float>("Gameplay", "ContagionProcChance", 0.03f, "Chance on kill (0.03 = 3%) to convert slain enemies into friendly Umbra Hands when Zoaholic Contagion is equipped."); _umbraAutoPickup = config.Bind<bool>("Gameplay", "UmbraAutoPickupItems", true, "Allow summoned & converted Umbra Hands to autonomously run to and collect eligible ground items (excluding Lunar & Void) into Bondrewd's shared inventory."); _umbraPickupRange = config.Bind<float>("Gameplay", "UmbraPickupRange", 36f, "Search radius in meters around an Umbra Hand / Bondrewd for item foraging."); _persistentUmbraHands = config.Bind<bool>("Gameplay", "PersistentUmbraHands", false, "Disable passive Squid-Turret-style HP decay on summoned & converted Umbra Hands so they remain until slain in combat (still capped at 5 + bonus Special charges for Zoaholic and max Contagion allies)."); _multiplayerSharedZoaholic = config.Bind<bool>("Gameplay", "MultiplayerSharedZoaholic", true, "Allow Allied Bondrewd players to share Zoaholic vessels in multiplayer: casting R while a Bondrewd teammate is dead revives them at the vessel (60% HP), and fatal blows can consume an allied Bondrewd's active R Umbra Hand."); _showHudBars = config.Bind<bool>("HUD & Audio", "ShowHudBars", true, "Show Bondrewd's native HUD gauges for Abyssal Charge, Blessed Form, and active Umbra Hands."); _hudScale = config.Bind<float>("HUD & Audio", "HudScale", 1f, "Scale multiplier for Bondrewd's HUD gauges."); _hudVerticalOffset = config.Bind<float>("HUD & Audio", "HudVerticalOffset", 0f, "Vertical pixel offset (positive moves gauges upward) from default anchor."); _voiceVolumeScale = config.Bind<float>("HUD & Audio", "VoiceVolumeScale", 1f, "Master volume multiplier (0 to 2) for Bondrewd's voice lines."); } } public class BondrewdContent : IContentPackProvider { private readonly ContentPack _contentPack = new ContentPack(); public string identifier => "com.scifive_.bondrewd"; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { BondrewdSurvivor.Build(_contentPack); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(_contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } public sealed class BondrewdUmbraSquad : MonoBehaviour { internal sealed class UmbraEntry { public CharacterMaster Master; public float MaxDuration; public float TransitionGrace; } public const int BaseMaxSummonedUmbras = 5; public const int BaseMaxConvertedUmbras = 5; public const int MaxConvertedUmbras = 5; private CharacterMaster? _ownerMaster; private BondrewdController? _controller; private readonly List<UmbraEntry> _umbras = new List<UmbraEntry>(); private readonly List<UmbraEntry> _convertedUmbras = new List<UmbraEntry>(); private readonly Dictionary<CharacterMaster, float> _warpCooldowns = new Dictionary<CharacterMaster, float>(); private int _lastSyncedStageInstanceId; private bool _pendingStageArrivalSync; private float _stageArrivalDelay; private float _catchUpTimer; private static readonly FieldInfo? PreventRespawnUntilNextStageField = typeof(CharacterMaster).GetField("preventRespawnUntilNextStageServer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public int SummonedCount => _umbras.Count; public int ConvertedCount => _convertedUmbras.Count; public float MaxZoaholicRemaining { get; private set; } public bool HasActiveAnchor => _umbras.Count > 0; private void Awake() { _ownerMaster = ((Component)this).GetComponent<CharacterMaster>(); if ((Object)(object)_ownerMaster != (Object)null) { _ownerMaster.onBodyStart += OnOwnerBodyStart; } } private void OnDestroy() { if ((Object)(object)_ownerMaster != (Object)null) { _ownerMaster.onBodyStart -= OnOwnerBodyStart; } DestroyAll(); } internal void AttachController(BondrewdController ctrl) { _controller = ctrl; if (NetworkServer.active) { CheckStageArrivalSchedule(); SyncControllerState(); } } internal void DetachController(BondrewdController ctrl) { if ((Object)(object)_controller == (Object)(object)ctrl) { _controller = null; } } private void OnOwnerBodyStart(CharacterBody newBody) { if (NetworkServer.active && !((Object)(object)newBody == (Object)null)) { CheckStageArrivalSchedule(); } } private void CheckStageArrivalSchedule() { Stage instance = Stage.instance; if ((Object)(object)instance == (Object)null) { return; } int instanceID = ((Object)instance).GetInstanceID(); if (instanceID != _lastSyncedStageInstanceId && (!((Object)(object)instance.sceneDef != (Object)null) || !instance.sceneDef.suppressNpcEntry)) { _lastSyncedStageInstanceId = instanceID; if (_umbras.Count != 0 || _convertedUmbras.Count != 0) { SetTransitionGrace(_umbras, 3f); SetTransitionGrace(_convertedUmbras, 3f); _pendingStageArrivalSync = true; _stageArrivalDelay = 0.25f; } } } private static void SetTransitionGrace(List<UmbraEntry> list, float grace) { for (int i = 0; i < list.Count; i++) { list[i].TransitionGrace = Mathf.Max(list[i].TransitionGrace, grace); } } private void FixedUpdate() { if (!NetworkServer.active || (Object)(object)_ownerMaster == (Object)null) { return; } RemoveDestroyedMasters(_umbras); RemoveDestroyedMasters(_convertedUmbras); if (!IsStageActiveForSquad(out CharacterBody ownerBody)) { return; } float fixedDeltaTime = Time.fixedDeltaTime; if (_pendingStageArrivalSync) { _stageArrivalDelay -= fixedDeltaTime; if (_stageArrivalDelay <= 0f) { _pendingStageArrivalSync = false; HandleStageArrival(ownerBody); } } _catchUpTimer -= fixedDeltaTime; if (_catchUpTimer <= 0f) { _catchUpTimer = 0.85f; SyncAndCatchUpBodies(ownerBody); } float maxHealthFrac; bool num = PruneList(_umbras, fixedDeltaTime, announceStatus: true, out maxHealthFrac); float maxHealthFrac2; bool flag = PruneList(_convertedUmbras, fixedDeltaTime, announceStatus: false, out maxHealthFrac2); MaxZoaholicRemaining = maxHealthFrac; if (num || flag) { SyncControllerState(); } else if ((Object)(object)_controller != (Object)null) { _controller.SyncFromSquad(this, forceBroadcast: false); } } private void SyncAndCatchUpBodies(CharacterBody ownerBody) { float time = Time.time; int ringIdx = 0; CatchUpList(_umbras, ownerBody, time, ref ringIdx); CatchUpList(_convertedUmbras, ownerBody, time, ref ringIdx); } private void CatchUpList(List<UmbraEntry> list, CharacterBody ownerBody, float now, ref int ringIdx) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown for (int i = 0; i < list.Count; i++) { CharacterMaster master = list[i].Master; if ((Object)(object)master == (Object)null || !master.hasBody) { continue; } CharacterBody body = master.GetBody(); if ((Object)(object)body == (Object)null) { continue; } SyncUmbraLoadout(body, ownerBody); if (Vector3.Distance(body.footPosition, ownerBody.footPosition) > 68f && (!_warpCooldowns.TryGetValue(master, out var value) || !(now < value))) { _warpCooldowns[master] = now + 6f; float num = (float)(ringIdx++ % 6) * 1.05f; Vector3 val = BondrewdController.FindSafePosition(ownerBody.footPosition + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * 2.4f, body, ownerBody.footPosition); TeleportHelper.TeleportBody(body, val, true); if ((Object)(object)BondrewdVfx.VoidImpact != (Object)null) { EffectManager.SpawnEffect(BondrewdVfx.VoidImpact, new EffectData { origin = val, scale = 1.8f }, true); } } } } private bool IsStageActiveForSquad(out CharacterBody? ownerBody) { ownerBody = (((Object)(object)_ownerMaster != (Object)null) ? _ownerMaster.GetBody() : null); Stage instance = Stage.instance; if ((Object)(object)instance == (Object)null || ((Object)(object)Run.instance != (Object)null && Run.instance.NetworkinSceneTransition)) { return false; } SceneDef val = ((instance != null) ? instance.sceneDef : null); if ((Object)(object)val != (Object)null && val.suppressNpcEntry) { return false; } if ((Object)(object)ownerBody != (Object)null && (Object)(object)ownerBody.healthComponent != (Object)null) { return ownerBody.healthComponent.alive; } return false; } private static void RemoveDestroyedMasters(List<UmbraEntry> list) { for (int num = list.Count - 1; num >= 0; num--) { if ((Object)(object)list[num].Master == (Object)null) { list.RemoveAt(num); } } } private static bool PruneList(List<UmbraEntry> list, float dt, bool announceStatus, out float maxHealthFrac) { bool result = false; maxHealthFrac = 0f; bool persistentUmbraHands = BondrewdConfig.PersistentUmbraHands; for (int num = list.Count - 1; num >= 0; num--) { UmbraEntry umbraEntry = list[num]; if (umbraEntry.TransitionGrace > 0f) { umbraEntry.TransitionGrace = Mathf.Max(0f, umbraEntry.TransitionGrace - dt); } CharacterMaster master = umbraEntry.Master; if ((Object)(object)master == (Object)null || master.IsDeadAndOutOfLivesServer() || (umbraEntry.TransitionGrace <= 0f && !master.hasBody)) { BondrewdController.DestroyMaster(master); list.RemoveAt(num); result = true; if (announceStatus) { BondrewdController.BroadcastServerChat("<color=#B366FF>Zoaholic:</color> Umbra Hand vessel destroyed!"); } continue; } CharacterBody body = master.GetBody(); HealthComponent val = (((Object)(object)body != (Object)null) ? body.healthComponent : null); if ((Object)(object)val == (Object)null || !val.alive) { continue; } if (!persistentUmbraHands && umbraEntry.TransitionGrace <= 0f && !body.HasBuff(Buffs.HiddenInvincibility)) { float num2 = val.fullCombinedHealth / Mathf.Max(5f, umbraEntry.MaxDuration) * dt; if (val.Networkshield > 0f) { float num3 = Mathf.Min(val.Networkshield, num2); val.Networkshield = Mathf.Max(0f, val.Networkshield - num3); num2 -= num3; } if (num2 > 0f) { float num4 = val.Networkhealth - num2; if (num4 <= 0.5f) { val.Networkhealth = 0f; master.TrueKill(); Object.Destroy((Object)(object)((Component)master).gameObject, 2f); list.RemoveAt(num); result = true; if (announceStatus) { BondrewdController.BroadcastServerChat("<color=#B366FF>Zoaholic:</color> Umbra Hand vessel withered."); } continue; } val.Networkhealth = num4; } } float num5 = Mathf.Clamp01(val.combinedHealthFraction); if (num5 > maxHealthFrac) { maxHealthFrac = num5; } } return result; } private void HandleStageArrival(CharacterBody ownerBody) { if (!((Object)(object)_ownerMaster == (Object)null) && !((Object)(object)ownerBody == (Object)null)) { int num = 0; int ringIdx = 0; num += RestoreListOnNewStage(_umbras, ownerBody, ref ringIdx, isSummoned: true); num += RestoreListOnNewStage(_convertedUmbras, ownerBody, ref ringIdx, isSummoned: false); MaxZoaholicRemaining = ComputeMaxHealthFraction(_umbras); SyncControllerState(); if (num > 0) { BondrewdController.BroadcastServerChat(string.Format("<color=#B366FF>Zoaholic:</color> {0} Umbra Hand{1} transitioned with you.", num, (num == 1) ? "" : "s")); } } } private int RestoreListOnNewStage(List<UmbraEntry> list, CharacterBody ownerBody, ref int ringIdx, bool isSummoned) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_ownerMaster == (Object)null) { return 0; } float num = (isSummoned ? BondrewdSynergies.GetZoaholicDuration(ownerBody) : BondrewdSynergies.GetContagionDuration(ownerBody)); int num2 = 0; for (int num3 = list.Count - 1; num3 >= 0; num3--) { UmbraEntry umbraEntry = list[num3]; CharacterMaster master = umbraEntry.Master; if ((Object)(object)master == (Object)null || master.IsDeadAndOutOfLivesServer()) { BondrewdController.DestroyMaster(master); list.RemoveAt(num3); } else { umbraEntry.MaxDuration = Mathf.Max(umbraEntry.MaxDuration, num); umbraEntry.TransitionGrace = 2f; if ((Object)(object)_ownerMaster.inventory != (Object)null && (Object)(object)master.inventory != (Object)null) { master.inventory.CopyItemsFrom(_ownerMaster.inventory); } float num4 = (float)ringIdx * 1.15f; ringIdx++; Vector3 val = BondrewdController.FindSafePosition(ownerBody.footPosition + new Vector3(Mathf.Cos(num4), 0f, Mathf.Sin(num4)) * 2.4f, ownerBody, ownerBody.footPosition); CharacterBody body = master.GetBody(); if ((Object)(object)body == (Object)null) { master.Respawn(val, ((Component)ownerBody).transform.rotation, true); body = master.GetBody(); if ((Object)(object)BondrewdVfx.VoidImpact != (Object)null) { EffectManager.SpawnEffect(BondrewdVfx.VoidImpact, new EffectData { origin = val, scale = 2f }, true); } } else { if ((Object)(object)body.healthComponent != (Object)null) { body.healthComponent.Networkhealth = body.healthComponent.fullHealth; body.healthComponent.Networkshield = body.healthComponent.fullShield; } if (Vector3.Distance(body.footPosition, ownerBody.footPosition) > 22f) { TeleportHelper.TeleportBody(body, val, true); } } if ((Object)(object)body != (Object)null) { SyncUmbraLoadout(body, ownerBody); } BaseAI component = ((Component)master).GetComponent<BaseAI>(); if ((Object)(object)component != (Object)null) { component.leader.gameObject = ((Component)ownerBody).gameObject; } if ((Object)(object)_controller != (Object)null && _controller.IsOverdrive && _controller.OverdriveTimer > 0.25f) { BondrewdController.GrantUmbraBlessedBuffs(master, _controller.OverdriveTimer); } num2++; } } return num2; } private static void SyncUmbraLoadout(CharacterBody umbraBody, CharacterBody ownerBody) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) SkillLocator skillLocator = ownerBody.skillLocator; SkillLocator skillLocator2 = umbraBody.skillLocator; if ((Object)(object)skillLocator == (Object)null || (Object)(object)skillLocator2 == (Object)null) { return; } SerializableEntityStateType activationState; SkillDef? obj; if ((Object)(object)skillLocator.primary != (Object)null) { activationState = skillLocator.primary.activationState; if (((SerializableEntityStateType)(ref activationState)).stateType == typeof(Sparagmos)) { obj = BondrewdSurvivor.UmbraSparagmosSkillDef; goto IL_0063; } } obj = BondrewdSurvivor.UmbraShakerSkillDef; goto IL_0063; IL_0063: SkillDef desired = obj; ApplySkillMirror(skillLocator2.primary, desired, BondrewdSurvivor.UmbraSparagmosSkillDef, BondrewdSurvivor.UmbraShakerSkillDef); SkillDef? obj2; if ((Object)(object)skillLocator.secondary != (Object)null) { activationState = skillLocator.secondary.activationState; if (((SerializableEntityStateType)(ref activationState)).stateType == typeof(ThirdWorks)) { obj2 = BondrewdSurvivor.UmbraThirdWorksSkillDef; goto IL_00bc; } } obj2 = BondrewdSurvivor.UmbraGangwaySkillDef; goto IL_00bc; IL_00bc: SkillDef desired2 = obj2; ApplySkillMirror(skillLocator2.secondary, desired2, BondrewdSurvivor.UmbraThirdWorksSkillDef, BondrewdSurvivor.UmbraGangwaySkillDef); } private static void ApplySkillMirror(GenericSkill? slot, SkillDef? desired, SkillDef? optA, SkillDef? optB) { if (!((Object)(object)slot == (Object)null) && !((Object)(object)desired == (Object)null) && !((Object)(object)slot.skillDef == (Object)(object)desired)) { if ((Object)(object)optA != (Object)null && (Object)(object)optA != (Object)(object)desired && (Object)(object)slot.skillDef == (Object)(object)optA) { slot.UnsetSkillOverride((object)slot, optA, (SkillOverridePriority)4); } if ((Object)(object)optB != (Object)null && (Object)(object)optB != (Object)(object)desired && (Object)(object)slot.skillDef == (Object)(object)optB) { slot.UnsetSkillOverride((object)slot, optB, (SkillOverridePriority)4); } if ((Object)(object)slot.skillDef != (Object)(object)desired) { slot.SetSkillOverride((object)slot, desired, (SkillOverridePriority)4); } } } private static float ComputeMaxHealthFraction(List<UmbraEntry> list) { float num = 0f; for (int i = 0; i < list.Count; i++) { CharacterBody val = (((Object)(object)list[i].Master != (Object)null) ? list[i].Master.GetBody() : null); HealthComponent val2 = (((Object)(object)val != (Object)null) ? val.healthComponent : null); if ((Object)(object)val2 != (Object)null && val2.alive) { num = Mathf.Max(num, Mathf.Clamp01(val2.combinedHealthFraction)); } } return num; } private void SyncControllerState(bool forceBroadcast = true) { if ((Object)(object)_controller != (Object)null) { _controller.SyncFromSquad(this, forceBroadcast); } } public void ActivateZoaholic(CharacterBody ownerBody, Vector3 anchorPosition, float duration = 30f) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || (Object)(object)ownerBody == (Object)null || (Object)(object)BondrewdSurvivor.UmbraMasterPrefab == (Object)null || (BondrewdConfig.MultiplayerSharedZoaholic && TryReviveDeadAlliedBondrewd(ownerBody, anchorPosition))) { return; } float zoaholicDuration = BondrewdSynergies.GetZoaholicDuration(ownerBody, duration); RemoveDestroyedMasters(_umbras); int num = (((Object)(object)ownerBody.skillLocator?.special != (Object)null) ? Mathf.Max(0, ownerBody.skillLocator.special.maxStock - 1) : 0); int num2 = 5 + num; while (_umbras.Count >= num2) { BondrewdController.DestroyMaster(_umbras[0].Master); _umbras.RemoveAt(0); } int count = _umbras.Count; float num3 = ((count == 0) ? 0f : (((count % 2 == 1) ? 1f : (-1f)) * (float)((count + 1) / 2) * 1.1f)); float num4 = 1.5f + (float)((count + 1) / 2) * 0.25f; Vector3 val = anchorPosition + ((Component)ownerBody).transform.forward * num4 + ((Component)ownerBody).transform.right * num3; Vector3 spawnPos = BondrewdController.FindSafePosition(val, ownerBody, val); CharacterMaster val2 = SummonUmbraMaster(ownerBody, spawnPos); if ((Object)(object)val2 != (Object)null) { _umbras.Add(new UmbraEntry { Master = val2, MaxDuration = zoaholicDuration, TransitionGrace = 1.2f }); MaxZoaholicRemaining = ComputeMaxHealthFraction(_umbras); if ((Object)(object)_controller != (Object)null && _controller.IsOverdrive && _controller.OverdriveTimer > 0.25f) { BondrewdController.GrantUmbraBlessedBuffs(val2, _controller.OverdriveTimer); } SyncControllerState(); } string arg = (BondrewdConfig.PersistentUmbraHands ? "persistent" : $"{Mathf.RoundToInt(zoaholicDuration)}s decay"); BondrewdNetwork.BroadcastVoice(((Component)ownerBody).gameObject, 0.88f, 3f, true, "voice_body_of_yours.mp3", "you-may-be-much-more-like-us.mp3"); BondrewdController.BroadcastServerChat($"<color=#B366FF>Zoaholic:</color> Umbra Hand deployed ({_umbras.Count}/{num2}, {arg})."); } private bool TryReviveDeadAlliedBondrewd(CharacterBody ownerBody, Vector3 anchorPosition) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown Stage instance = Stage.instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.sceneDef != (Object)null && instance.sceneDef.suppressNpcEntry) { return false; } if ((Object)(object)BondrewdSurvivor.BodyPrefab == (Object)null) { return false; } TeamIndex team = (TeamIndex)((!((Object)(object)ownerBody.teamComponent != (Object)null)) ? 1 : ((int)ownerBody.teamComponent.teamIndex)); PlayerCharacterMasterController val = null; foreach (PlayerCharacterMasterController instance2 in PlayerCharacterMasterController.instances) { if (IsAlliedBondrewdPcmc(instance2, _ownerMaster, team, out CharacterMaster master) && !master.hasBody && master.IsDeadAndOutOfLivesServer()) { val = instance2; break; } } if ((Object)(object)val == (Object)null || (Object)(object)val.master == (Object)null) { return false; } CharacterMaster master2 = val.master; Vector3 val2 = anchorPosition + ((Component)ownerBody).transform.forward * 1.8f; Vector3 spawnPointPosition = BondrewdController.FindSafePosition(val2, ownerBody, val2); PreventRespawnUntilNextStageField?.SetValue(master2, false); RespawnArgs val3 = new RespawnArgs { spawnBodyArgs = new SpawnBodyArgs { spawnPointPosition = spawnPointPosition, spawnPointRotation = ((Component)ownerBody).transform.rotation, spawnPointIsFootPos = true }, wasRevivedMidStage = true, ignoreMetamorphosis = true }; CharacterBody val4 = master2.Respawn(ref val3); if ((Object)(object)val4 == (Object)null) { return false; } EntityStateMachine[] components = ((Component)val4).GetComponents<EntityStateMachine>(); foreach (EntityStateMachine obj in components) { obj.initialStateType = obj.mainStateType; } if ((Object)(object)val4.healthComponent != (Object)null) { val4.healthComponent.Networkhealth = Mathf.Max(1f, val4.healthComponent.fullHealth * 0.6f); } val4.AddTimedBuff(Buffs.HiddenInvincibility, 3f); Vector3 footPosition = val4.footPosition; if ((Object)(object)BondrewdVfx.AbyssExplosion != (Object)null) { EffectManager.SpawnEffect(BondrewdVfx.AbyssExplosion, new EffectData { origin = footPosition, scale = 10f }, true); } BondrewdController.EmitServerSound("Play_voidman_R_pop", ((Component)val4).gameObject); BondrewdNetwork.BroadcastVoice(((Component)val4).gameObject, 0.92f, 1.5f, true, "how-about-that.mp3", "doesn-t-sound-so-bad-does-it.mp3", "voice_commotion.mp3"); string playerDisplayName = GetPlayerDisplayName(val); CharacterMaster? ownerMaster = _ownerMaster; string playerDisplayName2 = GetPlayerDisplayName((ownerMaster != null) ? ownerMaster.playerCharacterMasterController : null); BondrewdController.BroadcastServerChat("<color=#B366FF>Zoaholic:</color> " + playerDisplayName + "'s consciousness respawned into " + playerDisplayName2 + "'s Umbra vessel!"); return true; } internal static bool IsAlliedBondrewdPcmc(PlayerCharacterMasterController? pcmc, CharacterMaster? excludeMaster, TeamIndex team, out CharacterMaster? master) { //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) master = null; if ((Object)(object)pcmc == (Object)null || !pcmc.isConnected || (Object)(object)BondrewdSurvivor.BodyPrefab == (Object)null) { return false; } CharacterMaster master2 = pcmc.master; if ((Object)(object)master2 == (Object)null || (Object)(object)master2 == (Object)(object)excludeMaster || master2.teamIndex != team || (Object)(object)master2.bodyPrefab != (Object)(object)BondrewdSurvivor.BodyPrefab) { return false; } master = master2; return true; } internal static string GetPlayerDisplayName(PlayerCharacterMasterController? pcmc) { if (!((Object)(object)pcmc != (Object)null) || !((Object)(object)pcmc.networkUser != (Object)null) || string.IsNullOrEmpty(pcmc.networkUser.userName)) { return "Bondrewd"; } return pcmc.networkUser.userName; } public void SpawnConvertedUmbraHand(CharacterBody ownerBody, Vector3 spawnPos, string victimName, float duration = 45f) { //IL_006b: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown if (!NetworkServer.active || (Object)(object)ownerBody == (Object)null || (Object)(object)BondrewdSurvivor.UmbraMasterPrefab == (Object)null) { return; } float contagionDuration = BondrewdSynergies.GetContagionDuration(ownerBody, duration); int maxContagionUmbras = BondrewdSynergies.GetMaxContagionUmbras(ownerBody); RemoveDestroyedMasters(_convertedUmbras); while (_convertedUmbras.Count >= maxContagionUmbras) { BondrewdController.DestroyMaster(_convertedUmbras[0].Master); _convertedUmbras.RemoveAt(0); } Vector3 val = spawnPos + Vector3.up * 0.3f; Vector3 val2 = BondrewdController.FindSafePosition(val, ownerBody, val); CharacterMaster val3 = SummonUmbraMaster(ownerBody, val2); if (!((Object)(object)val3 == (Object)null)) { _convertedUmbras.Add(new UmbraEntry { Master = val3, MaxDuration = contagionDuration, TransitionGrace = 1.2f }); if ((Object)(object)_controller != (Object)null && _controller.IsOverdrive && _controller.OverdriveTimer > 0.25f) { BondrewdController.GrantUmbraBlessedBuffs(val3, _controller.OverdriveTimer); } SyncControllerState(); if ((Object)(object)BondrewdVfx.AbyssExplosion != (Object)null) { EffectManager.SpawnEffect(BondrewdVfx.AbyssExplosion, new EffectData { origin = val2, scale = 5f }, true); } GameObject val4 = val3.GetBodyObject() ?? ((Component)ownerBody).gameObject; BondrewdController.EmitServerSound("Play_voidman_R_activate", val4); BondrewdNetwork.BroadcastVoice(val4, 0.82f, 8f, false, "voice_body_of_yours.mp3", "how-about-that.mp3"); BondrewdController.BroadcastServerChat("<color=#B366FF>Zoaholic Contagion:</color> " + victimName + " claimed as an Umbra Hand!"); } } private CharacterMaster? SummonUmbraMaster(CharacterBody ownerBody, Vector3 spawnPos) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_004c: 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) if ((Object)(object)ownerBody == (Object)null || (Object)(object)BondrewdSurvivor.UmbraMasterPrefab == (Object)null) { return null; } CharacterMaster val = new MasterSummon { masterPrefab = BondrewdSurvivor.UmbraMasterPrefab, position = spawnPos, rotation = ((Component)ownerBody).transform.rotation, summonerBodyObject = ((Component)ownerBody).gameObject, ignoreTeamMemberLimit = true, useAmbientLevel = null }.Perform(); if ((Object)(object)val != (Object)null) { Object.DontDestroyOnLoad((Object)(object)((Component)val).gameObject); if ((Object)(object)_ownerMaster != (Object)null && (Object)(object)_ownerMaster.inventory != (Object)null && (Object)(object)val.inventory != (Object)null) { val.inventory.CopyItemsFrom(_ownerMaster.inventory); } CharacterBody body = val.GetBody(); if ((Object)(object)body != (Object)null) { SyncUmbraLoadout(body, ownerBody); } } return val; } public bool DispatchForPickup(GenericPickupController gpc) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)gpc == (Object)null || (Object)(object)_ownerMaster == (Object)null) { return false; } Vector3 position = ((Component)gpc).transform.position; BondrewdUmbraForager best = null; float bestScore = float.PositiveInfinity; ConsiderForageList(_umbras, position, ref best, ref bestScore); ConsiderForageList(_convertedUmbras, position, ref best, ref bestScore); if ((Object)(object)best != (Object)null) { return best.ForceTargetPickup(gpc); } return false; } private static void ConsiderForageList(List<UmbraEntry> list, Vector3 pickupPos, ref BondrewdUmbraForager? best, ref float bestScore) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < list.Count; i++) { CharacterMaster master = list[i].Master; if ((Object)(object)master == (Object)null || !master.hasBody) { continue; } CharacterBody body = master.GetBody(); if ((Object)(object)body == (Object)null || (Object)(object)body.healthComponent == (Object)null || !body.healthComponent.alive) { continue; } BondrewdUmbraForager component = ((Component)master).GetComponent<BondrewdUmbraForager>(); if ((Object)(object)component == (Object)null) { continue; } float num = Vector3.Distance(body.footPosition, pickupPos); if (!(num > 85f)) { float num2 = num + (component.IsIdleForForage ? 0f : 35f); if (num2 < bestScore) { bestScore = num2; best = component; } } } } public void FocusAllOnTarget(GameObject targetBodyObj) { FocusList(_umbras, targetBodyObj); FocusList(_convertedUmbras, targetBodyObj); } private static void FocusList(List<UmbraEntry> list, GameObject targetBodyObj) { for (int i = 0; i < list.Count; i++) { CharacterMaster master = list[i].Master; if (!((Object)(object)master == (Object)null) && master.hasBody) { BaseAI component = ((Component)master).GetComponent<BaseAI>(); if ((Object)(object)component != (Object)null && component.currentEnemy != null) { component.currentEnemy.gameObject = targetBodyObj; } } } } public void GrantBlessedBuffs(float duration) { GrantListBuffs(_umbras, duration); GrantListBuffs(_convertedUmbras, duration); } private static void GrantListBuffs(List<UmbraEntry> list, float duration) { for (int i = 0; i < list.Count; i++) { BondrewdController.GrantUmbraBlessedBuffs(list[i].Master, duration); } } public void SyncAllInventories() { if (NetworkServer.active && !((Object)(object)_ownerMaster == (Object)null) && !((Object)(object)_ownerMaster.inventory == (Object)null)) { SyncListInventories(_umbras, _ownerMaster.inventory); SyncListInventories(_convertedUmbras, _ownerMaster.inventory); CharacterBody body = _ownerMaster.GetBody(); if ((Object)(object)body != (Object)null && (RefreshDurationList(_umbras, BondrewdSynergies.GetZoaholicDuration(body)) | RefreshDurationList(_convertedUmbras, BondrewdSynergies.GetContagionDuration(body)))) { MaxZoaholicRemaining = ComputeMaxHealthFraction(_umbras); SyncControllerState(); } } } private static bool RefreshDurationList(List<UmbraEntry> list, float newMax) { bool result = false; for (int i = 0; i < list.Count; i++) { UmbraEntry umbraEntry = list[i]; if (newMax > umbraEntry.MaxDuration + 0.05f) { umbraEntry.MaxDuration = newMax; result = true; } } return result; } private static void SyncListInventories(List<UmbraEntry> list, Inventory ownerInv) { for (int i = 0; i < list.Count; i++) { CharacterMaster master = list[i].Master; if ((Object)(object)master != (Object)null && (Object)(object)master.inventory != (Object)null && !master.IsDeadAndOutOfLivesServer()) { master.inventory.CopyItemsFrom(ownerInv); } } } public bool TryConsumeNearestForTransfer(Vector3 originPos, out Vector3 transferPos) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) int num = -1; float num2 = float.PositiveInfinity; transferPos = Vector3.zero; for (int i = 0; i < _umbras.Count; i++) { CharacterBody val = (((Object)(object)_umbras[i].Master != (Object)null) ? _umbras[i].Master.GetBody() : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.healthComponent == (Object)null) && val.healthComponent.alive) { Vector3 val2 = val.footPosition - originPos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num2) { num2 = sqrMagnitude; num = i; transferPos = val.footPosition; } } } if (num < 0) { return false; } BondrewdController.DestroyMaster(_umbras[num].Master); _umbras.RemoveAt(num); MaxZoaholicRemaining = ComputeMaxHealthFraction(_umbras); SyncControllerState(); return true; } public void DestroyAll() { foreach (UmbraEntry umbra in _umbras) { BondrewdController.DestroyMaster(umbra.Master); } _umbras.Clear(); foreach (UmbraEntry convertedUmbra in _convertedUmbras) { BondrewdController.DestroyMaster(convertedUmbra.Master); } _convertedUmbras.Clear(); _warpCooldowns.Clear(); MaxZoaholicRemaining = 0f; SyncControllerState(); } } public class BondrewdController : MonoBehaviour, IOnTakeDamageServerReceiver, IOnIncomingDamageServerReceiver { public const float MaxCharge = 100f; public const float OverdriveDuration = 8f; public const float CartridgeSaveThreshold = 75f; public const float CartridgeSaveCooldownDuration = 45f; public const float ContagionProcChance = 0.03f; public const int MaxConvertedUmbras = 5; private CharacterBody? _body; private BondrewdUmbraSquad? _squad; private bool _skillOverridesApplied; private float _stateSyncTimer; private float _initialSyncTimer = 0.45f; private float _lastSyncedCharge = -1f; private bool _lastSyncedOverdrive; private int _lastSyncedConverted = -1; private float _lastSyncedSaveCooldown; private int _syncedConvertedCount; private float _burdenFxCooldown; private Inventory? _subscribedInventory; public float AbyssCharge { get; private set; } public bool IsOverdrive { get; private set; } public float OverdriveTimer { get; private set; } public bool HasZoaholicAnchor { get { if (!((Object)(object)_squad != (Object)null) || !_squad.HasActiveAnchor) { return ZoaholicWindowTimer > 0.01f; } return true; } } public int ActiveUmbraCount { get { if (!((Object)(object)_squad != (Object)null) || _squad.SummonedCount <= 0) { if (!((Object)(object)_body != (Object)null) || !((Object)(object)BondrewdBuffs.ZoaholicActive != (Object)null)) { return 0; } return _body.GetBuffCount(BondrewdBuffs.ZoaholicActive); } return _squad.SummonedCount; } } public int ActiveConvertedUmbraCount { get { if (!((Object)(object)_squad != (Object)null)) { return _syncedConvertedCount; } return _squad.ConvertedCount; } } public float ZoaholicWindowTimer { get; private set; } public float CartridgeSaveCooldown { get; private set; } public bool HasContagionPassive => HasMiscSkill(BondrewdSurvivor.MiscContagionSkillDef); public bool HasOverflowPassive => HasMiscSkill(BondrewdSurvivor.MiscOverflowSkillDef); internal CharacterBody? Body => _body; private bool HasMiscSkill(SkillDef? def) { if ((Object)(object)def != (Object)null) { CharacterBody? body = _body; if ((Object)(object)((body != null) ? body.skillLocator : null) != (Object)null) { return (Object)(object)_body.skillLocator.FindSkillByDef(def) != (Object)null; } } return false; } private BondrewdUmbraSquad? EnsureSquad() { if (NetworkServer.active) { CharacterBody? body = _body; if (!((Object)(object)((body != null) ? body.master : null) == (Object)null)) { if ((Object)(object)_squad == (Object)null) { _squad = ((Component)_body.master).GetComponent<BondrewdUmbraSquad>() ?? ((Component)_body.master).gameObject.AddComponent<BondrewdUmbraSquad>(); _squad.AttachController(this); } return _squad; } } return _squad; } private void Awake() { _body = ((Component)this).GetComponent<CharacterBody>(); } private void Update() { if ((Object)(object)_body != (Object)null && _body.hasEffectiveAuthority) { BondrewdHudPanel.SyncForController(this); } } private void FixedUpdate() { if ((Object)(object)_body == (Object)null) { return; } if (_body.hasEffectiveAuthority && (Object)(object)_body.healthComponent != (Object)null && _body.healthComponent.alive && _body.healthComponent.combinedHealthFraction <= 0.3f) { BondrewdAudio.PlayLowHealthWarning(((Component)_body).gameObject); } if (!NetworkServer.active) { if (CartridgeSaveCooldown > 0f) { CartridgeSaveCooldown = Mathf.Max(0f, CartridgeSaveCooldown - Time.fixedDeltaTime); } if (IsOverdrive && OverdriveTimer > 0f) { OverdriveTimer = Mathf.Max(0f, OverdriveTimer - Time.fixedDeltaTime); } return; } if (CartridgeSaveCooldown > 0f) { CartridgeSaveCooldown = Mathf.Max(0f, CartridgeSaveCooldown - Time.fixedDeltaTime); } if (IsOverdrive) { OverdriveTimer -= Time.fixedDeltaTime; if (OverdriveTimer <= 0f) { EndOverdrive(); } } BondrewdUmbraSquad bondrewdUmbraSquad = EnsureSquad(); if ((Object)(object)_subscribedInventory == (Object)null && (Object)(object)_body.master != (Object)null && (Object)(object)_body.master.inventory != (Object)null) { _subscribedInventory = _body.master.inventory; _subscribedInventory.onInventoryChanged += SyncAllUmbraInventories; } if ((Object)(object)bondrewdUmbraSquad != (Object)null) { ZoaholicWindowTimer = bondrewdUmbraSquad.MaxZoaholicRemaining; } _stateSyncTimer -= Time.fixedDeltaTime; if (_burdenFxCooldown > 0f) { _burdenFxCooldown = Mathf.Max(0f, _burdenFxCooldown - Time.fixedDeltaTime); } bool flag = false; if (_initialSyncTimer > 0f) { _initialSyncTimer -= Time.fixedDeltaTime; if (_initialSyncTimer <= 0f) { flag = true; } } if (flag || _stateSyncTimer <= 0f) { MaybeBroadcastState(flag); } } public void ApplyClientSyncedState(float charge, bool overdrive, float overdriveTimer, float zoaTimer, float saveCd, int convertedCount) { if (!NetworkServer.active) { AbyssCharge = charge; OverdriveTimer = overdriveTimer; ZoaholicWindowTimer = zoaTimer; CartridgeSaveCooldown = saveCd; _syncedConvertedCount = Mathf.Max(0, convertedCount); if (overdrive != IsOverdrive) { IsOverdrive = overdrive; ApplyBlessedSkillOverrides(overdrive); } } } private void MaybeBroadcastState(bool force) { if (NetworkServer.active && !((Object)(object)_body == (Object)null)) { int activeConvertedUmbraCount = ActiveConvertedUmbraCount; if (!force && IsOverdrive == _lastSyncedOverdrive && !(Mathf.Abs(AbyssCharge - _lastSyncedCharge) >= 0.5f) && activeConvertedUmbraCount == _lastSyncedConverted && (!(CartridgeSaveCooldown <= 0f) || !(_lastSyncedSaveCooldown > 0f)) && !IsOverdrive && !HasZoaholicAnchor && activeConvertedUmbraCount <= 0 && !(CartridgeSaveCooldown > 0f)) { _stateSyncTimer = 0.25f; return; } _stateSyncTimer = 0.2f; _lastSyncedCharge = AbyssCharge; _lastSyncedOverdrive = IsOverdrive; _lastSyncedConverted = activeConvertedUmbraCount; _lastSyncedSaveCooldown = CartridgeSaveCooldown; BondrewdNetwork.BroadcastControllerState(((Component)this).gameObject, AbyssCharge, IsOverdrive, OverdriveTimer, ZoaholicWindowTimer, CartridgeSaveCooldown, activeConvertedUmbraCount); } } internal void SyncFromSquad(BondrewdUmbraSquad squad, bool forceBroadcast) { ZoaholicWindowTimer = squad.MaxZoaholicRemaining; SyncZoaholicBuffCount(); if (forceBroadcast) { MaybeBroadcastState(force: true); } } internal static void BroadcastServerChat(string message) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if (NetworkServer.active && !string.IsNullOrEmpty(message)) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = message }); } } internal static void EmitServerSound(string soundEvent, GameObject? targetObj) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && (Object)(object)targetObj != (Object)null && !string.IsNullOrEmpty(soundEvent)) { EntitySoundManager.EmitSoundServer((AkEventIdArg)soundEvent, targetObj); } } internal static Vector3 FindSafePosition(Vector3 desiredPos, CharacterBody? body, Vector3 fallbackPos) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body != (Object)null) { Vector3? val = TeleportHelper.FindSafeTeleportDestination(desiredPos, body, RoR2Application.rng); if (val.HasValue) { return val.Value; } } return fallbackPos; } public void FocusUmbrasOnTarget(GameObject? targetBodyObj) { if (NetworkServer.active && !((Object)(object)targetBodyObj == (Object)null)) { EnsureSquad()?.FocusAllOnTarget(targetBodyObj); } } public bool DispatchUmbraForPickup(GenericPickupController? pickup) { if (!NetworkServer.active || (Object)(object)pickup == (Object)null) { return false; } return EnsureSquad()?.DispatchForPickup(pickup) ?? false; } public void OnIncomingDamageServer(DamageInfo damageInfo) { //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_002d: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown if (!NetworkServer.active || damageInfo == null || damageInfo.rejected || (Object)(object)_body == (Object)null) { return; } DamageType damageType = damageInfo.damageType.damageType; if ((damageType & 0x10001) != 0) { return; } HealthComponent healthComponent = _body.healthComponent; if ((Object)(object)healthComponent == (Object)null || !healthComponent.alive) { return; } BondrewdUmbraSquad bondrewdUmbraSquad = EnsureSquad(); if ((damageType & 2) == 0 && (Object)(object)damageInfo.attacker != (Object)null && (Object)(object)damageInfo.attacker != (Object)(object)((Component)this).gameObject && (Object)(object)bondrewdUmbraSquad != (Object)null && bondrewdUmbraSquad.SummonedCount > 0 && damageInfo.damage > 0.5f) { float canopyPerUmbraFraction = BondrewdSynergies.GetCanopyPerUmbraFraction(_body); float num = Mathf.Min(BondrewdSynergies.GetCanopyMaxMitigation(_body), canopyPerUmbraFraction * (float)bondrewdUmbraSquad.SummonedCount); damageInfo.damage *= 1f - num; if (_burdenFxCooldown <= 0f && damageInfo.damage > 2f && (Object)(object)BondrewdVfx.VoidImpact != (Object)null) { _burdenFxCooldown = 0.75f; EffectManager.SpawnEffect(BondrewdVfx.VoidImpact, new EffectData { origin = _body.corePosition, scale = 1.6f }, true); } } float num2 = damageInfo.damage * (damageInfo.crit ? 2f : 1f); if ((damageType & 2) == 0) { float armor = _body.armor; float num3 = ((armor >= 0f) ? (100f / (100f + armor)) : (2f - 100f / (100f - armor))); num2 *= num3; } if (num2 >= healthComponent.combinedHealth && TryCheatDeath(healthComponent)) { damageInfo.rejected = true; } } public void OnTakeDamageServer(DamageReport damageReport) { //IL_0027: 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) if (NetworkServer.active && !((Object)(object)damageReport?.victim == (Object)null) && (damageReport.damageInfo.damageType.damageType & 0x10000) == 0 && damageReport.victim.health <= 0f) { TryCheatDeath(damageReport.victim); } } private void Start() { EnsureSquad(); } private void SyncZoaholicBuffCount() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && (Object)(object)_body != (Object)null && (Object)(object)BondrewdBuffs.ZoaholicActive != (Object)null) { _body.SetBuffCount(BondrewdBuffs.ZoaholicActive.buffIndex, ((Object)(object)_squad != (Object)null) ? _squad.SummonedCount : 0); } } public void AddAbyssCharge(float amount) { if (NetworkServer.active && !IsOverdrive && !((Object)(object)_body == (Object)null)) { if (HasOverflowPassive) { amount *= 1.35f; } AbyssCharge = Mathf.Min(100f, AbyssCharge + amount); if (AbyssCharge >= 100f) { StartOverdrive(); } else { MaybeBroadcastState(force: false); } } } public void ExtendOrStartOverdrive() { if (!NetworkServer.active || (Object)(object)_body == (Object)null) { return; } if (!IsOverdrive) { AddAbyssCharge(100f); return; } float blessedFormDuration = BondrewdSynergies.GetBlessedFormDuration(_body); float num = (OverdriveTimer = Mathf.Min(blessedFormDuration, OverdriveTimer + blessedFormDuration * 0.65f)); if ((Object)(object)BondrewdBuffs.BlessedForm != (Object)null) { _body.AddTimedBuff(BondrewdBuffs.BlessedForm, num); } _body.AddTimedBuff(Buffs.TeamWarCry, num); _body.AddTimedBuff(Buffs.CloakSpeed, num); _body.AddTimedBuff(Buffs.FullCrit, num); EnsureSquad()?.GrantBlessedBuffs(num); MaybeBroadcastState(force: true); } private void StartOverdrive() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown if ((Object)(object)_body == (Object)null) { return; } float blessedFormDuration = BondrewdSynergies.GetBlessedFormDuration(_body); IsOverdrive = true; OverdriveTimer = blessedFormDuration; AbyssCharge = 0f; if (HasOverflowPassive) { HealthComponent healthComponent = _body.healthComponent; if (healthComponent != null) { healthComponent.HealFraction(0.1f, default(ProcChainMask)); } } if ((Object)(object)BondrewdBuffs.BlessedForm != (Object)null) { _body.AddTimedBuff(BondrewdBuffs.BlessedForm, blessedFormDuration); } _body.AddTimedBuff(Buffs.TeamWarCry, blessedFormDuration); _body.AddTimedBuff(Buffs.CloakSpeed, blessedFormDuration); _body.AddTimedBuff(Buffs.FullCrit, blessedFormDuration); _body.MarkAllStatsDirty(); ApplyBlessedSkillOverrides(enable: true); EnsureSquad()?.GrantBlessedBuffs(blessedFormDuration); if ((Object)(object)BondrewdVfx.AbyssExplosion != (Object)null) { EffectManager.SpawnEffect(BondrewdVfx.AbyssExplosion, new EffectData { origin = ((Component)this).transform.position, scale = 6f }, true); } BondrewdNetwork.BroadcastVoice(((Component)this).gameObject, 0.88f, 2f, true, "you-are-truly-worthy-of-receiving-the-blessing.mp3", "voice_aubade.mp3", "simply-spectacular.mp3"); BroadcastServerChat("<color=#B366FF>Blessing of the Abyss:</color> Overdrive active!"); MaybeBroadcastState(force: true); } private void EndOverdrive() { IsOverdrive = false; OverdriveTimer = 0f; ApplyBlessedSkillOverrides(enable: false); CharacterBody? body = _body; if (body != null) { body.MarkAllStatsDirty(); } MaybeBroadcastState(force: true); } private void ApplyBlessedSkillOverrides(bool enable) { if ((Object)(object)_body == (Object)null || (Object)(object)_body.skillLocator == (Object)null || enable == _skillOverridesApplied) { return; } SkillLocator skillLocator = _body.skillLocator; GenericSkill[] array = (GenericSkill[])(object)new GenericSkill[3] { skillLocator.primary, skillLocator.secondary, skillLocator.utility }; foreach (GenericSkill val in array) { if ((Object)(object)val == (Object)null) { continue; } (SkillDef, SkillDef)[] blessedSkillPairs = BondrewdSurvivor.BlessedSkillPairs; for (int j = 0; j < blessedSkillPairs.Length; j++) { var (val2, val3) = blessedSkillPairs[j]; if (enable && ((Object)(object)val.skillDef == (Object)(object)val2 || (Object)(object)val.baseSkill == (Object)(object)val2)) { int stock = val.stock; float rechargeStopwatch = val.rechargeStopwatch; val.SetSkillOverride((object)this, val3, (SkillOverridePriority)4); val.stock = Mathf.Clamp(stock, 0, val.maxStock); val.rechargeStopwatch = rechargeStopwatch; break; } if (!enable && ((Object)(object)val.skillDef == (Object)(object)val3 || (Object)(object)val.baseSkill == (Object)(object)val2)) { int stock2 = val.stock; float rechargeStopwatch2 = val.rechargeStopwatch; val.UnsetSkillOverride((object)this, val3, (SkillOverridePriority)4); val.stock = Mathf.Clamp(stock2, 0, val.maxStock); val.rechargeStopwatch = rechargeStopwatch2; break; } } } _skillOverridesApplied = enable; } internal static void GrantUmbraBlessedBuffs(CharacterMaster? umbraMaster, float duration) { //IL_006b: 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) if (!NetworkServer.active || (Object)(object)umbraMaster == (Object)null || duration <= 0.05f) { return; } CharacterBody body = umbraMaster.GetBody(); if (!((Object)(object)body == (Object)null) && !((Object)(object)body.healthComponent == (Object)null) && body.healthComponent.alive) { if ((Object)(object)BondrewdBuffs.BlessedForm != (Object)null) { body.AddTimedBuff(BondrewdBuffs.BlessedForm, duration); } body.healthComponent.HealFraction(0.25f, default(ProcChainMask)); body.AddTimedBuff(Buffs.TeamWarCry, duration); body.AddTimedBuff(Buffs.FullCrit, duration); body.MarkAllStatsDirty(); } } public void ActivateZoaholic(Vector3 anchorPosition, float duration = 30f) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && !((Object)(object)_body == (Object)null)) { EnsureSquad()?.ActivateZoaholic(_body, anchorPosition, duration); } } public void SpawnConvertedUmbraHand(Vector3 spawnPos, string victimName, float duration = 45f) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && !((Object)(object)_body == (Object)null)) { EnsureSquad()?.SpawnConvertedUmbraHand(_body, spawnPos, victimName, duration); } } internal void SyncAllUmbraInventories() { EnsureSquad()?.SyncAllInventories(); } internal static void DestroyMaster(CharacterMaster? master) { if (!((Object)(object)master == (Object)null)) { GameObject bodyObject = master.GetBodyObject(); if ((Object)(object)bodyObject != (Object)null) { Object.Destroy((Object)(object)bodyObject); } Object.Destroy((Object)(object)((Component)master).gameObject); } } private void OnDestroy() { if ((Object)(object)_subscribedInventory != (Object)null) { _subscribedInventory.onInventoryChanged -= SyncAllUmbraInventories; _subscribedInventory = null; } BondrewdHudPanel.HideForBody(((Component)this).gameObject); ApplyBlessedSkillOverrides(enable: false); _squad?.DetachController(this); } public bool TryCheatDeath(HealthComponent hc) { //IL_002e: 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_003e: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown if (!NetworkServer.active || (Object)(object)_body == (Object)null) { return false; } BondrewdUmbraSquad bondrewdUmbraSquad = EnsureSquad(); if ((Object)(object)bondrewdUmbraSquad != (Object)null && bondrewdUmbraSquad.TryConsumeNearestForTransfer(((Component)this).transform.position, out var transferPos)) { CompleteUmbraTransfer(hc, transferPos, null); return true; } if (BondrewdConfig.MultiplayerSharedZoaholic && TryConsumeAlliedUmbraForTransfer(((Component)this).transform.position, out Vector3 transferPos2, out string donorName)) { CompleteUmbraTransfer(hc, transferPos2, donorName); return true; } if (CartridgeSaveCooldown <= 0f && AbyssCharge >= BondrewdConfig.CartridgeSaveThreshold) { AbyssCharge = 0f; CartridgeSaveCooldown = BondrewdSynergies.GetCartridgeSaveCooldown(_body); hc.Networkhealth = Mathf.Max(1f, hc.fullHealth * 0.25f); _body.AddTimedBuff(Buffs.HiddenInvincibility, 2f); if ((Object)(object)BondrewdVfx.AbyssExplosion != (Object)null) { EffectManager.SpawnEffect(BondrewdVfx.AbyssExplosion, new EffectData { origin = ((Component)this).transform.position, scale = 8f }, true); } EmitServerSound("Play_railgunner_shift_alt_explo", ((Component)this).gameObject); BondrewdNetwork.BroadcastVoice(((Component)this).gameObject, 0.92f, 1.5f, true, "doesn-t-sound-so-bad-does-it.mp3", "voice_most_regrettable.mp3", "how-about-that.mp3"); BroadcastServerChat("<color=#FF66CC>Cartridge Expended:</color> Lethal Curse absorbed!"); MaybeBroadcastState(force: true); return true; } return false; } private bool TryConsumeAlliedUmbraForTransfer(Vector3 originPos, out Vector3 transferPos, out string donorName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) transferPos = Vector3.zero; donorName = string.Empty; if ((Object)(object)_body == (Object)null || (Object)(object)BondrewdSurvivor.BodyPrefab == (Object)null) { return false; } TeamIndex team = (TeamIndex)((!((Object)(object)_body.teamComponent != (Object)null)) ? 1 : ((int)_body.teamComponent.teamIndex)); CharacterMaster master = _body.master; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (BondrewdUmbraSquad.IsAlliedBondrewdPcmc(instance, master, team, out CharacterMaster master2)) { BondrewdUmbraSquad component = ((Component)master2).GetComponent<BondrewdUmbraSquad>(); if ((Object)(object)component != (Object)null && component.TryConsumeNearestForTransfer(originPos, out transferPos)) { donorName = BondrewdUmbraSquad.GetPlayerDisplayName(instance); return true; } } } return false; } private void CompleteUmbraTransfer(HealthComponent hc, Vector3 bestPos, string? alliedDonorName) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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_0054: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (!((Object)(object)_body == (Object)null)) { Vector3 val = FindSafePosition(bestPos, _body, bestPos); hc.Networkhealth = Mathf.Max(1f, hc.fullHealth * 0.6f); _body.AddTimedBuff(Buffs.HiddenInvincibility, 3f); TeleportHelper.TeleportBody(_body, val, true); if ((Object)(object)BondrewdVfx.AbyssExplosion != (Object)null) { EffectManager.SpawnEffect(BondrewdVfx.AbyssExplosion, new EffectData { origin = val, scale = 10f }, true); } EmitServerSound("Play_voidman_R_pop", ((Component)this).gameObject); BondrewdNetwork.BroadcastVoice(((Component)this).gameObject, 0.92f, 1.5f, true, "how-about-that.mp3", "doesn-t-sound-so-bad-does-it.mp3", "voice_commotion.mp3", "voice_most_regrettable.mp3"); if (!string.IsNullOrEmpty(alliedDonorName)) { CharacterMaster master = _body.master; string playerDisplayName = BondrewdUmbraSquad.GetPlayerDisplayName((master != null) ? master.playerCharacterMasterController : null); BroadcastServerChat("<color=#B366FF>Zoaholic:</color> " + playerDisplayName + "'s consciousness transferred into " + alliedDonorName + "'s Umbrae!"); } else { BroadcastServerChat("<color=#B366FF>Zoaholic:</color> Consciousness transferred to an Umbrae!"); } MaybeBroadcastState(force: true); } } } public static class BondrewdCombatHooks { private static int _killCounter; internal static void Init() { GlobalEventManager.onServerDamageDealt += OnServerDamageDealt; GlobalEventManager.onCharacterDeathServer += OnCharacterDeathGlobal; TeleporterInteraction.onTeleporterBeginChargingGlobal += OnTeleporterBeginCharging; } private static void OnTeleporterBeginCharging(TeleporterInteraction _) { foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances != (Object)null && readOnlyInstances.hasEffectiveAuthority && (Object)(object)((Component)readOnlyInstances).GetComponent<BondrewdController>() != (Object)null) { BondrewdAudio.PlayCombatQuip(((Component)readOnlyInstances).gameObject, 0.8f, "voice_aubade.mp3", "voice_show_it_to_me.mp3"); break; } } } private static void OnCharacterDeathGlobal(DamageReport report) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Invalid comparison between Unknown and I4 //IL_0076: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)report?.attackerBody == (Object)null) { return; } BondrewdController component = ((Component)report.attackerBody).GetComponent<BondrewdController>(); if (!((Object)(object)component == (Object)null)) { if (NetworkServer.active && component.HasContagionPassive && (Object)(object)report.victimBody != (Object)null && (int)report.victimTeamIndex != 1 && Util.CheckRoll(BondrewdSynergies.GetContagionProcChance(report.attackerBody) * 100f, report.attackerMaster)) { component.SpawnConvertedUmbraHand(report.victimBody.footPosition, report.victimBody.GetDisplayName()); } _killCounter++; if (((Object)(object)report.victimBody != (Object)null && report.victimBody.isBoss) || _killCounter % 12 == 0) { BondrewdNetwork.BroadcastVoice(((Component)report.attackerBody).gameObject, 0.78f, 8f, false, "simply-spectacular.mp3", "voice_high_spirits.mp3", "voice_keen_insight.mp3"); } } } private static void OnServerDamageDealt(DamageReport report) { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Invalid comparison between Unknown and I4 //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Invalid comparison between Unknown and I4 //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Invalid comparison between Unknown and I4 //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Invalid comparison between Unknown and I4 //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = report?.attackerBody; DamageInfo val2 = report?.damageInfo; if ((Object)(object)val == (Object)null || val2 == null) { return; } BondrewdController component = ((Component)val).GetComponent<BondrewdController>(); if (val2.procCoefficient > 0f) { if ((Object)(object)component != (Object)null) { float chargeGainMultiplier = BondrewdSynergies.GetChargeGainMultiplier(val); float amount = Mathf.Min(9f, 3.2f * val2.procCoefficient * chargeGainMultiplier); component.AddAbyssCharge(amount); } else if (val.baseNameToken == "BONDREWD_UMBRA_NAME") { CharacterMaster master = val.master; object obj; if (master == null) { obj = null; } else { MinionOwnership minionOwnership = master.minionOwnership; if (minionOwnership == null) { obj = null; } else { CharacterMaster ownerMaster = minionOwnership.ownerMaster; obj = ((ownerMaster != null) ? ownerMaster.GetBody() : null); } } CharacterBody val3 = (CharacterBody)obj; BondrewdController bondrewdController = (((Object)(object)val3 != (Object)null) ? ((Component)val3).GetComponent<BondrewdController>() : null); if ((Object)(object)bondrewdController != (Object)null) { float chargeGainMultiplier2 = BondrewdSynergies.GetChargeGainMultiplier(val3); float num = Mathf.Min(9f, 3.2f * val2.procCoefficient * chargeGainMultiplier2); bondrewdController.AddAbyssCharge(num * 0.35f); } } } CharacterBody victimBody = report.victimBody; if ((Object)(object)victimBody == (Object)null) { return; } DamageTypeCombo damageType = val2.damageType; DamageSource damageSource = damageType.damageSource; if ((Object)(object)component != (Object)null && (int)damageSource == 2 && (Object)(object)victimBody.healthComponent != (Object)null && victimBody.healthComponent.alive) { component.FocusUmbrasOnTarget(((Component)victimBody).gameObject); } if ((!((Object)(object)component != (Object)null) && !(val.baseNameToken == "BONDREWD_UMBRA_NAME")) || (Object)(object)BondrewdBuffs.ShakerNeedle == (Object)null) { return; } SerializableEntityStateType activationState; int num2; if ((int)damageSource == 1 && (damageType.damageType & 2) == 0 && (Object)(object)val.skillLocator != (Object)null && (Object)(object)val.skillLocator.primary != (Object)null) { activationState = val.skillLocator.primary.activationState; num2 = ((((SerializableEntityStateType)(ref activationState)).stateType == typeof(Shaker)) ? 1 : 0); } else { num2 = 0; } bool flag = (byte)num2 != 0; if ((int)damageSource == 1 && (damageType.damageType & 2) != 0 && (Object)(object)BondrewdBuffs.Unraveled != (Object)null && (Object)(object)val.skillLocator != (Object)null && (Object)(object)val.skillLocator.primary != (Object)null) { activationState = val.skillLocator.primary.activationState; if (((SerializableEntityStateType)(ref activationState)).stateType == typeof(Sparagmos)) { bool flag2 = (Object)(object)BondrewdBuffs.BlessedForm != (Object)null && val.HasBuff(BondrewdBuffs.BlessedForm); int num3 = Mathf.Max(1, Mathf.RoundToInt((flag2 ? 2f : 1f) * val2.procCoefficient)); int buffCount = victimBody.GetBuffCount(BondrewdBuffs.Unraveled); int num4 = Mathf.Min(BondrewdSynergies.GetMaxUnravelStacks(val), buffCount + num3); if (num4 > buffCount) { victimBody.SetBuffCount(BondrewdBuffs.Unraveled.buffIndex, num4); } return; } } if (flag) { int maxAscentCurseStacks = BondrewdSynergies.GetMaxAscentCurseStacks(val); victimBody.AddTimedBuff(BondrewdBuffs.ShakerNeedle, 8f, maxAscentCurseStacks); } else if ((int)damageSource == 2) { int buffCount2 = victimBody.GetBuffCount(BondrewdBuffs.ShakerNeedle); if (buffCount2 > 0) { victimBody.SetBuffCount(BondrewdBuffs.ShakerNeedle.buffIndex, 0); DetonateShakerNeedles(val, victimBody, buffCount2); } } } private static void DetonateShakerNeedles(CharacterBody attacker, CharacterBody victim, int stacks) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_004e: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_009f: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Vector3 corePosition = victim.corePosition; if ((Object)(object)BondrewdVfx.ShakerDetonateVfx != (Object)null) { EffectManager.SpawnEffect(BondrewdVfx.ShakerDetonateVfx, new EffectData { origin = corePosition, scale = Mathf.Clamp(2.5f + (float)stacks * 0.4f, 2.5f, 7f) }, true); } BondrewdController.EmitServerSound("Play_voidman_m2_explode", ((Component)victim).gameObject); new BlastAttack { attacker = ((Component)attacker).gameObject, inflictor = ((Component)attacker).gameObject, teamIndex = (TeamIndex)((!((Object)(object)attacker.teamComponent != (Object)null)) ? 1 : ((int)attacker.teamComponent.teamIndex)), position = corePosition, radius = 6f, falloffModel = (FalloffModel)0, baseDamage = (float)stacks * BondrewdSynergies.GetNeedleDetonationMultiplier(attacker) * attacker.damage, damageType = (DamageTypeCombo.op_Implicit((DamageType)0) | DamageTypeCombo.op_Implicit((DamageSource)0)), crit = Util.CheckRoll(attacker.crit, attacker.master), procCoefficient = 0.4f }.Fire(); } } [HarmonyPatch(typeof(PingerController), "SetCurrentPing")] internal static class BondrewdPingHooks { [HarmonyPostfix] private static void Postfix(PingerController __instance, PingInfo __0) { //IL_0010: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown if (!NetworkServer.active || (Object)(object)__instance == (Object)null || !__0.active || (Object)(object)__0.targetNetworkIdentity == (Object)null) { return; }