using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using RoR2; using RoR2.Artifacts; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SacrificeItemSpawn")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SacrificeItemSpawn")] [assembly: AssemblyTitle("SacrificeItemSpawn")] [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 SacrificeItemSpawn { [BepInPlugin("com.nickn.sacrificeitemspawn", "Sacrifice Item Spawn", "1.1.5")] public sealed class SacrificeItemSpawnPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(SacrificeArtifactManager), "OnServerCharacterDeath")] private static class SacrificeDropPositionPatch { [HarmonyPrefix] private static void RecordExistingDroplets(out HashSet __state) { __state = new HashSet(Object.FindObjectsOfType()); } [HarmonyPostfix] private static void MoveNewDroplets(HashSet __state) { //IL_0047: 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) if (!IsSacrificeActive()) { return; } PickupDropletController[] array = Object.FindObjectsOfType(); foreach (PickupDropletController val in array) { if (Object.op_Implicit((Object)(object)val) && !__state.Contains(val)) { ((Component)val).transform.position = GetNearestPlayerDropPosition(((Component)val).transform.position); } } } } [HarmonyPatch(typeof(PickupDropletController), "Start")] private static class LunarCoinDropPositionPatch { [HarmonyPostfix] private static void MoveLunarCoinDroplet(PickupDropletController __instance) { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0035: 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) if (NetworkServer.active && IsSacrificeActive()) { PickupIndex val = PickupCatalog.FindPickupIndex("LunarCoin"); PickupIndex pickupIndex = __instance.pickupIndex; if (!(pickupIndex != val) || IsEliteAspect(pickupIndex)) { ((Component)__instance).transform.position = GetNearestPlayerDropPosition(((Component)__instance).transform.position); } } } } [HarmonyPatch(typeof(BossGroup), "DropRewards")] private static class BossRewardDropPositionPatch { [HarmonyPrefix] private static void RecordExistingDroplets(out HashSet __state) { __state = new HashSet(Object.FindObjectsOfType()); } [HarmonyPostfix] private static void MoveNewBossRewardDroplets(HashSet __state) { //IL_0047: 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) if (!IsSacrificeActive()) { return; } PickupDropletController[] array = Object.FindObjectsOfType(); foreach (PickupDropletController val in array) { if (Object.op_Implicit((Object)(object)val) && !__state.Contains(val)) { ((Component)val).transform.position = GetNearestPlayerDropPosition(((Component)val).transform.position); } } } } public const string PluginGuid = "com.nickn.sacrificeitemspawn"; public const string PluginName = "Sacrifice Item Spawn"; public const string PluginVersion = "1.1.5"; private const float DropOffset = 2f; private Harmony? harmony; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown harmony = new Harmony("com.nickn.sacrificeitemspawn"); harmony.PatchAll(); } private void OnDestroy() { Harmony? obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } private static bool IsEliteAspect(PickupIndex pickupIndex) { //IL_0001: 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_001f: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Invalid comparison between Unknown and I4 //IL_002c: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef == null) { return false; } if ((int)pickupDef.itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if (itemDef != null && ((Object)itemDef).name.StartsWith("ZetAspect", StringComparison.Ordinal)) { return true; } } if ((int)pickupDef.equipmentIndex == -1) { return false; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex); if (equipmentDef == null) { return false; } if (((Object)equipmentDef).name.StartsWith("ZetAspect", StringComparison.Ordinal)) { return true; } foreach (EliteIndex elite in EliteCatalog.eliteList) { EliteDef eliteDef = EliteCatalog.GetEliteDef(elite); if (eliteDef != null && (Object)(object)eliteDef.eliteEquipmentDef == (Object)(object)equipmentDef) { return true; } } return false; } private static bool IsSacrificeActive() { return Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(Artifacts.Sacrifice); } private static Vector3 GetNearestPlayerDropPosition(Vector3 originalPosition) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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) //IL_0098: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = null; float num = float.PositiveInfinity; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterBody body = instance.master.GetBody(); if (body != null && body.healthComponent.alive) { Vector3 val2 = body.corePosition - originalPosition; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { val = body; num = sqrMagnitude; } } } if (val == null) { return originalPosition; } return val.corePosition + ((Component)val).transform.right * 2f; } } }