Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of MinionMeld v1.1.6
MinionMeld.dll
Decompiled 7 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Drone; using HG.Reflection; using HarmonyLib; using IL.RoR2; using KinematicCharacterController; using Microsoft.CodeAnalysis; using MinionMeld.Components; using MinionMeld.Modules; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.Drone; using On.RoR2; using On.RoR2.Projectile; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Navigation; using RoR2.Projectile; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MinionMeld")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d808189e9c86db39e2909241d682fc507309536a")] [assembly: AssemblyProduct("MinionMeld")] [assembly: AssemblyTitle("MinionMeld")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MinionMeld { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(string data) { _logSource.LogDebug((object)data); } internal static void Error(string data) { _logSource.LogError((object)data); } internal static void Fatal(string data) { _logSource.LogFatal((object)data); } internal static void Info(string data) { _logSource.LogInfo((object)data); } internal static void Message(string data) { _logSource.LogMessage((object)data); } internal static void Warning(string data) { _logSource.LogWarning((object)data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.score.MinionMeld", "MinionMeld", "1.1.6")] public class MinionMeldPlugin : BaseUnityPlugin { public const string PluginGUID = "com.score.MinionMeld"; public const string PluginAuthor = "score"; public const string PluginName = "MinionMeld"; public const string PluginVersion = "1.1.6"; public static ItemDef meldStackItem; internal Harmony harmonyPatcher; public static bool RooInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); public static MinionMeldPlugin Instance { get; private set; } public static ItemIndex meldStackIndex => meldStackItem.itemIndex; public void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) Instance = this; harmonyPatcher = new Harmony("com.score.MinionMeld"); Log.Init(((BaseUnityPlugin)this).Logger); PluginConfig.Init(((BaseUnityPlugin)this).Config); meldStackItem = ScriptableObject.CreateInstance<ItemDef>(); meldStackItem.deprecatedTier = (ItemTier)5; meldStackItem.canRemove = true; meldStackItem.hidden = true; meldStackItem.nameToken = "ITEM_MINIONMELD_STACK_NAME"; meldStackItem.loreToken = ""; meldStackItem.descriptionToken = ""; meldStackItem.pickupToken = ""; ((Object)meldStackItem).name = "MinionMeldInternalStackItem"; meldStackItem.tags = (ItemTag[])(object)new ItemTag[2] { (ItemTag)11, (ItemTag)12 }; ContentAddition.AddItemDef(meldStackItem); Hooks.Init(); TurretHooks.Init(); MultiEquipDrone.Init(); } } public static class PluginConfig { public static ConfigEntry<bool> perPlayer; public static ConfigEntry<bool> teleturret; public static ConfigEntry<bool> respawnSummon; public static ConfigEntry<int> maxDronesPerType; public static ConfigEntry<bool> enableTurretLeash; public static ConfigEntry<int> minionLeashRange; public static ConfigEntry<MeldingTime.DronemeldPriorityOrder> priorityOrder; public static ConfigEntry<bool> disableTeamCollision; public static ConfigEntry<bool> disableProjectileCollision; public static ConfigEntry<int> statMultHealth; public static ConfigEntry<int> statMultDamage; public static ConfigEntry<int> statMultAttackSpeed; public static ConfigEntry<int> statMultCDR; public static ConfigEntry<int> vfxResize; public static ConfigEntry<string> blacklistMasters; public static ConfigEntry<string> blacklistTurrets; public static ConfigEntry<bool> printMasterNames; public static ConfigEntry<bool> useWhitelist; public static ConfigEntry<string> whitelistMasters; public static ConfigEntry<string> whitelistTurrets; public static readonly HashSet<MasterIndex> MasterBlacklist = new HashSet<MasterIndex>(); public static readonly HashSet<MasterIndex> TurretBlacklist = new HashSet<MasterIndex>(); public static readonly HashSet<MasterIndex> MasterWhitelist = new HashSet<MasterIndex>(); public static readonly HashSet<MasterIndex> TurretWhitelist = new HashSet<MasterIndex>(); private static readonly Regex StringFilter = new Regex("\\s", RegexOptions.Compiled); [SystemInitializer(new Type[] { typeof(MasterCatalog) })] private static void Init() { string permaBlackList = "DevotedLemurianMaster,DevotedLemurianBruiserMaster,NemMercCloneMaster,"; RebuildBlacklist(MasterBlacklist, permaBlackList + blacklistMasters.Value); blacklistMasters.SettingChanged += delegate { RebuildBlacklist(MasterBlacklist, permaBlackList + blacklistMasters.Value); }; RebuildBlacklist(TurretBlacklist, blacklistTurrets.Value); blacklistTurrets.SettingChanged += delegate { RebuildBlacklist(TurretBlacklist, blacklistTurrets.Value); }; RebuildBlacklist(MasterWhitelist, whitelistMasters.Value); whitelistMasters.SettingChanged += delegate { RebuildBlacklist(MasterWhitelist, whitelistMasters.Value); }; RebuildBlacklist(TurretWhitelist, whitelistTurrets.Value); whitelistTurrets.SettingChanged += delegate { RebuildBlacklist(TurretWhitelist, whitelistTurrets.Value); }; static void RebuildBlacklist(HashSet<MasterIndex> list, string option) { //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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) list.Clear(); option = StringFilter.Replace(option, (Match match) => string.Empty); if (!string.IsNullOrEmpty(option)) { string[] array = option.Split(','); foreach (string text in array) { if (!string.IsNullOrEmpty(text)) { string text2 = text.Replace("(Clone)", string.Empty); MasterIndex val = MasterCatalog.FindMasterIndex(text2); if (val == MasterIndex.none) { val = MasterCatalog.FindMasterIndex(text2 + "Master"); } if (val != MasterIndex.none) { list.Add(val); } } } } } } public static void Init(ConfigFile cfg) { string section = "General"; string section2 = "Stats"; string section3 = "BlackList"; string section4 = "WhiteList"; perPlayer = cfg.BindOption(section, "Limit Drones Per Player", defaultValue: true, "If false, then the team's collective drones will be limited"); teleturret = cfg.BindOption(section, "Teleporting Turrets", defaultValue: true, "Turrets, Squids, etc (anything immobile) remember their previous spawn locations and follow when you start a scripted combat event (teleporter, mithrix etc)"); respawnSummon = cfg.BindOption(section, "Spawn In New Location", defaultValue: true, "Summoned allies will 'respawn' in the location that that they are summoned."); maxDronesPerType = cfg.BindOptionSlider(section, "Max Minions Per Type", 1, "Max Number of Minions you (or your team) can control of that type before melding is applied.", 1f); enableTurretLeash = cfg.BindOption(section, "Enable Turret Leash", defaultValue: true, "Allows turrets to teleport to their owner when too far."); minionLeashRange = cfg.BindOptionSlider(section, "Minion Leash Range", 200, "Max distance a minion should be from their owner before teleporting. Applies to turrets.", 50f, 1000f); priorityOrder = cfg.BindOption(section, "Selection Priority", MeldingTime.DronemeldPriorityOrder.RoundRobin, "Used for deciding which drone should be selected for melding."); disableTeamCollision = cfg.BindOption(section, "Disable Minion Collision", defaultValue: true, "Allows you to walk through any minions.", restartRequired: true); disableProjectileCollision = cfg.BindOption(section, "Disable Team Attack Collision", defaultValue: false, "Lightweight filter to allow all teammate bullets and projectiles to pass through allies. Should be disabled for certain characters to function correctly.", restartRequired: true); statMultHealth = cfg.BindOptionSlider(section2, "Health Multiplier", 20, "Stacks additively.", 0f, 200f); statMultDamage = cfg.BindOptionSlider(section2, "Damage Multiplier", 20, "Stacks additively.", 0f, 200f); statMultAttackSpeed = cfg.BindOptionSlider(section2, "Attack Speed Multiplier", 20, "Stacks additively.", 0f, 200f); statMultCDR = cfg.BindOptionSlider(section2, "Cooldown Reduction Multiplier", 20, "Stacks additively.", 0f, 200f); vfxResize = cfg.BindOptionSlider(section2, "Size Multiplier", 20, "Visual size increase per meld, in percent. Stacks additively.", 0f, 200f); blacklistMasters = cfg.BindOption(section3, "Blacklist", "EngiTurretMaster,EngiWalkerTurretMaster,GhoulMaster,TombstoneMaster", "Put the broken shit in here, or just things you want duplicates of. For Devotion Artifact, download LemurFusion.\r\nTo find these, download the DebugToolKit mod, open the console (Ctrl Alt ~), then type list_ai or enable the print option below."); blacklistTurrets = cfg.BindOption(section3, "Blacklist Teleporting Turret", "", "Makes teleporting turret component unable to be applied to these guys. Typically applied to characters without the ability to move on their own."); printMasterNames = cfg.BindOption(section3, "Print Master Names To Console", defaultValue: true, "Prints the name to the console (Ctrl Alt ~) when preforming a successful meld. Helpful for setting up the blacklist."); useWhitelist = cfg.BindOption(section4, "Use Whitelist", defaultValue: false, "Use a custom whitelist of allowed CharacterMaster names instead of the default blacklist."); whitelistMasters = cfg.BindOption(section4, "Whitelist", "", "CharacterMaster names that should be allowed to meld. Teleporting turrets will not be affected by this list."); whitelistTurrets = cfg.BindOption(section4, "Whitelist Teleporting Turret", "", "CharacterMaster names of the immobile turret-like allies that should teleport around with you during combat events."); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static ConfigEntry<T> BindOption<T>(this ConfigFile cfg, string section, string name, T defaultValue, string description = "", bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry<T> val = cfg.Bind<T>(section, name, defaultValue, description); if (MinionMeldPlugin.RooInstalled) { TryRegisterOption<T>(val, restartRequired); } return val; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static ConfigEntry<T> BindOptionSlider<T>(this ConfigFile cfg, string section, string name, T defaultValue, string description = "", float min = 0f, float max = 20f, bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } string text = description; T val = defaultValue; description = text + " (Default: " + val?.ToString() + ")"; if (restartRequired) { description += " (restart required)"; } ConfigEntry<T> val2 = cfg.Bind<T>(section, name, defaultValue, description); if (MinionMeldPlugin.RooInstalled) { TryRegisterOptionSlider<T>(val2, min, max, restartRequired); } return val2; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void InitRoO() { ModSettingsManager.SetModDescription("Devotion Artifact but better."); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void TryRegisterOption<T>(ConfigEntry<T> entry, bool restartRequired) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown if (entry is ConfigEntry<string> val) { ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(val, restartRequired)); } else if (entry is ConfigEntry<float> val2) { ModSettingsManager.AddOption((BaseOption)new SliderOption(val2, new SliderConfig { min = 0f, max = 20f, FormatString = "{0:0.00}", restartRequired = restartRequired })); } else if (entry is ConfigEntry<int> val3) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption(val3, restartRequired)); } else if (entry is ConfigEntry<bool> val4) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val4, restartRequired)); } else if (entry is ConfigEntry<KeyboardShortcut> val5) { ModSettingsManager.AddOption((BaseOption)new KeyBindOption(val5, restartRequired)); } else if (typeof(T).IsEnum) { ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)entry, restartRequired)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void TryRegisterOptionSlider<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired) { //IL_000b: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown if (entry is ConfigEntry<int> val) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption(val, new IntSliderConfig { min = (int)min, max = (int)max, formatString = "{0:0.00}", restartRequired = restartRequired })); } else if (entry is ConfigEntry<float> val2) { ModSettingsManager.AddOption((BaseOption)new SliderOption(val2, new SliderConfig { min = min, max = max, FormatString = "{0:0.00}", restartRequired = restartRequired })); } } } } namespace MinionMeld.Modules { public class Hooks { [CompilerGenerated] private static class <>O { public static Action<CharacterBody> <0>__CharacterBody_ResizeBody; public static hook_Perform <1>__MasterSummon_Perform; public static hook_TrySpawnObject <2>__DirectorCore_TrySpawnObject; public static hook_DefaultFilterCallbackImplementation <3>__BulletAttack_DefaultFilterCallbackImplementation; public static hook_IgnoreCollisionsWithOwner <4>__ProjectileController_IgnoreCollisionsWithOwner; } private const string SPAWN_STRING = "{0} | Spawning Meldable Minion: {1}"; private const string MELD_STRING = "{0} | Performing Minion Meld: {1}"; public static Hooks Instance { get; private set; } public static void Init() { if (Instance == null) { Instance = new Hooks(); } } private Hooks() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown CharacterBody.GetDisplayName += new hook_GetDisplayName(CharacterBody_GetDisplayName); CharacterBody.onBodyStartGlobal += CharacterBody_ResizeBody; CharacterBody.onBodyInventoryChangedGlobal += CharacterBody_ResizeBody; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); object obj = <>O.<1>__MasterSummon_Perform; if (obj == null) { hook_Perform val = MasterSummon_Perform; <>O.<1>__MasterSummon_Perform = val; obj = (object)val; } MasterSummon.Perform += (hook_Perform)obj; object obj2 = <>O.<2>__DirectorCore_TrySpawnObject; if (obj2 == null) { hook_TrySpawnObject val2 = DirectorCore_TrySpawnObject; <>O.<2>__DirectorCore_TrySpawnObject = val2; obj2 = (object)val2; } DirectorCore.TrySpawnObject += (hook_TrySpawnObject)obj2; if (PluginConfig.disableProjectileCollision.Value) { object obj3 = <>O.<3>__BulletAttack_DefaultFilterCallbackImplementation; if (obj3 == null) { hook_DefaultFilterCallbackImplementation val3 = BulletAttack_DefaultFilterCallbackImplementation; <>O.<3>__BulletAttack_DefaultFilterCallbackImplementation = val3; obj3 = (object)val3; } BulletAttack.DefaultFilterCallbackImplementation += (hook_DefaultFilterCallbackImplementation)obj3; object obj4 = <>O.<4>__ProjectileController_IgnoreCollisionsWithOwner; if (obj4 == null) { hook_IgnoreCollisionsWithOwner val4 = ProjectileController_IgnoreCollisionsWithOwner; <>O.<4>__ProjectileController_IgnoreCollisionsWithOwner = val4; obj4 = (object)val4; } ProjectileController.IgnoreCollisionsWithOwner += (hook_IgnoreCollisionsWithOwner)obj4; } } private static bool BulletAttack_DefaultFilterCallbackImplementation(orig_DefaultFilterCallbackImplementation orig, BulletAttack bulletAttack, ref BulletHit hitInfo) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (orig.Invoke(bulletAttack, ref hitInfo)) { TeamComponent val = default(TeamComponent); if (Object.op_Implicit((Object)(object)hitInfo.hitHurtBox) && Object.op_Implicit((Object)(object)hitInfo.hitHurtBox.healthComponent) && Object.op_Implicit((Object)(object)bulletAttack.owner) && bulletAttack.owner.TryGetComponent<TeamComponent>(ref val) && (int)val.teamIndex == 1) { return FriendlyFireManager.ShouldDirectHitProceed(hitInfo.hitHurtBox.healthComponent, val.teamIndex); } return true; } return false; } private static void ProjectileController_IgnoreCollisionsWithOwner(orig_IgnoreCollisionsWithOwner orig, ProjectileController self, bool shouldIgnore) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 orig.Invoke(self, shouldIgnore); if (!shouldIgnore || !PluginConfig.disableProjectileCollision.Value || (int)FriendlyFireManager.friendlyFireMode != 0 || (int)self.teamFilter.teamIndex != 1 || self.myColliders.Length == 0 || !Object.op_Implicit((Object)(object)self.owner)) { return; } foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { if (!((Object)(object)((Component)teamMember).gameObject != (Object)(object)self.owner) || !Object.op_Implicit((Object)(object)teamMember.body) || !Object.op_Implicit((Object)(object)teamMember.body.hurtBoxGroup)) { continue; } HurtBox[] hurtBoxes = teamMember.body.hurtBoxGroup.hurtBoxes; for (int i = 0; i < hurtBoxes.Length; i++) { for (int j = 0; j < self.myColliders.Length; j++) { Physics.IgnoreCollision(hurtBoxes[i].collider, self.myColliders[j], true); } } } } private static CharacterMaster MasterSummon_Perform(orig_Perform orig, MasterSummon self) { //IL_0044: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_00a3: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = default(CharacterBody); if (!Object.op_Implicit((Object)(object)self.masterPrefab) || !Object.op_Implicit((Object)(object)self.summonerBodyObject) || !self.summonerBodyObject.TryGetComponent<CharacterBody>(ref val) || !Object.op_Implicit((Object)(object)val.master)) { return orig.Invoke(self); } MasterIndex masterIdx = MasterCatalog.FindMasterIndex(self.masterPrefab); if (!MeldingTime.CanApply(masterIdx, val.teamComponent.teamIndex, self.teamIndexOverride)) { return orig.Invoke(self); } if (MeldingTime.PerformMeld(masterIdx, val.master, out var newSummon)) { TeleportingTurret teleportingTurret = default(TeleportingTurret); if (PluginConfig.teleturret.Value && newSummon.hasBody && newSummon.bodyInstanceObject.TryGetComponent<TeleportingTurret>(ref teleportingTurret)) { teleportingTurret.RegisterLocation(self.position); } else if (PluginConfig.respawnSummon.Value) { TeleportHelper.TeleportBody(newSummon.GetBody(), self.position, false); } MeldingTime.HandleInventory(self, newSummon, newSummon.inventory); if (PluginConfig.printMasterNames.Value) { Log.Info(string.Format("{0} | Performing Minion Meld: {1}", "MasterSummon", ((Object)newSummon).name)); } return newSummon; } newSummon = orig.Invoke(self); if (Object.op_Implicit((Object)(object)newSummon)) { MeldingTime.InitMinion(newSummon); if (PluginConfig.printMasterNames.Value) { Log.Info(string.Format("{0} | Spawning Meldable Minion: {1}", "MasterSummon", ((Object)newSummon).name)); } } return newSummon; } private static GameObject DirectorCore_TrySpawnObject(orig_TrySpawnObject orig, DirectorCore self, DirectorSpawnRequest spawnReq) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_0166: 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_00f2: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = default(CharacterBody); if (!Object.op_Implicit((Object)(object)spawnReq?.spawnCard) || !Object.op_Implicit((Object)(object)spawnReq.spawnCard.prefab) || !Object.op_Implicit((Object)(object)spawnReq.summonerBodyObject) || spawnReq.placementRule == null || !spawnReq.summonerBodyObject.TryGetComponent<CharacterBody>(ref val) || !Object.op_Implicit((Object)(object)val.master)) { return orig.Invoke(self, spawnReq); } MasterIndex masterIdx = MasterCatalog.FindMasterIndex(spawnReq.spawnCard.prefab); if (!MeldingTime.CanApply(masterIdx, val.teamComponent.teamIndex, spawnReq.teamIndexOverride)) { return orig.Invoke(self, spawnReq); } if (MeldingTime.PerformMeld(masterIdx, val.master, out var newSummon)) { CharacterBody body = newSummon.GetBody(); if (Object.op_Implicit((Object)(object)body)) { Vector3? val2 = MeldingTime.FindSpawnDestination(body, spawnReq.placementRule, spawnReq.rng); if (val2.HasValue) { TeleportingTurret teleportingTurret = default(TeleportingTurret); if (PluginConfig.teleturret.Value && ((Component)body).TryGetComponent<TeleportingTurret>(ref teleportingTurret)) { teleportingTurret.RegisterLocation(val2.Value); } else if (PluginConfig.respawnSummon.Value) { TeleportHelper.TeleportBody(body, val2.Value, false); } } MeldingTime.HandleInventory(spawnReq, newSummon.inventory, new SpawnResult { spawnedInstance = ((Component)newSummon).gameObject, spawnRequest = spawnReq, position = body.footPosition, success = true, rotation = body.transform.rotation }); } if (PluginConfig.printMasterNames.Value) { Log.Info(string.Format("{0} | Performing Minion Meld: {1}", "DirectorCore", ((Object)newSummon).name)); } return ((Component)newSummon).gameObject; } GameObject val3 = orig.Invoke(self, spawnReq); newSummon = (Object.op_Implicit((Object)(object)val3) ? val3.GetComponent<CharacterMaster>() : null); if (Object.op_Implicit((Object)(object)newSummon)) { MeldingTime.InitMinion(newSummon); if (PluginConfig.printMasterNames.Value) { Log.Info(string.Format("{0} | Spawning Meldable Minion: {1}", "DirectorCore", ((Object)val3).name)); } } return val3; } private static void CharacterBody_ResizeBody(CharacterBody body) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if (PluginConfig.vfxResize.Value <= 0 || !NetworkClient.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory)) { return; } int itemCount = body.inventory.GetItemCount(MinionMeldPlugin.meldStackIndex); if (itemCount > 0 && Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform)) { GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(body.bodyIndex); ModelLocator val = (Object.op_Implicit((Object)(object)bodyPrefab) ? bodyPrefab.GetComponent<ModelLocator>() : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.modelTransform)) { Vector3 localScale = val.modelTransform.localScale; float num = (float)itemCount * ((float)PluginConfig.vfxResize.Value * 0.01f); body.modelLocator.modelTransform.localScale = localScale + localScale * num; } } } private string CharacterBody_GetDisplayName(orig_GetDisplayName orig, CharacterBody self) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) string text = orig.Invoke(self); if (Object.op_Implicit((Object)(object)self.inventory)) { int itemCount = self.inventory.GetItemCount(MinionMeldPlugin.meldStackIndex); if (itemCount > 0) { return $"{text} <style=cStack>x{itemCount + 1}</style>"; } } return text; } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.master) && Object.op_Implicit((Object)(object)sender.master.inventory)) { int itemCount = sender.master.inventory.GetItemCount(MinionMeldPlugin.meldStackIndex); if (itemCount > 0) { args.baseHealthAdd += (sender.baseMaxHealth + sender.levelMaxHealth * sender.level) * (float)itemCount * (float)PluginConfig.statMultHealth.Value * 0.01f; args.baseDamageAdd += (sender.baseDamage + sender.levelDamage * sender.level) * (float)itemCount * (float)PluginConfig.statMultDamage.Value * 0.01f; args.baseAttackSpeedAdd += (sender.baseAttackSpeed + sender.levelAttackSpeed * sender.level) * (float)itemCount * (float)PluginConfig.statMultAttackSpeed.Value * 0.01f; args.cooldownMultAdd -= Util.ConvertAmplificationPercentageIntoReductionNormalized((float)(itemCount * PluginConfig.statMultCDR.Value) * 0.01f); } } } } public static class MeldingTime { public enum DronemeldPriorityOrder { RoundRobin, Random, FirstOnly } public static void HandleInventory(DirectorSpawnRequest spawnReq, Inventory inventory, SpawnResult result) { //IL_0001: 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) //IL_0038: 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_0052: 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) int itemCount = inventory.GetItemCount(MinionMeldPlugin.meldStackIndex); inventory.itemAcquisitionOrder.Clear(); inventory.itemStacks = ItemCatalog.RequestItemStackArray(); inventory.itemAcquisitionOrder.Add(MinionMeldPlugin.meldStackIndex); inventory.itemStacks[MinionMeldPlugin.meldStackIndex] = itemCount; spawnReq.onSpawnedServer?.Invoke(result); int itemCount2 = inventory.GetItemCount(MinionMeldPlugin.meldStackIndex); inventory.GiveItem(MinionMeldPlugin.meldStackIndex, itemCount - itemCount2); } public static void HandleInventory(MasterSummon self, CharacterMaster newSummon, Inventory inventory) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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) int itemCount = inventory.GetItemCount(MinionMeldPlugin.meldStackIndex); if (Object.op_Implicit((Object)(object)self.inventoryToCopy)) { inventory.CopyItemsFrom(self.inventoryToCopy, self.inventoryItemCopyFilter ?? Inventory.defaultItemCopyFilterDelegate); } else { inventory.itemAcquisitionOrder.Clear(); inventory.itemStacks = ItemCatalog.RequestItemStackArray(); inventory.itemAcquisitionOrder.Add(MinionMeldPlugin.meldStackIndex); inventory.itemStacks[MinionMeldPlugin.meldStackIndex] = itemCount; } IInventorySetupCallback inventorySetupCallback = self.inventorySetupCallback; if (inventorySetupCallback != null) { inventorySetupCallback.SetupSummonedInventory(self, inventory); } self.preSpawnSetupCallback?.Invoke(newSummon); int itemCount2 = inventory.GetItemCount(MinionMeldPlugin.meldStackIndex); inventory.GiveItem(MinionMeldPlugin.meldStackIndex, itemCount - itemCount2); } public static CharacterMaster ApplyPerPlayer(MasterIndex masterIdx, CharacterMaster summonerMaster) { //IL_0012: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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) List<CharacterMaster> list = new List<CharacterMaster>(); DronemeldPriorityOrder value = PluginConfig.priorityOrder.Value; NetworkInstanceId netId = ((NetworkBehaviour)summonerMaster).netId; if (Object.op_Implicit((Object)(object)summonerMaster.minionOwnership.ownerMaster)) { netId = ((NetworkBehaviour)summonerMaster.minionOwnership.ownerMaster).netId; } MinionGroup val = MinionGroup.FindGroup(netId); if (val != null) { MinionOwnership[] members = val.members; foreach (MinionOwnership val2 in members) { if (!Object.op_Implicit((Object)(object)val2)) { continue; } CharacterMaster component = ((Component)val2).GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory) && component.masterIndex == masterIdx && !component.IsDeadAndOutOfLivesServer()) { if (value == DronemeldPriorityOrder.FirstOnly) { return component; } list.Add(component); } } } if (list.Any() && list.Count >= PluginConfig.maxDronesPerType.Value) { return (CharacterMaster)(value switch { DronemeldPriorityOrder.RoundRobin => list.OrderBy((CharacterMaster m) => m.inventory.GetItemCount(MinionMeldPlugin.meldStackIndex)).FirstOrDefault(), DronemeldPriorityOrder.Random => list.ElementAtOrDefault(Random.Range(0, list.Count)), _ => null, }); } return null; } public static CharacterMaster ApplyGlobal(MasterIndex masterIdx) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) List<CharacterMaster> list = new List<CharacterMaster>(); DronemeldPriorityOrder value = PluginConfig.priorityOrder.Value; foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1)) { if (!Object.op_Implicit((Object)(object)teamMember) || !Object.op_Implicit((Object)(object)teamMember.body)) { continue; } CharacterMaster master = teamMember.body.master; if (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory) && master.masterIndex == masterIdx && !master.IsDeadAndOutOfLivesServer()) { if (value == DronemeldPriorityOrder.FirstOnly) { return master; } list.Add(master); } } if (list.Any() && list.Count >= PluginConfig.maxDronesPerType.Value) { return (CharacterMaster)(value switch { DronemeldPriorityOrder.RoundRobin => list.OrderBy((CharacterMaster m) => m.inventory.GetItemCount(MinionMeldPlugin.meldStackIndex)).FirstOrDefault(), DronemeldPriorityOrder.Random => list.ElementAtOrDefault(Random.Range(0, list.Count)), _ => null, }); } return null; } public static bool CanApply(MasterIndex masterIdx, TeamIndex summonerTeam, TeamIndex? teamIndexOverride) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (masterIdx != MasterIndex.none && (int)(teamIndexOverride.HasValue ? teamIndexOverride.Value : summonerTeam) == 1) { if (PluginConfig.useWhitelist.Value) { return PluginConfig.MasterWhitelist.Contains(masterIdx); } return !PluginConfig.MasterBlacklist.Contains(masterIdx); } return false; } public static bool CanApplyTurret(CharacterMaster master) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0016: 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_004a: 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_005c: Unknown result type (might be due to invalid IL or missing references) if (PluginConfig.teleturret.Value && (int)master.teamIndex == 1 && master.masterIndex != MasterIndex.none) { if (PluginConfig.useWhitelist.Value) { return PluginConfig.TurretWhitelist.Contains(master.masterIndex); } if (!PluginConfig.MasterBlacklist.Contains(master.masterIndex)) { return !PluginConfig.TurretBlacklist.Contains(master.masterIndex); } return false; } return false; } public static bool PerformMeld(MasterIndex masterIdx, CharacterMaster summonerMaster, out CharacterMaster newSummon) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) newSummon = (PluginConfig.perPlayer.Value ? ApplyPerPlayer(masterIdx, summonerMaster) : ApplyGlobal(masterIdx)); if (Object.op_Implicit((Object)(object)newSummon)) { newSummon.inventory.GiveItem(MinionMeldPlugin.meldStackIndex, 1); MasterSuicideOnTimer val = default(MasterSuicideOnTimer); if (((Component)newSummon).TryGetComponent<MasterSuicideOnTimer>(ref val)) { ((Component)newSummon).gameObject.AddComponent<TimedMeldStack>().Activate(val.lifeTimer - val.timer); Object.Destroy((Object)(object)val); } int itemCount = newSummon.inventory.GetItemCount(Items.HealthDecay); if (itemCount > 0) { CharacterBody body = newSummon.GetBody(); if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent)) { ((Component)newSummon).gameObject.AddComponent<TimedMeldStack>().Activate((float)itemCount * body.healthComponent.combinedHealthFraction); int num = 1 + newSummon.inventory.GetItemCount(MinionMeldPlugin.meldStackIndex); body.healthComponent.HealFraction(1f / (float)num, default(ProcChainMask)); } } } return (Object)(object)newSummon != (Object)null; } public static void InitMinion(CharacterMaster newSummon) { CharacterBody body = newSummon.GetBody(); if (!Object.op_Implicit((Object)(object)body)) { return; } if (PluginConfig.disableTeamCollision.Value) { ((Component)body).gameObject.layer = LayerIndex.fakeActor.intVal; if (Object.op_Implicit((Object)(object)body.characterMotor)) { ((BaseCharacterController)body.characterMotor).Motor.RebuildCollidableLayers(); } } if (CanApplyTurret(newSummon)) { TryAddTeleTurret(body); } } public static void TryAddTeleTurret(CharacterBody body) { if (PluginConfig.teleturret.Value && Object.op_Implicit((Object)(object)body) && !Object.op_Implicit((Object)(object)((Component)body).GetComponent<TeleportingTurret>()) && ((!Object.op_Implicit((Object)(object)body.characterMotor) && !Object.op_Implicit((Object)(object)((Component)body).GetComponent<KinematicCharacterMotor>()) && !Object.op_Implicit((Object)(object)((Component)body).GetComponent<RigidbodyMotor>())) || body.baseMoveSpeed <= 0f)) { ((Component)body).gameObject.AddComponent<TeleportingTurret>(); } } public static Vector3? FindSpawnDestination(CharacterBody characterBodyOrPrefabComponent, DirectorPlacementRule rule, Xoroshiro128Plus rng) { //IL_000f: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Vector3? result = null; SpawnCard obj = ScriptableObject.CreateInstance<SpawnCard>(); obj.hullSize = characterBodyOrPrefabComponent.hullClassification; obj.nodeGraphType = (GraphType)0; obj.prefab = LegacyResourcesAPI.Load<GameObject>("SpawnCards/HelperPrefab"); DirectorSpawnRequest val = new DirectorSpawnRequest(obj, rule, rng); GameObject val2 = DirectorCore.instance.TrySpawnObject(val); if (!Object.op_Implicit((Object)(object)val2)) { if ((int)val.placementRule.placementMode < 2) { val.placementRule.placementMode = (PlacementMode)2; val2 = DirectorCore.instance.TrySpawnObject(val); } if (!Object.op_Implicit((Object)(object)val2)) { val.placementRule.placementMode = (PlacementMode)5; val2 = DirectorCore.instance.TrySpawnObject(val); } } if (Object.op_Implicit((Object)(object)val2)) { result = val2.transform.position; Object.Destroy((Object)(object)val2); } Object.Destroy((Object)(object)obj); return result; } } public static class TurretHooks { [CompilerGenerated] private static class <>O { public static hook_OnImpactServer <0>__DeathState_OnImpactServer; public static hook_Respawn <1>__CharacterMaster_Respawn; public static hook_TrackInteractions <2>__HalcyoniteShrineInteractable_TrackInteractions; public static hook_OnEnable <3>__HoldoutZoneController_OnEnable; public static hook_BeginEncounter <4>__ScriptedCombatEncounter_BeginEncounter; } private static bool _initialized; public static void Init() { //IL_001e: 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_0029: Expected O, but got Unknown //IL_003e: 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: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown if (!_initialized) { _initialized = true; object obj = <>O.<0>__DeathState_OnImpactServer; if (obj == null) { hook_OnImpactServer val = DeathState_OnImpactServer; <>O.<0>__DeathState_OnImpactServer = val; obj = (object)val; } DeathState.OnImpactServer += (hook_OnImpactServer)obj; object obj2 = <>O.<1>__CharacterMaster_Respawn; if (obj2 == null) { hook_Respawn val2 = CharacterMaster_Respawn; <>O.<1>__CharacterMaster_Respawn = val2; obj2 = (object)val2; } CharacterMaster.Respawn += (hook_Respawn)obj2; object obj3 = <>O.<2>__HalcyoniteShrineInteractable_TrackInteractions; if (obj3 == null) { hook_TrackInteractions val3 = HalcyoniteShrineInteractable_TrackInteractions; <>O.<2>__HalcyoniteShrineInteractable_TrackInteractions = val3; obj3 = (object)val3; } HalcyoniteShrineInteractable.TrackInteractions += (hook_TrackInteractions)obj3; object obj4 = <>O.<3>__HoldoutZoneController_OnEnable; if (obj4 == null) { hook_OnEnable val4 = HoldoutZoneController_OnEnable; <>O.<3>__HoldoutZoneController_OnEnable = val4; obj4 = (object)val4; } HoldoutZoneController.OnEnable += (hook_OnEnable)obj4; object obj5 = <>O.<4>__ScriptedCombatEncounter_BeginEncounter; if (obj5 == null) { hook_BeginEncounter val5 = ScriptedCombatEncounter_BeginEncounter; <>O.<4>__ScriptedCombatEncounter_BeginEncounter = val5; obj5 = (object)val5; } ScriptedCombatEncounter.BeginEncounter += (hook_BeginEncounter)obj5; } } private static void HalcyoniteShrineInteractable_TrackInteractions(orig_TrackInteractions orig, HalcyoniteShrineInteractable self) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); UpdateTurretPositions(((Component)self).transform.position); } private static void HoldoutZoneController_OnEnable(orig_OnEnable orig, HoldoutZoneController self) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); UpdateTurretPositions(((Component)self).transform.position); } private static void ScriptedCombatEncounter_BeginEncounter(orig_BeginEncounter orig, ScriptedCombatEncounter self) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); UpdateTurretPositions(((Component)self).transform.position); } private static void UpdateTurretPositions(Vector3 newPosition) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } foreach (TeleportingTurret instances in TeleportingTurret.instancesList) { instances.CreateTeleportNode(newPosition); } } private static CharacterBody CharacterMaster_Respawn(orig_Respawn orig, CharacterMaster self, Vector3 footPosition, Quaternion rotation, bool wasRevivedMidStage) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = orig.Invoke(self, footPosition, rotation, wasRevivedMidStage); if (MeldingTime.CanApplyTurret(self)) { MeldingTime.TryAddTeleTurret(val); } return val; } private static void DeathState_OnImpactServer(orig_OnImpactServer orig, DeathState self, Vector3 contactPoint) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, contactPoint); Inventory val = (Object.op_Implicit((Object)(object)((EntityState)self).characterBody) ? ((EntityState)self).characterBody.inventory : null); if (Object.op_Implicit((Object)(object)val)) { int itemCount = val.GetItemCount(MinionMeldPlugin.meldStackIndex); for (int i = 1; i < itemCount; i++) { orig.Invoke(self, contactPoint); } } } } } namespace MinionMeld.Components { public class MultiEquipDrone { [CompilerGenerated] private static class <>O { public static Action<EquipmentSlot, EquipmentIndex> <0>__ActivateAllEquipment; public static hook_SetEquipment <1>__Inventory_SetEquipment; } public static MultiEquipDrone Instance { get; private set; } public static void Init() { if (Instance == null) { Instance = new MultiEquipDrone(); } } private MultiEquipDrone() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //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_0052: Expected O, but got Unknown EquipmentSlot.onServerEquipmentActivated += ActivateAllEquipment; CharacterBody.OnInventoryChanged += new Manipulator(CharacterBody_OnInventoryChanged); object obj = <>O.<1>__Inventory_SetEquipment; if (obj == null) { hook_SetEquipment val = Inventory_SetEquipment; <>O.<1>__Inventory_SetEquipment = val; obj = (object)val; } Inventory.SetEquipment += (hook_SetEquipment)obj; } private static void Inventory_SetEquipment(orig_SetEquipment orig, Inventory self, EquipmentState equipmentState, uint slot) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || self.GetItemCount(MinionMeldPlugin.meldStackIndex) <= 0 || (int)equipmentState.equipmentIndex == -1 || (int)self.GetEquipment(slot).equipmentIndex == -1) { orig.Invoke(self, equipmentState, slot); return; } for (uint num = 0u; num < self.equipmentStateSlots.Length; num++) { if (self.equipmentStateSlots[num].equipmentIndex == equipmentState.equipmentIndex) { orig.Invoke(self, equipmentState, num); return; } } for (uint num2 = (uint)self.equipmentStateSlots.Length; num2 > slot; num2--) { EquipmentState equipment = self.GetEquipment(num2 - 1); if (self.SetEquipmentInternal(equipment, num2)) { ((NetworkBehaviour)self).SetDirtyBit(16u); self.HandleInventoryChanged(); if (self.spawnedOverNetwork) { self.CallRpcClientEquipmentChanged(equipment.equipmentIndex, num2); } } } orig.Invoke(self, equipmentState, slot); if (self.activeEquipmentSlot == slot) { return; } EquipmentDef equipmentDef = self.GetEquipment(slot).equipmentDef; if (Object.op_Implicit((Object)(object)equipmentDef) && equipmentDef.cooldown > 0f) { EquipmentDef equipmentDef2 = self.currentEquipmentState.equipmentDef; if (!Object.op_Implicit((Object)(object)equipmentDef2) || equipmentDef2.cooldown <= 0f || equipmentDef.cooldown < equipmentDef2.cooldown) { self.SetActiveEquipmentSlot((byte)slot); } } } private static void ActivateAllEquipment(EquipmentSlot self, EquipmentIndex equipmentIndex) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } Inventory val = (Object.op_Implicit((Object)(object)self.characterBody) ? self.characterBody.inventory : null); if (!Object.op_Implicit((Object)(object)val) || val.GetItemCount(MinionMeldPlugin.meldStackIndex) <= 0) { return; } int equipmentSlotCount = val.GetEquipmentSlotCount(); if (equipmentSlotCount <= 1) { return; } for (uint num = 0u; num < equipmentSlotCount; num++) { if (num != val.activeEquipmentSlot) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val.GetEquipment(num).equipmentIndex); if (Object.op_Implicit((Object)(object)equipmentDef) && equipmentDef.cooldown > 0f) { self.PerformEquipmentAction(equipmentDef); } } } } private void CharacterBody_OnInventoryChanged(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.MatchStfld<CharacterBody>(x, "statsDirty") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<CharacterBody>>((Action<CharacterBody>)delegate(CharacterBody body) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (body.inventory.GetItemCount(MinionMeldPlugin.meldStackIndex) > 0) { for (uint num = 0u; num < body.inventory.GetEquipmentSlotCount(); num++) { BuffDef val2 = body.inventory.GetEquipment(num).equipmentDef?.passiveBuffDef; if (Object.op_Implicit((Object)(object)val2) && !body.HasBuff(val2)) { body.AddBuff(val2); } } } }); } else { Log.Error("MinionMeld.CharacterBody_OnInventoryChanged: ILHook failed."); } } } [RequireComponent(typeof(CharacterBody))] public class TeleportingTurret : MonoBehaviour { private readonly List<Vector3> storedNodes = new List<Vector3>(); private CharacterBody body; private CharacterBody ownerBody; private float teleportAttemptTimer; private Vector3 currentNode; public static List<TeleportingTurret> instancesList = new List<TeleportingTurret>(); private void OnEnable() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) instancesList.Add(this); body = ((Component)this).GetComponent<CharacterBody>(); storedNodes.Add(body.footPosition); currentNode = body.footPosition; } private void OnDisable() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) instancesList.Remove(this); currentNode = Vector3.zero; storedNodes.Clear(); } public void FixedUpdate() { if (!Object.op_Implicit((Object)(object)ownerBody)) { CharacterMaster master = body.master; CharacterMaster val = (Object.op_Implicit((Object)(object)master) ? master.minionOwnership.ownerMaster : null); ownerBody = (Object.op_Implicit((Object)(object)val) ? val.GetBody() : null); } teleportAttemptTimer -= Time.fixedDeltaTime; if (!(teleportAttemptTimer > 0f)) { teleportAttemptTimer = 2f; CheckNodesForTeleport(); } } public void RegisterLocation(Vector3 pos) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_004b: Unknown result type (might be due to invalid IL or missing references) foreach (Vector3 storedNode in storedNodes) { Vector3 val = storedNode - pos; if (((Vector3)(ref val)).sqrMagnitude < 400f) { return; } } storedNodes.Add(pos); teleportAttemptTimer = 0f; } private void CheckNodesForTeleport() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_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_004f: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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) if (!Object.op_Implicit((Object)(object)ownerBody) || !Object.op_Implicit((Object)(object)body)) { return; } HealthComponent healthComponent = body.healthComponent; if (healthComponent == null || !healthComponent.alive) { return; } Vector3 val = currentNode; Vector3 position = ownerBody.transform.position; Vector3 val2 = val - position; float num = ((Vector3)(ref val2)).sqrMagnitude; if (PluginConfig.enableTurretLeash.Value && num > (float)(PluginConfig.minionLeashRange.Value * PluginConfig.minionLeashRange.Value)) { Vector3? val3 = MeldingTime.FindSpawnDestination(body, new DirectorPlacementRule { position = position, placementMode = (PlacementMode)1 }, RoR2Application.rng); if (val3.HasValue) { RegisterLocation(val3.Value); } } foreach (Vector3 storedNode in storedNodes) { val2 = storedNode - position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val = storedNode; } } if (currentNode != val) { TeleportHelper.TeleportGameObject(((Component)this).gameObject, val); ((Component)this).transform.rotation = Quaternion.identity; currentNode = val; } } public void CreateTeleportNode(Vector3 destination) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0093: 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) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { return; } HealthComponent healthComponent = body.healthComponent; if (healthComponent == null || !healthComponent.alive) { return; } Vector3 footPosition = currentNode; Vector3 val = footPosition - destination; float num = ((Vector3)(ref val)).sqrMagnitude; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance.body)) { if ((Object)(object)instance.body == (Object)(object)ownerBody) { footPosition = ownerBody.footPosition; } val = instance.body.footPosition - destination; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; footPosition = instance.body.footPosition; } } } Vector3? val2 = null; DirectorPlacementRule val3 = new DirectorPlacementRule { position = footPosition, placementMode = (PlacementMode)1 }; if (footPosition != currentNode) { val2 = MeldingTime.FindSpawnDestination(body, val3, RoR2Application.rng); } val3.position = destination; if (!val2.HasValue) { val2 = MeldingTime.FindSpawnDestination(body, val3, RoR2Application.rng); } if (val2.HasValue) { RegisterLocation(val2.Value); return; } Log.Message("Failed to create turret teleport node for " + ((Object)body).name); teleportAttemptTimer = 10f; } } [RequireComponent(typeof(CharacterMaster))] public class TimedMeldStack : MonoBehaviour { private float stopwatch; private bool started; public void Activate(float time) { if (!started) { stopwatch = time; started = true; } } private void FixedUpdate() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (!started) { return; } stopwatch -= Time.fixedDeltaTime; if (stopwatch <= 0f) { CharacterMaster component = ((Component)this).GetComponent<CharacterMaster>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory)) { component.inventory.RemoveItem(MinionMeldPlugin.meldStackIndex, 1); } Deployable val = default(Deployable); if (((Component)this).TryGetComponent<Deployable>(ref val)) { val.OnDestroy(); Object.Destroy((Object)(object)val); } Object.Destroy((Object)(object)this); } } } }