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 CertainHallowedConcepts v1.0.0
plugins/viliger-CertainHallowedConcepts/CertainHallowedConcepts.dll
Decompiled a day agousing System; 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 EntityStates.HallowedCauldron; using EntityStates.Interactables.TrialGong; using IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.HallowedCauldron; using On.RoR2; using RoR2; using RoR2.Navigation; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; [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("CertainHallowedConcepts")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CertainHallowedConcepts")] [assembly: AssemblyTitle("CertainHallowedConcepts")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace CertainHallowedConcepts; [BepInPlugin("com.viliger.CertainHallowedConcepts", "CertainHallowedConcepts", "1.0.0")] public class CertainHallowedConcepts : BaseUnityPlugin { public const string Author = "viliger"; public const string ModName = "CertainHallowedConcepts"; public const string Version = "1.0.0"; public const string GUID = "com.viliger.CertainHallowedConcepts"; public static ConfigEntry<bool> WakeEnableFlowerAdvancement; public static ConfigEntry<float> SacrificeHealthFraction; public static ConfigEntry<float> SacrificeHoldoutPercent; public static ConfigEntry<bool> WakeDropsSacrificeOnAllSouls; public static ConfigEntry<bool> GongSpawnPortalOnHitter; public static ConfigEntry<bool> GuaranteedWake; public static ConfigEntry<float> GuaranteedWakePercentPerStage; public static ConfigEntry<bool> CleansedHexesExtendTrialTimer; public static ConfigEntry<float> CleansedHexesBonusSeconds; private void Awake() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0040: 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) //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) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); InitiateConfigValue(); if (WakeEnableFlowerAdvancement.Value) { WakeDonationController.DonatePeaceFlowersServer += new hook_DonatePeaceFlowersServer(WakeDonationController_DonatePeaceFlowersServer); } if (WakeDropsSacrificeOnAllSouls.Value) { AddDrops(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC4_Wake.WakeAltar_prefab).WaitForCompletion()); AddDrops(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC4_Wake.WakeAltarPage_prefab).WaitForCompletion()); } if (GongSpawnPortalOnHitter.Value) { TrialGongInteraction.OnIncomingDamageServer += new Manipulator(TrialGongInteraction_OnIncomingDamageServer); } if (GuaranteedWake.Value) { Run.onRunStartGlobal += Run_onRunStartGlobal; } if (CleansedHexesExtendTrialTimer.Value) { DrainingItems.OnExit += new hook_OnExit(DrainingItems_OnExit); } } private void DrainingItems_OnExit(orig_OnExit orig, DrainingItems self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)DLC4ProgressionController.instance) && Object.op_Implicit((Object)(object)DLC4ProgressionController.instance.trialSelector) && self.itemsTaken != 0) { float remainingTrialTimeServer = DLC4ProgressionController.instance.trialSelector.GetRemainingTrialTimeServer(); DLC4ProgressionController.instance.trialSelector.SetRemainingTrialTimeServer(remainingTrialTimeServer + (float)self.itemsTaken * CleansedHexesBonusSeconds.Value); } } private void Run_onRunStartGlobal(Run obj) { ((Component)obj).gameObject.AddComponent<GuaranteedWakeController>(); } private void TrialGongInteraction_OnIncomingDamageServer(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); bool flag = val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchDup(x) }); ILCursor val2 = new ILCursor(il); ILLabel val3 = val2.DefineLabel(); int num = default(int); bool flag2 = val2.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<BaseTrialGongState>(x, "OnStruck") }); if (flag && flag2) { val2.MarkLabel(val3); val2.Emit(OpCodes.Ldarg, 0); val2.Emit(OpCodes.Ldarg, 1); val2.EmitDelegate<Action<TrialGongInteraction, DamageInfo>>((Action<TrialGongInteraction, DamageInfo>)AdjustSpawnPosition); val.Emit(OpCodes.Brtrue, (object)val3); val.Emit(OpCodes.Dup); } else { Log.Warning("IL Hook Failed - RoR2.TrialGongInteraction.OnIncomingDamageServer: Gong teleporter won't spawn on attacker's position."); } } private void AdjustSpawnPosition(TrialGongInteraction interaction, DamageInfo damageInfo) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_006d: 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_0076: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = default(CharacterBody); if (Object.op_Implicit((Object)(object)SceneInfo.instance) && Object.op_Implicit((Object)(object)SceneInfo.instance.groundNodes) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref val)) { Vector3 corePosition = val.corePosition; NodeGraph groundNodes = SceneInfo.instance.groundNodes; NodeIndex val2 = groundNodes.FindClosestNode(corePosition, (HullClassification)0, 50f); if (!(val2 == NodeIndex.invalid)) { Node val3 = groundNodes.nodes[val2.nodeIndex]; GameObject val4 = new GameObject(); ((Object)val4).name = "CertainHallowedConcepts_GongPortalLocation"; val4.transform.position = val3.position; interaction.preferredSpawnPosition = val4.transform; } } } private void WakeDonationController_DonatePeaceFlowersServer(orig_DonatePeaceFlowersServer orig, WakeDonationController self, Interactor donator) { if (!Object.op_Implicit((Object)(object)WakeController.instance) || !Object.op_Implicit((Object)(object)WakeController.instance.holdoutZoneController)) { orig.Invoke(self, donator); return; } int num = 0; float num2 = 0f; CharacterBody val = default(CharacterBody); if (Object.op_Implicit((Object)(object)WakeController.instance) && ((Component)donator).TryGetComponent<CharacterBody>(ref val) && Object.op_Implicit((Object)(object)val.inventory)) { num = val.inventory.GetItemCountEffective(Items.HelpWake); } if (self.instanceData.isValid && ((LocalSacrificeData)(ref self.instanceData)).isAlive) { num2 = self.instanceData.body.healthComponent.healthFraction; } orig.Invoke(self, donator); if (num != 0 && !(num2 < SacrificeHealthFraction.Value)) { float num3 = WakeController.instance.holdoutZoneController.charge + Mathf.Clamp(SacrificeHoldoutPercent.Value, 0f, 100f) / 100f; WakeController.instance.holdoutZoneController.RaiseCharge(num3); } } private void AddDrops(GameObject prefab) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown DropSacrificePage dropSacrificePage = prefab.AddComponent<DropSacrificePage>(); dropSacrificePage.itemToDrop = Addressables.LoadAssetAsync<ItemDef>((object)RoR2_DLC4_CursedBook.PageDie_asset).WaitForCompletion(); prefab.GetComponent<WakeEventCaller>().onWakeSuccessServer.AddPersistentListener(new UnityAction(dropSacrificePage.DropItemServer)); } private void InitiateConfigValue() { WakeEnableFlowerAdvancement = ((BaseUnityPlugin)this).Config.Bind<bool>("Ancient Sepulcher", "Enable Flowers Advancing Charging", true, "Donating flowers to Soul Conduit will advance charge zone by configured ammount."); SacrificeHealthFraction = ((BaseUnityPlugin)this).Config.Bind<float>("Ancient Sepulcher", "Soul Conduit Health Fraction", 0.9f, "At what health fraction Soul Conduit has to be to give to charge zone."); SacrificeHoldoutPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Ancient Sepulcher", "Soul Conduit Holdout Fraction Charge", 10f, "How much Ancient Sepulcher hold out zone gains from giving Soul Conduit flower."); WakeDropsSacrificeOnAllSouls = ((BaseUnityPlugin)this).Config.Bind<bool>("Ancient Sepulcher", "Drop Reincarnation on All Souls Alive", true, "Ancient Sepulcher drops guaranteed Reincarnation page if it is charged with all Soul Conduits alive."); GongSpawnPortalOnHitter = ((BaseUnityPlugin)this).Config.Bind<bool>("Ritual Gong", "Ritual Gong Spawns Portal on Interactor", true, "Ritual Gong spawns its portal on interactor instead of preditermined locations in front of it. This allow for hitting the gong to be actually useful."); GuaranteedWake = ((BaseUnityPlugin)this).Config.Bind<bool>("Ancient Sepulcher", "Guaranteed Ancient Sepulcher within first four stages", true, "Enables guaranteed Ancient Sepulcher within first four stages, resets on loop, doesn't spawn if one spawns naturally."); GuaranteedWakePercentPerStage = ((BaseUnityPlugin)this).Config.Bind<float>("Ancient Sepulcher", "Guaranteed Ancient Sepulcher Spawn Chance Per Stage", 25f, "Spawn chance of Ancient Sepulcher per stage. Chances are rolled only on stages 1-4 and reset on loop. If one spawns naturally then chances are no longer rolled on this loop."); CleansedHexesExtendTrialTimer = ((BaseUnityPlugin)this).Config.Bind<bool>("Hexes", "Cleansed Hexes Add To Trial Timer", true, "Hexes removed by Life hand give additional seconds to trial timer."); CleansedHexesBonusSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Hexes", "Bonus Seconds From Cleansed Hexes", 5f, "How many seconds each cleansed Hex gives to Trial timer."); } } public class DropSacrificePage : MonoBehaviour { public ItemDef itemToDrop; private WakeController controller; private void Awake() { controller = ((Component)this).GetComponent<WakeController>(); } public void DropItemServer() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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) if (NetworkServer.active && Object.op_Implicit((Object)(object)itemToDrop) && Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.shamanPickupCreator) && controller.sacrificesKilled <= 0) { Transform transform = ((Component)controller.shamanPickupCreator).transform; Vector3 val = Vector3.up * ((BaseCreatePickupDroplet)controller.shamanPickupCreator).pickupVelocityY + ((Component)this).transform.forward * ((BaseCreatePickupDroplet)controller.shamanPickupCreator).pickupVelocityZ; PickupDropletController.CreatePickupDroplet(new UniquePickup(PickupCatalog.FindPickupIndex(itemToDrop.itemIndex)), transform.position, val, false); } } } public class GuaranteedWakeController : MonoBehaviour { private bool spawnedWake; private Xoroshiro128Plus rng; public float chancePerStage => CertainHallowedConcepts.GuaranteedWakePercentPerStage.Value; private void Start() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (NetworkServer.active) { rng = new Xoroshiro128Plus(Run.instance.runRNG.nextUlong); } } private void OnEnable() { SceneDirector.onPostPopulateSceneServer += SceneDirector_onPostPopulateSceneServer; Run.onLoopBeginServer += Run_onLoopBeginServer; } private void Run_onLoopBeginServer(LoopBeginArgs obj) { spawnedWake = false; } private void OnDisable() { SceneDirector.onPostPopulateSceneServer -= SceneDirector_onPostPopulateSceneServer; Run.onLoopBeginServer -= Run_onLoopBeginServer; } private void SceneDirector_onPostPopulateSceneServer(SceneDirector obj) { //IL_0087: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)Run.instance) || !Run.instance.IsExpansionEnabled(DLC4Content.DLC4) || !Object.op_Implicit((Object)(object)DLC4ProgressionController.instance)) { return; } if (Object.op_Implicit((Object)(object)WakeController.instance)) { spawnedWake = true; } if (spawnedWake) { return; } int stageOrder = SceneCatalog.GetSceneDefForCurrentScene().stageOrder; if (stageOrder >= 1 && stageOrder <= 4 && rng.nextNormalizedFloat < (float)stageOrder * chancePerStage / 100f) { DirectorSpawnRequest val = new DirectorSpawnRequest(DLC4ProgressionController.instance.wakeSpawnCard, new DirectorPlacementRule { placementMode = (PlacementMode)4 }, rng); spawnedWake = Object.op_Implicit((Object)(object)DirectorCore.instance.TrySpawnObject(val)); if (spawnedWake) { DLC4ProgressionController.instance.hasWakeSpawned = spawnedWake; DLC4ProgressionController.instance.lastSpawnedWakeLoopIndex = Run.instance.loopClearCount; } } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } public static class Utils { public static void AddPersistentListener(this UnityEvent unityEvent, UnityAction action) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown ((UnityEventBase)unityEvent).m_PersistentCalls.AddListener(new PersistentCall { m_Target = (Object)/*isinst with value type is only supported in some contexts*/, m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName), m_MethodName = ((Delegate)(object)action).Method.Name, m_CallState = (UnityEventCallState)2, m_Mode = (PersistentListenerMode)0 }); } }