Bonelab mods are targeting MelonLoader version 0.5.7. Newer versions will not work!, so double-check your MelonLoader version if you're having issues.
Decompiled source of SwipezGamemodeLib v1.3.1
Mods/SwipezGamemodeLib.dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BoneLib; using BoneLib.Nullables; using HarmonyLib; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LabFusion; using LabFusion.Data; using LabFusion.Extensions; using LabFusion.Grabbables; using LabFusion.MarrowIntegration; using LabFusion.MonoBehaviours; using LabFusion.Network; using LabFusion.Representation; using LabFusion.SDK.Gamemodes; using LabFusion.SDK.Modules; using LabFusion.Senders; using LabFusion.Syncables; using LabFusion.Utilities; using MelonLoader; using SLZ; using SLZ.Bonelab; using SLZ.Combat; using SLZ.Interaction; using SLZ.Marrow; using SLZ.Marrow.Data; using SLZ.Marrow.Pool; using SLZ.Marrow.SceneStreaming; using SLZ.Marrow.Warehouse; using SLZ.Player; using SLZ.Props; using SLZ.Props.Weapons; using SLZ.Rig; using SLZ.SFX; using SLZ.UI; using SLZ.Utilities; using SLZ.VRMK; using SLZ.Zones; using SwipezGamemodeLib; using SwipezGamemodeLib.Data; using SwipezGamemodeLib.Events; using SwipezGamemodeLib.Module; using SwipezGamemodeLib.Patches; using SwipezGamemodeLib.Spawning; using SwipezGamemodeLib.Spectator; using SwipezGamemodeLib.Utilities; using TMPro; using UnhollowerBaseLib; using UnhollowerBaseLib.Attributes; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Main), "SwipezGamemodeLib", "1.3.1", "notnotnotswipez", null)] [assembly: ModuleInfo(typeof(SwipezLibModule), "SwipezGamemodeLibModule", "1.3.1", "notnotnotswipez", "swlibmodule", true, ConsoleColor.Yellow)] [assembly: AssemblyTitle("SwipezGamemodeLib")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SwipezGamemodeLib")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("08e3c3dc-6940-4e56-ac3e-1861c34c0595")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace SwipezGamemodeLib { public class Main : MelonMod { public override void OnInitializeMelon() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown Type type = FusionMod.FusionAssembly.GetTypes().First((Type t) => t.Name == "AccessoryInstance"); ModuleHandler.LoadModule(Assembly.GetExecutingAssembly()); ((MelonBase)this).HarmonyInstance.Patch((MethodBase)type.GetMethod("Update", AccessTools.all), new HarmonyMethod(typeof(AccessoryInstancePatch).GetMethod("Prefix", AccessTools.all)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public override void OnUpdate() { foreach (KeyValuePair<PlayerId, HeadIcon> headIcon in PlayerIdExtensions._headIcons) { headIcon.Value.Update(); } } } } namespace SwipezGamemodeLib.Utilities { public class FusionPlayerExtended { public static bool worldInteractable = true; public static bool canSendDamage = true; public static void SetCanDamageOthers(bool value) { canSendDamage = value; } public static void SetWorldInteractable(bool value) { worldInteractable = value; } private static void AssureStatsCapture() { if (AvatarCalculatePatch._avatarStatsCapture == null) { AvatarCalculatePatch._avatarStatsCapture = new AvatarStatsCapture(); } } public static void SetSpeedMultiplier(float value) { AssureStatsCapture(); AvatarCalculatePatch._avatarStatsCapture.speedMult = value; } public static void SetAgilityMultiplier(float value) { AssureStatsCapture(); AvatarCalculatePatch._avatarStatsCapture.agilityMult = value; } public static void SetStrengthUpperMultiplier(float value) { AssureStatsCapture(); AvatarCalculatePatch._avatarStatsCapture.strengthUpperMult = value; } public static void SetStrengthLowerMultiplier(float value) { AssureStatsCapture(); AvatarCalculatePatch._avatarStatsCapture.strengthLowerMult = value; } public static void ClearModifiedStats() { AvatarCalculatePatch._avatarStatsCapture = null; } public static void RefreshAvatar() { Player.rigManager.SwapAvatarCrate(Barcode.op_Implicit(((CrateReference)Player.rigManager.AvatarCrate)._barcode), false, (Action<bool>)null); } } public class GamemodeTimer { private Stopwatch internalStopwatch; public bool isRunning; public void Start() { isRunning = true; internalStopwatch = Stopwatch.StartNew(); } public long GetTimeMs() { return internalStopwatch.ElapsedMilliseconds; } public void Reset() { if (internalStopwatch != null) { isRunning = false; internalStopwatch.Reset(); } } public bool IsFinishedInMinutes(int minutes) { if (internalStopwatch == null) { return false; } return internalStopwatch.ElapsedMilliseconds >= minutes * 60 * 1000; } public bool IsFinishedInSeconds(int seconds) { if (internalStopwatch == null) { return false; } return internalStopwatch.ElapsedMilliseconds >= seconds * 1000; } public string ConvertToReadableTime() { return internalStopwatch.Elapsed.ToString("m\\:ss"); } } } namespace SwipezGamemodeLib.Spectator { public class PlayerHiddenStorage { public List<MeshRenderer> MeshRenderers = new List<MeshRenderer>(); public List<SkinnedMeshRenderer> SkinnedMeshRenderers = new List<SkinnedMeshRenderer>(); public List<Collider> Colliders = new List<Collider>(); public void Populate(RigManager rigManager) { MelonLogger.Msg("Populating rigmanager contents to hide..."); foreach (MeshRenderer componentsInChild in ((Component)rigManager).gameObject.GetComponentsInChildren<MeshRenderer>()) { if (((Renderer)componentsInChild).enabled) { MelonLogger.Msg("Mesh Renderer Found and disabled. " + ((Object)componentsInChild).name); MeshRenderers.Add(componentsInChild); ((Renderer)componentsInChild).enabled = false; } } foreach (SkinnedMeshRenderer componentsInChild2 in ((Component)rigManager).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>()) { if (((Renderer)componentsInChild2).enabled) { MelonLogger.Msg("Mesh Renderer Found and disabled. " + ((Object)componentsInChild2).name); SkinnedMeshRenderers.Add(componentsInChild2); ((Renderer)componentsInChild2).enabled = false; } } } public void Show() { MelonLogger.Msg("Showing rigmanager contents..."); foreach (MeshRenderer meshRenderer in MeshRenderers) { MelonLogger.Msg("Mesh Renderer Found and enabled. " + ((Object)meshRenderer).name); ((Renderer)meshRenderer).enabled = true; } foreach (SkinnedMeshRenderer skinnedMeshRenderer in SkinnedMeshRenderers) { MelonLogger.Msg("Skinned Renderer Found and enabled. " + ((Object)skinnedMeshRenderer).name); ((Renderer)skinnedMeshRenderer).enabled = true; } } } public static class PlayerIdExtensions { public static List<RigManager> hiddenManagers = new List<RigManager>(); public static List<PlayerId> hiddenIds = new List<PlayerId>(); internal static Dictionary<PlayerId, HeadIcon> _headIcons = new Dictionary<PlayerId, HeadIcon>(); public static void Hide(this PlayerId playerId) { PlayerRep val = default(PlayerRep); if (PlayerRepManager.TryGetPlayerRep(PlayerId.op_Implicit(playerId), ref val) && !hiddenManagers.Contains(val.RigReferences.RigManager)) { hiddenManagers.Add(val.RigReferences.RigManager); val.DetachObject((Handedness)1); val.DetachObject((Handedness)2); ((Component)val.RigReferences.RigManager).gameObject.active = false; val.repCanvas.gameObject.active = false; hiddenIds.Add(playerId); FieldInfo field = ((object)val).GetType().GetField("_voiceSource", BindingFlags.Instance | BindingFlags.NonPublic); object? value = field.GetValue(val); AudioSource val2 = (AudioSource)((value is AudioSource) ? value : null); if (Object.op_Implicit((Object)(object)val2)) { val2.mute = true; } } } public static void Show(this PlayerId playerId) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) PlayerRep val = default(PlayerRep); if (PlayerRepManager.TryGetPlayerRep(PlayerId.op_Implicit(playerId), ref val) && hiddenManagers.Contains(val.RigReferences.RigManager)) { hiddenManagers.Remove(val.RigReferences.RigManager); hiddenIds.Remove(playerId); ((Component)val.RigReferences.RigManager).gameObject.active = true; val.repCanvas.gameObject.active = true; val.RigReferences.RigManager.physicsRig.ResetHands((Handedness)3); val.RigReferences.RigManager.physicsRig.UnRagdollRig(); val.RigReferences.RigManager.TeleportToPose(val.serializedPelvis.position, Vector3.forward, true); FieldInfo field = ((object)val).GetType().GetField("_voiceSource", BindingFlags.Instance | BindingFlags.NonPublic); object? value = field.GetValue(val); AudioSource val2 = (AudioSource)((value is AudioSource) ? value : null); if (Object.op_Implicit((Object)(object)val2)) { val2.mute = false; } } } public static void SetHeadIcon(this PlayerId playerId, Texture2D texture2D) { if ((Object)(object)texture2D == (Object)null) { if (_headIcons.ContainsKey(playerId)) { _headIcons[playerId].Cleanup(); _headIcons.Remove(playerId); } return; } if (!_headIcons.ContainsKey(playerId)) { _headIcons.Add(playerId, new HeadIcon(playerId)); } HeadIcon headIcon = _headIcons[playerId]; headIcon.SetIcon(texture2D); } } } namespace SwipezGamemodeLib.Spawning { public class SpawnManager { public static T GetComponentOnObject<T>(GameObject go) where T : Component { if ((Object)(object)go != (Object)null) { if (Object.op_Implicit((Object)(object)go.GetComponent<T>())) { return go.GetComponent<T>(); } if (Object.op_Implicit((Object)(object)go.GetComponentInParent<T>())) { return go.GetComponentInParent<T>(); } if (Object.op_Implicit((Object)(object)go.GetComponentInChildren<T>())) { return go.GetComponentInChildren<T>(); } } return default(T); } public static Barcode GetSpawnableBarcode(GameObject gameObject) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown AssetPoolee val = gameObject.GetComponent<AssetPoolee>(); if ((Object)(object)val == (Object)null) { val = gameObject.GetComponentInParent<AssetPoolee>(); if ((Object)(object)val == (Object)null) { val = gameObject.GetComponentInChildren<AssetPoolee>(); } } if ((Object)(object)val == (Object)null) { Barcode val2 = new Barcode(); val2._id = "empty"; return val2; } return ((Scannable)val.spawnableCrate)._barcode; } public static bool IsCrate(string barcode) { GameObjectCrate crate = AssetWarehouse.Instance.GetCrate<GameObjectCrate>(barcode); if ((Object)(object)crate == (Object)null) { return false; } return true; } public static void SpawnSpawnable(string barcode, Vector3 position, Quaternion rotation, Action<GameObject> onSpawn) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) SpawnableCrateReference crateRef = new SpawnableCrateReference(barcode); Spawnable val = new Spawnable { crateRef = crateRef, policyData = null }; AssetSpawner.Register(val); AssetSpawner.Spawn(val, position, rotation, BoxedNullable<Vector3>.op_Implicit(new BoxedNullable<Vector3>((Vector3?)null)), false, BoxedNullable<int>.op_Implicit(new BoxedNullable<int>((int?)null)), Action<GameObject>.op_Implicit(onSpawn), (Action<GameObject>)null); } public static void SpawnGameObject(string barcode, Vector3 position, Quaternion rotation, Action<GameObject> onSpawn) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) GameObjectCrate crate = AssetWarehouse.Instance.GetCrate<GameObjectCrate>(barcode); Action<GameObject> action = delegate(GameObject o) { //IL_000f: 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) GameObject val = Object.Instantiate<GameObject>(o); val.transform.position = position; val.transform.rotation = rotation; onSpawn(val); }; ((CrateT<GameObject>)(object)crate).LoadAsset(Action<GameObject>.op_Implicit(action)); } public static void SpawnRagdoll(string barcode, Vector3 position, Quaternion rotation, Action<RigManager> action) { //IL_0015: 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) SpawnPlayerRep(position, rotation, delegate(RigManager manager) { manager.SwapAvatarCrate(barcode, false, (Action<bool>)null); manager.physicsRig.RagdollRig(); ((Object)manager).name = barcode; foreach (InventorySlotReceiver componentsInChild in ((Component)manager).GetComponentsInChildren<InventorySlotReceiver>()) { ((Behaviour)componentsInChild).enabled = false; } action(manager); }); } private static void SpawnPlayerRep(Vector3 position, Quaternion rotation, Action<RigManager> onSpawn) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) GameObjectCrate crate = AssetWarehouse.Instance.GetCrate<GameObjectCrate>("SLZ.BONELAB.Core.DefaultPlayerRig"); Action<GameObject> action = delegate(GameObject obj) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0043: 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) GameObject val = new GameObject(); val.SetActive(false); RigManager componentInChildren = obj.GetComponentInChildren<RigManager>(); RigManager component = Object.Instantiate<GameObject>(((Component)componentInChildren).gameObject, val.transform).GetComponent<RigManager>(); GameObject gameObject = ((Component)component).gameObject; gameObject.SetActive(false); gameObject.transform.position = position; gameObject.transform.rotation = rotation; FixPlayerRep(component); gameObject.transform.parent = null; Object.Destroy((Object)(object)val); gameObject.SetActive(true); onSpawn(component); }; ((CrateT<GameObject>)(object)crate).LoadAsset(Action<GameObject>.op_Implicit(action)); } private static void FixPlayerRep(RigManager rigManager) { //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Expected O, but got Unknown MelonLogger.Msg("Fixing player rep..."); rigManager.physicsRig.headSfx.mouthSrc.spatialBlend = 1f; MelonCoroutines.Start(WaitForWind(((Component)((Rig)rigManager.physicsRig).m_head).GetComponent<WindBuffetSFX>())); rigManager.bodyVitals.hasBodyLog = true; rigManager.bodyVitals.bodyLogEnabled = true; rigManager.loadAvatarFromSaveData = false; RemoveHaptics(((Component)((ControllerRig)rigManager.openControllerRig).leftController).GetComponent<Haptor>()); RemoveHaptics(((Component)((ControllerRig)rigManager.openControllerRig).rightController).GetComponent<Haptor>()); Object.DestroyImmediate((Object)(object)((Component)rigManager).GetComponent<PlayerAvatarArt>()); Object.DestroyImmediate((Object)(object)((Component)((Component)rigManager.uiRig).transform.Find("DATAMANAGER")).gameObject); ((Component)rigManager.uiRig).gameObject.SetActive(false); rigManager.uiRig.Start(); rigManager.uiRig.popUpMenu.radialPageView.Start(); rigManager.uiRig.popUpMenu.Awake(); try { rigManager.uiRig.popUpMenu.Start(); } catch (Exception) { } ((Component)rigManager.tutorialRig).gameObject.SetActive(false); GameObject gameObject = ((Component)((Component)rigManager).GetComponentInChildren<SpawnGunUI>()).gameObject; gameObject.SetActive(false); ((ControllerRig)rigManager.openControllerRig).isRightHanded = true; ((ControllerRig)rigManager.openControllerRig).jumpEnabled = true; ((ControllerRig)rigManager.openControllerRig).slowMoEnabled = false; ((ControllerRig)rigManager.openControllerRig).primaryEnabled = true; ((ControllerRig)rigManager.openControllerRig).quickmenuEnabled = false; ((ControllerRig)rigManager.openControllerRig).autoLiftLegs = true; ((Component)((Rig)rigManager.openControllerRig).m_head).tag = null; rigManager.openControllerRig.OnLastCameraUpdate = new UnityEvent(); rigManager.openControllerRig.cameras = new Il2CppReferenceArray<Camera>(0L); Object.DestroyImmediate((Object)(object)((Component)((Rig)rigManager.openControllerRig).m_head).GetComponent<AudioListener>()); Object.DestroyImmediate((Object)(object)((Component)((Rig)rigManager.openControllerRig).m_head).GetComponent<StreamingController>()); Object.DestroyImmediate((Object)(object)((Component)((Rig)rigManager.openControllerRig).m_head).GetComponent<CameraSettings>()); Object.DestroyImmediate((Object)(object)((Component)((Rig)rigManager.openControllerRig).m_head).GetComponent<VolumetricRendering>()); Object.DestroyImmediate((Object)(object)((Component)((Rig)rigManager.openControllerRig).m_head).GetComponent<VolumetricPlatformSwitch>()); Object.DestroyImmediate((Object)(object)((Component)((Rig)rigManager.openControllerRig).m_head).GetComponent<UniversalAdditionalCameraData>()); Object.DestroyImmediate((Object)(object)((Component)((Rig)rigManager.openControllerRig).m_head).GetComponent<XRLODBias>()); Object.DestroyImmediate((Object)(object)((Component)((Rig)rigManager.openControllerRig).m_head).GetComponent<Camera>()); Object.DestroyImmediate((Object)(object)((Component)((Rig)rigManager.openControllerRig).m_head).GetComponent<DebugDraw>()); PhysHand component = ((Component)rigManager.physicsRig.leftHand).GetComponent<PhysHand>(); PhysHand component2 = ((Component)rigManager.physicsRig.rightHand).GetComponent<PhysHand>(); FixPhysHand(component); FixPhysHand(component2); Object.DestroyImmediate((Object)(object)((Component)((ControllerRig)rigManager.openControllerRig).leftController).GetComponent<UIControllerInput>()); Object.DestroyImmediate((Object)(object)((Component)((ControllerRig)rigManager.openControllerRig).rightController).GetComponent<UIControllerInput>()); GameObject val = new GameObject("RepVignette"); SkinnedMeshRenderer val2 = val.AddComponent<SkinnedMeshRenderer>(); ((Renderer)val2).enabled = false; val.gameObject.SetActive(false); MelonCoroutines.Start(WaitAndFixPlayerHealth(((Component)rigManager).GetComponentInChildren<Player_Health>(), val)); AmmoInventory ammoInventory = rigManager.AmmoInventory; ((Component)ammoInventory.ammoReceiver).GetComponent<Collider>().enabled = false; ammoInventory.AddCartridge(ammoInventory.lightAmmoGroup, 99999); ammoInventory.AddCartridge(ammoInventory.heavyAmmoGroup, 99999); ammoInventory.AddCartridge(ammoInventory.mediumAmmoGroup, 99999); Object.DestroyImmediate((Object)(object)((Component)rigManager).GetComponent<ForceLevels>()); Object.DestroyImmediate((Object)(object)((Component)rigManager).GetComponent<CheatTool>()); Object.DestroyImmediate((Object)(object)((Component)rigManager).GetComponent<UtilitySpawnables>()); Object.DestroyImmediate((Object)(object)((Component)rigManager).GetComponent<LineMesh>()); Object.DestroyImmediate((Object)(object)((Component)rigManager).GetComponent<TempTextureRef>()); Object.DestroyImmediate((Object)(object)((Component)rigManager).GetComponent<RigVolumeSettings>()); Object.DestroyImmediate((Object)(object)((Component)rigManager).GetComponent<Volume>()); RigScreenOptions component3 = ((Component)rigManager).GetComponent<RigScreenOptions>(); Object.DestroyImmediate((Object)(object)((Component)component3.OverlayCam).gameObject); Object.DestroyImmediate((Object)(object)((Component)component3.cam).gameObject); Object.DestroyImmediate((Object)(object)component3); } private static void FixPhysHand(PhysHand hand) { ((Collider)hand.inventoryPlug).enabled = false; ((Component)hand.inventoryPlug).gameObject.SetActive(false); } private static void RemoveHaptics(Haptor haptor) { haptor.hapticsAllowed = false; haptor.cur_sin_amp = 0f; haptor.cur_sin_length = 0f; haptor.hap_amplitude = 0f; haptor.hap_calc_t = 0f; haptor.hap_click_down_amplitude = 0f; haptor.hap_delay = 0f; haptor.low_thr_freq = 0f; haptor.hap_frequency = 0f; haptor.hap_hit_frequency = 0f; haptor.hap_click_down_t = 0f; haptor.hap_click_down_frequency = 0f; haptor.hap_click_up_t = 0f; haptor.hap_click_up_amplitude = 0f; haptor.hap_knock_frequency = 0f; haptor.hap_click_up_frequency = 0f; haptor.hap_duration = 0f; haptor.sin_gateCount = 0; haptor.hap_knock_duration = 0f; haptor.hap_tap_duration = 0f; haptor.hap_hit_mod = 0f; haptor.hap_tap_amplitude = 0f; haptor.hap_tap_duration = 0f; haptor.hap_tap_frequency = 0f; haptor.hap_max_hardSin_amp = 0f; haptor.hap_min_hardSin_amp = 0f; haptor.hap_hardSin_freq = 0f; haptor.hap_hardSin_length = 0f; haptor.hap_subtle_amplitude = 0f; haptor.hap_subtle_frequency = 0f; haptor.hap_subtle_t = 0f; haptor.hap_knock_amplitude = 0f; haptor.hap_softSin_freq = 0f; haptor.hap_max_softSin_amp = 0f; haptor.hap_min_softSin_amp = 0f; haptor.hap_softSin_length = 0f; ((Behaviour)haptor).enabled = false; } private static IEnumerator WaitForWind(WindBuffetSFX sfx) { yield return null; if (Object.op_Implicit((Object)(object)sfx)) { sfx._buffetSrc.spatialBlend = 1f; } } private static IEnumerator WaitAndFixPlayerHealth(Player_Health playerHealth, GameObject vignette) { yield return (object)new WaitForSecondsRealtime(0.5f); ((Health)playerHealth).healthMode = (HealthMode)0; playerHealth.Vignetter = vignette; } } } namespace SwipezGamemodeLib.SDK { [RegisterTypeInIl2Cpp] public sealed class GamemodeResetSpawnable : FusionMarrowBehaviour { private string barcode; public GamemodeResetSpawnable(IntPtr intPtr) : base(intPtr) { } private void Awake() { barcode = Barcode.op_Implicit(((CrateReference)((Component)this).gameObject.GetComponent<SpawnableCratePlacer>().spawnableCrateReference)._barcode); GamemodeManager.OnGamemodeChanged += OnGamemodeChanged; } private void OnDestroy() { GamemodeManager.OnGamemodeChanged -= OnGamemodeChanged; } [HideFromIl2Cpp] private void OnGamemodeChanged(Gamemode gamemode) { if (gamemode == null) { if (NetworkInfo.HasServer && !NetworkInfo.IsServer) { return; } Dictionary<Barcode, AssetPool> barcodeToPool = AssetSpawner._instance._barcodeToPool; Enumerator<Barcode, AssetPool> enumerator = barcodeToPool.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair<Barcode, AssetPool> current = enumerator.Current; if (!(current.key.ToString() == barcode)) { continue; } Il2CppArrayBase<AssetPoolee> val = current.value.spawned.ToArray(); if (val.Count <= 0) { break; } { foreach (AssetPoolee item in val) { item.Despawn(); } break; } } } else if (NetworkInfo.IsServer) { ((Component)this).gameObject.GetComponent<SpawnableCratePlacer>().RePlaceSpawnable(); } } } } namespace SwipezGamemodeLib.Patches { public class AvatarCalculatePatch { [HarmonyPatch(typeof(Avatar), "ComputeBaseStats")] public class CalculateBaseStatsPatch { public static void Postfix(Avatar __instance) { if ((Object)(object)Player.rigManager != (Object)null && (Object)(object)Player.rigManager.avatar == (Object)(object)__instance && _avatarStatsCapture != null) { _avatarStatsCapture.Apply(__instance); } } } public static AvatarStatsCapture _avatarStatsCapture; } public static class AccessoryInstancePatch { public static bool Prefix(object __instance) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown RigManager val = (RigManager)__instance.GetType().GetField("rigManager", BindingFlags.Instance | BindingFlags.Public).GetValue(__instance); if (Object.op_Implicit((Object)(object)val) && PlayerIdExtensions.hiddenManagers.Contains(val)) { GameObject val2 = (GameObject)__instance.GetType().GetField("accessory", BindingFlags.Instance | BindingFlags.Public).GetValue(__instance); if (Object.op_Implicit((Object)(object)val2)) { val2.SetActive(false); } return false; } return true; } } public class BlacklistPatches { [HarmonyPatch(typeof(SyncBlacklist), "HasBlacklistedComponents")] public static class BlacklistBypassPatch { public static bool Prefix(GameObject go, ref bool __result) { RigManager componentInParent = go.GetComponentInParent<RigManager>(); if ((Object)(object)componentInParent != (Object)null && ((Object)componentInParent).name.ToLower().Contains("ragdoll")) { __result = false; return false; } return true; } } } public class GrabHelperOverridePatches { [HarmonyPatch(typeof(GrabHelper), "SendObjectAttach")] public static class GrabHelperSendObjectOverridePatch { public static bool Prefix(Hand hand, Grip grip) { if (NetworkInfo.HasServer) { MelonCoroutines.Start(Internal_ObjectAttachRoutine(hand, grip)); } return false; } } [HarmonyPatch(typeof(SyncBlacklist), "IsSyncWhitelisted")] public static class SyncBlacklistOverridePatch { public static bool Prefix(GameObject go, ref bool __result) { RigManager componentInParent = go.GetComponentInParent<RigManager>(); if (Object.op_Implicit((Object)(object)componentInParent) && ((Object)componentInParent).name.ToLower().Contains("ragdoll")) { __result = true; return false; } if (SyncBlacklist.HasBlacklistedComponents(go)) { __result = false; return false; } bool flag = (Object)(object)go.GetComponentInChildren<Rigidbody>(true) != (Object)null; bool flag2 = (Object)(object)go.GetComponentInChildren<FirearmCartridge>(true) == (Object)null || (Object)(object)go.GetComponentInChildren<Gun>(true) != (Object)null; bool flag3 = true; AssetPoolee componentInChildren = go.GetComponentInChildren<AssetPoolee>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { flag3 = Barcode.op_Implicit(((Scannable)componentInChildren.spawnableCrate).Barcode) != "c1534c5a-7b2a-41d7-bf2e-af9544657374"; } bool flag4 = flag && flag2 && flag3; __result = flag4; return false; } } internal static IEnumerator Internal_ObjectAttachRoutine(Hand hand, Grip grip) { for (int i = 0; i < 4; i++) { yield return null; } if (!NetworkInfo.HasServer) { yield break; } Handedness handedness = hand.handedness; byte smallId = PlayerIdManager.LocalSmallId; GrabGroup group = (GrabGroup)0; SerializedGrab serializedGrab = null; bool validGrip = false; if ((Object)(object)grip != (Object)null) { byte repId = default(byte); RigReferenceCollection repReferences = default(RigReferenceCollection); bool isAvatarGrip = default(bool); if (PlayerRepUtilities.FindAttachedPlayer(grip, ref repId, ref repReferences, ref isAvatarGrip)) { group = (GrabGroup)1; serializedGrab = (SerializedGrab)new SerializedPlayerBodyGrab(repId, repReferences.GetIndex(grip, isAvatarGrip).Value, isAvatarGrip); validGrip = true; } else if (((HandReciever)grip).IsStatic) { if ((Object)(object)((Il2CppObjectBase)grip).TryCast<WorldGrip>() != (Object)null) { group = (GrabGroup)5; serializedGrab = (SerializedGrab)new SerializedWorldGrab(smallId); validGrip = true; } else { group = (GrabGroup)4; serializedGrab = (SerializedGrab)new SerializedStaticGrab(GameObjectUtilities.GetFullPath(((Component)grip).gameObject)); validGrip = true; } } else if (((HandReciever)grip).HasRigidbody) { bool ignore = false; RigManager rigManager = ((Component)grip).GetComponentInParent<RigManager>(); if (Object.op_Implicit((Object)(object)rigManager) && !((Object)rigManager).name.ToLower().Contains("ragdoll")) { ignore = true; } if (!ignore) { group = (GrabGroup)2; InteractableHost host = default(InteractableHost); GrabHelper.GetGripInfo(grip, ref host); GameObject root = InteractableHelpers.GetSyncRoot(host); PropSyncable syncable3 = default(PropSyncable); if (GripExtender.Cache.TryGet(grip, ref syncable3) || PropSyncable.HostCache.TryGet(((Component)host).gameObject, ref syncable3) || PropSyncable.Cache.TryGet(root, ref syncable3)) { serializedGrab = (SerializedGrab)new SerializedPropGrab("_", ((Syncable)syncable3).GetIndex(grip).Value, ((Syncable)syncable3).GetId()); validGrip = true; } else { if (!SyncBlacklist.IsSyncWhitelisted(root)) { yield break; } if (!NetworkInfo.IsServer) { syncable3 = new PropSyncable(host, (GameObject)null); ushort queuedId = SyncManager.QueueSyncable((ISyncable)(object)syncable3); FusionWriter writer2 = FusionWriter.Create(3); try { SyncableIDRequestData data2 = SyncableIDRequestData.Create(smallId, queuedId); try { writer2.Write<SyncableIDRequestData>(data2); FusionMessage message2 = FusionMessage.Create(NativeMessageTag.SyncableIDRequest, writer2); try { MessageSender.BroadcastMessageExceptSelf((NetworkChannel)0, message2); } finally { ((IDisposable)message2)?.Dispose(); } } finally { ((IDisposable)data2)?.Dispose(); } } finally { ((IDisposable)writer2)?.Dispose(); } while (((Syncable)syncable3).IsQueued()) { yield return null; } yield return null; serializedGrab = (SerializedGrab)new SerializedPropGrab(GameObjectUtilities.GetFullPath(((Component)host).gameObject), ((Syncable)syncable3).GetIndex(grip).Value, ((Syncable)syncable3).Id); validGrip = true; } else if (NetworkInfo.IsServer) { syncable3 = new PropSyncable(host, (GameObject)null); SyncManager.RegisterSyncable((ISyncable)(object)syncable3, SyncManager.AllocateSyncID()); serializedGrab = (SerializedGrab)new SerializedPropGrab(GameObjectUtilities.GetFullPath(((Component)host).gameObject), ((Syncable)syncable3).GetIndex(grip).Value, ((Syncable)syncable3).Id); validGrip = true; } } } } } if (!validGrip) { yield break; } serializedGrab.WriteDefaultGrip(hand, grip); FusionWriter writer = FusionWriter.Create(3 + serializedGrab.GetSize()); try { PlayerRepGrabData data = PlayerRepGrabData.Create(smallId, handedness, group, serializedGrab); try { writer.Write<PlayerRepGrabData>(data); FusionMessage message = FusionMessage.Create(NativeMessageTag.PlayerRepGrab, writer); try { MessageSender.BroadcastMessageExceptSelf((NetworkChannel)0, message); } finally { ((IDisposable)message)?.Dispose(); } } finally { ((IDisposable)data)?.Dispose(); } } finally { ((IDisposable)writer)?.Dispose(); } } } public class HeadTitlePatch { [HarmonyPatch(typeof(HeadTitles), "Start")] public class HeadTitlesStartPatch { public static void Postfix(HeadTitles __instance) { ((TMP_Text)__instance.text_SubTitle).richText = true; ((TMP_Text)__instance.text_Title).richText = true; } } } public class RepFixingPatches { [HarmonyPatch(typeof(OpenControllerRig), "OnEarlyUpdate")] private class ControllerRigPatch { public static bool Prefix(OpenControllerRig __instance) { if (((Object)((Component)((Rig)__instance).manager).gameObject).name.Contains("Ragdoll")) { return false; } return true; } } [HarmonyPatch(typeof(PullCordDevice), "StartAvatarUpdateEvent")] private class PullCordPreventionPatch { public static bool Prefix(PullCordDevice __instance) { if (((Object)__instance.rm).name.Contains("Ragdoll")) { return false; } return true; } } [HarmonyPatch(typeof(PullCordDevice), "AvatarTransformationSequence")] private class PullCordSequencePreventPatch { public static bool Prefix(PullCordDevice __instance) { if (((Object)__instance.rm).name.Contains("Ragdoll")) { return false; } return true; } } [HarmonyPatch(typeof(PullCordDevice), "SwapAvatar")] private class PullCordTransformSequencePatch { public static bool Prefix(PullCordDevice __instance) { if (((Object)__instance.rm).name.Contains("Ragdoll")) { return false; } return true; } } [HarmonyPatch(typeof(SceneZone), "OnTriggerEnter", new Type[] { typeof(Collider) })] public class SceneZoneEnterPatch { public static bool Prefix(SceneZone __instance, Collider other) { RigManager componentOnObject = SpawnManager.GetComponentOnObject<RigManager>(((Component)other).gameObject); if (Object.op_Implicit((Object)(object)componentOnObject) && ((Object)componentOnObject).name.Contains("Ragdoll")) { return false; } return true; } } [HarmonyPatch(typeof(SceneZone), "OnTriggerExit", new Type[] { typeof(Collider) })] public class SceneZoneExitPatch { public static bool Prefix(SceneZone __instance, Collider other) { RigManager componentOnObject = SpawnManager.GetComponentOnObject<RigManager>(((Component)other).gameObject); if (Object.op_Implicit((Object)(object)componentOnObject) && ((Object)componentOnObject).name.Contains("Ragdoll")) { return false; } return true; } } [HarmonyPatch(typeof(ChunkTrigger), "OnTriggerExit", new Type[] { typeof(Collider) })] public class ChunkTriggerExitPatch { public static bool Prefix(ChunkTrigger __instance, Collider other) { RigManager componentOnObject = SpawnManager.GetComponentOnObject<RigManager>(((Component)other).gameObject); if (Object.op_Implicit((Object)(object)componentOnObject) && ((Object)componentOnObject).name.Contains("Ragdoll")) { return false; } return true; } } [HarmonyPatch(typeof(ChunkTrigger), "OnTriggerEnter", new Type[] { typeof(Collider) })] public class ChunkTriggerEnterPatch { public static bool Prefix(ChunkTrigger __instance, Collider other) { RigManager componentOnObject = SpawnManager.GetComponentOnObject<RigManager>(((Component)other).gameObject); if (Object.op_Implicit((Object)(object)componentOnObject) && ((Object)componentOnObject).name.Contains("Ragdoll")) { return false; } return true; } } [HarmonyPatch(typeof(TriggerLasers), "OnTriggerEnter", new Type[] { typeof(Collider) })] public class TriggerLaserEnterPatch { public static bool Prefix(TriggerLasers __instance, Collider other) { RigManager componentOnObject = SpawnManager.GetComponentOnObject<RigManager>(((Component)other).gameObject); if (Object.op_Implicit((Object)(object)componentOnObject) && ((Object)componentOnObject).name.Contains("Ragdoll")) { return false; } return true; } } [HarmonyPatch(typeof(TriggerLasers), "OnTriggerExit", new Type[] { typeof(Collider) })] public class TriggerLaserExitPatch { public static bool Prefix(TriggerLasers __instance, Collider other) { RigManager componentOnObject = SpawnManager.GetComponentOnObject<RigManager>(((Component)other).gameObject); if (Object.op_Implicit((Object)(object)componentOnObject) && ((Object)componentOnObject).name.Contains("Ragdoll")) { return false; } return true; } } } public class SendPlayerDamagePatch { [HarmonyPatch(typeof(PlayerSender), "SendPlayerDamage", new Type[] { typeof(byte), typeof(float), typeof(BodyPart) })] public static class DamageCancelPatch { public static bool Prefix() { if (!FusionPlayerExtended.canSendDamage) { return false; } return true; } } } public class WorldInteractablePatches { [HarmonyPatch(typeof(GrabHelper), "SendObjectAttach")] public class FusionAttachPatch { public static bool Prefix() { if (!FusionPlayerExtended.worldInteractable) { return false; } return true; } } [HarmonyPatch(typeof(MessageSender), "BroadcastMessageExceptSelf", new Type[] { typeof(NetworkChannel), typeof(FusionMessage) })] public class FusionOwnershipHostPatch { public static bool Prefix(NetworkChannel channel, FusionMessage message) { if (message == null) { return true; } return FusionOwnershipClientPatch.CheckTagAndWorldInteractable(message, NativeMessageTag.SyncableOwnershipResponse); } } [HarmonyPatch(typeof(MessageSender), "BroadcastMessage", new Type[] { typeof(NetworkChannel), typeof(FusionMessage) })] public class FusionOwnershipClientPatch { public static bool Prefix(NetworkChannel channel, FusionMessage message) { if (message == null) { return true; } return CheckTagAndWorldInteractable(message, NativeMessageTag.SyncableOwnershipRequest); } public unsafe static bool CheckTagAndWorldInteractable(FusionMessage message, byte tag) { if (*message.Buffer == tag && !FusionPlayerExtended.worldInteractable) { return false; } return true; } } [HarmonyPatch(typeof(Grip), "OnAttachedToHand")] public class GripAttachPatch { public static void Postfix(Grip __instance, Hand hand) { if (!FusionPlayerExtended.worldInteractable && (Object)(object)Player.rigManager != (Object)null && (Object)(object)hand.manager == (Object)(object)Player.rigManager && ((HandReciever)__instance).HasHost && (Object)(object)((HandReciever)__instance).Host.Rb != (Object)null) { __instance.ForceDetach(hand); } } } [HarmonyPatch(typeof(PlayerRep), "AttachObject")] public class AttachObjectPatch { public static bool Prefix(PlayerRep __instance) { if (PlayerIdExtensions.hiddenIds.Contains(__instance.PlayerId)) { return false; } return true; } } [HarmonyPatch(typeof(PlayerRep), "DetachObject")] public class DetachObjectPatch { public static bool Prefix(PlayerRep __instance) { if (PlayerIdExtensions.hiddenIds.Contains(__instance.PlayerId)) { return false; } return true; } } [HarmonyPatch(typeof(CollisionSyncer), "OnCollisionEnter")] public class CollisionSyncPatch { public static bool Prefix() { if (!FusionPlayerExtended.worldInteractable) { return false; } return true; } } [HarmonyPatch(typeof(ForcePullGrip), "OnFarHandHoverUpdate")] public static class ForcePullPatches { public static bool Prefix(ForcePullGrip __instance, ref bool __state, Hand hand) { if ((Object)(object)hand.manager == (Object)(object)Player.rigManager && !FusionPlayerExtended.worldInteractable) { return false; } return true; } } [HarmonyPatch(typeof(GrabHelper), "SendObjectDetach")] public class FusionDetachPatch { public static bool Prefix() { if (!FusionPlayerExtended.worldInteractable) { return false; } return true; } } [HarmonyPatch(typeof(GrabHelper), "SendObjectForcePull")] public class FusionForceGrabPatch { public static bool Prefix() { if (!FusionPlayerExtended.worldInteractable) { return false; } return true; } } } } namespace SwipezGamemodeLib.Module { public class PlayerSendCustomEventMessageData : IFusionSerializable, IDisposable { public PlayerId sender; public string eventSent; public void Deserialize(FusionReader reader) { sender = PlayerIdManager.GetPlayerId(reader.ReadByte()); eventSent = reader.ReadString(); } public void Serialize(FusionWriter writer) { writer.Write(sender.SmallId); writer.Write(eventSent); } public void Dispose() { GC.SuppressFinalize(this); } public static PlayerSendCustomEventMessageData Create(PlayerId sender, string eventName) { return new PlayerSendCustomEventMessageData { sender = sender, eventSent = eventName }; } } public class PlayerSendCustomEventMessageHandler : ModuleMessageHandler { public override void HandleMessage(byte[] bytes, bool isServerHandled = false) { FusionReader val = FusionReader.Create(bytes); try { using PlayerSendCustomEventMessageData playerSendCustomEventMessageData = val.ReadFusionSerializable<PlayerSendCustomEventMessageData>(); if (NetworkInfo.IsServer && isServerHandled) { FusionMessage val2 = FusionMessage.ModuleCreate<PlayerSendCustomEventMessageHandler>(bytes); try { MessageSender.BroadcastMessageExcept(PlayerId.op_Implicit(playerSendCustomEventMessageData.sender), (NetworkChannel)0, val2, true); } finally { ((IDisposable)val2)?.Dispose(); } } SwipezGamemodeLibEvents.PlayerSendEvent(playerSendCustomEventMessageData.sender, playerSendCustomEventMessageData.eventSent); } finally { ((IDisposable)val)?.Dispose(); } } } public class SwipezLibModule : Module { public override void OnModuleLoaded() { } } } namespace SwipezGamemodeLib.Extensions { public static class AssetBundleExtensioner { public static T LoadPersistentAsset<T>(this AssetBundle bundle, string name) where T : Object { Object val = bundle.LoadAsset(name); if (val != (Object)null) { val.hideFlags = (HideFlags)32; return ((Il2CppObjectBase)val).TryCast<T>(); } return default(T); } } } namespace SwipezGamemodeLib.Events { public class SwipezGamemodeLibEvents { public static event Action<PlayerId, string> OnPlayerSendEvent; public static void PlayerSendEvent(PlayerId playerId, string eventName) { SafeActions.InvokeActionSafe<PlayerId, string>(SwipezGamemodeLibEvents.OnPlayerSendEvent, playerId, eventName); } public static void SendPlayerEvent(string eventName) { if (!NetworkInfo.HasServer) { return; } FusionWriter val = FusionWriter.Create(); try { using PlayerSendCustomEventMessageData playerSendCustomEventMessageData = PlayerSendCustomEventMessageData.Create(PlayerIdManager.LocalId, eventName); val.Write<PlayerSendCustomEventMessageData>(playerSendCustomEventMessageData); FusionMessage val2 = FusionMessage.ModuleCreate<PlayerSendCustomEventMessageHandler>(val); try { MessageSender.SendToServer((NetworkChannel)0, val2); } finally { ((IDisposable)val2)?.Dispose(); } } finally { ((IDisposable)val)?.Dispose(); } } } } namespace SwipezGamemodeLib.Data { public class AvatarStatsCapture { public float speedMult; public float agilityMult; public float strengthLowerMult; public float strengthUpperMult; public void Apply(Avatar avatar) { avatar._speed *= speedMult; avatar._agility *= agilityMult; avatar._strengthLower *= strengthLowerMult; avatar._strengthUpper *= strengthUpperMult; } } internal class HeadIcon { protected const float LogoDivider = 270f; public GameObject go; public Canvas canvas; public RawImage image; public PlayerRep rep; public HeadIcon(PlayerId id) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0062: 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) go = new GameObject($"{id.SmallId} Head Icon"); canvas = go.AddComponent<Canvas>(); canvas.renderMode = (RenderMode)2; canvas.sortingOrder = 100000; go.transform.localScale = Vector3.one / 270f; image = go.AddComponent<RawImage>(); Object.DontDestroyOnLoad((Object)(object)go); ((Object)go).hideFlags = (HideFlags)32; PlayerRepManager.TryGetPlayerRep(PlayerId.op_Implicit(id), ref rep); } public void Cleanup() { if (Object.op_Implicit((Object)(object)go)) { Object.Destroy((Object)(object)go); } } public void SetIcon(Texture2D texture2D) { image.texture = (Texture)(object)texture2D; } public void Update() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (rep != null) { RigManager rigManager = rep.RigReferences.RigManager; if (Object.op_Implicit((Object)(object)rigManager)) { Transform head = ((Rig)rigManager.physicsRig).m_head; go.transform.position = head.position + Vector3.up * rep.GetNametagOffset(); TransformExtensions.LookAtPlayer(go.transform); } } } } }