using 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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Drone;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using MinionMeld.Components;
using MinionMeld.Modules;
using On.EntityStates.Drone;
using On.RoR2;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Navigation;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MinionMeld")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bef4e649829c82d5867c47287ee8b6249435c0e7")]
[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.DroneMeld", "DroneMeld", "1.0.7")]
public class MinionMeldPlugin : BaseUnityPlugin
{
public const string PluginGUID = "com.score.DroneMeld";
public const string PluginAuthor = "score";
public const string PluginName = "DroneMeld";
public const string PluginVersion = "1.0.7";
public static ItemDef meldStackItem;
public static bool rooInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
public static MinionMeldPlugin Instance { get; private set; }
public void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
Log.Init(((BaseUnityPlugin)this).Logger);
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);
PluginConfig.Init(((BaseUnityPlugin)this).Config);
Hooks.Init();
}
}
}
namespace MinionMeld.Modules
{
public class Hooks
{
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_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Expected O, but got Unknown
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
CharacterBody.GetDisplayName += new hook_GetDisplayName(CharacterBody_GetDisplayName);
DeathState.OnImpactServer += new hook_OnImpactServer(DeathState_OnImpactServer);
HoldoutZoneController.OnEnable += new hook_OnEnable(HoldoutZoneController_OnEnable);
ScriptedCombatEncounter.BeginEncounter += new hook_BeginEncounter(ScriptedCombatEncounter_BeginEncounter);
CharacterMaster.Respawn += new hook_Respawn(CharacterMaster_Respawn);
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
MasterSummon.Perform += new hook_Perform(MasterSummon_Perform);
DirectorCore.TrySpawnObject += new hook_TrySpawnObject(DirectorCore_TrySpawnObject);
}
private 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)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
CharacterBody result = orig.Invoke(self, footPosition, rotation, wasRevivedMidStage);
if (!PluginConfig.masterBlacklist.Contains(self.masterIndex))
{
MeldingTime.TryAddTeleTurret(self);
}
return result;
}
private 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_006d: 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)
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.Apply(masterIdx, val.masterObjectId, out var newSummon))
{
CharacterBody val2 = (Object.op_Implicit((Object)(object)newSummon) ? newSummon.GetBody() : null);
int itemCount = newSummon.inventory.GetItemCount(MinionMeldPlugin.meldStackItem);
if (Object.op_Implicit((Object)(object)self.inventoryToCopy))
{
newSummon.inventory.CopyEquipmentFrom(self.inventoryToCopy);
newSummon.inventory.CopyItemsFrom(self.inventoryToCopy, self.inventoryItemCopyFilter ?? Inventory.defaultItemCopyFilterDelegate);
}
IInventorySetupCallback inventorySetupCallback = self.inventorySetupCallback;
if (inventorySetupCallback != null)
{
inventorySetupCallback.SetupSummonedInventory(self, newSummon.inventory);
}
int itemCount2 = newSummon.inventory.GetItemCount(MinionMeldPlugin.meldStackItem);
if (itemCount2 != itemCount)
{
newSummon.inventory.GiveItem(MinionMeldPlugin.meldStackItem, itemCount - itemCount2);
}
TeleportingTurret teleportingTurret = default(TeleportingTurret);
if (PluginConfig.teleturret.Value && Object.op_Implicit((Object)(object)val2) && ((Component)val2).TryGetComponent<TeleportingTurret>(ref teleportingTurret))
{
teleportingTurret.RegisterLocation(self.position);
}
return null;
}
newSummon = orig.Invoke(self);
MeldingTime.TryAddTeleTurret(newSummon);
return newSummon;
}
private GameObject DirectorCore_TrySpawnObject(orig_TrySpawnObject orig, DirectorCore self, DirectorSpawnRequest spawnReq)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_006c: 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_0089: 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_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: 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_00e4: 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_0149: 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)
CharacterBody val = default(CharacterBody);
if (spawnReq == null || !Object.op_Implicit((Object)(object)spawnReq.spawnCard) || !Object.op_Implicit((Object)(object)spawnReq.spawnCard.prefab) || !Object.op_Implicit((Object)(object)spawnReq.summonerBodyObject) || !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.Apply(masterIdx, val.masterObjectId, out var newSummon))
{
CharacterBody body = newSummon.GetBody();
TeleportingTurret teleportingTurret = default(TeleportingTurret);
if (PluginConfig.teleturret.Value && Object.op_Implicit((Object)(object)body) && ((Component)body).TryGetComponent<TeleportingTurret>(ref teleportingTurret))
{
Vector3? val2 = MeldingTime.FindSpawnDestination(body, spawnReq.placementRule, spawnReq.rng);
if (val2.HasValue)
{
teleportingTurret.RegisterLocation(val2.Value);
}
}
spawnReq.onSpawnedServer?.Invoke(new SpawnResult
{
spawnedInstance = ((Component)newSummon).gameObject,
spawnRequest = spawnReq,
position = (Object.op_Implicit((Object)(object)body) ? body.corePosition : val.corePosition),
success = true,
rotation = (Object.op_Implicit((Object)(object)body) ? body.transform.rotation : Quaternion.identity)
});
return null;
}
GameObject val3 = orig.Invoke(self, spawnReq);
MeldingTime.TryAddTeleTurret(Object.op_Implicit((Object)(object)val3) ? val3.GetComponent<CharacterMaster>() : null);
return val3;
}
private void HoldoutZoneController_OnEnable(orig_OnEnable orig, HoldoutZoneController self)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
if (!NetworkServer.active)
{
return;
}
foreach (TeleportingTurret instances in TeleportingTurret.instancesList)
{
instances.CreateTeleportNode(((Component)self).transform.position);
}
}
private void ScriptedCombatEncounter_BeginEncounter(orig_BeginEncounter orig, ScriptedCombatEncounter self)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
if (!NetworkServer.active)
{
return;
}
foreach (TeleportingTurret instances in TeleportingTurret.instancesList)
{
instances.CreateTeleportNode(((Component)self).transform.position);
}
}
private string CharacterBody_GetDisplayName(orig_GetDisplayName orig, CharacterBody self)
{
string text = orig.Invoke(self);
if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.master) && Object.op_Implicit((Object)(object)self.master.inventory))
{
int itemCount = self.master.inventory.GetItemCount(MinionMeldPlugin.meldStackItem);
if (itemCount > 0)
{
return $"{text} <style=cStack>x{itemCount + 1}</style>";
}
}
return text;
}
private void DeathState_OnImpactServer(orig_OnImpactServer orig, DeathState self, Vector3 contactPoint)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody.master) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody.master.inventory))
{
num = ((EntityState)self).characterBody.master.inventory.GetItemCount(MinionMeldPlugin.meldStackItem);
}
orig.Invoke(self, contactPoint);
for (int i = 0; i < num; i++)
{
orig.Invoke(self, contactPoint);
}
}
private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
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.meldStackItem);
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 += (float)(itemCount * PluginConfig.statMultCDR.Value) * 0.01f;
}
}
}
}
public static class MeldingTime
{
public enum DronemeldPriorityOrder
{
RoundRobin,
Random,
FirstOnly
}
public static CharacterMaster ApplyPerPlayer(MasterIndex masterIdx, NetworkInstanceId summonerId)
{
//IL_0011: 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)
List<CharacterMaster> list = new List<CharacterMaster>();
DronemeldPriorityOrder value = PluginConfig.priorityOrder.Value;
MinionGroup val = MinionGroup.FindGroup(summonerId);
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)
{
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.meldStackItem)).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)
{
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.meldStackItem)).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_0012: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between Unknown and I4
if (masterIdx == MasterIndex.none || PluginConfig.masterBlacklist.Contains(masterIdx))
{
return false;
}
return (int)(teamIndexOverride.HasValue ? teamIndexOverride.Value : summonerTeam) == 1;
}
public static bool Apply(MasterIndex masterIdx, NetworkInstanceId summonerId, out CharacterMaster newSummon)
{
//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_000d: 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)
newSummon = (PluginConfig.perPlayer.Value ? ApplyPerPlayer(masterIdx, summonerId) : ApplyGlobal(masterIdx));
if (Object.op_Implicit((Object)(object)newSummon))
{
newSummon.inventory.GiveItem(MinionMeldPlugin.meldStackItem, 1);
MasterSuicideOnTimer val = default(MasterSuicideOnTimer);
if (((Component)newSummon).TryGetComponent<MasterSuicideOnTimer>(ref val))
{
((Component)newSummon).gameObject.AddComponent<TimedMeldStack>().Activate(val.lifeTimer - val.timer);
val.timer = 0f;
}
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))
{
int num = 1 + newSummon.inventory.GetItemCount(MinionMeldPlugin.meldStackItem);
body.healthComponent.HealFraction(1f / (float)num, default(ProcChainMask));
((Component)newSummon).gameObject.AddComponent<TimedMeldStack>().Activate((float)itemCount * body.healthComponent.combinedHealthFraction);
}
}
}
return (Object)(object)newSummon != (Object)null;
}
public static void TryAddTeleTurret(CharacterMaster newSummon)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
CharacterBody val = (Object.op_Implicit((Object)(object)newSummon) ? newSummon.GetBody() : null);
if (PluginConfig.teleturret.Value && Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)((Component)val).GetComponent<TeleportingTurret>()) && !PluginConfig.turretBlacklist.Contains(newSummon.masterIndex) && ((!Object.op_Implicit((Object)(object)val.characterMotor) && !Object.op_Implicit((Object)(object)((Component)val).GetComponent<KinematicCharacterMotor>()) && !Object.op_Implicit((Object)(object)((Component)val).GetComponent<RigidbodyMotor>())) || val.baseMoveSpeed <= 0f))
{
((Component)val).gameObject.AddComponent<TeleportingTurret>();
}
}
public static Vector3? FindSpawnDestination(CharacterBody characterBodyOrPrefabComponent, DirectorPlacementRule rule, Xoroshiro128Plus rng)
{
//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_002c: 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_0053: Expected O, but got Unknown
//IL_005e: 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: Expected O, but got Unknown
//IL_00a8: 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_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Expected O, but got Unknown
if (rule == null || rule == null)
{
return null;
}
Vector3? result = null;
SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>();
val.hullSize = characterBodyOrPrefabComponent.hullClassification;
val.nodeGraphType = (GraphType)0;
val.prefab = LegacyResourcesAPI.Load<GameObject>("SpawnCards/HelperPrefab");
GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, rule, rng));
if (!Object.op_Implicit((Object)(object)val2))
{
rule.placementMode = (PlacementMode)3;
val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, rule, rng));
if (!Object.op_Implicit((Object)(object)val2))
{
rule.placementMode = (PlacementMode)5;
val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, rule, rng));
}
}
if (Object.op_Implicit((Object)(object)val2))
{
result = val2.transform.position;
Object.Destroy((Object)(object)val2);
}
Object.Destroy((Object)(object)val);
return result;
}
}
public static class PluginConfig
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static EventHandler <>9__15_1;
public static EventHandler <>9__15_2;
public static hook_Init <>9__15_0;
internal void <Init>b__15_0(orig_Init orig)
{
orig.Invoke();
RebuildBlacklist(masterBlacklist, blacklistOption);
blacklistOption.SettingChanged += delegate
{
RebuildBlacklist(masterBlacklist, blacklistOption);
};
RebuildBlacklist(turretBlacklist, blacklistOption2);
blacklistOption2.SettingChanged += delegate
{
RebuildBlacklist(turretBlacklist, blacklistOption2);
};
}
internal void <Init>b__15_1(object _, EventArgs _)
{
RebuildBlacklist(masterBlacklist, blacklistOption);
}
internal void <Init>b__15_2(object _, EventArgs _)
{
RebuildBlacklist(turretBlacklist, blacklistOption2);
}
}
public static ConfigFile myConfig;
public static ConfigEntry<bool> perPlayer;
public static ConfigEntry<bool> teleturret;
public static ConfigEntry<int> maxDronesPerType;
public static ConfigEntry<MeldingTime.DronemeldPriorityOrder> priorityOrder;
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> blacklistOption;
public static ConfigEntry<string> blacklistOption2;
public static readonly HashSet<MasterIndex> masterBlacklist = new HashSet<MasterIndex>();
public static readonly HashSet<MasterIndex> turretBlacklist = new HashSet<MasterIndex>();
private static void RebuildBlacklist(HashSet<MasterIndex> list, ConfigEntry<string> option)
{
//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_0057: 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_0065: Unknown result type (might be due to invalid IL or missing references)
list.Clear();
if (string.IsNullOrWhiteSpace(option.Value))
{
return;
}
string[] array = option.Value.Split(',');
for (int i = 0; i < array.Length; i++)
{
if (!string.IsNullOrWhiteSpace(array[i]))
{
MasterIndex val = MasterCatalog.FindMasterIndex(array[i].Replace(" ", string.Empty).Replace("(Clone)", string.Empty));
if (val != MasterIndex.none)
{
list.Add(val);
}
}
}
}
public static void Init(ConfigFile cfg)
{
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Expected O, but got Unknown
string section = "Stats";
string section2 = "WhiteList";
myConfig = cfg;
perPlayer = BindOption("General", "Limit Drones Per Player", defaultValue: true, "If false, then the team's collective drones will be limited");
teleturret = BindOption("General", "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)");
maxDronesPerType = BindOptionSlider("General", "Max Drones Per Type", 1, "Max Number of Drones you (or your team) can control of that type before melding is applied.", 1f);
priorityOrder = BindOption("General", "Selection Priority", MeldingTime.DronemeldPriorityOrder.RoundRobin, "Used for deciding which drone should be selected for melding.");
statMultHealth = BindOptionSlider(section, "Health Multiplier", 20, "Stacks additively.", 0f, 200f);
statMultDamage = BindOptionSlider(section, "Damage Multiplier", 20, "Stacks additively.", 0f, 200f);
statMultAttackSpeed = BindOptionSlider(section, "Attack Speed Multiplier", 20, "Stacks additively.", 0f, 200f);
statMultCDR = BindOptionSlider(section, "Cooldown Reduction Multiplier", 20, "Stacks additively.", 0f, 200f);
vfxResize = BindOptionSlider(section, "Size Multiplier", 0, "** DOESNT WORK ** UNDER CONSTRUCTION ** I HATE NETWORKING **", 0f, 200f);
blacklistOption = BindOption(section2, "Blacklist", "DevotedLemurianMaster,DevotedLemurianBruiserMaster,EquipmentDroneMaster,EngiTurretMaster,EngiBeamTurretMaster", "Put the broken shit in here, or just things you want duplicates of. For devotion, download LemurFusion.\r\nTo find these, open the console (Ctrl Alt ~), then type list_ai");
blacklistOption2 = BindOption(section2, "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.");
object obj = <>c.<>9__15_0;
if (obj == null)
{
hook_Init val = delegate(orig_Init orig)
{
orig.Invoke();
RebuildBlacklist(masterBlacklist, blacklistOption);
blacklistOption.SettingChanged += delegate
{
RebuildBlacklist(masterBlacklist, blacklistOption);
};
RebuildBlacklist(turretBlacklist, blacklistOption2);
blacklistOption2.SettingChanged += delegate
{
RebuildBlacklist(turretBlacklist, blacklistOption2);
};
};
<>c.<>9__15_0 = val;
obj = (object)val;
}
MasterCatalog.Init += (hook_Init)obj;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static ConfigEntry<T> BindOption<T>(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 = myConfig.Bind<T>(section, name, defaultValue, description);
if (MinionMeldPlugin.rooInstalled)
{
TryRegisterOption<T>(val, restartRequired);
}
return val;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static ConfigEntry<T> BindOptionSlider<T>(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 = myConfig.Bind<T>(section, name, defaultValue, description);
if (MinionMeldPlugin.rooInstalled)
{
TryRegisterOptionSlider<T>(val2, min, max, restartRequired);
}
return val2;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void InitRoO()
{
ModSettingsManager.SetModDescription("Devotion Artifact but better.");
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public 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)]
public 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.Components
{
[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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
instancesList.Add(this);
storedNodes.Add(((Component)this).transform.position);
currentNode = storedNodes[0];
body = ((Component)this).GetComponent<CharacterBody>();
}
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 = 1f;
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_0067: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: 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_0105: 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)
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 (num > 40000f)
{
Vector3? val3 = TeleportHelper.FindSafeTeleportDestination(position, body, RoR2Application.rng);
if (val3.HasValue)
{
RegisterLocation(val3.Value);
}
else
{
Log.Error("Teleporting turret was unable to create a valid node");
}
}
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);
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_00d6: 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_008d: 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_0093: 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_0080: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: 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_00f6: 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_0107: Expected O, but got Unknown
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: 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_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Expected O, but got Unknown
//IL_0141: 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;
if (footPosition != currentNode)
{
val2 = MeldingTime.FindSpawnDestination(body, new DirectorPlacementRule
{
position = footPosition,
placementMode = (PlacementMode)1
}, RoR2Application.rng);
}
if (!val2.HasValue)
{
val2 = MeldingTime.FindSpawnDestination(body, new DirectorPlacementRule
{
position = destination,
placementMode = (PlacementMode)1
}, RoR2Application.rng);
}
if (val2.HasValue)
{
RegisterLocation(val2.Value);
}
else
{
Log.Error("Failed to create turret teleport node for " + ((Object)body).name);
}
}
}
[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()
{
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.meldStackItem, 1);
}
Object.Destroy((Object)(object)this);
}
}
}
}