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 AllBossRoute v1.0.0
UnifiedStagePool.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: IgnoresAccessChecksTo("HGCSharpUtils")] [assembly: IgnoresAccessChecksTo("HGUnityUtils")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace UnifiedStagePool { [BepInPlugin("custom.UnifiedStagePool", "UnifiedStagePool", "2.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class UnifiedStagePoolPlugin : BaseUnityPlugin { internal static ManualLogSource Log; private ConfigEntry<bool> addReformedAltar; private ConfigEntry<bool> addTreebornColony; private ConfigEntry<bool> addConduitCanyon; private ConfigEntry<bool> mergeLoopVariants; private ConfigEntry<bool> routeNormalExit; private ConfigEntry<float> addedWeight; private ConfigEntry<string> extraStages; private static readonly FieldInfo entriesField = typeof(SceneCollection).GetField("_sceneEntries", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private void Awake() { Log = ((BaseUnityPlugin)this).Logger; addReformedAltar = ((BaseUnityPlugin)this).Config.Bind<bool>("Stages", "ReformedAltar", true, "Add Reformed Altar (lemuriantemple) to the stage 2 pool, before and after looping."); addTreebornColony = ((BaseUnityPlugin)this).Config.Bind<bool>("Stages", "TreebornColony", true, "Add Treeborn Colony (habitat) and its loop variant (habitatfall) to the stage 3 pool, before and after looping."); addConduitCanyon = ((BaseUnityPlugin)this).Config.Bind<bool>("Stages", "ConduitCanyon", true, "Add Conduit Canyon (conduitcanyon) to the stage 4 pool, before and after looping."); extraStages = ((BaseUnityPlugin)this).Config.Bind<string>("Stages", "ExtraStages", string.Empty, "Extra scenes as name:stage pairs, comma separated (e.g. mymap:3)."); mergeLoopVariants = ((BaseUnityPlugin)this).Config.Bind<bool>("Loops", "MergeLoopVariants", true, "Every stage pool contains both the normal and the loop-variant stages, before and after looping (villagenight, lakesnight, etc.)."); addedWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Stages", "AddedStageWeight", 1f, "Selection weight for added stages (vanilla stages are 1)."); routeNormalExit = ((BaseUnityPlugin)this).Config.Bind<bool>("Routes", "RouteStagesUseNormalExit", true, "Added route stages lead into the normal pool of the next stage instead of continuing their route."); try { Apply(); } catch (Exception ex) { Log.LogError((object)ex); } } private static SceneEntry[] Raw(SceneCollection c) { if ((Object)(object)c == (Object)null || entriesField == null) { return (SceneEntry[])(object)new SceneEntry[0]; } return (SceneEntry[])(((object)(SceneEntry[])entriesField.GetValue(c)) ?? ((object)new SceneEntry[0])); } private static T Load<T>(string path) where T : Object { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) try { return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion(); } catch (Exception ex) { Log.LogWarning((object)("Could not load " + path + ": " + ex.Message)); return (T)(object)null; } } private static SceneDef Scene(string name) { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, string> dictionary = new Dictionary<string, string>(); dictionary.Add("lemuriantemple", "RoR2/DLC2/lemuriantemple/lemuriantemple.asset"); dictionary.Add("habitat", "RoR2/DLC2/habitat/habitat.asset"); dictionary.Add("habitatfall", "RoR2/DLC2/habitatfall/habitatfall.asset"); dictionary.Add("conduitcanyon", "RoR2/DLC3/conduitcanyon/conduitcanyon.asset"); Dictionary<string, string> dictionary2 = dictionary; if (dictionary2.TryGetValue(name, out var value)) { SceneDef val = Load<SceneDef>(value); if (Object.op_Implicit((Object)(object)val)) { return val; } } SceneDef val2 = SceneCatalog.FindSceneDef(name); if (Object.op_Implicit((Object)(object)val2)) { return val2; } string[] array = new string[5] { "Base", "DLC1", "DLC2", "DLC3", "DLC4" }; string[] array2 = array; foreach (string text in array2) { SceneDef val3 = null; try { val3 = Addressables.LoadAssetAsync<SceneDef>((object)("RoR2/" + text + "/" + name + "/" + name + ".asset")).WaitForCompletion(); } catch { } if (Object.op_Implicit((Object)(object)val3)) { return val3; } } Log.LogWarning((object)("Scene not found: " + name)); return null; } private void Apply() { SceneCollection[] array = (SceneCollection[])(object)new SceneCollection[6]; SceneCollection[] array2 = (SceneCollection[])(object)new SceneCollection[6]; for (int i = 1; i <= 5; i++) { array[i] = Load<SceneCollection>("RoR2/Base/SceneGroups/sgStage" + i + ".asset"); array2[i] = Load<SceneCollection>("RoR2/Base/SceneGroups/loopSgStage" + i + ".asset"); } if (mergeLoopVariants.Value) { for (int j = 1; j <= 5; j++) { if (!Object.op_Implicit((Object)(object)array[j]) || !Object.op_Implicit((Object)(object)array2[j])) { continue; } List<SceneDef> list = (from e in Raw(array[j]) select e.sceneDef into d where (Object)(object)d != (Object)null select d).ToList(); List<SceneDef> list2 = (from e in Raw(array2[j]) select e.sceneDef into d where (Object)(object)d != (Object)null select d).ToList(); foreach (SceneDef item in list2) { Add(item, array[j]); } foreach (SceneDef item2 in list) { Add(item2, array2[j]); } } } List<KeyValuePair<SceneDef, int>> list3 = new List<KeyValuePair<SceneDef, int>>(); if (addReformedAltar.Value) { list3.Add(new KeyValuePair<SceneDef, int>(Scene("lemuriantemple"), 2)); } if (addTreebornColony.Value) { list3.Add(new KeyValuePair<SceneDef, int>(Scene("habitat"), 3)); list3.Add(new KeyValuePair<SceneDef, int>(Scene("habitatfall"), 3)); } if (addConduitCanyon.Value) { list3.Add(new KeyValuePair<SceneDef, int>(Scene("conduitcanyon"), 4)); } string[] array3 = extraStages.Value.Split(new char[1] { ',' }); foreach (string text in array3) { string[] array4 = text.Trim().Split(new char[1] { ':' }); if (array4.Length == 2 && int.TryParse(array4[1], out var result) && result >= 1 && result <= 5) { list3.Add(new KeyValuePair<SceneDef, int>(Scene(array4[0].Trim()), result)); } } foreach (KeyValuePair<SceneDef, int> item3 in list3) { if ((Object)(object)item3.Key == (Object)null || !Object.op_Implicit((Object)(object)item3.Key)) { Log.LogWarning((object)"Skipping a stage that failed to load."); continue; } Add(item3.Key, array[item3.Value]); Add(item3.Key, array2[item3.Value]); if (!routeNormalExit.Value || item3.Value >= 5) { continue; } if (Object.op_Implicit((Object)(object)array[item3.Value + 1])) { item3.Key.destinationsGroup = array[item3.Value + 1]; } if (Object.op_Implicit((Object)(object)array2[item3.Value + 1])) { FieldInfo field = typeof(SceneDef).GetField("loopedDestinationsGroup", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(item3.Key, array2[item3.Value + 1]); } } } for (int num2 = 1; num2 <= 5; num2++) { if (Object.op_Implicit((Object)(object)array[num2])) { Log.LogInfo((object)("sgStage" + num2 + ": " + string.Join(", ", from e in Raw(array[num2]) select (!((Object)(object)e.sceneDef != (Object)null)) ? "NULL" : ((Object)e.sceneDef).name))); } if (Object.op_Implicit((Object)(object)array2[num2])) { Log.LogInfo((object)("loopSgStage" + num2 + ": " + string.Join(", ", from e in Raw(array2[num2]) select (!((Object)(object)e.sceneDef != (Object)null)) ? "NULL" : ((Object)e.sceneDef).name))); } } } private void Add(SceneDef scene, SceneCollection collection) { //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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)scene == (Object)null || (Object)(object)collection == (Object)null || entriesField == null) { return; } SceneEntry[] array = (SceneEntry[])(((object)(SceneEntry[])entriesField.GetValue(collection)) ?? ((object)new SceneEntry[0])); SceneEntry[] array2 = array; for (int i = 0; i < array2.Length; i++) { SceneEntry val = array2[i]; if (object.ReferenceEquals(val.sceneDef, scene)) { return; } } SceneEntry item = new SceneEntry { sceneDef = scene }; ((SceneEntry)(ref item)).weight = addedWeight.Value; List<SceneEntry> list = array.Where((SceneEntry e) => (Object)(object)e.sceneDef != (Object)null).ToList(); list.Add(item); entriesField.SetValue(collection, list.ToArray()); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } }
AlloyEncounters.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: IgnoresAccessChecksTo("HGCSharpUtils")] [assembly: IgnoresAccessChecksTo("HGUnityUtils")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace AlloyEncounters { public class AlloyMarker : MonoBehaviour { public enum Kind { Stage2Hunter, SirenHunter, ConduitHunter, WorshipUnit } public Kind kind; public bool invulnerable; public bool statsApplied; public bool dropsGiven; } [BepInPlugin("custom.AlloyEncounters", "AlloyEncounters", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class AlloyEncountersPlugin : BaseUnityPlugin { public const string QualityGUID = "com.Gorakh.ItemQualities"; private const string SirenScene = "shipgraveyard"; private const string ConduitScene = "conduitcanyon"; internal static AlloyEncountersPlugin Instance; internal static ManualLogSource Log; internal static ConfigEntry<bool> Stage2Hunter; internal static ConfigEntry<bool> Stage2ApplyOnLoops; internal static ConfigEntry<bool> SirenForceTeleporter; internal static ConfigEntry<bool> SirenWorshipRequired; internal static ConfigEntry<bool> SirenForceSolusBoss; internal static ConfigEntry<bool> SirenHunter; internal static ConfigEntry<bool> SirenChat; internal static ConfigEntry<bool> SirenDisableDescent; internal static ConfigEntry<float> SirenHunterFallbackSeconds; internal static ConfigEntry<bool> SirenHunterInvulnerable; internal static ConfigEntry<string> DescentCardNames; internal static ConfigEntry<float> WorshipDamageMult; internal static ConfigEntry<float> ConduitHunterHpMult; internal static ConfigEntry<float> SirenHunterHpMult; internal static ConfigEntry<bool> ConduitDrops; internal static ConfigEntry<bool> SirenDrops; internal static ConfigEntry<bool> WorshipDrops; internal static ConfigEntry<bool> WorshipLegendaryReds; internal static ConfigEntry<float> RedConversionWindow; internal static ConfigEntry<int> RedConversionCount; private static CharacterSpawnCard hunterCard; private static CharacterSpawnCard solusControlCard; private static BodyIndex hunterBody = (BodyIndex)(-1); private static BodyIndex worshipBody = (BodyIndex)(-1); private static BodyIndex solusControlBody = (BodyIndex)(-1); private static float redWindowEnd = -1f; private static int redConversionsLeft; private static readonly FieldInfo monstersClearedField = AccessTools.Field(typeof(TeleporterInteraction), "monstersCleared"); private static readonly FieldInfo defeatedServerField = AccessTools.Field(typeof(CombatSquad), "defeatedServer"); private static bool QualityInstalled { [CompilerGenerated] get { return Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities"); } } private void Awake() { //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Expected O, but got Unknown //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Expected O, but got Unknown //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Expected O, but got Unknown //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Expected O, but got Unknown //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Expected O, but got Unknown //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; Stage2Hunter = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage2", "InvincibleOverloadingHunter", true, "Spawn one unkillable Overloading Alloy Hunter when any stage 2 teleporter starts. It is despawned once the teleporter finishes and its boss is dead."); Stage2ApplyOnLoops = ((BaseUnityPlugin)this).Config.Bind<bool>("Stage2", "ApplyOnLoops", true, "Also apply on stage 2 of later loops (stage 7, 12, ...)."); SirenForceTeleporter = ((BaseUnityPlugin)this).Config.Bind<bool>("SirensCall", "WorshipUnitActivatesTeleporter", true, "Spawning the Alloy Worship Unit forces the teleporter to activate."); SirenWorshipRequired = ((BaseUnityPlugin)this).Config.Bind<bool>("SirensCall", "WorshipUnitRequiredForTeleporter", true, "The Alloy Worship Unit must be killed before the teleporter can finish."); SirenForceSolusBoss = ((BaseUnityPlugin)this).Config.Bind<bool>("SirensCall", "ForceSolusControlUnitBoss", true, "The teleporter boss is always Solus Control Units, even during family events."); SirenHunter = ((BaseUnityPlugin)this).Config.Bind<bool>("SirensCall", "OverloadingHunterBoss", true, "Spawn an Overloading Alloy Hunter as an extra teleporter boss. It is unkillable until all Solus Control Units are dead."); SirenHunterInvulnerable = ((BaseUnityPlugin)this).Config.Bind<bool>("SirensCall", "HunterInvulnerableUntilSolusDead", false, "If true, the Siren's Call hunter cannot be damaged until all Solus Control Units are dead. If false, it is a normal teleporter boss from the start."); SirenHunterFallbackSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("SirensCall", "HunterVulnerableFallbackSeconds", 60f, "If no Solus Control Unit has spawned after this many seconds, the hunter becomes vulnerable anyway."); SirenChat = ((BaseUnityPlugin)this).Config.Bind<bool>("SirensCall", "SirenChatMessage", true, "Broadcast 'Siren: Awoooooooooo' when the teleporter activates."); SirenDisableDescent = ((BaseUnityPlugin)this).Config.Bind<bool>("SirensCall", "DisableShrineOfDescent", true, "Prevent the Shrine of Descent from spawning on Siren's Call."); DescentCardNames = ((BaseUnityPlugin)this).Config.Bind<string>("SirensCall", "DescentSpawnCardNames", "Descent,Descend", "Comma-separated name fragments of spawn cards blocked on Siren's Call when DisableShrineOfDescent is on."); WorshipDamageMult = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "WorshipUnitDamageMultiplier", 2f, "Damage multiplier for the Alloy Worship Unit."); ConduitHunterHpMult = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "ConduitCanyonHunterHealthMultiplier", 2f, "Health multiplier for the Alloy Hunter in Conduit Canyon."); SirenHunterHpMult = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "SirensCallHunterHealthMultiplier", 2f, "Health multiplier for the Overloading Alloy Hunter on Siren's Call."); ConduitDrops = ((BaseUnityPlugin)this).Config.Bind<bool>("Drops", "ConduitCanyonHunterDrops", true, "Conduit Canyon Alloy Hunter drops Faulty Conductor (Epic with Quality) + Polylute."); SirenDrops = ((BaseUnityPlugin)this).Config.Bind<bool>("Drops", "SirensCallHunterDrops", true, "Siren's Call Overloading Alloy Hunter drops Faulty Conductor (Legendary with Quality) + Polylute + Unstable Tesla Coil + Silence Between Two Strikes."); WorshipDrops = ((BaseUnityPlugin)this).Config.Bind<bool>("Drops", "WorshipUnitDropsEmpathyCores", true, "Alloy Worship Unit drops Empathy Cores (Legendary with Quality)."); WorshipLegendaryReds = ((BaseUnityPlugin)this).Config.Bind<bool>("Drops", "WorshipUnitRedsLegendary", true, "With Quality installed, red items dropped when the Alloy Worship Unit dies become Legendary."); RedConversionWindow = ((BaseUnityPlugin)this).Config.Bind<float>("Drops", "RedConversionWindowSeconds", 30f, "How long after the Worship Unit dies its red reward drops are converted."); RedConversionCount = ((BaseUnityPlugin)this).Config.Bind<int>("Drops", "RedConversionCount", 0, "How many red drops to convert. 0 = one per player (matches the vanilla reward count)."); AsyncOperationHandle<CharacterSpawnCard> val = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/VultureHunter/cscVultureHunter.asset"); val.Completed += delegate(AsyncOperationHandle<CharacterSpawnCard> h) { hunterCard = h.Result; }; AsyncOperationHandle<CharacterSpawnCard> val2 = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/RoboBallBoss/cscRoboBallBoss.asset"); val2.Completed += delegate(AsyncOperationHandle<CharacterSpawnCard> h) { solusControlCard = h.Result; }; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) hunterBody = BodyCatalog.FindBodyIndex("VultureHunterBody"); worshipBody = BodyCatalog.FindBodyIndex("SuperRoboBallBossBody"); solusControlBody = BodyCatalog.FindBodyIndex("RoboBallBossBody"); }); Harmony val3 = new Harmony("custom.AlloyEncounters"); PatchPrefix(val3, typeof(HealthComponent), "TakeDamage", "BlockDamagePrefix"); PatchPrefix(val3, typeof(HealthComponent), "TakeDamageProcess", "BlockDamagePrefix"); PatchPrefix(val3, typeof(HealthComponent), "Suicide", "BlockDamagePrefix"); MethodInfo[] methods = typeof(CharacterMaster).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "TrueKill") { val3.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(AlloyEncountersPlugin), "BlockTrueKillPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } MethodInfo methodInfo2 = AccessTools.Method(typeof(CombatDirector), "SetNextSpawnAsBoss", (Type[])null, (Type[])null); HarmonyMethod val4 = new HarmonyMethod(typeof(AlloyEncountersPlugin), "SetNextSpawnAsBossPostfix", (Type[])null); val3.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val4, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val3.Patch((MethodBase)AccessTools.Method(typeof(GenericPickupController), "CreatePickup", (Type[])null, (Type[])null), new HarmonyMethod(typeof(AlloyEncountersPlugin), "CreatePickupPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo3 = AccessTools.Method(typeof(DLC4SacrificeZoneSpawner), "OnPrePopulateSceneServer", (Type[])null, (Type[])null); if (methodInfo3 != null) { val3.Patch((MethodBase)methodInfo3, new HarmonyMethod(typeof(AlloyEncountersPlugin), "SacrificeZonePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } val3.Patch((MethodBase)AccessTools.Method(typeof(DirectorCore), "TrySpawnObject", (Type[])null, (Type[])null), new HarmonyMethod(typeof(AlloyEncountersPlugin), "TrySpawnObjectPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); TeleporterInteraction.onTeleporterBeginChargingGlobal += OnTeleporterBeginCharging; CharacterBody.onBodyStartGlobal += OnBodyStart; GlobalEventManager.onCharacterDeathServer += OnCharacterDeath; } private static void PatchPrefix(Harmony h, Type t, string name, string prefix) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown MethodInfo[] methods = t.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == name) { h.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(AlloyEncountersPlugin), prefix, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } private static string SceneName() { SceneDef mostRecentSceneDef = SceneCatalog.mostRecentSceneDef; return (!Object.op_Implicit((Object)(object)mostRecentSceneDef)) ? string.Empty : mostRecentSceneDef.cachedName; } private static PickupIndex ToQuality(PickupIndex idx, int tier) { //IL_00c0: 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) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_00c7: 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_004b: 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_00a7: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!QualityInstalled || idx == PickupIndex.none) { return idx; } try { Type type = Type.GetType("ItemQualities.QualityCatalog, ItemQualities"); Type type2 = Type.GetType("ItemQualities.QualityTier, ItemQualities"); if (type == null || type2 == null) { return idx; } MethodInfo method = type.GetMethod("GetPickupIndexOfQuality", new Type[2] { typeof(PickupIndex), type2 }); if (method == null) { return idx; } return (PickupIndex)method.Invoke(null, new object[2] { idx, Enum.ToObject(type2, tier) }); } catch (Exception ex) { Log.LogError((object)ex); return idx; } } private static PickupIndex ItemPickup(string itemName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0018: 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_000e: Unknown result type (might be due to invalid IL or missing references) ItemIndex val = ItemCatalog.FindItemIndex(itemName); return ((int)val != -1) ? PickupCatalog.FindPickupIndex(val) : PickupIndex.none; } private static PickupIndex EquipmentPickup(string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0018: 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_000e: Unknown result type (might be due to invalid IL or missing references) EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(name); return ((int)val != -1) ? PickupCatalog.FindPickupIndex(val) : PickupIndex.none; } private static void DropAll(List<PickupIndex> pickups, Vector3 pos) { //IL_0049: 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_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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_006a: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0089: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) pickups.RemoveAll((PickupIndex p) => p == PickupIndex.none); if (pickups.Count != 0) { float num = 360f / (float)pickups.Count; for (int num2 = 0; num2 < pickups.Count; num2++) { Vector3 val = Quaternion.AngleAxis(num * (float)num2, Vector3.up) * Vector3.forward; PickupDropletController.CreatePickupDroplet(new UniquePickup(pickups[num2]), pos + Vector3.up * 2f, Vector3.up * 20f + val * 8f, false, false); } } } private static void MultiplyStat(Inventory inv, ItemDef boostItem, float mult) { if (Object.op_Implicit((Object)(object)inv) && Object.op_Implicit((Object)(object)boostItem) && !(mult <= 1f)) { int itemCountPermanent = inv.GetItemCountPermanent(boostItem); float num = 1f + 0.1f * (float)itemCountPermanent; int num2 = Mathf.RoundToInt((num * mult - num) * 10f); if (num2 > 0) { inv.GiveItemPermanent(boostItem, num2); } } } private static void ApplyOverloading(Inventory inv) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) EliteDef lightning = Elites.Lightning; if (Object.op_Implicit((Object)(object)inv) && Object.op_Implicit((Object)(object)lightning) && Object.op_Implicit((Object)(object)lightning.eliteEquipmentDef)) { inv.SetEquipmentIndex(lightning.eliteEquipmentDef.equipmentIndex); int num = Mathf.RoundToInt((lightning.healthBoostCoefficient - 1f) * 10f); int num2 = Mathf.RoundToInt((lightning.damageBoostCoefficient - 1f) * 10f); if (num > 0) { inv.GiveItemPermanent(Items.BoostHp, num); } if (num2 > 0) { inv.GiveItemPermanent(Items.BoostDamage, num2); } } } private static AlloyMarker MarkerOf(CharacterMaster master) { return (!Object.op_Implicit((Object)(object)master)) ? null : ((Component)master).GetComponent<AlloyMarker>(); } private static AlloyMarker MarkerOfBodyObject(GameObject bodyObj) { if (!Object.op_Implicit((Object)(object)bodyObj)) { return null; } CharacterBody component = bodyObj.GetComponent<CharacterBody>(); return (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.master)) ? null : ((Component)component.master).GetComponent<AlloyMarker>(); } private static void Despawn(CharacterMaster master) { if (!Object.op_Implicit((Object)(object)master)) { return; } try { master.DestroyBody(); NetworkServer.Destroy(((Component)master).gameObject); } catch (Exception ex) { Log.LogError((object)ex); } } private static bool BlockDamagePrefix(HealthComponent __instance) { if (!Object.op_Implicit((Object)(object)__instance)) { return true; } AlloyMarker alloyMarker = MarkerOfBodyObject(((Component)__instance).gameObject); return !Object.op_Implicit((Object)(object)alloyMarker) || !alloyMarker.invulnerable; } private static bool BlockTrueKillPrefix(CharacterMaster __instance) { AlloyMarker alloyMarker = MarkerOf(__instance); return !Object.op_Implicit((Object)(object)alloyMarker) || !alloyMarker.invulnerable; } private static void ProtectBody(CharacterBody body) { //IL_000e: 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_0019: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body)) { body.bodyFlags = (BodyFlags)(body.bodyFlags | 0x810); } } private static void SpawnHunter(TeleporterInteraction tp, AlloyMarker.Kind kind, Action<CharacterMaster> onReady) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_00a1: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)hunterCard) || !Object.op_Implicit((Object)(object)DirectorCore.instance)) { Log.LogError((object)"Alloy Hunter spawn card not loaded."); return; } CharacterSpawnCard obj = hunterCard; DirectorPlacementRule val = new DirectorPlacementRule(); val.placementMode = (PlacementMode)1; val.spawnOnTarget = ((Component)tp).transform; val.position = ((Component)tp).transform.position; val.minDistance = 15f; val.maxDistance = 60f; DirectorSpawnRequest val2 = new DirectorSpawnRequest((SpawnCard)(object)obj, val, new Xoroshiro128Plus(Run.instance.stageRng.nextUlong)); val2.teamIndexOverride = (TeamIndex)2; val2.ignoreTeamMemberLimit = true; DirectorSpawnRequest val3 = val2; val3.onSpawnedServer = delegate(SpawnResult result) { if (result.success && Object.op_Implicit((Object)(object)result.spawnedInstance)) { CharacterMaster component = result.spawnedInstance.GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component)) { AlloyMarker alloyMarker = ((Component)component).gameObject.AddComponent<AlloyMarker>(); alloyMarker.kind = kind; alloyMarker.invulnerable = kind == AlloyMarker.Kind.Stage2Hunter || SirenHunterInvulnerable.Value; ApplyOverloading(component.inventory); if (kind == AlloyMarker.Kind.SirenHunter) { MultiplyStat(component.inventory, Items.BoostHp, SirenHunterHpMult.Value); } alloyMarker.statsApplied = true; CharacterBody body = component.GetBody(); if (Object.op_Implicit((Object)(object)body)) { ProtectBody(body); } component.onBodyStart += ProtectBody; onReady?.Invoke(component); } } }; GameObject val4 = DirectorCore.instance.TrySpawnObject(val3); if (!Object.op_Implicit((Object)(object)val4)) { Log.LogWarning((object)string.Concat("Failed to place Alloy Hunter (", kind, ").")); } } private void OnTeleporterBeginCharging(TeleporterInteraction tp) { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)tp) || !Object.op_Implicit((Object)(object)Run.instance)) { return; } try { int stageClearCount = Run.instance.stageClearCount; bool flag = stageClearCount % 5 == 1 && (stageClearCount == 1 || Stage2ApplyOnLoops.Value); string text = SceneName(); if (Stage2Hunter.Value && flag && text != "shipgraveyard") { SpawnHunter(tp, AlloyMarker.Kind.Stage2Hunter, delegate(CharacterMaster master) { ((MonoBehaviour)this).StartCoroutine(Stage2Watcher(tp, master)); }); } if (!(text == "shipgraveyard")) { return; } if (SirenChat.Value) { BroadcastSiren(); } if (SirenHunter.Value) { SpawnHunter(tp, AlloyMarker.Kind.SirenHunter, delegate(CharacterMaster master) { master.isBoss = true; ((MonoBehaviour)this).StartCoroutine(SirenHunterWatcher(tp, master)); }); } } catch (Exception ex) { Log.LogError((object)ex); } } private IEnumerator Stage2Watcher(TeleporterInteraction tp, CharacterMaster master) { WaitForSeconds wait = new WaitForSeconds(0.5f); while (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)tp)) { CombatSquad squad = ((!Object.op_Implicit((Object)(object)tp.bossGroup)) ? null : tp.bossGroup.combatSquad); bool bossDead = !Object.op_Implicit((Object)(object)squad) || squad.memberCount == 0; if (tp.isCharged && bossDead) { break; } yield return wait; } Despawn(master); } private static void SetMonstersCleared(TeleporterInteraction tp, bool value) { try { if (Object.op_Implicit((Object)(object)tp) && monstersClearedField != null) { monstersClearedField.SetValue(tp, value); } } catch { } } private static bool SquadDefeated(CombatSquad squad) { try { return Object.op_Implicit((Object)(object)squad) && defeatedServerField != null && (bool)defeatedServerField.GetValue(squad); } catch { return false; } } private static CombatSquad TeleporterSquad(TeleporterInteraction tp) { if (!Object.op_Implicit((Object)(object)tp)) { return null; } CombatSquad val = null; try { if (Object.op_Implicit((Object)(object)tp.bossGroup)) { val = tp.bossGroup.combatSquad; } } catch { } if (!Object.op_Implicit((Object)(object)val)) { try { if (Object.op_Implicit((Object)(object)tp.bossDirector)) { val = tp.bossDirector.combatSquad; } } catch { } } if (!Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)tp.bossGroup)) { val = ((Component)tp.bossGroup).GetComponent<CombatSquad>(); } return val; } private static int CountAliveSolusControlUnits() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Invalid comparison between Unknown and I4 int num = 0; foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances) && readOnlyInstances.bodyIndex == solusControlBody && Object.op_Implicit((Object)(object)readOnlyInstances.healthComponent) && readOnlyInstances.healthComponent.alive && Object.op_Implicit((Object)(object)readOnlyInstances.teamComponent) && (int)readOnlyInstances.teamComponent.teamIndex != 1) { num++; } } return num; } private IEnumerator SirenHunterWatcher(TeleporterInteraction tp, CharacterMaster master) { WaitForSeconds wait = new WaitForSeconds(0.25f); float start = Time.time; bool seenSolus = false; bool added = false; while (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)tp)) { CharacterBody body = master.GetBody(); if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && !body.healthComponent.alive) { break; } AlloyMarker marker = MarkerOf(master); if (!added) { CombatSquad val = TeleporterSquad(tp); if (Object.op_Implicit((Object)(object)val) && val.memberCount > 0 && !SquadDefeated(val)) { try { val.AddMember(master); added = true; Log.LogInfo((object)"Siren hunter added to teleporter boss group."); } catch (Exception ex) { Log.LogError((object)ex); added = true; } } } if (Object.op_Implicit((Object)(object)marker) && marker.invulnerable) { int num = CountAliveSolusControlUnits(); if (num > 0) { seenSolus = true; } if ((seenSolus && num == 0) || (!seenSolus && Time.time - start > SirenHunterFallbackSeconds.Value)) { marker.invulnerable = false; Log.LogInfo((object)"Siren hunter is now vulnerable."); } } SetMonstersCleared(tp, value: false); yield return wait; } if (Object.op_Implicit((Object)(object)tp)) { CombatSquad val2 = TeleporterSquad(tp); SetMonstersCleared(tp, !Object.op_Implicit((Object)(object)val2) || SquadDefeated(val2) || val2.memberCount == 0); } } private IEnumerator RequireBossManually(TeleporterInteraction tp, CharacterMaster master) { WaitForSeconds wait = new WaitForSeconds(0.1f); while (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)tp)) { CharacterBody b = master.GetBody(); if (Object.op_Implicit((Object)(object)b) && Object.op_Implicit((Object)(object)b.healthComponent) && !b.healthComponent.alive) { break; } SetMonstersCleared(tp, value: false); yield return wait; } if (Object.op_Implicit((Object)(object)tp)) { CombatSquad val = ((!Object.op_Implicit((Object)(object)tp.bossGroup)) ? null : tp.bossGroup.combatSquad); SetMonstersCleared(tp, !Object.op_Implicit((Object)(object)val) || SquadDefeated(val) || val.memberCount == 0); } } private static void BroadcastSiren() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown string text = null; try { string text2 = Language.GetString("BROTHER_DIALOGUE_FORMAT"); if (!string.IsNullOrEmpty(text2) && text2.Contains("{0}") && text2.Contains("Mithrix")) { text = string.Format(text2.Replace("Mithrix", "Siren"), "Awoooooooooo"); } } catch { } if (text == null) { text = "<color=#c6d5ff><size=120%>Siren: Awoooooooooo</color></size>"; } SimpleChatMessage val = new SimpleChatMessage(); val.baseToken = text; Chat.SendBroadcastChat((ChatMessageBase)(object)val); } private void OnBodyStart(CharacterBody body) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Invalid comparison between Unknown and I4 if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master)) { return; } try { CharacterMaster master = body.master; string text = SceneName(); if (body.bodyIndex == worshipBody && (int)worshipBody != -1) { AlloyMarker alloyMarker = MarkerOf(master); if (!Object.op_Implicit((Object)(object)alloyMarker)) { alloyMarker = ((Component)master).gameObject.AddComponent<AlloyMarker>(); alloyMarker.kind = AlloyMarker.Kind.WorshipUnit; MultiplyStat(master.inventory, Items.BoostDamage, WorshipDamageMult.Value); alloyMarker.statsApplied = true; if (text == "shipgraveyard") { ((MonoBehaviour)this).StartCoroutine(HandleWorshipOnSiren(master)); } } } else if (body.bodyIndex == hunterBody && (int)hunterBody != -1 && text == "conduitcanyon" && !Object.op_Implicit((Object)(object)MarkerOf(master))) { AlloyMarker alloyMarker2 = ((Component)master).gameObject.AddComponent<AlloyMarker>(); alloyMarker2.kind = AlloyMarker.Kind.ConduitHunter; MultiplyStat(master.inventory, Items.BoostHp, ConduitHunterHpMult.Value); alloyMarker2.statsApplied = true; } } catch (Exception ex) { Log.LogError((object)ex); } } private IEnumerator HandleWorshipOnSiren(CharacterMaster worship) { yield return null; TeleporterInteraction tp = TeleporterInteraction.instance; if (!Object.op_Implicit((Object)(object)tp) || !Object.op_Implicit((Object)(object)worship)) { yield break; } if (SirenForceTeleporter.Value && tp.isIdle) { Interactor val = null; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { CharacterBody val2 = ((!Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)instance.master)) ? null : instance.master.GetBody()); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)(val = ((Component)val2).GetComponent<Interactor>()))) { break; } } try { tp.OnInteractionBegin(val); } catch (Exception ex) { Log.LogError((object)ex); } } if (SirenWorshipRequired.Value && !tp.isCharged) { ((MonoBehaviour)this).StartCoroutine(RequireBossManually(tp, worship)); } } private static void SetNextSpawnAsBossPostfix(CombatDirector __instance) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown try { if (SirenForceSolusBoss.Value && NetworkServer.active && Object.op_Implicit((Object)(object)solusControlCard) && !(SceneName() != "shipgraveyard")) { TeleporterInteraction instance = TeleporterInteraction.instance; if (Object.op_Implicit((Object)(object)instance) && !((Object)(object)instance.bossDirector != (Object)(object)__instance)) { DirectorCard val = new DirectorCard(); val.spawnCard = (SpawnCard)(object)solusControlCard; val.selectionWeight = 1; __instance.OverrideCurrentMonsterCard(val); } } } catch (Exception ex) { Log.LogError((object)ex); } } private void OnCharacterDeath(DamageReport report) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || report == null || !Object.op_Implicit((Object)(object)report.victimMaster)) { return; } try { AlloyMarker alloyMarker = MarkerOf(report.victimMaster); if (!Object.op_Implicit((Object)(object)alloyMarker) || alloyMarker.dropsGiven) { return; } Vector3 pos = ((!Object.op_Implicit((Object)(object)report.victimBody)) ? ((Component)report.victimMaster).transform.position : report.victimBody.corePosition); List<PickupIndex> list = new List<PickupIndex>(); switch (alloyMarker.kind) { default: return; case AlloyMarker.Kind.ConduitHunter: if (!ConduitDrops.Value) { return; } list.Add(ToQuality(ItemPickup("ShockDamageAura"), 2)); list.Add(ItemPickup("ChainLightningVoid")); break; case AlloyMarker.Kind.SirenHunter: if (!SirenDrops.Value) { return; } list.Add(ToQuality(ItemPickup("ShockDamageAura"), 3)); list.Add(ItemPickup("ChainLightningVoid")); list.Add(ItemPickup("ShockNearby")); list.Add(EquipmentPickup("AffixBlue")); break; case AlloyMarker.Kind.WorshipUnit: if (WorshipLegendaryReds.Value && QualityInstalled) { redWindowEnd = Time.time + RedConversionWindow.Value; redConversionsLeft = ((RedConversionCount.Value <= 0) ? Math.Max(1, PlayerCharacterMasterController.instances.Count) : RedConversionCount.Value); } if (!WorshipDrops.Value) { return; } list.Add(ToQuality(ItemPickup("RoboBallBuddy"), 3)); break; } alloyMarker.dropsGiven = true; DropAll(list, pos); } catch (Exception ex) { Log.LogError((object)ex); } } private static void CreatePickupPrefix(ref CreatePickupInfo createPickupInfo) { //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) //IL_005b: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) try { if (Time.time > redWindowEnd || redConversionsLeft <= 0 || !NetworkServer.active || SceneName() != "shipgraveyard") { return; } PickupDef pickupDef = PickupCatalog.GetPickupDef(((CreatePickupInfo)(ref createPickupInfo)).pickupIndex); if (pickupDef != null && (int)pickupDef.itemIndex != -1 && (int)pickupDef.itemTier == 2) { ((CreatePickupInfo)(ref createPickupInfo)).pickupIndex = ToQuality(((CreatePickupInfo)(ref createPickupInfo)).pickupIndex, 3); if (--redConversionsLeft <= 0) { redWindowEnd = -1f; } } } catch (Exception ex) { Log.LogError((object)ex); } } private static bool SacrificeZonePrefix() { return !SirenDisableDescent.Value || !(SceneName() == "shipgraveyard"); } private static bool TrySpawnObjectPrefix(DirectorSpawnRequest directorSpawnRequest, ref GameObject __result) { if (!SirenDisableDescent.Value || directorSpawnRequest == null || !Object.op_Implicit((Object)(object)directorSpawnRequest.spawnCard)) { return true; } if (SceneName() != "shipgraveyard") { return true; } string name = ((Object)directorSpawnRequest.spawnCard).name; string[] array = DescentCardNames.Value.Split(new char[1] { ',' }); foreach (string text in array) { string text2 = text.Trim(); if (text2.Length > 0 && name.IndexOf(text2, StringComparison.OrdinalIgnoreCase) >= 0) { __result = null; return false; } } return true; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } }
BazaarOverhaul.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.NewtMonster; using HarmonyLib; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: IgnoresAccessChecksTo("HGCSharpUtils")] [assembly: IgnoresAccessChecksTo("HGUnityUtils")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace BazaarOverhaul { [BepInPlugin("custom.BazaarOverhaul", "BazaarOverhaul", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class BazaarOverhaulPlugin : BaseUnityPlugin { public const string QualityGUID = "com.Gorakh.ItemQualities"; internal static BazaarOverhaulPlugin Instance; internal static ManualLogSource Log; internal static ConfigEntry<bool> GuaranteeBluePortal; internal static ConfigEntry<bool> FreeLunar; internal static ConfigEntry<bool> DisableLunarRecycler; internal static ConfigEntry<int> PrinterCount; internal static ConfigEntry<float> PrinterWhite; internal static ConfigEntry<float> PrinterGreen; internal static ConfigEntry<float> PrinterRed; internal static ConfigEntry<float> PrinterBoss; internal static ConfigEntry<int> QualityPrinterCount; internal static ConfigEntry<float> QualityWhite; internal static ConfigEntry<float> QualityGreen; internal static ConfigEntry<float> QualityRed; internal static ConfigEntry<float> QualityBoss; internal static ConfigEntry<int> ScrapperCount; internal static ConfigEntry<string> PrinterSpots; internal static ConfigEntry<string> QualityPrinterSpots; internal static ConfigEntry<string> ScrapperSpots; internal static ConfigEntry<bool> EssenceEnabled; internal static ConfigEntry<bool> EssenceOnLoops; internal static ConfigEntry<string> EssenceTiers; internal static ConfigEntry<string> EssenceFallbackPosition; internal static ConfigEntry<float> EssenceDistance; private static GameObject commandCubePrefab; internal static ConfigEntry<bool> NoKickOut; internal static ConfigEntry<float> NewtHealthMult; private static readonly string[] DuplicatorPaths = new string[4] { "RoR2/Base/Duplicator/iscDuplicator.asset", "RoR2/Base/DuplicatorLarge/iscDuplicatorLarge.asset", "RoR2/Base/DuplicatorMilitary/iscDuplicatorMilitary.asset", "RoR2/Base/DuplicatorWild/iscDuplicatorWild.asset" }; private const string ScrapperPath = "RoR2/Base/Scrapper/iscScrapper.asset"; private static readonly string[] QualityFields = new string[4] { "QualityDuplicator", "QualityDuplicatorLarge", "QualityDuplicatorMilitary", "QualityDuplicatorWild" }; private static readonly InteractableSpawnCard[] duplicatorCards = (InteractableSpawnCard[])(object)new InteractableSpawnCard[4]; private static InteractableSpawnCard scrapperCard; private void Awake() { //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Expected O, but got Unknown //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Expected O, but got Unknown //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Expected O, but got Unknown //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Expected O, but got Unknown //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Expected O, but got Unknown //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Expected O, but got Unknown //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Expected O, but got Unknown //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; GuaranteeBluePortal = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "GuaranteeBluePortal", true, "Always spawn the Bazaar (blue) portal after every teleporter event."); FreeLunar = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "FreeLunarContent", true, "All Lunar Coin purchases cost 0 (lunar pods, bazaar shop, seers, newt altars, etc.)."); DisableLunarRecycler = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisableLunarRecycler", true, "Block the Bazaar lunar shop reroll (Lunar Recycler)."); PrinterCount = ((BaseUnityPlugin)this).Config.Bind<int>("Printers", "Count", 4, "Regular printers added to the Bazaar (0-4)."); PrinterWhite = ((BaseUnityPlugin)this).Config.Bind<float>("Printers", "WhiteWeight", 70f, "Relative chance of a white printer."); PrinterGreen = ((BaseUnityPlugin)this).Config.Bind<float>("Printers", "GreenWeight", 20f, "Relative chance of a green printer."); PrinterRed = ((BaseUnityPlugin)this).Config.Bind<float>("Printers", "RedWeight", 5f, "Relative chance of a red printer."); PrinterBoss = ((BaseUnityPlugin)this).Config.Bind<float>("Printers", "BossWeight", 5f, "Relative chance of a boss (yellow) printer."); QualityPrinterCount = ((BaseUnityPlugin)this).Config.Bind<int>("QualityPrinters", "Count", 2, "Quality printers added to the Bazaar when the Quality mod is installed (0-2)."); QualityWhite = ((BaseUnityPlugin)this).Config.Bind<float>("QualityPrinters", "WhiteWeight", 70f, "Relative chance of a white quality printer."); QualityGreen = ((BaseUnityPlugin)this).Config.Bind<float>("QualityPrinters", "GreenWeight", 20f, "Relative chance of a green quality printer."); QualityRed = ((BaseUnityPlugin)this).Config.Bind<float>("QualityPrinters", "RedWeight", 5f, "Relative chance of a red quality printer."); QualityBoss = ((BaseUnityPlugin)this).Config.Bind<float>("QualityPrinters", "BossWeight", 5f, "Relative chance of a boss quality printer."); ScrapperCount = ((BaseUnityPlugin)this).Config.Bind<int>("Scrappers", "Count", 4, "Scrappers added to the Bazaar (0-4)."); PrinterSpots = ((BaseUnityPlugin)this).Config.Bind<string>("Placement", "PrinterPositions", "-133.3,-25.7,-17.9,72.6; -143.8,-24.7,-23.6,61; -110.7,-26.7,-46.4,32.2; -132,-25,-29.7,60", "Positions for regular printers as x,y,z,yaw separated by ';'. The y value is snapped to the floor."); QualityPrinterSpots = ((BaseUnityPlugin)this).Config.Bind<string>("Placement", "QualityPrinterPositions", "-138.5,-25.2,-20.7,66; -121.4,-25.8,-38,45", "Positions for quality printers as x,y,z,yaw separated by ';'."); ScrapperSpots = ((BaseUnityPlugin)this).Config.Bind<string>("Placement", "ScrapperPositions", "-87.1,-24,-7.2,72.6; -65.7,-23.5,-18.9,72.6; -82.1,-23.7,-5.2,72.6; -71.3,-24.7,-29.2,291", "Positions for scrappers as x,y,z,yaw separated by ';'."); EssenceEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("CommandEssence", "Enabled", true, "Spawn one Command Essence in front of the Newt when entering the Bazaar."); EssenceTiers = ((BaseUnityPlugin)this).Config.Bind<string>("CommandEssence", "TiersAfterStage", "white,green,green,red", "Tier of the essence when entering the Bazaar after stage 1,2,3,4 (white/green/red/boss/none). Stages beyond the list get nothing."); EssenceOnLoops = ((BaseUnityPlugin)this).Config.Bind<bool>("CommandEssence", "ApplyOnLoops", false, "If true, the list repeats every loop (after stage 6-9 etc.). If false, only after the first 4 stages."); EssenceDistance = ((BaseUnityPlugin)this).Config.Bind<float>("CommandEssence", "ForwardDistanceFromCauldrons", 15f, "How far in front of the midpoint between the two Bazaar cauldrons the essence appears. Use a negative value to place it behind instead."); EssenceFallbackPosition = ((BaseUnityPlugin)this).Config.Bind<string>("CommandEssence", "FallbackPosition", "-81.5,-23.6,-46.3", "Used if the cauldrons cannot be found (x,y,z)."); NoKickOut = ((BaseUnityPlugin)this).Config.Bind<bool>("Newt", "DisableKickOut", true, "The Newt never kicks players out of the Bazaar."); NewtHealthMult = ((BaseUnityPlugin)this).Config.Bind<float>("Newt", "HealthMultiplier", 10f, "Multiplier for the Newt's max health (1 = vanilla)."); AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Command/CommandCube.prefab"); val.Completed += delegate(AsyncOperationHandle<GameObject> h) { commandCubePrefab = h.Result; }; for (int num = 0; num < 4; num++) { int idx = num; AsyncOperationHandle<InteractableSpawnCard> val2 = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)DuplicatorPaths[num]); val2.Completed += delegate(AsyncOperationHandle<InteractableSpawnCard> h) { duplicatorCards[idx] = h.Result; }; } AsyncOperationHandle<InteractableSpawnCard> val3 = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/Scrapper/iscScrapper.asset"); val3.Completed += delegate(AsyncOperationHandle<InteractableSpawnCard> h) { scrapperCard = h.Result; }; Harmony val4 = new Harmony("custom.BazaarOverhaul"); MethodInfo methodInfo = AccessTools.Method(typeof(TeleporterInteraction), "Start", (Type[])null, (Type[])null); HarmonyMethod val5 = new HarmonyMethod(typeof(BazaarOverhaulPlugin), "TeleporterStartPostfix", (Type[])null); val4.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val5, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); methodInfo = AccessTools.Method(typeof(PurchaseInteraction), "Awake", (Type[])null, (Type[])null); val5 = new HarmonyMethod(typeof(BazaarOverhaulPlugin), "PurchaseCostPostfix", (Type[])null); val4.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val5, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); methodInfo = AccessTools.Method(typeof(PurchaseInteraction), "Start", (Type[])null, (Type[])null); val5 = new HarmonyMethod(typeof(BazaarOverhaulPlugin), "PurchaseStartPostfix", (Type[])null); val4.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val5, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val4.Patch((MethodBase)AccessTools.Method(typeof(PurchaseInteraction), "GetInteractability", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BazaarOverhaulPlugin), "InteractabilityPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Type typeFromHandle = typeof(KickFromShop); val4.Patch((MethodBase)AccessTools.Method(typeFromHandle, "OnEnter", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BazaarOverhaulPlugin), "KickOnEnterPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val4.Patch((MethodBase)AccessTools.Method(typeFromHandle, "FixedUpdate", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BazaarOverhaulPlugin), "KickSkipPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val4.Patch((MethodBase)AccessTools.Method(typeFromHandle, "OnExit", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BazaarOverhaulPlugin), "KickSkipPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); CharacterBody.onBodyStartGlobal += OnBodyStart; TeleporterInteraction.onTeleporterBeginChargingGlobal += delegate(TeleporterInteraction tp) { ForceShopPortal(tp); }; Stage.onServerStageBegin += OnServerStageBegin; } private static void TeleporterStartPostfix(TeleporterInteraction __instance) { ForceShopPortal(__instance); } private static void ForceShopPortal(TeleporterInteraction tp) { if (!GuaranteeBluePortal.Value || !NetworkServer.active || !Object.op_Implicit((Object)(object)tp)) { return; } try { tp.shouldAttemptToSpawnShopPortal = true; } catch (Exception ex) { Log.LogError((object)ex); } } private static void PurchaseCostPostfix(PurchaseInteraction __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 if (FreeLunar.Value && Object.op_Implicit((Object)(object)__instance) && (int)__instance.costType == 3) { __instance.cost = 0; } } private static void PurchaseStartPostfix(PurchaseInteraction __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if (FreeLunar.Value && NetworkServer.active && Object.op_Implicit((Object)(object)__instance)) { if ((int)__instance.costType == 3 && __instance.cost != 0) { __instance.Networkcost = 0; } if (DisableLunarRecycler.Value && IsRecycler(__instance)) { __instance.SetAvailable(false); } } } private static bool IsRecycler(PurchaseInteraction pi) { return Object.op_Implicit((Object)(object)pi) && ((Object)((Component)pi).gameObject).name.StartsWith("LunarRecycler", StringComparison.OrdinalIgnoreCase); } private static bool InteractabilityPrefix(PurchaseInteraction __instance, ref Interactability __result) { if (DisableLunarRecycler.Value && IsRecycler(__instance)) { __result = (Interactability)0; return false; } return true; } private static void OnServerStageBegin(Stage stage) { SceneDef mostRecentSceneDef = SceneCatalog.mostRecentSceneDef; if (Object.op_Implicit((Object)(object)mostRecentSceneDef) && !(mostRecentSceneDef.cachedName != "bazaar")) { ((MonoBehaviour)Instance).StartCoroutine(SetUpBazaar()); } } private static IEnumerator SetUpBazaar() { yield return (object)new WaitForSeconds(0.5f); if (!NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance)) { yield break; } if (DisableLunarRecycler.Value) { PurchaseInteraction[] array = Object.FindObjectsOfType<PurchaseInteraction>(); foreach (PurchaseInteraction val in array) { if (IsRecycler(val)) { val.SetAvailable(false); } } } Xoroshiro128Plus rng = new Xoroshiro128Plus(Run.instance.stageRng.nextUlong); for (int w = 0; w < 10; w++) { if (FindCauldrons().Count >= 2) { break; } yield return (object)new WaitForSeconds(0.5f); } try { SpawnCommandEssence(rng); } catch (Exception ex) { Log.LogError((object)ex); } List<GameObject> spawned = new List<GameObject>(); List<Vector4> printerSpots = ParseSpots(PrinterSpots.Value); int printers = Mathf.Min(Mathf.Max(0, PrinterCount.Value), printerSpots.Count); for (int j = 0; j < printers; j++) { InteractableSpawnCard card = duplicatorCards[PickTier(rng, PrinterWhite.Value, PrinterGreen.Value, PrinterRed.Value, PrinterBoss.Value)]; SpawnAt(card, printerSpots[j], rng, spawned); } List<Vector4> qualitySpots = ParseSpots(QualityPrinterSpots.Value); int quality = Mathf.Min(Mathf.Max(0, QualityPrinterCount.Value), qualitySpots.Count); if (quality > 0 && Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities")) { InteractableSpawnCard[] qualityCards = GetQualityCards(); for (int k = 0; k < quality; k++) { InteractableSpawnCard val2 = qualityCards[PickTier(rng, QualityWhite.Value, QualityGreen.Value, QualityRed.Value, QualityBoss.Value)]; if (!Object.op_Implicit((Object)(object)val2)) { Log.LogWarning((object)"Quality printer spawn card not found."); } else { SpawnAt(val2, qualitySpots[k], rng, spawned); } } } List<Vector4> scrapperSpots = ParseSpots(ScrapperSpots.Value); int scrappers = Mathf.Min(Mathf.Max(0, ScrapperCount.Value), scrapperSpots.Count); for (int l = 0; l < scrappers; l++) { SpawnAt(scrapperCard, scrapperSpots[l], rng, spawned); } yield return (object)new WaitForSeconds(1f); foreach (GameObject item in spawned) { if (!Object.op_Implicit((Object)(object)item)) { continue; } ShopTerminalBehavior component = item.GetComponent<ShopTerminalBehavior>(); if (!Object.op_Implicit((Object)(object)component)) { continue; } try { if (component.CurrentPickupIndex() == PickupIndex.none) { component.GenerateNewPickupServer(); } } catch (Exception ex2) { Log.LogError((object)ex2); } } Log.LogInfo((object)("Bazaar: spawned " + spawned.Count + " interactables.")); } private static bool KickOnEnterPrefix(KickFromShop __instance) { if (!NoKickOut.Value) { return true; } try { if (Object.op_Implicit((Object)(object)((EntityState)__instance).outer)) { ((EntityState)__instance).outer.SetNextStateToMain(); } } catch (Exception ex) { Log.LogError((object)ex); } return false; } private static bool KickSkipPrefix() { return !NoKickOut.Value; } private static void OnBodyStart(CharacterBody body) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) try { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master) || NewtHealthMult.Value <= 1f || body.bodyIndex != BodyCatalog.FindBodyIndex("ShopkeeperBody") || Object.op_Implicit((Object)(object)((Component)body.master).GetComponent<NewtBuffed>())) { return; } ((Component)body.master).gameObject.AddComponent<NewtBuffed>(); Inventory inventory = body.master.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCountPermanent = inventory.GetItemCountPermanent(Items.BoostHp); float num = 1f + 0.1f * (float)itemCountPermanent; int num2 = Mathf.RoundToInt((num * NewtHealthMult.Value - num) * 10f); if (num2 > 0) { inventory.GiveItemPermanent(Items.BoostHp, num2); } } } catch (Exception ex) { Log.LogError((object)ex); } } private static void SpawnCommandEssence(Xoroshiro128Plus rng) { //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) if (!EssenceEnabled.Value) { return; } int stageClearCount = Run.instance.stageClearCount; if (stageClearCount < 1) { return; } string[] array = EssenceTiers.Value.Split(new char[1] { ',' }); int num = stageClearCount - 1; if (EssenceOnLoops.Value) { num %= 5; } if (num < array.Length) { List<PickupIndex> list; switch (array[num].Trim().ToLowerInvariant()) { default: return; case "white": list = Run.instance.availableTier1DropList; break; case "green": list = Run.instance.availableTier2DropList; break; case "red": list = Run.instance.availableTier3DropList; break; case "boss": list = Run.instance.availableBossDropList; break; } if (list != null && list.Count != 0) { PickupIndex pickupIndex = list[rng.RangeInt(0, list.Count)]; GetEssencePosition(out var pos, out var _); CreatePickupInfo val = default(CreatePickupInfo); ((CreatePickupInfo)(ref val)).pickupIndex = pickupIndex; val.position = pos; val.rotation = Quaternion.identity; val.artifactFlag = (PickupArtifactFlag)1; PickupDropletController.CreatePickupDroplet(val, pos, Vector3.up * 10f); Log.LogInfo((object)("Spawned " + array[num].Trim() + " Command Essence at " + pos)); } } } private static List<Transform> FindCauldrons() { List<Transform> list = new List<Transform>(); PurchaseInteraction[] array = Object.FindObjectsOfType<PurchaseInteraction>(); foreach (PurchaseInteraction val in array) { if (Object.op_Implicit((Object)(object)val) && ((Object)((Component)val).gameObject).name.IndexOf("LunarCauldron", StringComparison.OrdinalIgnoreCase) >= 0) { list.Add(((Component)val).gameObject.transform); } } return list; } private static void GetEssencePosition(out Vector3 pos, out Quaternion rot) { //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) List<Transform> list = FindCauldrons(); if (list.Count >= 2) { Transform val = list[0]; Transform val2 = list[1]; float num = float.MaxValue; for (int i = 0; i < list.Count; i++) { for (int j = i + 1; j < list.Count; j++) { Vector3 val3 = list[i].position - list[j].position; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val = list[i]; val2 = list[j]; } } } Vector3 val4 = (val.position + val2.position) * 0.5f; Vector3 val5 = val.forward + val2.forward; val5.y = 0f; if (((Vector3)(ref val5)).sqrMagnitude < 0.01f) { Vector3 val6 = val2.position - val.position; val6.y = 0f; val5 = Vector3.Cross(Vector3.up, val6); } ((Vector3)(ref val5)).Normalize(); Vector3 val7 = val4 + val5 * EssenceDistance.Value + Vector3.up * 5f; RaycastHit val8 = default(RaycastHit); if (Physics.Raycast(val7, Vector3.down, ref val8, 20f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { val7 = ((RaycastHit)(ref val8)).point; } pos = val7 + Vector3.up * 1f; rot = Quaternion.LookRotation(-val5); Log.LogInfo((object)("Command Essence placed between cauldrons " + ((Object)((Component)val).gameObject).name + " and " + ((Object)((Component)val2).gameObject).name)); } else { Log.LogWarning((object)"Bazaar cauldrons not found; using fallback position."); pos = ParseVector(EssenceFallbackPosition.Value, new Vector3(-81.5f, -23.6f, -46.3f)); rot = Quaternion.identity; } } private static Vector3 ParseVector(string s, Vector3 fallback) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0040: 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) try { string[] array = s.Split(new char[1] { ',' }); CultureInfo invariantCulture = CultureInfo.InvariantCulture; return new Vector3(float.Parse(array[0], invariantCulture), float.Parse(array[1], invariantCulture), float.Parse(array[2], invariantCulture)); } catch { return fallback; } } private static GameObject Spawn(InteractableSpawnCard card, Vector3 pos, float yaw, Xoroshiro128Plus rng) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0009: 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) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) try { DirectorPlacementRule val = new DirectorPlacementRule(); val.placementMode = (PlacementMode)0; val.position = pos; DirectorSpawnRequest val2 = new DirectorSpawnRequest((SpawnCard)(object)card, val, rng); return ((SpawnCard)card).DoSpawn(pos, Quaternion.Euler(0f, yaw, 0f), val2).spawnedInstance; } catch (Exception ex) { Log.LogError((object)ex); return null; } } private static void SpawnAt(InteractableSpawnCard card, Vector4 spot, Xoroshiro128Plus rng, List<GameObject> spawned) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_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) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)card)) { Log.LogWarning((object)"Spawn card not loaded; skipped."); return; } Vector3 point = default(Vector3); ((Vector3)(ref point))..ctor(spot.x, spot.y, spot.z); RaycastHit val = default(RaycastHit); if (Physics.Raycast(point + Vector3.up * 6f, Vector3.down, ref val, 15f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { point = ((RaycastHit)(ref val)).point; } GameObject val2 = Spawn(card, point, spot.w, rng); if (Object.op_Implicit((Object)(object)val2)) { spawned.Add(val2); Log.LogInfo((object)("Spawned " + ((Object)card).name + " at " + point)); } else { Log.LogWarning((object)("Failed to spawn " + ((Object)card).name + " at " + point)); } } private static List<Vector4> ParseSpots(string value) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) List<Vector4> list = new List<Vector4>(); CultureInfo invariantCulture = CultureInfo.InvariantCulture; string[] array = value.Split(new char[1] { ';' }); foreach (string text in array) { string[] array2 = text.Split(new char[1] { ',' }); if (array2.Length >= 3) { try { list.Add(new Vector4(float.Parse(array2[0].Trim(), invariantCulture), float.Parse(array2[1].Trim(), invariantCulture), float.Parse(array2[2].Trim(), invariantCulture), (array2.Length <= 3) ? 0f : float.Parse(array2[3].Trim(), invariantCulture))); } catch { Log.LogWarning((object)("Bad position entry: " + text)); } } } return list; } private static int PickTier(Xoroshiro128Plus rng, float w, float g, float r, float b) { float num = Mathf.Max(0f, w) + Mathf.Max(0f, g) + Mathf.Max(0f, r) + Mathf.Max(0f, b); if (num <= 0f) { return 0; } float num2 = rng.nextNormalizedFloat * num; if ((num2 -= Mathf.Max(0f, w)) < 0f) { return 0; } if ((num2 -= Mathf.Max(0f, g)) < 0f) { return 1; } if ((num2 -= Mathf.Max(0f, r)) < 0f) { return 2; } return 3; } private static InteractableSpawnCard[] GetQualityCards() { InteractableSpawnCard[] array = (InteractableSpawnCard[])(object)new InteractableSpawnCard[4]; try { Type type = Type.GetType("ItemQualities.ItemQualitiesContent+SpawnCards, ItemQualities"); if (type == null) { return array; } for (int i = 0; i < 4; i++) { FieldInfo field = type.GetField(QualityFields[i], BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { ref InteractableSpawnCard reference = ref array[i]; object? value = field.GetValue(null); reference = (InteractableSpawnCard)((value is InteractableSpawnCard) ? value : null); } } } catch (Exception ex) { Log.LogError((object)ex); } return array; } } public class NewtBuffed : MonoBehaviour { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } }
BetterReincarnation.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: IgnoresAccessChecksTo("HGCSharpUtils")] [assembly: IgnoresAccessChecksTo("HGUnityUtils")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace BetterReincarnation { [BepInPlugin("com.Bloonjitsu7.BetterReincarnation", "BetterReincarnation", "1.2.0")] public class BetterReincarnation : BaseUnityPlugin { public static int trialCount; private static readonly Dictionary<string, Vector3> PagePositions = new Dictionary<string, Vector3> { { "sad1", new Vector3(-4768.42f, 70.14f, -5173.27f) }, { "soul1", new Vector3(4420.31f, -2410.97f, 1230.51f) }, { "surv2", new Vector3(3295.17f, -976.83f, -2154.03f) } }; public static ConfigEntry<int> trialRequirement { get; set; } public static ConfigEntry<bool> everyTrial { get; set; } public void Awake() { trialRequirement = ((BaseUnityPlugin)this).Config.Bind<int>("Better Reincarnation", "Trial Requirement", 1, "Number of trials that must be entered in a run before pages start spawning. 1 = from the first trial."); everyTrial = ((BaseUnityPlugin)this).Config.Bind<bool>("Better Reincarnation", "Every Trial", true, "If true, a page spawns in every trial from the requirement onward. If false, only once (original behaviour)."); Stage.onStageStartGlobal += OnStageStart; Run.onRunStartGlobal += OnRunStart; } private void OnStageStart(Stage stage) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)stage) || !Object.op_Implicit((Object)(object)stage.sceneDef) || !PagePositions.TryGetValue(stage.sceneDef.cachedName, out var value)) { return; } trialCount++; if (!((!everyTrial.Value) ? (trialCount == trialRequirement.Value) : (trialCount >= trialRequirement.Value))) { return; } try { CreatePickupInfo val = default(CreatePickupInfo); ((CreatePickupInfo)(ref val)).pickupIndex = PickupCatalog.FindPickupIndex(Items.PageDie.itemIndex); val.rotation = Quaternion.identity; PickupDropletController.CreatePickupDroplet(val, value, Vector3.zero); ((BaseUnityPlugin)this).Logger.LogMessage((object)("Page Spawned! (trial " + trialCount + ")")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)ex); } } private void OnRunStart(Run run) { trialCount = 0; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } }
BossSuperArmor.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: IgnoresAccessChecksTo("HGCSharpUtils")] [assembly: IgnoresAccessChecksTo("HGUnityUtils")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace BossSuperArmor { [BepInPlugin("custom.BossSuperArmor", "BossSuperArmor", "1.0.0")] public class BossSuperArmorPlugin : BaseUnityPlugin { public const string GUID = "custom.BossSuperArmor"; public const string NAME = "BossSuperArmor"; public const string VERSION = "1.0.0"; private const string BrotherBodyPath = "RoR2/Base/Brother/BrotherBody.prefab"; internal static ManualLogSource Log; internal static BuffDef ArmorBuff; internal static float HealthThreshold = 0.1f; internal static float BuffDuration = 5f; internal static int RequiredKarma = 1; internal static GameObject ApplicationEffect; private ConfigEntry<bool> requireKarma; private ConfigEntry<bool> falseSon; private ConfigEntry<bool> solusWing; private ConfigEntry<bool> solusHeart; private ConfigEntry<bool> animaHarvester; private ConfigEntry<bool> echoOfProvidence; private ConfigEntry<bool> voidling; private ConfigEntry<string> extraBodies; private readonly HashSet<string> targetBodyNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private readonly HashSet<BodyIndex> targetBodyIndices = new HashSet<BodyIndex>(); private static readonly string[] FalseSonBodies = new string[3] { "FalseSonBossBody", "FalseSonBossBodyLunarShard", "FalseSonBossBodyBrokenLunarShard" }; private static readonly string[] SolusWingBodies = new string[1] { "SolusWingBody" }; private static readonly string[] SolusHeartBodies = new string[2] { "SolusHeartBody", "SolusHeartBody_Offering" }; private static readonly string[] AnimaHarvesterBodies = new string[3] { "ReaperBossBody", "ReaperBossMalachiteBody", "ReaperBossSoulBody" }; private static readonly string[] EchoOfProvidenceBodies = new string[4] { "ProvBody", "ProvDesperationBody", "ProvFinalBody", "ProvStationaryBody" }; private static readonly string[] VoidlingBodies = new string[6] { "MiniVoidRaidCrabBodyBase", "MiniVoidRaidCrabBodyPhase1", "MiniVoidRaidCrabBodyPhase2", "MiniVoidRaidCrabBodyPhase3", "VoidRaidCrabBody", "VoidRaidCrabJointBody" }; private void Awake() { //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; requireKarma = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RequireKarma", true, "If true, bosses only get super armor when run Karma meets Mithrix's requirement (Karma 1). If false, always applied."); falseSon = ((BaseUnityPlugin)this).Config.Bind<bool>("Bosses", "FalseSon", true, "Apply to False Son (all phases)."); solusWing = ((BaseUnityPlugin)this).Config.Bind<bool>("Bosses", "SolusWing", true, "Apply to Solus Wing."); solusHeart = ((BaseUnityPlugin)this).Config.Bind<bool>("Bosses", "SolusHeart", true, "Apply to Solus Heart."); animaHarvester = ((BaseUnityPlugin)this).Config.Bind<bool>("Bosses", "AnimaHarvester", true, "Apply to the Anima Harvester (both phases)."); echoOfProvidence = ((BaseUnityPlugin)this).Config.Bind<bool>("Bosses", "EchoOfProvidence", true, "Apply to Echo of Providence (all phases)."); voidling = ((BaseUnityPlugin)this).Config.Bind<bool>("Bosses", "Voidling", true, "Apply to Voidling (vanilla, OldFathomlessVoidling, Nuxlar FathomlessVoidling joints)."); extraBodies = ((BaseUnityPlugin)this).Config.Bind<string>("Bosses", "ExtraBodyNames", string.Empty, "Comma-separated extra body names (e.g. BeetleQueen2Body) to also receive super armor."); if (falseSon.Value) { AddNames(FalseSonBodies); } if (solusWing.Value) { AddNames(SolusWingBodies); } if (solusHeart.Value) { AddNames(SolusHeartBodies); } if (animaHarvester.Value) { AddNames(AnimaHarvesterBodies); } if (echoOfProvidence.Value) { AddNames(EchoOfProvidenceBodies); } if (voidling.Value) { AddNames(VoidlingBodies); } string[] array = extraBodies.Value.Split(new char[1] { ',' }); foreach (string text in array) { if (!string.IsNullOrWhiteSpace(text)) { targetBodyNames.Add(text.Trim()); } } AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/BrotherBody.prefab"); val.Completed += delegate(AsyncOperationHandle<GameObject> handle) { ReadMithrixArmor(handle.Result); }; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(ResolveBodyIndices)); GlobalEventManager.onServerDamageDealt += OnServerDamageDealt; } private void OnDestroy() { GlobalEventManager.onServerDamageDealt -= OnServerDamageDealt; RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(ResolveBodyIndices)); } private void AddNames(string[] names) { foreach (string item in names) { targetBodyNames.Add(item); } } private void ResolveBodyIndices() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) targetBodyIndices.Clear(); foreach (string targetBodyName in targetBodyNames) { BodyIndex val = BodyCatalog.FindBodyIndex(targetBodyName); if ((int)val != -1) { targetBodyIndices.Add(val); } else { Log.LogInfo((object)("Body not found (DLC/mod not installed?): " + targetBodyName)); } } Log.LogInfo((object)("Super armor targets resolved: " + targetBodyIndices.Count)); } private static void ReadMithrixArmor(GameObject brotherPrefab) { try { Component val = ((!Object.op_Implicit((Object)(object)brotherPrefab)) ? null : brotherPrefab.GetComponentInChildren(typeof(BrotherSuperArmorController), true)); if ((Object)(object)val != (Object)null) { Traverse val2 = Traverse.Create((object)val); BuffDef value = val2.Field("buffToApply").GetValue<BuffDef>(); if (Object.op_Implicit((Object)(object)value)) { ArmorBuff = value; } float value2 = val2.Field("healthThreshold").GetValue<float>(); if (value2 > 0f) { HealthThreshold = value2; } float value3 = val2.Field("buffDuration").GetValue<float>(); if (value3 > 0f) { BuffDuration = value3; } RequiredKarma = val2.Field("requiredKarma").GetValue<int>(); ApplicationEffect = val2.Field("applicationEffectPrefab").GetValue<GameObject>(); Log.LogInfo((object)("Copied Mithrix super armor: buff=" + ((!Object.op_Implicit((Object)(object)ArmorBuff)) ? "null" : ((Object)ArmorBuff).name) + " threshold=" + HealthThreshold + " duration=" + BuffDuration + " karma=" + RequiredKarma)); } else { Log.LogWarning((object)"BrotherSuperArmorController not found on Mithrix; using defaults."); } } catch (Exception ex) { Log.LogError((object)ex); } if (!Object.op_Implicit((Object)(object)ArmorBuff)) { ArmorBuff = Buffs.DamageReduction; Log.LogWarning((object)"Falling back to DLC4 DamageReduction buff."); } } private bool KarmaAllows() { if (!requireKarma.Value) { return true; } KarmaManager instance = KarmaManager.instance; if (!Object.op_Implicit((Object)(object)instance) || !instance.IsKarmaEnabled()) { return false; } return instance.GetEffectiveKarma() >= RequiredKarma; } private void OnServerDamageDealt(DamageReport report) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) try { if (!NetworkServer.active || report == null) { return; } CharacterBody victimBody = report.victimBody; if (!Object.op_Implicit((Object)(object)victimBody) || !targetBodyIndices.Contains(victimBody.bodyIndex) || !Object.op_Implicit((Object)(object)ArmorBuff) || !KarmaAllows() || victimBody.HasBuff(ArmorBuff)) { return; } HealthComponent healthComponent = victimBody.healthComponent; if (!Object.op_Implicit((Object)(object)healthComponent) || !healthComponent.alive) { return; } SuperArmorTracker superArmorTracker = ((Component)victimBody).GetComponent<SuperArmorTracker>(); if (!Object.op_Implicit((Object)(object)superArmorTracker)) { superArmorTracker = ((Component)victimBody).gameObject.AddComponent<SuperArmorTracker>(); } superArmorTracker.damageAccumulated += report.damageDealt; if (!(superArmorTracker.damageAccumulated < HealthThreshold * healthComponent.fullCombinedHealth)) { superArmorTracker.damageAccumulated = 0f; victimBody.AddTimedBuff(ArmorBuff, BuffDuration); if (Object.op_Implicit((Object)(object)ApplicationEffect)) { GameObject applicationEffect = ApplicationEffect; EffectData val = new EffectData(); val.origin = victimBody.corePosition; val.rootObject = ((Component)victimBody).gameObject; val.scale = victimBody.radius; EffectManager.SpawnEffect(applicationEffect, val, true); } } } catch (Exception ex) { Log.LogError((object)ex); } } } public class SuperArmorTracker : MonoBehaviour { public float damageAccumulated; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } }
EnemyCap20.dll
Decompiled a day agousing System; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using RoR2; [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: IgnoresAccessChecksTo("HGCSharpUtils")] [assembly: IgnoresAccessChecksTo("HGUnityUtils")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace EnemyCap20 { [BepInPlugin("custom.EnemyCap20", "EnemyCap20", "1.0.0")] public class EnemyCapPlugin : BaseUnityPlugin { private void Awake() { //IL_0039: 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_005c: Unknown result type (might be due to invalid IL or missing references) ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>("General", "EnemyCap", 20, "Max enemies alive per enemy team (vanilla: 40). Applies to Monster, Lunar and Void teams."); TeamIndex[] array = new TeamIndex[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); TeamIndex[] array2 = (TeamIndex[])(object)array; foreach (TeamIndex val2 in array2) { TeamDef teamDef = TeamCatalog.GetTeamDef(val2); if (teamDef != null) { teamDef.softCharacterLimit = val.Value; ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Concat(val2, " cap set to ", val.Value)); } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } }
GuaranteedHalcyonShrine.dll
Decompiled a day agousing System; using System.Collections; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: IgnoresAccessChecksTo("HGCSharpUtils")] [assembly: IgnoresAccessChecksTo("HGUnityUtils")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace GuaranteedHalcyonShrine { [BepInPlugin("custom.GuaranteedHalcyonShrine", "GuaranteedHalcyonShrine", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class GuaranteedHalcyonShrinePlugin : BaseUnityPlugin { internal static GuaranteedHalcyonShrinePlugin Instance; internal static ManualLogSource Log; internal static ConfigEntry<bool> GuaranteeStage1; internal static ConfigEntry<bool> GuaranteeStage2; internal static ConfigEntry<bool> ApplyOnLoops; internal static ConfigEntry<string> SpawnCardPath; internal static ConfigEntry<bool> BuffEnabled; internal static ConfigEntry<bool> GildedOnly; internal static ConfigEntry<float> HealthMultiplier; internal static ConfigEntry<float> DamageMultiplier; private static InteractableSpawnCard shrineCard; private static BodyIndex halcyoniteBodyIndex = (BodyIndex)(-1); private void Awake() { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; GuaranteeStage1 = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawn", "GuaranteeStage1", true, "Guarantee a Shrine of Halcyon on stage 1."); GuaranteeStage2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawn", "GuaranteeStage2", true, "Guarantee a Shrine of Halcyon on stage 2."); ApplyOnLoops = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawn", "ApplyOnLoops", false, "If true, also guarantee on stages 6/7, 11/12, ..."); SpawnCardPath = ((BaseUnityPlugin)this).Config.Bind<string>("Spawn", "SpawnCardPath", "RoR2/DLC2/iscShrineHalcyonite.asset", "Addressable path of the shrine spawn card. Alternative: RoR2/DLC2/iscShrineHalcyoniteTier1.asset"); BuffEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Halcyonite", "Enabled", true, "Buff the Gilded Halcyonite spawned by the Shrine of Halcyon."); GildedOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Halcyonite", "GildedOnly", true, "If true, only shrine-spawned Halcyonites with the Gilded (Aurelionite) elite affix are buffed. If false, every Halcyonite spawned by the shrine is buffed."); HealthMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Halcyonite", "HealthMultiplier", 2f, "Max health multiplier (2 = double)."); DamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Halcyonite", "DamageMultiplier", 2f, "Damage multiplier (2 = double)."); AsyncOperationHandle<InteractableSpawnCard> val = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)SpawnCardPath.Value); val.Completed += delegate(AsyncOperationHandle<InteractableSpawnCard> h) { shrineCard = h.Result; if (!Object.op_Implicit((Object)(object)shrineCard)) { Log.LogError((object)("Shrine spawn card not found: " + SpawnCardPath.Value)); } }; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) halcyoniteBodyIndex = BodyCatalog.FindBodyIndex("HalcyoniteBody"); }); SceneDirector.onPostPopulateSceneServer += OnPostPopulateScene; Harmony val2 = new Harmony("custom.GuaranteedHalcyonShrine"); MethodInfo methodInfo = AccessTools.Method(typeof(HalcyoniteShrineInteractable), "Start", (Type[])null, (Type[])null); HarmonyMethod val3 = new HarmonyMethod(typeof(GuaranteedHalcyonShrinePlugin), "ShrineStartPostfix", (Type[])null); val2.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void OnPostPopulateScene(SceneDirector director) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown try { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance) || !Object.op_Implicit((Object)(object)shrineCard)) { return; } SceneDef mostRecentSceneDef = SceneCatalog.mostRecentSceneDef; if (!Object.op_Implicit((Object)(object)mostRecentSceneDef) || (int)mostRecentSceneDef.sceneType != 1) { return; } int stageClearCount = Run.instance.stageClearCount; if (stageClearCount < 5 || ApplyOnLoops.Value) { int num = stageClearCount % 5; if (((num == 0 && GuaranteeStage1.Value) || (num == 1 && GuaranteeStage2.Value)) && !Object.op_Implicit((Object)(object)Object.FindObjectOfType<HalcyoniteShrineInteractable>())) { DirectorCore instance = DirectorCore.instance; InteractableSpawnCard obj = shrineCard; DirectorPlacementRule val = new DirectorPlacementRule(); val.placementMode = (PlacementMode)4; GameObject val2 = instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)obj, val, Run.instance.stageRng)); Log.LogInfo((object)((!Object.op_Implicit((Object)(object)val2)) ? "Failed to place Shrine of Halcyon." : "Spawned guaranteed Shrine of Halcyon.")); } } } catch (Exception ex) { Log.LogError((object)ex); } } private static void ShrineStartPostfix(HalcyoniteShrineInteractable __instance) { if (NetworkServer.active && Object.op_Implicit((Object)(object)__instance)) { object? obj = AccessTools.Field(typeof(HalcyoniteShrineInteractable), "combatDirector")?.GetValue(__instance); Hook((CombatDirector)((obj is CombatDirector) ? obj : null)); object? obj2 = AccessTools.Field(typeof(HalcyoniteShrineInteractable), "activationDirector")?.GetValue(__instance); Hook((CombatDirector)((obj2 is CombatDirector) ? obj2 : null)); } } private static void Hook(CombatDirector director) { if (Object.op_Implicit((Object)(object)director) && director.onSpawnedServer != null) { ((UnityEvent<GameObject>)(object)director.onSpawnedServer).AddListener((UnityAction<GameObject>)OnShrineSpawnedMonster); } } private static void OnShrineSpawnedMonster(GameObject masterObject) { if (BuffEnabled.Value && Object.op_Implicit((Object)(object)masterObject)) { ((MonoBehaviour)Instance).StartCoroutine(BuffWhenReady(masterObject)); } } private static IEnumerator BuffWhenReady(GameObject masterObject) { yield return (object)new WaitForSeconds(0.5f); if (!Object.op_Implicit((Object)(object)masterObject)) { yield break; } CharacterMaster master = masterObject.GetComponent<CharacterMaster>(); if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.inventory)) { yield break; } CharacterBody body = master.GetBody(); if (!Object.op_Implicit((Object)(object)body) || body.bodyIndex != halcyoniteBodyIndex) { yield break; } if (GildedOnly.Value) { BuffDef eliteAurelionite = Buffs.EliteAurelionite; EquipmentDef eliteAurelioniteEquipment = Equipment.EliteAurelioniteEquipment; if ((!Object.op_Implicit((Object)(object)eliteAurelionite) || !body.HasBuff(eliteAurelionite)) && (!Object.op_Implicit((Object)(object)eliteAurelioniteEquipment) || master.inventory.currentEquipmentIndex != eliteAurelioniteEquipment.equipmentIndex)) { yield break; } } if (!Object.op_Implicit((Object)(object)((Component)master).GetComponent<HalcyonBuffed>())) { ((Component)master).gameObject.AddComponent<HalcyonBuffed>(); int hpStacks = Mathf.Max(0, Mathf.RoundToInt((HealthMultiplier.Value - 1f) * 10f)); int dmgStacks = Mathf.Max(0, Mathf.RoundToInt((DamageMultiplier.Value - 1f) * 10f)); if (hpStacks > 0) { master.inventory.GiveItemPermanent(Items.BoostHp, hpStacks); } if (dmgStacks > 0) { master.inventory.GiveItemPermanent(Items.BoostDamage, dmgStacks); } Log.LogInfo((object)("Buffed shrine Halcyonite: +" + hpStacks * 10 + "% HP, +" + dmgStacks * 10 + "% damage.")); } } } public class HalcyonBuffed : MonoBehaviour { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } }
HauntPortalOnStage4.dll
Decompiled a day agousing System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: IgnoresAccessChecksTo("HGCSharpUtils")] [assembly: IgnoresAccessChecksTo("HGUnityUtils")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace HauntPortalOnStage4 { [BepInPlugin("custom.HauntPortalOnStage4", "HauntPortalOnStage4", "1.0.0")] public class HauntPortalPlugin : BaseUnityPlugin { public const string GUID = "custom.HauntPortalOnStage4"; public const string NAME = "HauntPortalOnStage4"; public const string VERSION = "1.0.0"; private const string SpawnCardPath = "RoR2/DLC3/iscHardwareProgPortal_Haunt.asset"; private static InteractableSpawnCard hauntPortalCard; private ConfigEntry<bool> applyOnLoops; private void Awake() { //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) applyOnLoops = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ApplyOnLoops", false, "If true, also spawns the portal on the 4th stage of every loop (stage 9, 14, ...)."); AsyncOperationHandle<InteractableSpawnCard> val = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC3/iscHardwareProgPortal_Haunt.asset"); val.Completed += delegate(AsyncOperationHandle<InteractableSpawnCard> handle) { hauntPortalCard = handle.Result; if ((Object)(object)hauntPortalCard == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load RoR2/DLC3/iscHardwareProgPortal_Haunt.asset"); } }; TeleporterInteraction.onTeleporterChargedGlobal += OnTeleporterCharged; } private void OnDestroy() { TeleporterInteraction.onTeleporterChargedGlobal -= OnTeleporterCharged; } private void OnTeleporterCharged(TeleporterInteraction teleporter) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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) //IL_00c7: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || (Object)(object)Run.instance == (Object)null || (Object)(object)teleporter == (Object)null) { return; } int stageClearCount = Run.instance.stageClearCount; if (!((!applyOnLoops.Value) ? (stageClearCount == 3) : (stageClearCount % 5 == 3))) { return; } if ((Object)(object)hauntPortalCard == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Haunt portal spawn card not loaded; cannot spawn portal."); return; } DirectorPlacementRule val = new DirectorPlacementRule(); val.minDistance = 10f; val.maxDistance = 40f; val.placementMode = (PlacementMode)1; val.position = ((Component)teleporter).transform.position; DirectorPlacementRule val2 = val; DirectorSpawnRequest val3 = new DirectorSpawnRequest((SpawnCard)(object)hauntPortalCard, val2, Run.instance.stageRng); GameObject val4 = ((!((Object)(object)DirectorCore.instance != (Object)null)) ? null : DirectorCore.instance.TrySpawnObject(val3)); if ((Object)(object)val4 == (Object)null) { Vector3 val5 = ((Component)teleporter).transform.position + ((Component)teleporter).transform.forward * 12f + Vector3.up * 5f; RaycastHit val6 = default(RaycastHit); if (Physics.Raycast(val5, Vector3.down, ref val6, 50f, LayerMask.GetMask(new string[1] { "World" }))) { val5 = ((RaycastHit)(ref val6)).point; } val2.placementMode = (PlacementMode)0; val2.position = val5; val4 = ((!((Object)(object)DirectorCore.instance != (Object)null)) ? null : DirectorCore.instance.TrySpawnObject(val3)); } if ((Object)(object)val4 != (Object)null) { SimpleChatMessage val7 = new SimpleChatMessage(); val7.baseToken = "<style=cIsUtility>An Encrypted Portal has opened...</style>"; Chat.SendBroadcastChat((ChatMessageBase)(object)val7); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Spawned Solutional Haunt portal at " + val4.transform.position)); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to spawn Solutional Haunt portal."); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } }
StageBosses.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: IgnoresAccessChecksTo("HGCSharpUtils")] [assembly: IgnoresAccessChecksTo("HGUnityUtils")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace StageBosses { public class SanctumBossMarker : MonoBehaviour { public bool applied; } [BepInPlugin("custom.StageBosses", "StageBosses", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class StageBossesPlugin : BaseUnityPlugin { private class StageRule { public string[] scenes; public ConfigEntry<bool> bossEnabled; public ConfigEntry<bool> dropsEnabled; public string cardPath; public CharacterSpawnCard card; public string[] items; public bool alternate; public int qualityTier = -1; } public const string QualityGUID = "com.Gorakh.ItemQualities"; internal static StageBossesPlugin Instance; internal static ManualLogSource Log; private static readonly List<StageRule> rules = new List<StageRule>(); private static ConfigEntry<bool> noHordes; private static ConfigEntry<bool> sanctumDoubleReds; private static readonly string[] sanctumScavs = new string[3] { "ScavSanctum1Body", "ScavSanctum2Body", "ScavSanctum3Body" }; private void Awake() { //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; noHordes = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisableHordeOfMany", true, "The teleporter boss is never a Horde of Many on any stage."); sanctumDoubleReds = ((BaseUnityPlugin)this).Config.Bind<bool>("LuridBasilica", "DoubleRedDrops", true, "The special scavenger boss in Lurid Basilica (sanctum) drops two red items per player instead of one."); AddRule("AbyssalDepths", new string[1] { "dampcavesimple" }, "RoR2/Base/MagmaWorm/cscMagmaWorm.asset", new string[1] { "FireballsOnHit" }, alternate: false, -1, "Magma Worm teleporter boss", "Molten Perforator teleporter drops"); AddRule("SunderedGrove", new string[1] { "rootjungle" }, "RoR2/Base/Vagrant/cscVagrant.asset", new string[1] { "NovaOnLowHealth" }, alternate: false, 0, "Wandering Vagrant teleporter boss", "Genesis Loop teleporter drops (Uncommon quality if Quality is installed)"); AddRule("RepurposedCrater", new string[1] { "repurposedcrater" }, "RoR2/Base/RoboBallBoss/cscRoboBallBoss.asset", new string[2] { "ExtraEquipment", "RoboBallBuddy" }, alternate: true, -1, "Solus Control Unit teleporter boss", "Functional Coupler and Empathy Cores teleporter drops (alternating)"); AddRule("SunkenTombs", new string[1] { "sunkentombs_wormsworms" }, "RoR2/DLC1/VoidMegaCrab/cscVoidMegaCrab.asset", new string[3] { "ChainLightningVoid", "MissileVoid", "BearVoid" }, alternate: false, -1, "Void Devastator teleporter boss", "Polylute / Plasma Shrimp / Safer Spaces teleporter drops (random per drop)"); AddRule("StagnantPipeworks", new string[1] { "swampybog_winslow" }, "RoR2/Base/Scav/cscScav.asset", new string[0], alternate: false, -1, "Scavenger teleporter boss (bag drop unchanged)", null); AddRule("Tropics", new string[2] { "tropics_wormsworms", "tropicsnight_wormsworms" }, "RoR2/Base/ElectricWorm/cscElectricWorm.asset", new string[1] { "LightningStrikeOnHit" }, alternate: false, -1, "Overloading Worm teleporter boss (Sunset and Midnight Tropics)", "Charged Perforator teleporter drops"); Harmony val = new Harmony("custom.StageBosses"); MethodInfo methodInfo = AccessTools.Method(typeof(CombatDirector), "SetNextSpawnAsBoss", (Type[])null, (Type[])null); HarmonyMethod val2 = new HarmonyMethod(typeof(StageBossesPlugin), "SetNextSpawnAsBossPostfix", (Type[])null); val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(BossGroup), "DropRewards", (Type[])null, (Type[])null), new HarmonyMethod(typeof(StageBossesPlugin), "DropRewardsPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); CharacterBody.onBodyStartGlobal += OnBodyStart; } private void AddRule(string section, string[] scenes, string cardPath, string[] items, bool alternate, int quality, string bossDesc, string dropDesc) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) StageRule r = new StageRule { scenes = scenes, cardPath = cardPath, items = items, alternate = alternate, qualityTier = quality }; r.bossEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(section, "GuaranteeBoss", true, bossDesc); r.dropsEnabled = ((dropDesc == null) ? null : ((BaseUnityPlugin)this).Config.Bind<bool>(section, "GuaranteeDrops", true, dropDesc)); AsyncOperationHandle<CharacterSpawnCard> val = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)cardPath); val.Completed += delegate(AsyncOperationHandle<CharacterSpawnCard> hnd) { r.card = hnd.Result; }; rules.Add(r); } private static string SceneName() { SceneDef mostRecentSceneDef = SceneCatalog.mostRecentSceneDef; return (!Object.op_Implicit((Object)(object)mostRecentSceneDef)) ? string.Empty : mostRecentSceneDef.cachedName; } private static StageRule RuleForScene() { string n = SceneName(); return rules.FirstOrDefault((StageRule r) => r.scenes.Contains(n)); } private static bool IsChampion(DirectorCard card) { try { SpawnCard val = ((card == null) ? null : card.GetSpawnCard()); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.prefab)) { return false; } CharacterMaster component = val.prefab.GetComponent<CharacterMaster>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.bodyPrefab)) { return false; } CharacterBody component2 = component.bodyPrefab.GetComponent<CharacterBody>(); return Object.op_Implicit((Object)(object)component2) && component2.isChampion; } catch { return false; } } private static void SetNextSpawnAsBossPostfix(CombatDirector __instance) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown try { if (!NetworkServer.active) { return; } TeleporterInteraction instance = TeleporterInteraction.instance; if (!Object.op_Implicit((Object)(object)instance) || (Object)(object)instance.bossDirector != (Object)(object)__instance) { return; } StageRule stageRule = RuleForScene(); if (stageRule != null && stageRule.bossEnabled.Value && Object.op_Implicit((Object)(object)stageRule.card)) { DirectorCard val = new DirectorCard(); val.spawnCard = (SpawnCard)(object)stageRule.card; val.selectionWeight = 1; __instance.OverrideCurrentMonsterCard(val); EnsureAffordable(__instance, (SpawnCard)(object)stageRule.card); Log.LogInfo((object)("Teleporter boss forced to " + ((Object)stageRule.card).name)); } else { if (!noHordes.Value || IsChampion((DirectorCard)/*isinst with value type is only supported in some contexts*/)) { return; } WeightedSelection<DirectorCard> val2 = null; MethodInfo methodInfo = AccessTools.Method(typeof(CombatDirector), "GetFinalMonsterCardSelection", (Type[])null, (Type[])null); if (methodInfo != null) { val2 = methodInfo.Invoke(__instance, null) as WeightedSelection<DirectorCard>; } if (val2 == null) { val2 = AccessTools.Field(typeof(CombatDirector), "monsterCardsSelection")?.GetValue(__instance) as WeightedSelection<DirectorCard>; } List<DirectorCard> list = new List<DirectorCard>(); if (val2 != null) { for (int i = 0; i < val2.Count; i++) { DirectorCard value = val2.choices[i].value; if (value != null && IsChampion(value) && value.IsAvailable()) { list.Add(value); } } } if (list.Count > 0) { DirectorCard val3 = list[Random.Range(0, list.Count)]; __instance.OverrideCurrentMonsterCard(val3); EnsureAffordable(__instance, val3.GetSpawnCard()); Log.LogInfo((object)("Horde of Many replaced with " + ((Object)val3.GetSpawnCard()).name)); } else { Log.LogWarning((object)"Horde of Many could not be replaced: no champion available on this stage."); } } } catch (Exception ex) { Log.LogError((object)ex); } } private static void EnsureAffordable(CombatDirector director, SpawnCard card) { if (Object.op_Implicit((Object)(object)director) && Object.op_Implicit((Object)(object)card)) { float num = (float)card.directorCreditCost * 1.1f; if (director.monsterCredit < num) { Log.LogInfo((object)("Boss director credit raised from " + director.monsterCredit + " to " + num + " for " + ((Object)card).name)); director.monsterCredit = num; } } } private static PickupIndex ItemPickup(string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0018: 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_000e: Unknown result type (might be due to invalid IL or missing references) ItemIndex val = ItemCatalog.FindItemIndex(name); return ((int)val != -1) ? PickupCatalog.FindPickupIndex(val) : PickupIndex.none; } private static PickupIndex ToQuality(PickupIndex idx, int tier) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00c1: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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) if (tier < 0 || !Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities") || idx == PickupIndex.none) { return idx; } try { Type type = Type.GetType("ItemQualities.QualityCatalog, ItemQualities"); Type type2 = Type.GetType("ItemQualities.QualityTier, ItemQualities"); MethodInfo methodInfo = type?.GetMethod("GetPickupIndexOfQuality", new Type[2] { typeof(PickupIndex), type2 }); return (PickupIndex)((!(methodInfo != null)) ? idx : ((PickupIndex)methodInfo.Invoke(null, new object[2] { idx, Enum.ToObject(type2, tier) }))); } catch (Exception ex) { Log.LogError((object)ex); return idx; } } private static int PlayerCount() { try { PropertyInfo propertyInfo = AccessTools.Property(typeof(Run), "participatingPlayerCount"); if (propertyInfo != null) { return Math.Max(1, (int)propertyInfo.GetValue(Run.instance, null)); } } catch { } return Math.Max(1, PlayerCharacterMasterController.instances.Count); } private static bool ScaleByPlayers(BossGroup g) { try { FieldInfo fieldInfo = AccessTools.Field(typeof(BossGroup), "scaleRewardsByPlayerCount"); if (fieldInfo != null) { return (bool)fieldInfo.GetValue(g); } } catch { } return true; } private static Transform DropPosition(BossGroup g) { try { FieldInfo fieldInfo = AccessTools.Field(typeof(BossGroup), "dropPosition"); if (fieldInfo != null) { object? value = fieldInfo.GetValue(g); return (Transform)((value is Transform) ? value : null); } } catch { } return null; } private static bool DropRewardsPrefix(BossGroup __instance) { //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) try { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)Run.instance)) { return true; } SanctumBossMarker component = ((Component)__instance).GetComponent<SanctumBossMarker>(); if (Object.op_Implicit((Object)(object)component) && !component.applied && sanctumDoubleReds.Value) { component.applied = true; int bonusRewardCount = __instance.bonusRewardCount; __instance.bonusRewardCount = 2 * (bonusRewardCount + 1) - 1; Log.LogInfo((object)"Lurid Basilica scavenger rewards doubled."); return true; } TeleporterInteraction instance = TeleporterInteraction.instance; if (!Object.op_Implicit((Object)(object)instance) || (Object)(object)instance.bossGroup != (Object)(object)__instance) { return true; } StageRule stageRule = RuleForScene(); if (stageRule == null || stageRule.dropsEnabled == null || !stageRule.dropsEnabled.Value || stageRule.items.Length == 0) { return true; } List<PickupIndex> list = (from p in stageRule.items.Select(ItemPickup) where p != PickupIndex.none select p).ToList(); if (list.Count == 0) { return true; } int num = ((!ScaleByPlayers(__instance)) ? 1 : PlayerCount()) * (1 + Math.Max(0, __instance.bonusRewardCount)); Transform val = DropPosition(__instance); Vector3 val2 = ((!Object.op_Implicit((Object)(object)val)) ? (((Component)instance).transform.position + Vector3.up * 3f) : val.position); float num2 = 360f / (float)num; Vector3 val3 = Vector3.up * 20f + ((!Object.op_Implicit((Object)(object)val)) ? Vector3.forward : val.forward) * 2f; Quaternion val4 = Quaternion.AngleAxis(num2, Vector3.up); int num3 = Random.Range(0, list.Count); for (int num4 = 0; num4 < num; num4++) { PickupIndex idx = ((!stageRule.alternate) ? list[Random.Range(0, list.Count)] : list[(num3 + num4) % list.Count]); idx = ToQuality(idx, stageRule.qualityTier); PickupDropletController.CreatePickupDroplet(new UniquePickup(idx), val2, val3, false, false); val3 = val4 * val3; } Log.LogInfo((object)("Teleporter dropped " + num + " guaranteed item(s) on " + SceneName())); return false; } catch (Exception ex) { Log.LogError((object)ex); return true; } } private void OnBodyStart(CharacterBody body) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)body)) { object obj = BodyCatalog.GetBodyName(body.bodyIndex) as string; string text = default(string); if (obj != null) { text = (string)obj; obj = text; } if (obj != null && sanctumScavs.Contains(text)) { ((MonoBehaviour)this).StartCoroutine(MarkSanctumGroup(body)); } } } private IEnumerator MarkSanctumGroup(CharacterBody body) { for (int i = 0; i < 20; i++) { if (!Object.op_Implicit((Object)(object)body)) { break; } yield return (object)new WaitForSeconds(0.5f); if (!Object.op_Implicit((Object)(object)body)) { break; } BossGroup g = null; try { MethodInfo methodInfo = AccessTools.Method(typeof(BossGroup), "FindBossGroup", (Type[])null, (Type[])null); if (methodInfo != null) { object? obj = methodInfo.Invoke(null, new object[1] { body }); g = (BossGroup)((obj is BossGroup) ? obj : null); } } catch (Exception ex) { Log.LogError((object)ex); break; } if (Object.op_Implicit((Object)(object)g)) { if (!Object.op_Implicit((Object)(object)((Component)g).GetComponent<SanctumBossMarker>())) { ((Component)g).gameObject.AddComponent<SanctumBossMarker>(); } Log.LogInfo((object)"Tracking Lurid Basilica scavenger boss group."); break; } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } }
StageMountainShrines.dll
Decompiled a day agousing System; using System.Collections; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: IgnoresAccessChecksTo("HGCSharpUtils")] [assembly: IgnoresAccessChecksTo("HGUnityUtils")] [assembly: IgnoresAccessChecksTo("com.unity.multiplayer-hlapi.Runtime")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace StageMountainShrines { [BepInPlugin("custom.StageMountainShrines", "StageMountainShrines", "1.0.0")] public class StageMountainShrinesPlugin : BaseUnityPlugin { internal static StageMountainShrinesPlugin Instance; internal static ManualLogSource Log; internal static ConfigEntry<int>[] StageStacks = new ConfigEntry<int>[5]; internal static ConfigEntry<bool> ExtraRewards; internal static ConfigEntry<bool> ApplyOnLoops; private static MethodInfo addShrineStack; private void Awake() { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; int[] array = new int[5] { 2, 2, 1, 1, 1 }; for (int i = 0; i < 5; i++) { StageStacks[i] = ((BaseUnityPlugin)this).Config.Bind<int>("Stacks", "Stage" + (i + 1), array[i], "Number of Mountain Shrine effects applied to the stage " + (i + 1) + " teleporter."); } ExtraRewards = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExtraRewards", false, "If true, the added Mountain Shrine effects also grant their extra boss item drops. Shrines you activate yourself always give rewards."); ApplyOnLoops = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ApplyOnLoops", false, "If true, stages 6-10, 11-15, ... use the Stage1-Stage5 values. If false, only the first loop is affected."); addShrineStack = AccessTools.Method(typeof(TeleporterInteraction), "AddShrineStack", (Type[])null, (Type[])null); Harmony val = new Harmony("custom.StageMountainShrines"); MethodInfo methodInfo = AccessTools.Method(typeof(TeleporterInteraction), "Start", (Type[])null, (Type[])null); HarmonyMethod val2 = new HarmonyMethod(typeof(StageMountainShrinesPlugin), "TeleporterStartPostfix", (Type[])null); val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(BossGroup), "DropRewards", (Type[])null, (Type[])null), new HarmonyMethod(typeof(StageMountainShrinesPlugin), "DropRewardsPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static int GetStacksForCurrentStage() { if (!Object.op_Implicit((Object)(object)Run.instance)) { return 0; } int stageClearCount = Run.instance.stageClearCount; if (stageClearCount >= 5 && !ApplyOnLoops.Value) { return 0; } return Mathf.Max(0, StageStacks[stageClearCount % 5].Value); } private static void TeleporterStartPostfix(TeleporterInteraction __instance) { if (NetworkServer.active && Object.op_Implicit((Object)(object)__instance)) { int stacksForCurrentStage = GetStacksForCurrentStage(); if (stacksForCurrentStage > 0) { ((MonoBehaviour)Instance).StartCoroutine(ApplyStacks(__instance, stacksForCurrentStage)); } } } private static IEnumerator ApplyStacks(TeleporterInteraction tp, int stacks) { yield return null; if (!Object.op_Implicit((Object)(object)tp) || addShrineStack == null) { yield break; } int applied = 0; for (int i = 0; i < stacks; i++) { try { addShrineStack.Invoke(tp, null); applied++; } catch (Exception ex) { Log.LogError((object)ex); break; } } AddedStacks marker = ((Component)tp).GetComponent<AddedStacks>() ?? ((Component)tp).gameObject.AddComponent<AddedStacks>(); marker.count += applied; Log.LogInfo((object)("Applied " + applied + " Mountain Shrine stack(s) to teleporter.")); } private static void DropRewardsPrefix(BossGroup __instance) { try { if (ExtraRewards.Value || !NetworkServer.active || !Object.op_Implicit((Object)(object)__instance)) { return; } TeleporterInteraction instance = TeleporterInteraction.instance; if (Object.op_Implicit((Object)(object)instance) && !((Object)(object)instance.bossGroup != (Object)(object)__instance)) { AddedStacks component = ((Component)instance).GetComponent<AddedStacks>(); if (Object.op_Implicit((Object)(object)component) && component.count > 0 && !component.consumed) { __instance.bonusRewardCount = Mathf.Max(0, __instance.bonusRewardCount - component.count); component.consumed = true; } } } catch (Exception ex) { Log.LogError((object)ex); } } } public class AddedStacks : MonoBehaviour { public int count; public bool consumed; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } }