using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using ZeroGravityExtraction.Configuration; using ZeroGravityExtraction.Patches; using ZeroGravityExtraction.Services; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("Vippy")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+52470c0312c0bc1509489f456cedd38cd8bfc2b8")] [assembly: AssemblyProduct("ZeroGravityExtraction")] [assembly: AssemblyTitle("ZeroGravityExtraction")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [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 ZeroGravityExtraction { internal static class BuildInfo { public const string Version = "1.1.1"; } [BepInPlugin("Vippy.ZeroGravityExtraction", "ZeroGravityExtraction", "1.1.1")] public class ZeroGravityExtraction : BaseUnityPlugin { internal static ZeroGravityExtraction Instance { get; private set; } internal static ManualLogSource Logger => Instance.BaseLogger; private ManualLogSource BaseLogger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0054: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; PluginConfig.Init(((BaseUnityPlugin)this).Config); if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded."); } internal static void LogInfo(string msg) { if (PluginConfig.LoggingLevel.Value >= VerbosityLevel.Debug) { Logger.LogInfo((object)msg); } } internal static void LogVerbose(string msg) { if (PluginConfig.LoggingLevel.Value >= VerbosityLevel.Verbose) { Logger.LogDebug((object)msg); } } } } namespace ZeroGravityExtraction.Services { public class AnchorLock : MonoBehaviour { private Rigidbody? _rb; private void Awake() { _rb = ((Component)this).GetComponent(); } private void FixedUpdate() { Pin(); } private void LateUpdate() { Pin(); } private void Pin() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = true; _rb.constraints = (RigidbodyConstraints)126; } ((Component)this).transform.localPosition = AnchorSettings.GrabOffset; ((Component)this).transform.localRotation = Quaternion.identity; ((Component)this).transform.localScale = Vector3.one * 0.15f; } } internal static class AnchorSettings { public static readonly Vector3 GrabOffset = new Vector3(0f, 1.55f, -1.5f); public const float Size = 0.15f; public const float PokeHeight = 3f; public const float ZoneRadius = 2.5f; public const float ZoneHeight = 6f; } public class PadAnchor : MonoBehaviour { public bool ZeroGravityOn; public bool ButtonMode; public int PadViewId; public ExtractionPoint? Point; private const float PokeCooldown = 0.5f; private StaticGrabObject? _staticGrab; private bool _wasGrabbed; private bool _wasPoked; private float _pokeCooldownTimer; private void Awake() { _staticGrab = ((Component)this).GetComponent(); } private void Update() { if (!ButtonMode) { _wasGrabbed = false; _wasPoked = false; return; } if ((Object)(object)_staticGrab != (Object)null) { bool flag = (Object)(object)PhysGrabber.instance != (Object)null && (Object)(object)PhysGrabber.instance.grabbedStaticGrabObject == (Object)(object)_staticGrab; if (flag && !_wasGrabbed) { GrabToggle(); } _wasGrabbed = flag; } if (SemiFunc.IsMasterClientOrSingleplayer() && PluginConfig.NonHostButton.Value) { PokeCheck(); } } private void PokeCheck() { if (_pokeCooldownTimer > 0f) { _pokeCooldownTimer -= Time.deltaTime; } bool flag = SomethingPoking(); if (flag && !_wasPoked && _pokeCooldownTimer <= 0f) { ZeroGravityOn = !ZeroGravityOn; _pokeCooldownTimer = 0.5f; ZeroGravityExtraction.LogInfo("Pad zero-gravity toggled " + (ZeroGravityOn ? "on" : "off") + " (poked)."); ZeroGravityPadService.Instance?.PlayToggleSound(ZeroGravityOn, Point); } _wasPoked = flag; } private bool SomethingPoking() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) float num = 0.15f; Vector3 val = ((Component)this).transform.position + Vector3.up * 1.5f; Vector3 val2 = ((Component)this).transform.position - Vector3.up * 1.5f; Collider[] array = Physics.OverlapCapsule(val, val2, num, -1, (QueryTriggerInteraction)2); foreach (Collider val3 in array) { if (!((Component)val3).transform.IsChildOf(((Component)this).transform)) { Rigidbody attachedRigidbody = val3.attachedRigidbody; if ((Object)(object)attachedRigidbody != (Object)null && (Object)(object)((Component)attachedRigidbody).GetComponentInParent() != (Object)null) { return true; } } } return false; } private void GrabToggle() { if (SemiFunc.IsMasterClientOrSingleplayer()) { ZeroGravityOn = !ZeroGravityOn; ZeroGravityExtraction.LogInfo("Pad zero-gravity toggled " + (ZeroGravityOn ? "on" : "off") + "."); ZeroGravityPadService.Instance?.PlayToggleSound(ZeroGravityOn, Point); } else if ((Object)(object)PunManager.instance != (Object)null && PadViewId != 0) { PunManager.instance.photonView.RPC("ZGE_TogglePad", (RpcTarget)2, new object[1] { PadViewId }); } } } public class ZeroGravityNet : MonoBehaviourPunCallbacks { public override void OnJoinedRoom() { ZeroGravityPadService.HostHasMod = false; } public override void OnLeftRoom() { ZeroGravityPadService.HostHasMod = false; } public override void OnPlayerEnteredRoom(Player newPlayer) { if (SemiFunc.IsMasterClientOrSingleplayer()) { ((MonoBehaviourPun)this).photonView.RPC("ZGE_HostPresent", newPlayer, Array.Empty()); } } [PunRPC] public void ZGE_HostPresent(PhotonMessageInfo info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (info.Sender != null && info.Sender.IsMasterClient) { ZeroGravityPadService.HostHasMod = true; } } [PunRPC] public void ZGE_TogglePad(int padViewId, PhotonMessageInfo info = default(PhotonMessageInfo)) { if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } PhotonView val = PhotonView.Find(padViewId); if (!((Object)(object)val == (Object)null)) { ExtractionPoint component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { ZeroGravityPadService.Instance?.TogglePadByPoint(component); } } } } public class ZeroGravityPadService : MonoBehaviour { private readonly struct FloatTarget { public readonly int Key; public readonly int ViewId; public readonly Vector3 Position; public readonly PhysGrabObject? PhysObject; public readonly PlayerAvatar? Player; public FloatTarget(int key, int viewId, Vector3 position, PhysGrabObject? physObject, PlayerAvatar? player) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Key = key; ViewId = viewId; Position = position; PhysObject = physObject; Player = player; } } private const float AffectTime = 1.5f; private const float TickInterval = 0.5f; internal static ZeroGravityPadService? Instance; internal static bool HostHasMod; private GameObject? _affectPrefab; private string? _orbResourcePath; private bool _resolveFailed; private int _resolveAttempts; private bool _anchorsFailed; private readonly HashSet _seen = new HashSet(); private readonly List _stale = new List(); private readonly List _targets = new List(); private readonly Dictionary _anchors = new Dictionary(); private readonly Dictionary _activeAffects = new Dictionary(); private const float NetworkPulseInterval = 2.5f; private float _nextPulse; private readonly HashSet _pulsed = new HashSet(); private readonly List _viewIds = new List(); private readonly List _times = new List(); private const float ToggleVolume = 1f; private const float ToggleFalloff = 3f; private Sound? _onSound; private Sound? _offSound; private bool _soundsResolved; private void OnEnable() { Instance = this; ((MonoBehaviour)this).StartCoroutine(Loop()); } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } RoundDirectorStartPatch.ServiceGone(this); } internal void ResetLevelState() { _anchors.Clear(); _activeAffects.Clear(); _pulsed.Clear(); _nextPulse = 0f; _anchorsFailed = false; } private IEnumerator Loop() { WaitForSeconds wait = new WaitForSeconds(0.5f); while (true) { yield return wait; Tick(); } } private void Tick() { if (!PluginConfig.Enabled.Value || (Object)(object)RoundDirector.instance == (Object)null) { return; } bool num = SemiFunc.IsMasterClientOrSingleplayer(); if (num || HostHasMod) { EnsureAnchors(); } if (!num || _resolveFailed || ((Object)(object)_affectPrefab == (Object)null && !TryResolveEffect())) { return; } _targets.Clear(); _seen.Clear(); if (PluginConfig.VanillaPlus.Value) { CollectDroneZoneTargets(); } else { CollectButtonToggledTargets(); } if (SemiFunc.IsMultiplayer()) { NetworkPulse(); return; } foreach (FloatTarget target in _targets) { ApplyFloat(target); } PruneLeftBehind(); } private void CollectDroneZoneTargets() { foreach (GameObject extractionPoint in RoundDirector.instance.extractionPointList) { ExtractionPoint val = ActivePoint(extractionPoint); if ((Object)(object)val != (Object)null && IsPadPowered(val)) { FloatColumn(val); } } EncourageDronesToGrabAnchors(); } private void CollectButtonToggledTargets() { foreach (GameObject extractionPoint in RoundDirector.instance.extractionPointList) { ExtractionPoint val = ActivePoint(extractionPoint); if (!((Object)(object)val == (Object)null) && _anchors.TryGetValue(((Object)val).GetInstanceID(), out GameObject value) && !((Object)(object)value == (Object)null)) { PadAnchor component = value.GetComponent(); if ((Object)(object)component != (Object)null && component.ZeroGravityOn) { FloatPadVolume(val); } } } } private static ExtractionPoint? ActivePoint(GameObject pointObject) { if ((Object)(object)pointObject == (Object)null) { return null; } ExtractionPoint component = pointObject.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component.roomVolume == (Object)null || !component.roomVolume.activeInHierarchy) { return null; } return component; } internal void TogglePadByPoint(ExtractionPoint point) { if (_anchors.TryGetValue(((Object)point).GetInstanceID(), out GameObject value) && !((Object)(object)value == (Object)null)) { PadAnchor component = value.GetComponent(); if (!((Object)(object)component == (Object)null)) { component.ZeroGravityOn = !component.ZeroGravityOn; ZeroGravityExtraction.LogInfo("Pad zero-gravity toggled " + (component.ZeroGravityOn ? "on" : "off") + " (remote)."); PlayToggleSound(component.ZeroGravityOn, point); } } } internal void PlayToggleSound(bool on, ExtractionPoint point) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) ResolveToggleSounds(); Vector3 val = AnchorPosition(point); Sound val2 = (on ? _onSound : _offSound); if (val2 != null) { val2.Play(val, 1f, 3f, 1f, 1f); } else if ((Object)(object)point != (Object)null) { Sound obj = (on ? point.soundButton : point.soundCancel); if (obj != null) { obj.Play(val, 1f, 1f, 1f, 1f); } } } private Vector3 AnchorPosition(ExtractionPoint point) { //IL_0042: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)point != (Object)null && _anchors.TryGetValue(((Object)point).GetInstanceID(), out GameObject value) && (Object)(object)value != (Object)null) { return value.transform.position; } if ((Object)(object)point != (Object)null) { return ((Component)point).transform.position; } if (!((Object)(object)Camera.main != (Object)null)) { return Vector3.zero; } return ((Component)Camera.main).transform.position; } private void ResolveToggleSounds() { if (_soundsResolved || (Object)(object)StatsManager.instance == (Object)null) { return; } foreach (Item value in StatsManager.instance.itemDictionary.Values) { GameObject val = ((!((Object)(object)value != (Object)null)) ? null : ((PrefabRef)(object)value.prefab)?.Prefab); ItemDrone val2 = (((Object)(object)val != (Object)null) ? val.GetComponentInChildren(true) : null); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).GetComponentInChildren(true) == (Object)null)) { ItemDroneSounds itemDroneSounds = val2.itemDroneSounds; if (!((Object)(object)itemDroneSounds == (Object)null)) { _onSound = itemDroneSounds.DroneStart; _offSound = itemDroneSounds.DroneEnd; _soundsResolved = true; break; } } } } private void EnsureAnchors() { foreach (GameObject extractionPoint in RoundDirector.instance.extractionPointList) { ExtractionPoint val = ActivePoint(extractionPoint); if ((Object)(object)val != (Object)null) { EnsureAnchor(val); } } } private static void EncourageDronesToGrabAnchors() { foreach (ItemDrone activeDrone in ItemDrone.activeDrones) { if ((Object)(object)activeDrone != (Object)null && activeDrone.itemActivated && (Object)(object)((Component)activeDrone).GetComponent() != (Object)null) { activeDrone.targetNonValuables = true; } } } private void EnsureAnchor(ExtractionPoint point) { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) if (_anchorsFailed) { return; } int instanceID = ((Object)point).GetInstanceID(); bool flag = !PluginConfig.VanillaPlus.Value; if (_anchors.TryGetValue(instanceID, out GameObject value) && (Object)(object)value != (Object)null) { PadAnchor component = value.GetComponent(); if ((Object)(object)component != (Object)null && component.ButtonMode == flag) { return; } Object.Destroy((Object)(object)value); _anchors.Remove(instanceID); } try { Transform val = (((Object)(object)point.platform != (Object)null) ? point.platform : ((Component)point).transform); GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val2).name = "ZeroGravityExtraction_Anchor"; val2.tag = "Phys Grab Object"; val2.layer = LayerMask.NameToLayer("PhysGrabObject"); val2.transform.SetParent(val, false); val2.transform.localPosition = AnchorSettings.GrabOffset; val2.transform.localRotation = Quaternion.identity; val2.GetComponent().enabled = false; val2.AddComponent(); if (flag) { StaticGrabObject obj = val2.AddComponent(); obj.colliderTransform = val2.transform; obj.uiPosition = val2.transform; obj.hoverText = "Zero Gravity"; } else { val2.AddComponent(); val2.AddComponent(); val2.AddComponent(); } PadAnchor padAnchor = val2.AddComponent(); padAnchor.ButtonMode = flag; padAnchor.Point = point; padAnchor.PadViewId = (((Object)(object)point.photonView != (Object)null) ? point.photonView.ViewID : 0); val2.AddComponent(); _anchors[instanceID] = val2; ZeroGravityExtraction.LogVerbose(string.Format("Anchor placed on pad {0} ({1}).", instanceID, flag ? "button" : "drone")); } catch (Exception ex) { _anchorsFailed = true; ZeroGravityExtraction.Logger.LogWarning((object)("Anchor creation failed: " + ex.Message)); } } private void FloatColumn(ExtractionPoint point) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0059: 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_0078: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)point.platform != (Object)null) ? point.platform : ((Component)point).transform); float num = 6f; Vector3 val2 = val.TransformPoint(new Vector3(AnchorSettings.GrabOffset.x, 0f, AnchorSettings.GrabOffset.z)) + val.up * (num * 0.5f); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(2.5f, num * 0.5f, 2.5f); Collider[] array = Physics.OverlapBox(val2, val3, val.rotation, -1, (QueryTriggerInteraction)2); foreach (Collider hit in array) { Consider(hit); } } private void FloatPadVolume(ExtractionPoint point) { //IL_0013: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Collider[] componentsInChildren = point.roomVolume.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { Bounds bounds = componentsInChildren[i].bounds; Collider[] array = Physics.OverlapBox(((Bounds)(ref bounds)).center, ((Bounds)(ref bounds)).extents, Quaternion.identity, -1, (QueryTriggerInteraction)2); foreach (Collider hit in array) { Consider(hit); } } } private bool IsPadPowered(ExtractionPoint point) { if (!_anchors.TryGetValue(((Object)point).GetInstanceID(), out GameObject value) || (Object)(object)value == (Object)null) { return false; } PhysGrabObject component = value.GetComponent(); if ((Object)(object)component == (Object)null) { return false; } foreach (ItemDrone activeDrone in ItemDrone.activeDrones) { if (!((Object)(object)activeDrone == (Object)null) && activeDrone.itemActivated && !((Object)(object)((Component)activeDrone).GetComponent() == (Object)null)) { ItemBattery component2 = ((Component)activeDrone).GetComponent(); if (!((Object)(object)component2 == (Object)null) && !(component2.batteryLife <= 0f) && activeDrone.magnetActive && (Object)(object)activeDrone.magnetTargetPhysGrabObject == (Object)(object)component) { return true; } } } return false; } private void Consider(Collider hit) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar componentInParent = ((Component)hit).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { if (PluginConfig.FloatPlayers.Value) { Register(((Object)componentInParent).GetInstanceID(), ViewIdOf(componentInParent.photonView), ((Component)componentInParent).transform.position, componentInParent.tumble.physGrabObject, componentInParent); } return; } EnemyParent componentInParent2 = ((Component)hit).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { if (PluginConfig.FloatEnemies.Value) { Register(((Object)componentInParent2).GetInstanceID(), ViewIdOf(((MonoBehaviourPun)componentInParent2).photonView), ((Component)componentInParent2).transform.position, ((Component)componentInParent2).GetComponentInChildren(), null); } return; } PhysGrabObject componentInParent3 = ((Component)hit).GetComponentInParent(); if ((Object)(object)componentInParent3 != (Object)null && PhysObjectAllowed(componentInParent3)) { Register(((Object)componentInParent3).GetInstanceID(), ViewIdOf(componentInParent3.photonView), ((Component)componentInParent3).transform.position, componentInParent3, null); } } private static int ViewIdOf(PhotonView? view) { if (!((Object)(object)view != (Object)null)) { return 0; } return view.ViewID; } private static bool PhysObjectAllowed(PhysGrabObject physObject) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)physObject).GetComponent() != (Object)null) { return PluginConfig.FloatValuables.Value; } ItemAttributes component = ((Component)physObject).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.item != (Object)null && IsWeapon(component.item.itemType)) { return PluginConfig.FloatWeapons.Value; } return PluginConfig.FloatItems.Value; } private static bool IsWeapon(itemType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 if ((int)type != 9 && (int)type != 7 && (int)type != 15 && (int)type != 6) { return (int)type == 11; } return true; } private void Register(int key, int viewId, Vector3 position, PhysGrabObject? physObject, PlayerAvatar? player) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (_seen.Add(key)) { _targets.Add(new FloatTarget(key, viewId, position, physObject, player)); } } private void NetworkPulse() { if (_targets.Count == 0) { _pulsed.Clear(); return; } bool flag = Time.time >= _nextPulse; _viewIds.Clear(); _times.Clear(); foreach (FloatTarget target in _targets) { if (target.ViewId != 0 && (flag || !_pulsed.Contains(target.Key))) { _viewIds.Add(target.ViewId); _times.Add(1.5f); } } if (_viewIds.Count > 0) { FireOrb(_viewIds.ToArray(), _times.ToArray()); } if (flag) { _nextPulse = Time.time + 2.5f; _pulsed.Clear(); } foreach (FloatTarget target2 in _targets) { _pulsed.Add(target2.Key); } } private void FireOrb(int[] viewIds, float[] times) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(_orbResourcePath)) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, -1000f, 0f); GameObject val2 = PhotonNetwork.Instantiate(_orbResourcePath, val, Quaternion.identity, (byte)0, (object[])null); SlowProjectile component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } SemiAreaOfEffect componentInChildren = val2.GetComponentInChildren(true); if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren.photonView == (Object)null) { PhotonNetwork.Destroy(val2); return; } componentInChildren.photonView.RPC("CreateAffectsRPC", (RpcTarget)0, new object[4] { viewIds, times, val, Vector3.up }); ((MonoBehaviour)this).StartCoroutine(DestroyOrbLater(val2)); } } private IEnumerator DestroyOrbLater(GameObject orb) { yield return (object)new WaitForSeconds(1f); if ((Object)(object)orb != (Object)null) { PhotonNetwork.Destroy(orb); } } private void ApplyFloat(FloatTarget target) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_005c: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target.PhysObject == (Object)null) { return; } if (_activeAffects.TryGetValue(target.Key, out SemiAffect value) && (Object)(object)value != (Object)null) { value.timer = value.timerTotal; return; } SemiAffect component = Object.Instantiate(_affectPrefab, target.Position, Quaternion.identity).GetComponent(); component.direction = Vector3.up; component.positionOfOriginalAreaOfEffect = target.Position; component.SetupSingleplayer(((Component)target.PhysObject).transform, target.PhysObject, 1.5f, target.Player); ParticleSystem[] componentsInChildren = ((Component)component).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { MainModule main = componentsInChildren[i].main; ((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)0; } _activeAffects[target.Key] = component; } private void PruneLeftBehind() { if (_activeAffects.Count == 0) { return; } _stale.Clear(); foreach (KeyValuePair activeAffect in _activeAffects) { if (!_seen.Contains(activeAffect.Key)) { if ((Object)(object)activeAffect.Value != (Object)null) { Object.Destroy((Object)(object)((Component)activeAffect.Value).gameObject); } _stale.Add(activeAffect.Key); } } foreach (int item in _stale) { _activeAffects.Remove(item); } } private bool TryResolveEffect() { StatsManager instance = StatsManager.instance; if ((Object)(object)instance == (Object)null || instance.itemDictionary.Count == 0) { return false; } bool flag = false; int num = 0; foreach (Item value in instance.itemDictionary.Values) { GameObject val = ((!((Object)(object)value != (Object)null)) ? null : ((PrefabRef)(object)value.prefab)?.Prefab); ItemStaffZeroGravity val2 = (((Object)(object)val != (Object)null) ? val.GetComponentInChildren(true) : null); if ((Object)(object)val2 == (Object)null) { continue; } flag = true; PrefabRef projectilePrefab = val2.projectilePrefab; if (projectilePrefab == null || (Object)(object)((PrefabRef)(object)projectilePrefab).Bundle != (Object)null || !((PrefabRef)(object)projectilePrefab).IsValid()) { num++; continue; } GameObject prefab = ((PrefabRef)(object)projectilePrefab).Prefab; GameObject val3 = ((PrefabRef)(object)(((Object)(object)prefab != (Object)null) ? prefab.GetComponentInChildren(true) : null)?.semiAffectPrefab)?.Prefab; if ((Object)(object)val3 == (Object)null || (Object)(object)val3.GetComponentInChildren(true) == (Object)null) { continue; } _affectPrefab = val3; _orbResourcePath = ((PrefabRef)(object)projectilePrefab).ResourcePath; if (num > 0) { ZeroGravityExtraction.LogInfo($"Resolved zero-gravity effect from '{((Object)value).name}' (skipped {num} non-Resources look-alike staff(s))."); } else { ZeroGravityExtraction.LogInfo("Resolved zero-gravity effect from '" + ((Object)value).name + "'."); } return true; } if (++_resolveAttempts >= 5) { _resolveFailed = true; ZeroGravityExtraction.Logger.LogWarning((object)$"Zero-gravity staff effect not found (scanned {instance.itemDictionary.Count} items, staff present: {flag}, non-Resources look-alikes skipped: {num}); floating disabled."); } return false; } } } namespace ZeroGravityExtraction.Patches { [HarmonyPatch(typeof(PunManager), "Awake")] internal class PunManagerPatch { [HarmonyPostfix] public static void Postfix(PunManager __instance) { if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } } } [HarmonyPatch(typeof(RoundDirector), "Start")] internal class RoundDirectorStartPatch { private static ZeroGravityPadService? _service; [HarmonyPostfix] public static void Postfix() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if ((Object)(object)_service != (Object)null) { _service.ResetLevelState(); return; } GameObject val = new GameObject("ZeroGravityExtraction_Service"); _service = val.AddComponent(); Object.DontDestroyOnLoad((Object)val); ZeroGravityExtraction.LogVerbose("Float service created."); } internal static void ServiceGone(ZeroGravityPadService service) { if ((Object)(object)_service == (Object)(object)service) { _service = null; } } } } namespace ZeroGravityExtraction.Configuration { public enum VerbosityLevel { Off, Debug, Verbose } internal static class PluginConfig { public static ConfigEntry Enabled; public static ConfigEntry VanillaPlus; public static ConfigEntry NonHostButton; public static ConfigEntry FloatValuables; public static ConfigEntry FloatItems; public static ConfigEntry FloatWeapons; public static ConfigEntry FloatPlayers; public static ConfigEntry FloatEnemies; public static ConfigEntry LoggingLevel; public static void Init(ConfigFile config) { Enabled = config.Bind("General", "Enabled", true, "Master switch."); VanillaPlus = config.Bind("General", "Vanilla+", false, "Off: the whole active pad is zero-gravity, toggled at the spot. On: only a drone latched onto the pad floats a zone there."); NonHostButton = config.Bind("General", "Non-host button", true, "Flip a pad by touching the spot with a dead Semibot head. Works for players without the mod. Turn it off to keep toggling to modded players grabbing the spot."); FloatValuables = config.Bind("What floats", "Valuables", true, "Float the loot you're extracting."); FloatItems = config.Bind("What floats", "Items", true, "Float tools, carts and other non-weapon props."); FloatWeapons = config.Bind("What floats", "Weapons", true, "Float guns, melee weapons, grenades, mines and launchers."); FloatPlayers = config.Bind("What floats", "Players", true, "Float Semibots in the pad."); FloatEnemies = config.Bind("What floats", "Enemies", true, "Float enemies in the pad."); LoggingLevel = config.Bind("General", "LogLevel", VerbosityLevel.Off, "Off: errors and one-time setup only. Debug: each effect. Verbose: full trace."); } } }