using System;
using System.Collections;
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.Logging;
using HG;
using HG.Reflection;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API.AddressReferencedAssets;
using R2API.AutoVersionGen;
using R2API.Utils;
using RoR2;
using RoR2.ExpansionManagement;
using UnityEngine;
[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("R2API.Director")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.3.2.0")]
[assembly: AssemblyInformationalVersion("2.3.2+618e5c79de15afc414a1027c35b944a0b92fe2e8")]
[assembly: AssemblyProduct("R2API.Director")]
[assembly: AssemblyTitle("R2API.Director")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.3.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[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 System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
}
namespace R2API
{
[CreateAssetMenu(fileName = "New AddressableDCCSPool", menuName = "R2API/DirectorAPI/AddressableDCCSPool")]
public class AddressableDCCSPool : ScriptableObject
{
[Serializable]
public class PoolEntry
{
[Tooltip("The DCCS for this pool entry")]
public AddressableDirectorCardCategorySelection dccs;
[Tooltip("An address or a Direct reference to an existing Family Director Card Category Selection")]
public AddressReferencedFamilyDirectorCardCategorySelection familyDccs;
[Tooltip("The weight of this pool entry relative to the others")]
public float weight;
internal virtual PoolEntry Upgrade()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_003d: Expected O, but got Unknown
return new PoolEntry
{
dccs = (DirectorCardCategorySelection)(((AddressReferencedAsset<FamilyDirectorCardCategorySelection>)(object)familyDccs).AssetExists ? ((object)((AddressReferencedAsset<FamilyDirectorCardCategorySelection>)(object)familyDccs).Asset) : ((object)dccs.targetCardCategorySelection)),
weight = weight
};
}
}
[Serializable]
public class ConditionalPoolEntry : PoolEntry
{
[Tooltip("ALL expansions in this list must be enabled for this run for this entry to be considered")]
public AddressReferencedExpansionDef[] requiredExpansions = Array.Empty<AddressReferencedExpansionDef>();
internal override PoolEntry Upgrade()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
return (PoolEntry)new ConditionalPoolEntry
{
dccs = (DirectorCardCategorySelection)(((AddressReferencedAsset<FamilyDirectorCardCategorySelection>)(object)familyDccs).AssetExists ? ((object)((AddressReferencedAsset<FamilyDirectorCardCategorySelection>)(object)familyDccs).Asset) : ((object)dccs.targetCardCategorySelection)),
requiredExpansions = requiredExpansions.Select((AddressReferencedExpansionDef x) => ((AddressReferencedAsset<ExpansionDef>)(object)x).Asset).ToArray(),
weight = weight
};
}
}
[Serializable]
public class Category
{
[Tooltip("A name to help identify this category")]
public string name;
[Tooltip("The weight of all entries in this category relative to the sibling categories")]
public float categoryWeight;
[Tooltip("These entries are always considered")]
public PoolEntry[] alwaysIncluded = Array.Empty<PoolEntry>();
[Tooltip("These entries are only considered if their individual conditions are met")]
public ConditionalPoolEntry[] includedIfConditionsMet = Array.Empty<ConditionalPoolEntry>();
[Tooltip("These entries are considered only if no entries from 'includedIfConditionsMet' have been includedd")]
public PoolEntry[] includedIfNoConditionsMet = Array.Empty<PoolEntry>();
internal Category Upgrade()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
return new Category
{
name = name,
categoryWeight = categoryWeight,
alwaysIncluded = alwaysIncluded.Select((PoolEntry x) => x.Upgrade()).ToArray(),
includedIfConditionsMet = includedIfConditionsMet.Select((ConditionalPoolEntry x) => x.Upgrade()).Cast<ConditionalPoolEntry>().ToArray(),
includedIfNoConditionsMet = includedIfNoConditionsMet.Select((PoolEntry x) => x.Upgrade()).ToArray()
};
}
}
private static HashSet<AddressableDCCSPool> instances = new HashSet<AddressableDCCSPool>();
[Tooltip("The DccsPool that will be overwritten with the values stored in this AddressableDCCSPool")]
public DccsPool targetPool;
[Tooltip("The categories for this pool")]
public Category[] poolCategories = Array.Empty<Category>();
[SystemInitializer(new Type[] { })]
private static void SystemInitializer()
{
AddressReferencedAsset.OnAddressReferencedAssetsLoaded += delegate
{
foreach (AddressableDCCSPool instance in instances)
{
instance.Upgrade();
}
};
}
private void Upgrade()
{
Category[] array = poolCategories.Select((Category x) => x.Upgrade()).ToArray();
targetPool.poolCategories = array;
poolCategories = null;
}
private void Awake()
{
instances.Add(this);
}
private void OnDestroy()
{
instances.Remove(this);
}
}
[Serializable]
public class AddressableDirectorCard
{
[Tooltip("The spawn card for this DirectorCard")]
public AddressReferencedSpawnCard spawnCard;
[Tooltip("The weight of this director card relative to other cards")]
public int selectionWeight;
[Tooltip("The distance used for spawning this card, used for monsters")]
public MonsterSpawnDistance spawnDistance;
public bool preventOverhead;
[Tooltip("The minimum amount of stages that need to be completed before this Card can be spawned")]
public int minimumStageCompletions;
[Tooltip("This unlockableDef must be unlocked for this Card to spawn")]
public AddressReferencedUnlockableDef requiredUnlockableDef;
[Tooltip("This unlockableDef cannot be unlocked for this Card to spawn")]
public AddressReferencedUnlockableDef forbiddenUnlockableDef;
internal DirectorCard Upgrade()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: 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_0022: 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_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)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
return new DirectorCard
{
spawnCard = AddressReferencedSpawnCard.op_Implicit(spawnCard),
selectionWeight = selectionWeight,
spawnDistance = spawnDistance,
preventOverhead = preventOverhead,
minimumStageCompletions = minimumStageCompletions,
requiredUnlockableDef = AddressReferencedUnlockableDef.op_Implicit(requiredUnlockableDef),
forbiddenUnlockableDef = AddressReferencedUnlockableDef.op_Implicit(forbiddenUnlockableDef)
};
}
}
[CreateAssetMenu(fileName = "New AddressableDirectorCardCategorySelection", menuName = "R2API/DirectorAPI/AddressableDirectorCardCategorySelection")]
public class AddressableDirectorCardCategorySelection : ScriptableObject
{
[Serializable]
public struct Category
{
[Tooltip("The name of this category")]
public string name;
[Tooltip("The DirectorCards for this category")]
public AddressableDirectorCard[] cards;
[Tooltip("The weight of this category relative to the other categories")]
public float selectionWeight;
internal Category Upgrade()
{
//IL_0002: 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)
Category result = default(Category);
result.name = name;
result.cards = cards.Select((AddressableDirectorCard x) => x.Upgrade()).ToArray();
result.selectionWeight = selectionWeight;
return result;
}
}
private static HashSet<AddressableDirectorCardCategorySelection> instances = new HashSet<AddressableDirectorCardCategorySelection>();
[Tooltip("The DirectorCardCategorySelection that will be overridedn with the values stored in this AddressableDirectorCardCategorySelection")]
public DirectorCardCategorySelection targetCardCategorySelection;
[Tooltip("The categories for this AddressableDirectorCardCategorySelection")]
public Category[] categories = Array.Empty<Category>();
private void Upgrade()
{
targetCardCategorySelection.categories = categories.Select((Category x) => x.Upgrade()).ToArray();
categories = null;
}
private void Awake()
{
instances.Add(this);
}
private void OnDestroy()
{
instances.Remove(this);
}
[SystemInitializer(new Type[] { })]
private static void SystemInitializer()
{
AddressReferencedAsset.OnAddressReferencedAssetsLoaded += delegate
{
foreach (AddressableDirectorCardCategorySelection instance in instances)
{
instance.Upgrade();
}
};
}
}
[AutoVersion]
public static class DirectorAPI
{
public enum MonsterCategory
{
Invalid,
Custom,
BasicMonsters,
Minibosses,
Champions,
Special
}
public enum InteractableCategory
{
Invalid,
Custom,
Chests,
Barrels,
Shrines,
Drones,
Misc,
Rare,
Duplicator,
VoidStuff,
StormStuff
}
[Flags]
public enum Stage : long
{
Custom = 1L,
TitanicPlains = 2L,
DistantRoost = 4L,
WetlandAspect = 8L,
AbandonedAqueduct = 0x10L,
RallypointDelta = 0x20L,
ScorchedAcres = 0x40L,
AbyssalDepths = 0x80L,
SirensCall = 0x100L,
GildedCoast = 0x200L,
MomentFractured = 0x400L,
Bazaar = 0x800L,
VoidCell = 0x1000L,
MomentWhole = 0x2000L,
SkyMeadow = 0x4000L,
ArtifactReliquary = 0x8000L,
Commencement = 0x10000L,
SunderedGrove = 0x20000L,
AphelianSanctuary = 0x40000L,
AphelianSanctuarySimulacrum = 0x80000L,
AbyssalDepthsSimulacrum = 0x100000L,
RallypointDeltaSimulacrum = 0x200000L,
TitanicPlainsSimulacrum = 0x400000L,
AbandonedAqueductSimulacrum = 0x800000L,
CommencementSimulacrum = 0x1000000L,
SkyMeadowSimulacrum = 0x2000000L,
SiphonedForest = 0x4000000L,
SulfurPools = 0x8000000L,
VoidLocus = 0x10000000L,
ThePlanetarium = 0x20000000L,
VerdantFalls = 0x40000000L,
ViscousFalls = 0x80000000L,
ArtifactReliquary_AphelianSanctuary_Theme = 0x100000000L,
ArtifactReliquary_AbandonedAqueduct_Theme = 0x200000000L,
ArtifactReliquary_ScorchedAcres_Theme = 0x400000000L,
ShatteredAbodes = 0x800000000L,
DisturbedImpact = 0x1000000000L,
ReformedAltar = 0x2000000000L,
TreebornColony = 0x4000000000L,
GoldenDieback = 0x8000000000L,
HelminthHatchery = 0x10000000000L,
PrimeMeridian = 0x20000000000L
}
[Serializable]
public struct StageSerde
{
public long Value;
public StageSerde(long value)
{
Value = value;
}
public static implicit operator StageSerde(Stage enumValue)
{
return new StageSerde((long)enumValue);
}
public static implicit operator Stage(StageSerde stageSerde)
{
return (Stage)stageSerde.Value;
}
}
public struct StageInfo
{
public Stage stage;
public string CustomStageName;
public static StageInfo ParseInternalStageName(string internalStageName)
{
SetHooks();
StageInfo result = default(StageInfo);
result.stage = DirectorAPI.ParseInternalStageName(internalStageName);
result.CustomStageName = ((result.stage == Stage.Custom) ? "" : internalStageName);
return result;
}
public string ToInternalStageName()
{
SetHooks();
string text = DirectorAPI.ToInternalStageName(stage);
if (!(text == ""))
{
return text;
}
return CustomStageName;
}
public bool CheckStage(Stage stage, params string[] customStageNames)
{
SetHooks();
if (!stage.HasFlag(this.stage))
{
return false;
}
if (this.stage == Stage.Custom && customStageNames.Length != 0)
{
return customStageNames.Contains(CustomStageName);
}
return true;
}
}
public class StageSettings
{
public int SceneDirectorMonsterCredits;
public int SceneDirectorInteractableCredits;
public Dictionary<GameObject, int>? BonusCreditObjects;
public Dictionary<DirectorCardCategorySelection, Dictionary<string, float>> MonsterCategoryWeightsPerDccs;
public Dictionary<DirectorCardCategorySelection, Dictionary<string, float>> InteractableCategoryWeightsPerDccs;
}
public class DirectorCardHolder
{
public DirectorCard? Card;
public MonsterCategory MonsterCategory;
public string CustomMonsterCategory;
public float MonsterCategorySelectionWeight = 1f;
public InteractableCategory InteractableCategory;
public string CustomInteractableCategory;
public float InteractableCategorySelectionWeight = 1f;
public bool IsMonster => MonsterCategory != MonsterCategory.Invalid;
public bool IsInteractable => InteractableCategory != InteractableCategory.Invalid;
public bool IsValid()
{
SetHooks();
if (InteractableCategory == InteractableCategory.Invalid && MonsterCategory == MonsterCategory.Invalid)
{
return false;
}
return true;
}
public void ThrowIfInvalid()
{
SetHooks();
if (!IsValid())
{
throw new Exception("Both DirectorCardHolder.InteractableCategory and DirectorCardHolder.MonsterCategory are invalid");
}
}
public string GetCategoryName()
{
SetHooks();
ThrowIfInvalid();
if (InteractableCategory == InteractableCategory.Invalid)
{
if (MonsterCategory == MonsterCategory.Custom)
{
return CustomMonsterCategory;
}
return Helpers.GetVanillaMonsterCategoryName(MonsterCategory);
}
if (InteractableCategory == InteractableCategory.Custom)
{
return CustomInteractableCategory;
}
return Helpers.GetVanillaInteractableCategoryName(InteractableCategory);
}
}
public class MonsterFamilyHolder
{
public Dictionary<string, List<DirectorCard>> MonsterCategoryToMonsterCards;
public Dictionary<string, float> MonsterCategoryToSelectionWeights;
public int MinStageCompletion;
public int MaxStageCompletion;
public float FamilySelectionWeight;
public string? SelectionChatString;
}
public static class Helpers
{
public static class MonsterNames
{
public static readonly string Beetle = "cscbeetle";
public static readonly string BeetleGuard = "cscbeetleguard";
public static readonly string BeetleQueen = "cscbeetlequeen";
public static readonly string BrassContraption = "cscbell";
public static readonly string BighornBison = "cscbison";
public static readonly string Mithrix = "cscbrother";
public static readonly string MithrixHurt = "cscbrotherhurt";
public static readonly string ClayDunestrider = "cscclayboss";
public static readonly string ClayTemplar = "cscclaybruiser";
public static readonly string StrikeDrone = "cscbackupdrone";
public static readonly string GunnerDrone = "cscdrone1";
public static readonly string HealingDrone = "cscdrone2";
public static readonly string TC280Prototype = "cscmegadrone";
public static readonly string OverloadingWorm = "cscelectricworm";
public static readonly string StoneGolem = "cscgolem";
public static readonly string Grandparent = "cscgrandparent";
public static readonly string Grovetender = "cscgravekeeper";
public static readonly string GreaterWisp = "cscgreaterwisp";
public static readonly string HermitCrab = "cschermitcrab";
public static readonly string Imp = "cscimp";
public static readonly string ImpOverlord = "cscimpboss";
public static readonly string Jellyfish = "cscjellyfish";
public static readonly string Lemurian = "csclemurian";
public static readonly string ElderLemurian = "csclemurianbruiser";
public static readonly string LunarChimeraExploder = "csclunarexploder";
public static readonly string LunarChimeraGolem = "csclunargolem";
public static readonly string LunarChimeraWisp = "csclunarwisp";
public static readonly string MagmaWorm = "cscmagmaworm";
public static readonly string MiniMushrum = "cscminimushroom";
public static readonly string VoidReaver = "cscnullifier";
public static readonly string VoidReaverAlly = "cscnullifierally";
public static readonly string Parent = "cscparent";
public static readonly string SolusControlUnit = "cscroboballboss";
public static readonly string SolusProbe = "cscroboballmini";
public static readonly string AlloyWorshipUnit = "cscsuperroboballboss";
public static readonly string Scavenger = "cscscav";
public static readonly string ScavengerBoss = "cscscavboss";
public static readonly string TwiptwiptheDevotee = "cscscavlunar";
public static readonly string StoneTitan = "csctitanblackbeach";
public static readonly string StoneTitanAbyssalDepths = "csctitandampcave";
public static readonly string StoneTitanGolemPlains = "csctitangolemplains";
public static readonly string StoneTitanAbandonedAqueduct = "csctitangoolake";
public static readonly string Aurelionite = "csctitangold";
public static readonly string WanderingVagrant = "cscvagrant";
public static readonly string AlloyVulture = "cscvulture";
public static readonly string LesserWisp = "csclesserwisp";
public static readonly string BeetleGuardAlly = "cscbeetleguardally";
public static readonly string DelightedProbe = "cscroboballgreenbuddy";
public static readonly string QuietProbe = "cscroboballredbuddy";
public static readonly string SquidTurret = "cscsquidturret";
public static readonly string AurelioniteAlly = "csctitangoldally";
public static readonly string Larva = "cscacidlarva";
public static readonly string Assassin = "cscassassin2";
public static readonly string ClayApothecary = "cscclaygrenadier";
public static readonly string ColDroneman = "cscdronecommander";
public static readonly string BlindPest = "cscflyingvermin";
public static readonly string BlindPestSnowy = "cscflyingverminsnowy";
public static readonly string Geep = "cscgeepbody";
public static readonly string Gip = "cscgipbody";
public static readonly string Gup = "cscgupbody";
public static readonly string MAJORCONSTRUCT_BODY_NAME = "cscmajorconstruct";
public static readonly string XiConstruct = "cscmegaconstruct";
public static readonly string AlphaConstruct = "cscminorconstruct";
public static readonly string AlphaConstructAttachable = "cscminorconstructattachable";
public static readonly string AlphaConstructOnKill = "cscminorconstructonkill";
public static readonly string BlindVermin = "cscvermin";
public static readonly string BlindVerminSnowy = "cscverminsnowy";
public static readonly string VoidBarnacle = "cscvoidbarnacle";
public static readonly string VoidBarnacleAlly = "cscvoidbarnacleally";
public static readonly string VoidBarnacleNoCast = "cscvoidbarnaclenocast";
public static readonly string VoidJailer = "cscvoidjailer";
public static readonly string VoidJailerAlly = "cscvoidjailerally";
public static readonly string VoidDevastator = "cscvoidmegacrab";
public static readonly string Voidling = "cscvoidraidcrab";
public static readonly string VoidlingJoint = "cscvoidraidcrabjoint";
public static readonly string VoidlingBase = "cscminivoidraidcrabbase";
public static readonly string VoidlingPhase1 = "cscminivoidraidcrabphase1";
public static readonly string VoidlingPhase2 = "cscminivoidraidcrabphase2";
public static readonly string VoidlingPhase3 = "cscminivoidraidcrabphase3";
public static readonly string VoidInfestor = "cscvoidinfestor";
public static readonly string MithrixInfiniteTower = "cscbrotherit";
public static readonly string ArchWisp = "cscarchwisp";
public static readonly string BeetleCrystal = "cscbeetlecrystal";
public static readonly string BeetleGuardCrystal = "cscbeetleguardcrystal";
public static readonly string MithrixGlass = "cscbrotherglass";
public static readonly string AncestralPod = "cscparentpod";
}
public static class MonsterPoolCategories
{
public static readonly string Standard = "Standard";
public static readonly float StandardWeight = 0.98f;
public static readonly string Family = "Family";
public static readonly float FamilyWeight = 0.02f;
public static readonly string VoidInvasion = "VoidInvasion";
public static readonly float VoidInvasionWeight = 0.02f;
}
public static class InteractablePoolCategories
{
public static readonly string Standard = "Standard";
public static readonly float StandardWeight = 1f;
}
public static class InteractableNames
{
public static readonly string BrokenGunnerDrone = "iscbrokendrone1";
public static readonly string BrokenHealingDrone = "iscbrokendrone2";
public static readonly string BrokenEmergencyDrone = "iscbrokenemergencydrone";
public static readonly string BrokenEquipmentDrone = "iscbrokenequipmentdrone";
public static readonly string BrokenIncineratorDrone = "iscbrokenflamedrone";
public static readonly string BrokenTC280 = "iscbrokenmegadrone";
public static readonly string BrokenMissileDrone = "iscbrokenmissiledrone";
public static readonly string BrokenGunnerTurret = "iscbrokenturret1";
public static readonly string ScavengersSack = "iscscavbackpack";
public static readonly string ScavengersLunarSack = "iscscavlunarbackpack";
public static readonly string Barrel = "iscbarrel1";
public static readonly string AdaptiveChest = "isccasinochest";
public static readonly string ChestDamage = "isccategorychestdamage";
public static readonly string ChestHealing = "isccategorychesthealing";
public static readonly string ChestUtility = "isccategorychestutility";
public static readonly string Chest = "iscchest1";
public static readonly string CloakedChest = "iscchest1stealthed";
public static readonly string LargeChest = "iscchest2";
public static readonly string Printer3D = "iscduplicator";
public static readonly string Printer3DLarge = "iscduplicatorlarge";
public static readonly string PrinterMiliTech = "iscduplicatormilitary";
public static readonly string PrinterOvergrown3D = "iscduplicatorwild";
public static readonly string EquipmentBarrel = "iscequipmentbarrel";
public static readonly string LegendaryChest = "iscgoldchest";
public static readonly string LunarPod = "isclunarchest";
public static readonly string GoldPortal = "iscgoldshoresportal";
public static readonly string CelestialPortal = "iscmsportal";
public static readonly string BluePortal = "iscshopportal";
public static readonly string RadioScanner = "iscradartower";
public static readonly string Scrapper = "iscscrapper";
public static readonly string ShrineOfBlood = "iscshrineblood";
public static readonly string ShrineOfBloodSandy = "iscshrinebloodsandy";
public static readonly string ShrineOfBloodSnowy = "iscshrinebloodsnowy";
public static readonly string ShrineOftheMountain = "iscshrineboss";
public static readonly string ShrineOftheMountainSandy = "iscshrinebosssandy";
public static readonly string ShrineOftheMountainSnowy = "iscshrinebosssnowy";
public static readonly string ShrineOfChance = "iscshrinechance";
public static readonly string ShrineOfChanceSandy = "iscshrinechancesandy";
public static readonly string ShrineOfChanceSnowy = "iscshrinechancesnowy";
public static readonly string CleansingPool = "iscshrinecleanse";
public static readonly string CleansingPoolSandy = "iscshrinecleansesandy";
public static readonly string CleansingPoolSnowy = "iscshrinecleansesnowy";
public static readonly string ShrineOfCombat = "iscshrinecombat";
public static readonly string ShrineOfCombatSandy = "iscshrinecombatsandy";
public static readonly string ShrineOfCombatSnowy = "iscshrinecombatsnowy";
public static readonly string AltarOfGold = "iscshrinegoldshoresaccess";
public static readonly string ShrineOftheWoods = "iscshrinehealing";
public static readonly string ShrineOfOrder = "iscshrinerestack";
public static readonly string ShrineOfOrderSandy = "iscshrinerestacksandy";
public static readonly string ShrineOfOrderSnowy = "iscshrinerestacksnowy";
public static readonly string PrimordialTeleporter = "isclunarteleporter";
public static readonly string Teleporter = "iscteleporter";
public static readonly string TripleShop = "isctripleshop";
public static readonly string TripleShopEquipment = "isctripleshopequipment";
public static readonly string TripleShopLarge = "isctripleshoplarge";
public static readonly string HalcyonBeacon = "iscgoldshoresbeacon";
public static readonly string VoidRaidSafeWard = "iscvoidraidsafeward";
public static readonly string InfinitePortal = "iscinfinitetowerportal";
public static readonly string AssessmentFocus = "iscinfinitetowersafeward";
public static readonly string AssessmentFocusAwaitingInteraction = "iscinfinitetowersafewardawaitinginteraction";
public static readonly string LargeChestDamage = "isccategorychest2damage";
public static readonly string LargeChestHealing = "isccategorychest2healing";
public static readonly string LargeChestUtility = "isccategorychest2utility";
public static readonly string DeepVoidPortal = "iscdeepvoidportal";
public static readonly string DeepVoidSignal = "iscdeepvoidportalbattery";
public static readonly string VoidPortal = "iscvoidportal";
public static readonly string VoidSeed = "iscvoidcamp";
public static readonly string VoidCradle = "iscvoidchest";
public static readonly string Stalk = "iscvoidcoinbarrel";
public static readonly string VoidOutroPortal = "iscvoidoutroportal";
public static readonly string NewtAltar = "iscvoidsuppressor";
public static readonly string VoidPotential = "iscvoidtriple";
public static readonly string FreeChestMultiShop = "iscfreechest";
public static readonly string EncrustedLockbox = "isclockboxvoid";
public static readonly string GauntletEntranceOrb = "iscgauntletentrance";
public static readonly string SquidTurretMaster = "iscsquidturret";
public static readonly string RustyLockbox = "isclockbox";
}
public static void TryApplyChangesNow()
{
SetHooks();
ClassicStageInfo.instance.ApplyChanges();
ClassicStageInfo.instance.RebuildCards((DirectorCardCategorySelection)null, (DirectorCardCategorySelection)null);
}
public static void PreventElites(string? monsterName, bool elitesAllowed)
{
string monsterName2 = monsterName;
SetHooks();
MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage)
{
if (Object.op_Implicit((Object)(object)dccsPool))
{
ForEachPoolEntryInDccsPool(dccsPool, delegate(PoolEntry poolEntry)
{
PreventElitesForPoolEntry(monsterName2, elitesAllowed, poolEntry);
});
}
foreach (DirectorCardHolder mixEnemyArtifactMonster in mixEnemyArtifactMonsters)
{
PreventElite(monsterName2, elitesAllowed, mixEnemyArtifactMonster.Card);
}
};
static void PreventElite(string? monsterName, bool elitesAllowed, DirectorCard card)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if (string.Equals(((Object)card.spawnCard).name, monsterName, StringComparison.InvariantCultureIgnoreCase))
{
((CharacterSpawnCard)card.spawnCard).noElites = elitesAllowed;
}
}
static void PreventElitesForPoolEntry(string? monsterName, bool elitesAllowed, PoolEntry poolEntry)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
Category[] categories = poolEntry.dccs.categories;
for (int i = 0; i < categories.Length; i++)
{
DirectorCard[] cards = categories[i].cards;
foreach (DirectorCard card2 in cards)
{
PreventElite(monsterName, elitesAllowed, card2);
}
}
}
}
[Obsolete("Use the overload with the DirectorCardHolder instead")]
public static void AddNewMonster(DirectorCard? monsterCard, MonsterCategory monsterCategory)
{
SetHooks();
AddNewMonster(new DirectorCardHolder
{
Card = monsterCard,
MonsterCategory = monsterCategory
}, addToFamilies: false);
}
public static void AddNewMonster(DirectorCardHolder? monsterCard, bool addToFamilies)
{
SetHooks();
AddNewMonster(monsterCard, addToFamilies, null);
}
public static void AddNewMonster(DirectorCardHolder? monsterCard, bool addToFamilies, Predicate<DirectorCardCategorySelection> predicate)
{
DirectorCardHolder monsterCard2 = monsterCard;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
SetHooks();
MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage)
{
AddNewMonster(dccsPool, mixEnemyArtifactMonsters, monsterCard2, addToFamilies, predicate2);
};
}
public static void AddNewMonster(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, DirectorCardHolder monsterCardHolder, bool addToFamilies)
{
SetHooks();
AddNewMonster(dccsPool, mixEnemyArtifactMonsters, monsterCardHolder, addToFamilies, null);
}
public static void AddNewMonster(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, DirectorCardHolder monsterCardHolder, bool addToFamilies, Predicate<DirectorCardCategorySelection> predicate)
{
DccsPool dccsPool2 = dccsPool;
DirectorCardHolder monsterCardHolder2 = monsterCardHolder;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
SetHooks();
if (Object.op_Implicit((Object)(object)dccsPool2))
{
ForEachPoolCategoryInDccsPool(dccsPool2, delegate(Category poolCategory)
{
bool num = IsNotAFamilyCategory(poolCategory, dccsPool2.poolCategories.Length);
bool flag = !num;
bool flag2 = addToFamilies && flag;
if (num || flag2)
{
ForEachPoolEntryInDccsPoolCategory(poolCategory, delegate(PoolEntry poolEntry)
{
AddMonsterToPoolEntry(monsterCardHolder2, poolEntry, predicate2);
});
}
});
}
mixEnemyArtifactMonsters?.Add(monsterCardHolder2);
}
private static bool IsNotAFamilyCategory(Category poolCategory, int poolCategoryCount)
{
if (poolCategoryCount > 1 && !string.IsNullOrWhiteSpace(poolCategory.name))
{
return poolCategory.name == MonsterPoolCategories.Standard;
}
return true;
}
private static void AddMonsterToPoolEntry(DirectorCardHolder monsterCardHolder, PoolEntry poolEntry, Predicate<DirectorCardCategorySelection> predicate)
{
if ((predicate != null && predicate(poolEntry.dccs)) || predicate == null)
{
poolEntry.dccs.AddCard(monsterCardHolder);
}
}
[Obsolete("Use the overload with the DirectorCardHolder instead")]
public static void AddNewMonsterToStage(DirectorCard? monsterCard, MonsterCategory monsterCategory, Stage stage, string? customStageName = "")
{
SetHooks();
AddNewMonsterToStage(new DirectorCardHolder
{
Card = monsterCard,
MonsterCategory = monsterCategory
}, addToFamilies: false, stage, customStageName);
}
public static void AddNewMonsterToStage(DirectorCardHolder monsterCard, bool addToFamilies, Stage stage, string? customStageName = "")
{
SetHooks();
AddNewMonsterToStage(monsterCard, addToFamilies, null, stage, customStageName);
}
public static void AddNewMonsterToStage(DirectorCardHolder monsterCard, bool addToFamilies, Predicate<DirectorCardCategorySelection> predicate, Stage stage, string? customStageName = "")
{
string customStageName2 = customStageName;
DirectorCardHolder monsterCard2 = monsterCard;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
SetHooks();
MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage)
{
if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2))
{
AddNewMonster(dccsPool, mixEnemyArtifactMonsters, monsterCard2, addToFamilies, predicate2);
}
};
}
public static void AddNewMonsterToStagesWhere(DirectorCardHolder monsterCard, bool addToFamilies, Predicate<StageInfo> matchStage)
{
SetHooks();
AddNewMonsterToStagesWhere(monsterCard, addToFamilies, matchStage, null);
}
public static void AddNewMonsterToStagesWhere(DirectorCardHolder monsterCard, bool addToFamilies, Predicate<StageInfo> matchStage, Predicate<DirectorCardCategorySelection> predicate)
{
Predicate<StageInfo> matchStage2 = matchStage;
DirectorCardHolder monsterCard2 = monsterCard;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
SetHooks();
MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage)
{
if (matchStage2(currentStage))
{
AddNewMonster(dccsPool, mixEnemyArtifactMonsters, monsterCard2, addToFamilies, predicate2);
}
};
}
[Obsolete("Use the overload with the DirectorCardHolder instead")]
public static void AddNewInteractable(DirectorCard? interactableCard, InteractableCategory interactableCategory)
{
SetHooks();
AddNewInteractable(new DirectorCardHolder
{
Card = interactableCard,
InteractableCategory = interactableCategory
});
}
public static void AddNewInteractable(DirectorCardHolder? interactableCardHolder)
{
SetHooks();
AddNewInteractable(interactableCardHolder, null);
}
public static void AddNewInteractable(DirectorCardHolder? interactableCardHolder, Predicate<DirectorCardCategorySelection> predicate)
{
DirectorCardHolder interactableCardHolder2 = interactableCardHolder;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
SetHooks();
InteractableActions += delegate(DccsPool interactablesDccsPool, StageInfo currentStage)
{
AddNewInteractableToStage(interactablesDccsPool, interactableCardHolder2, predicate2);
};
}
[Obsolete("Use the overload with the DirectorCardHolder instead")]
public static void AddNewInteractableToStage(DirectorCard? interactableCard, InteractableCategory interactableCategory, Stage stage, string? customStageName = "")
{
SetHooks();
AddNewInteractableToStage(new DirectorCardHolder
{
Card = interactableCard,
InteractableCategory = interactableCategory
}, stage, customStageName);
}
public static void AddNewInteractableToStage(DirectorCardHolder interactableCardHolder, Stage stage, string customStageName = "")
{
SetHooks();
AddNewInteractableToStage(interactableCardHolder, null, stage, customStageName);
}
public static void AddNewInteractableToStage(DirectorCardHolder interactableCardHolder, Predicate<DirectorCardCategorySelection> predicate, Stage stage, string customStageName = "")
{
string customStageName2 = customStageName;
DirectorCardHolder interactableCardHolder2 = interactableCardHolder;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
SetHooks();
InteractableActions += delegate(DccsPool interactablesDccsPool, StageInfo currentStage)
{
if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2))
{
AddNewInteractableToStage(interactablesDccsPool, interactableCardHolder2, predicate2);
}
};
}
private static void AddNewInteractableToStage(DccsPool interactablesDccsPool, DirectorCardHolder interactableCardHolder, Predicate<DirectorCardCategorySelection> predicate)
{
DirectorCardHolder interactableCardHolder2 = interactableCardHolder;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
if (Object.op_Implicit((Object)(object)interactablesDccsPool))
{
ForEachPoolEntryInDccsPool(interactablesDccsPool, delegate(PoolEntry poolEntry)
{
AddInteractableToPoolEntry(interactableCardHolder2, poolEntry, predicate2);
});
}
}
private static void AddInteractableToPoolEntry(DirectorCardHolder interactableCardHolder, PoolEntry poolEntry, Predicate<DirectorCardCategorySelection> predicate)
{
if ((predicate != null && predicate(poolEntry.dccs)) || predicate == null)
{
poolEntry.dccs.AddCard(interactableCardHolder);
}
}
public static void RemoveExistingMonster(string? monsterName)
{
SetHooks();
RemoveExistingMonster(monsterName, removeFromFamilies: true, null);
}
public static void RemoveExistingMonster(string? monsterName, bool removeFromFamilies, Predicate<DirectorCardCategorySelection> predicate)
{
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
SetHooks();
StringUtils.ThrowIfStringIsNullOrWhiteSpace(monsterName, "monsterName");
string monsterNameLowered = monsterName.ToLowerInvariant();
MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage)
{
RemoveExistingMonster(dccsPool, mixEnemyArtifactMonsters, monsterNameLowered, removeFromFamilies, predicate2);
};
}
private static void RemoveExistingMonster(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, string monsterNameLowered, bool removeFromFamilies, Predicate<DirectorCardCategorySelection> predicate)
{
DccsPool dccsPool2 = dccsPool;
string monsterNameLowered2 = monsterNameLowered;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
if (Object.op_Implicit((Object)(object)dccsPool2))
{
ForEachPoolCategoryInDccsPool(dccsPool2, delegate(Category poolCategory)
{
bool num = IsNotAFamilyCategory(poolCategory, dccsPool2.poolCategories.Length);
bool flag = !num;
bool flag2 = removeFromFamilies && flag;
if (num || flag2)
{
ForEachPoolEntryInDccsPoolCategory(poolCategory, delegate(PoolEntry poolEntry)
{
RemoveMonsterFromPoolEntry(monsterNameLowered2, poolEntry, predicate2);
});
}
});
}
mixEnemyArtifactMonsters.RemoveAll((DirectorCardHolder card) => ((Object)card.Card.spawnCard).name.ToLowerInvariant() == monsterNameLowered2);
}
private static void RemoveMonsterFromPoolEntry(string monsterNameLowered, PoolEntry poolEntry, Predicate<DirectorCardCategorySelection> predicate)
{
string monsterNameLowered2 = monsterNameLowered;
if ((predicate == null || !predicate(poolEntry.dccs)) && predicate != null)
{
return;
}
for (int i = 0; i < poolEntry.dccs.categories.Length; i++)
{
List<DirectorCard> list = poolEntry.dccs.categories[i].cards.ToList();
list.RemoveAll((DirectorCard card) => ((Object)card.spawnCard).name.ToLowerInvariant() == monsterNameLowered2);
poolEntry.dccs.categories[i].cards = list.ToArray();
}
}
public static void RemoveExistingMonsterFromStage(string? monsterName, Stage stage, string? customStageName = "")
{
SetHooks();
RemoveExistingMonsterFromStage(monsterName, removeFromFamilies: false, null, stage, customStageName);
}
public static void RemoveExistingMonsterFromStage(string? monsterName, bool removeFromFamilies, Predicate<DirectorCardCategorySelection> predicate, Stage stage, string? customStageName = "")
{
string customStageName2 = customStageName;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
SetHooks();
StringUtils.ThrowIfStringIsNullOrWhiteSpace(monsterName, "monsterName");
string monsterNameLowered = monsterName.ToLowerInvariant();
MonsterActions += delegate(DccsPool dccsPool, List<DirectorCardHolder> mixEnemyArtifactMonsters, StageInfo currentStage)
{
if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2))
{
RemoveExistingMonster(dccsPool, mixEnemyArtifactMonsters, monsterNameLowered, removeFromFamilies, predicate2);
}
};
}
public static void RemoveExistingInteractable(string? interactableName)
{
SetHooks();
RemoveExistingInteractable(interactableName, null);
}
public static void RemoveExistingInteractable(string? interactableName, Predicate<DirectorCardCategorySelection> predicate)
{
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
SetHooks();
StringUtils.ThrowIfStringIsNullOrWhiteSpace(interactableName, "interactableName");
string interactableNameLowered = interactableName.ToLowerInvariant();
InteractableActions += delegate(DccsPool interactablesDccsPool, StageInfo currentStage)
{
RemoveExistingInteractable(interactablesDccsPool, interactableNameLowered, predicate2);
};
}
public static void RemoveExistingInteractableFromStage(string? interactableName, Stage stage, string? customStageName = "")
{
SetHooks();
RemoveExistingInteractableFromStage(interactableName, null, stage, customStageName);
}
public static void RemoveExistingInteractableFromStage(string? interactableName, Predicate<DirectorCardCategorySelection> predicate, Stage stage, string? customStageName = "")
{
string customStageName2 = customStageName;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
SetHooks();
StringUtils.ThrowIfStringIsNullOrWhiteSpace(interactableName, "interactableName");
string interactableNameLowered = interactableName.ToLowerInvariant();
InteractableActions += delegate(DccsPool interactablesDccsPool, StageInfo currentStage)
{
if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2))
{
RemoveExistingInteractable(interactablesDccsPool, interactableNameLowered, predicate2);
}
};
}
private static void RemoveExistingInteractable(DccsPool interactablesDccsPool, string interactableNameLowered, Predicate<DirectorCardCategorySelection> predicate)
{
string interactableNameLowered2 = interactableNameLowered;
Predicate<DirectorCardCategorySelection> predicate2 = predicate;
if (Object.op_Implicit((Object)(object)interactablesDccsPool))
{
ForEachPoolEntryInDccsPool(interactablesDccsPool, delegate(PoolEntry poolEntry)
{
RemoveInteractableFromPoolEntry(interactableNameLowered2, poolEntry, predicate2);
});
}
}
private static void RemoveInteractableFromPoolEntry(string interactableNameLowered, PoolEntry poolEntry, Predicate<DirectorCardCategorySelection> predicate)
{
string interactableNameLowered2 = interactableNameLowered;
if ((predicate == null || !predicate(poolEntry.dccs)) && predicate != null)
{
return;
}
for (int i = 0; i < poolEntry.dccs.categories.Length; i++)
{
List<DirectorCard> list = poolEntry.dccs.categories[i].cards.ToList();
list.RemoveAll((DirectorCard card) => ((Object)card.spawnCard).name.ToLowerInvariant() == interactableNameLowered2);
poolEntry.dccs.categories[i].cards = list.ToArray();
}
}
public static void AddSceneMonsterCredits(int increase, Stage stage, string? customStageName = "")
{
string customStageName2 = customStageName;
SetHooks();
StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage)
{
if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2))
{
settings.SceneDirectorMonsterCredits += increase;
}
};
}
public static void AddSceneInteractableCredits(int increase, Stage stage, string? customStageName = "")
{
string customStageName2 = customStageName;
SetHooks();
StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage)
{
if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2))
{
settings.SceneDirectorInteractableCredits += increase;
}
};
}
public static void MultiplySceneMonsterCredits(int multiplier, Stage stage, string? customStageName = "")
{
string customStageName2 = customStageName;
SetHooks();
StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage)
{
if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2))
{
settings.SceneDirectorMonsterCredits *= multiplier;
}
};
}
public static void MultiplySceneInteractableCredits(int multiplier, Stage stage, string? customStageName = "")
{
string customStageName2 = customStageName;
SetHooks();
StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage)
{
if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2))
{
settings.SceneDirectorInteractableCredits *= multiplier;
}
};
}
public static void ReduceSceneMonsterCredits(int divisor, Stage stage, string? customStageName = "")
{
string customStageName2 = customStageName;
SetHooks();
StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage)
{
if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2))
{
settings.SceneDirectorMonsterCredits /= divisor;
}
};
}
public static void ReduceSceneInteractableCredits(int divisor, Stage stage, string? customStageName = "")
{
string customStageName2 = customStageName;
SetHooks();
StageSettingsActions += delegate(StageSettings settings, StageInfo currentStage)
{
if (currentStage.stage == stage && currentStage.CheckStage(stage, customStageName2))
{
settings.SceneDirectorInteractableCredits /= divisor;
}
};
}
public static void ForEachPoolEntryInDccsPool(DccsPool dccsPool, Action<PoolEntry> action)
{
Action<PoolEntry> action2 = action;
SetHooks();
ForEachPoolCategoryInDccsPool(dccsPool, delegate(Category poolCategory)
{
ForEachPoolEntryInDccsPoolCategory(poolCategory, action2);
});
}
public static void ForEachPoolCategoryInDccsPool(DccsPool dccsPool, Action<Category> action)
{
SetHooks();
Category[] poolCategories = dccsPool.poolCategories;
foreach (Category obj in poolCategories)
{
try
{
action(obj);
}
catch (Exception ex)
{
DirectorPlugin.Logger.LogError((object)ex);
}
}
}
public static void ForEachPoolEntryInDccsPoolCategory(Category dccsPoolCategory, Action<PoolEntry> action)
{
Action<PoolEntry> action2 = action;
SetHooks();
CallAction(dccsPoolCategory.alwaysIncluded);
PoolEntry[] includedIfConditionsMet = (PoolEntry[])(object)dccsPoolCategory.includedIfConditionsMet;
CallAction(includedIfConditionsMet);
CallAction(dccsPoolCategory.includedIfNoConditionsMet);
void CallAction(PoolEntry[] poolEntries)
{
foreach (PoolEntry obj in poolEntries)
{
try
{
action2(obj);
}
catch (Exception ex)
{
DirectorPlugin.Logger.LogError((object)ex);
}
}
}
}
public static bool IsSameMonsterCategory(ref Category category, MonsterCategory monsterCategory)
{
SetHooks();
return GetMonsterCategory(category.name) == monsterCategory;
}
public static MonsterCategory GetMonsterCategory(string categoryString)
{
SetHooks();
if (string.IsNullOrWhiteSpace(categoryString))
{
throw new ArgumentException("categoryString");
}
return categoryString switch
{
"Champions" => MonsterCategory.Champions,
"Minibosses" => MonsterCategory.Minibosses,
"Basic Monsters" => MonsterCategory.BasicMonsters,
"Special" => MonsterCategory.Special,
_ => MonsterCategory.Custom,
};
}
public static string GetVanillaMonsterCategoryName(MonsterCategory monsterCategory)
{
SetHooks();
switch (monsterCategory)
{
case MonsterCategory.BasicMonsters:
return "Basic Monsters";
case MonsterCategory.Champions:
return "Champions";
case MonsterCategory.Minibosses:
return "Minibosses";
case MonsterCategory.Special:
return "Special";
default:
{
int num = (int)monsterCategory;
throw new ArgumentException(num.ToString());
}
}
}
public static InteractableCategory GetInteractableCategory(string categoryString)
{
SetHooks();
if (string.IsNullOrWhiteSpace(categoryString))
{
throw new ArgumentException("categoryString");
}
if (categoryString.Contains("Storm Stuff"))
{
return InteractableCategory.StormStuff;
}
return categoryString switch
{
"Chests" => InteractableCategory.Chests,
"Barrels" => InteractableCategory.Barrels,
"Shrines" => InteractableCategory.Shrines,
"Drones" => InteractableCategory.Drones,
"Misc" => InteractableCategory.Misc,
"Rare" => InteractableCategory.Rare,
"Duplicator" => InteractableCategory.Duplicator,
"Void Stuff" => InteractableCategory.VoidStuff,
_ => InteractableCategory.Custom,
};
}
public static string GetVanillaInteractableCategoryName(InteractableCategory interactableCategory)
{
SetHooks();
switch (interactableCategory)
{
case InteractableCategory.Chests:
return "Chests";
case InteractableCategory.Barrels:
return "Barrels";
case InteractableCategory.Shrines:
return "Shrines";
case InteractableCategory.Drones:
return "Drones";
case InteractableCategory.Misc:
return "Misc";
case InteractableCategory.Rare:
return "Rare";
case InteractableCategory.Duplicator:
return "Duplicator";
case InteractableCategory.VoidStuff:
return "Void Stuff";
case InteractableCategory.StormStuff:
return "Storm Stuff";
default:
{
int num = (int)interactableCategory;
throw new ArgumentException(num.ToString());
}
}
}
public static bool IsSameInteractableCategory(ref Category category, InteractableCategory interactableCategory)
{
SetHooks();
return GetInteractableCategory(category.name) == interactableCategory;
}
}
public class OriginalClassicStageInfo
{
public List<Category> monsterDccsPoolCategories;
public DirectorCardCategorySelection monsterCategories;
public List<MonsterFamily> possibleMonsterFamilies;
public List<Category> interactableDccsPoolCategories;
public DirectorCardCategorySelection interactableCategories;
}
[CompilerGenerated]
private static class <>O
{
public static hook_Start <0>__ApplyChangesOnStart;
public static Manipulator <1>__SwapVanillaDccsWithOurs;
public static hook_Init <2>__InitStageEnumToSceneDefs;
public static Func<DirectorCardCategorySelection, DirectorCardCategorySelection> <3>__SwapDccs;
}
public const string PluginGUID = "com.bepis.r2api.director";
public const string PluginName = "R2API.Director";
private static DirectorCardCategorySelection _dccsMixEnemyArtifact;
private static bool _hooksEnabled = false;
private static readonly Dictionary<string, OriginalClassicStageInfo> _classicStageInfoNameToOriginalClassicStageInfos = new Dictionary<string, OriginalClassicStageInfo>();
public const string PluginVersion = "2.3.2";
[Obsolete("All submodules are automatically loaded and this property is now unused")]
public static bool Loaded => true;
public static Dictionary<Stage, SceneDef[]> VanillaStageToSceneDefs { get; private set; } = new Dictionary<Stage, SceneDef[]>();
public static event Action<StageSettings, StageInfo>? StageSettingsActions;
public static event Action<DccsPool, List<DirectorCardHolder>, StageInfo>? MonsterActions;
public static event Action<DccsPool, StageInfo>? InteractableActions;
public static Stage ParseInternalStageName(string internalStageName)
{
return internalStageName switch
{
"golemplains" => Stage.TitanicPlains,
"blackbeach" => Stage.DistantRoost,
"foggyswamp" => Stage.WetlandAspect,
"goolake" => Stage.AbandonedAqueduct,
"frozenwall" => Stage.RallypointDelta,
"wispgraveyard" => Stage.ScorchedAcres,
"dampcavesimple" => Stage.AbyssalDepths,
"shipgraveyard" => Stage.SirensCall,
"goldshores" => Stage.GildedCoast,
"mysteryspace" => Stage.MomentFractured,
"bazaar" => Stage.Bazaar,
"arena" => Stage.VoidCell,
"limbo" => Stage.MomentWhole,
"skymeadow" => Stage.SkyMeadow,
"artifactworld" => Stage.ArtifactReliquary,
"moon2" => Stage.Commencement,
"rootjungle" => Stage.SunderedGrove,
"ancientloft" => Stage.AphelianSanctuary,
"itancientloft" => Stage.AphelianSanctuarySimulacrum,
"itdampcave" => Stage.AbyssalDepthsSimulacrum,
"itfrozenwall" => Stage.RallypointDeltaSimulacrum,
"itgolemplains" => Stage.TitanicPlainsSimulacrum,
"itgoolake" => Stage.AbandonedAqueductSimulacrum,
"itmoon" => Stage.CommencementSimulacrum,
"itskymeadow" => Stage.SkyMeadowSimulacrum,
"snowyforest" => Stage.SiphonedForest,
"sulfurpools" => Stage.SulfurPools,
"voidraid" => Stage.ThePlanetarium,
"voidstage" => Stage.VoidLocus,
"lakes" => Stage.VerdantFalls,
"lakesnight" => Stage.ViscousFalls,
"artifactworld01" => Stage.ArtifactReliquary_AphelianSanctuary_Theme,
"artifactworld02" => Stage.ArtifactReliquary_AbandonedAqueduct_Theme,
"artifactworld03" => Stage.ArtifactReliquary_ScorchedAcres_Theme,
"village" => Stage.ShatteredAbodes,
"villagenight" => Stage.DisturbedImpact,
"lemuriantemple" => Stage.ReformedAltar,
"habitat" => Stage.TreebornColony,
"habitatfall" => Stage.GoldenDieback,
"helminthroost" => Stage.HelminthHatchery,
"meridian" => Stage.PrimeMeridian,
_ => Stage.Custom,
};
}
public static Stage GetStageEnumFromSceneDef(SceneDef sceneDef)
{
return ParseInternalStageName(sceneDef.baseSceneName);
}
public static string ToInternalStageName(Stage stage)
{
return stage switch
{
Stage.TitanicPlains => "golemplains",
Stage.DistantRoost => "blackbeach",
Stage.WetlandAspect => "foggyswamp",
Stage.AbandonedAqueduct => "goolake",
Stage.RallypointDelta => "frozenwall",
Stage.ScorchedAcres => "wispgraveyard",
Stage.AbyssalDepths => "dampcavesimple",
Stage.SirensCall => "shipgraveyard",
Stage.GildedCoast => "goldshores",
Stage.MomentFractured => "mysteryspace",
Stage.Bazaar => "bazaar",
Stage.VoidCell => "arena",
Stage.MomentWhole => "limbo",
Stage.SkyMeadow => "skymeadow",
Stage.ArtifactReliquary => "artifactworld",
Stage.Commencement => "moon2",
Stage.SunderedGrove => "rootjungle",
Stage.AphelianSanctuary => "ancientloft",
Stage.AphelianSanctuarySimulacrum => "itancientloft",
Stage.AbyssalDepthsSimulacrum => "itdampcave",
Stage.RallypointDeltaSimulacrum => "itfrozenwall",
Stage.TitanicPlainsSimulacrum => "itgolemplains",
Stage.AbandonedAqueductSimulacrum => "itgoolake",
Stage.CommencementSimulacrum => "itmoon",
Stage.SkyMeadowSimulacrum => "itskymeadow",
Stage.SiphonedForest => "snowyforest",
Stage.SulfurPools => "sulfurpools",
Stage.VoidLocus => "voidstage",
Stage.ThePlanetarium => "voidraid",
Stage.VerdantFalls => "lakes",
Stage.ViscousFalls => "lakesnight",
Stage.ArtifactReliquary_AphelianSanctuary_Theme => "artifactworld01",
Stage.ArtifactReliquary_AbandonedAqueduct_Theme => "artifactworld02",
Stage.ArtifactReliquary_ScorchedAcres_Theme => "artifactworld03",
Stage.ShatteredAbodes => "village",
Stage.DisturbedImpact => "villagenight",
Stage.ReformedAltar => "lemuriantemple",
Stage.TreebornColony => "habitat",
Stage.GoldenDieback => "habitatfall",
Stage.HelminthHatchery => "helminthroost",
Stage.PrimeMeridian => "meridian",
_ => "",
};
}
public static int AddCard(this DirectorCardCategorySelection dccs, DirectorCardHolder cardHolder)
{
SetHooks();
string categoryName = cardHolder.GetCategoryName();
for (int i = 0; i < dccs.categories.Length; i++)
{
if (dccs.categories[i].name.Contains(categoryName, StringComparison.InvariantCultureIgnoreCase))
{
ArrayUtils.ArrayAppend<DirectorCard>(ref dccs.categories[i].cards, ref cardHolder.Card);
return dccs.categories[i].cards.Length - 1;
}
}
float num = (cardHolder.IsMonster ? cardHolder.MonsterCategorySelectionWeight : cardHolder.InteractableCategorySelectionWeight);
int num2 = dccs.AddCategory(categoryName, num);
return dccs.AddCard(num2, cardHolder.Card);
}
internal static void SetHooks()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//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_0043: Expected O, but got Unknown
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
if (!_hooksEnabled)
{
object obj = <>O.<0>__ApplyChangesOnStart;
if (obj == null)
{
hook_Start val = ApplyChangesOnStart;
<>O.<0>__ApplyChangesOnStart = val;
obj = (object)val;
}
ClassicStageInfo.Start += (hook_Start)obj;
object obj2 = <>O.<1>__SwapVanillaDccsWithOurs;
if (obj2 == null)
{
Manipulator val2 = SwapVanillaDccsWithOurs;
<>O.<1>__SwapVanillaDccsWithOurs = val2;
obj2 = (object)val2;
}
ClassicStageInfo.HandleMixEnemyArtifact += (Manipulator)obj2;
object obj3 = <>O.<2>__InitStageEnumToSceneDefs;
if (obj3 == null)
{
hook_Init val3 = InitStageEnumToSceneDefs;
<>O.<2>__InitStageEnumToSceneDefs = val3;
obj3 = (object)val3;
}
SceneCatalog.Init += (hook_Init)obj3;
_hooksEnabled = true;
}
}
internal static void UnsetHooks()
{
//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_001b: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
object obj = <>O.<0>__ApplyChangesOnStart;
if (obj == null)
{
hook_Start val = ApplyChangesOnStart;
<>O.<0>__ApplyChangesOnStart = val;
obj = (object)val;
}
ClassicStageInfo.Start -= (hook_Start)obj;
object obj2 = <>O.<1>__SwapVanillaDccsWithOurs;
if (obj2 == null)
{
Manipulator val2 = SwapVanillaDccsWithOurs;
<>O.<1>__SwapVanillaDccsWithOurs = val2;
obj2 = (object)val2;
}
ClassicStageInfo.HandleMixEnemyArtifact -= (Manipulator)obj2;
object obj3 = <>O.<2>__InitStageEnumToSceneDefs;
if (obj3 == null)
{
hook_Init val3 = InitStageEnumToSceneDefs;
<>O.<2>__InitStageEnumToSceneDefs = val3;
obj3 = (object)val3;
}
SceneCatalog.Init -= (hook_Init)obj3;
_hooksEnabled = false;
}
private static void ApplyChangesOnStart(orig_Start orig, ClassicStageInfo classicStageInfo)
{
classicStageInfo.PortToNewSystem();
classicStageInfo.ApplyChanges();
orig.Invoke(classicStageInfo);
}
private static void SwapVanillaDccsWithOurs(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction i) => ILPatternMatchingExt.MatchCallOrCallvirt<DirectorCardCategorySelection>(i, "CopyFrom")
}))
{
val.EmitDelegate<Func<DirectorCardCategorySelection, DirectorCardCategorySelection>>((Func<DirectorCardCategorySelection, DirectorCardCategorySelection>)SwapDccs);
}
static DirectorCardCategorySelection SwapDccs(DirectorCardCategorySelection vanillaDccs)
{
return _dccsMixEnemyArtifact;
}
}
private static IEnumerator InitStageEnumToSceneDefs(orig_Init orig)
{
yield return orig.Invoke();
foreach (IGrouping<Stage, SceneDef> item in from sceneDef in (IEnumerable<SceneDef>)(object)SceneCatalog.allStageSceneDefs
group sceneDef by GetStageEnumFromSceneDef(sceneDef))
{
VanillaStageToSceneDefs[item.Key] = item.ToArray();
}
}
private static void PortToNewSystem(this ClassicStageInfo classicStageInfo)
{
PortToNewMonsterSystem(classicStageInfo);
PortToNewInteractableSystem(classicStageInfo);
}
internal static void ApplyChanges(this ClassicStageInfo classicStageInfo)
{
StageInfo stageInfo = GetStageInfo(classicStageInfo);
BackupOrRestoreClassicStageInfoToOriginalState(classicStageInfo, stageInfo);
ApplyMonsterChanges(classicStageInfo, stageInfo);
ApplyInteractableChanges(classicStageInfo, stageInfo);
ApplySettingsChanges(classicStageInfo, stageInfo);
}
private static StageInfo GetStageInfo(ClassicStageInfo classicStageInfo)
{
StageInfo stageInfo = default(StageInfo);
stageInfo.stage = Stage.Custom;
stageInfo.CustomStageName = "";
StageInfo result = stageInfo;
SceneInfo component = ((Component)classicStageInfo).GetComponent<SceneInfo>();
if (!Object.op_Implicit((Object)(object)component))
{
return result;
}
SceneDef sceneDef = component.sceneDef;
if (!Object.op_Implicit((Object)(object)sceneDef))
{
return result;
}
result.stage = GetStageEnumFromSceneDef(sceneDef);
if (result.stage == Stage.Custom)
{
result.CustomStageName = sceneDef.baseSceneName;
}
return result;
}
private static void ApplySettingsChanges(ClassicStageInfo classicStageInfo, StageInfo stageInfo)
{
StageSettings stageSettings = GetStageSettings(classicStageInfo);
if (DirectorAPI.StageSettingsActions != null)
{
Delegate[] invocationList = DirectorAPI.StageSettingsActions.GetInvocationList();
for (int i = 0; i < invocationList.Length; i++)
{
Action<StageSettings, StageInfo> action = (Action<StageSettings, StageInfo>)invocationList[i];
try
{
action(stageSettings, stageInfo);
}
catch (Exception ex)
{
DirectorPlugin.Logger.LogError((object)ex);
}
}
}
SetStageSettings(classicStageInfo, stageSettings);
}
private static void PortToNewMonsterSystem(ClassicStageInfo classicStageInfo)
{
if (!Object.op_Implicit((Object)(object)classicStageInfo.monsterDccsPool) && Object.op_Implicit((Object)(object)classicStageInfo.monsterCategories))
{
DirectorPlugin.Logger.LogInfo((object)"Current scene is using old monster dccs system, porting to new one");
DccsPool val = ScriptableObject.CreateInstance<DccsPool>();
((Object)val).name = "R2API_dp" + ((Object)classicStageInfo).name + "Monsters";
List<Category> list = new List<Category>();
PortOldStandardMonsterCategoriesToNewDccsPoolSystem(classicStageInfo.monsterCategories, list);
if (classicStageInfo.possibleMonsterFamilies != null)
{
PortOldMonsterFamiliesToNewDccsPoolSystem(classicStageInfo.possibleMonsterFamilies, list);
}
val.poolCategories = list.ToArray();
classicStageInfo.monsterDccsPool = val;
}
}
private static void PortOldStandardMonsterCategoriesToNewDccsPoolSystem(DirectorCardCategorySelection monsterCategories, List<Category> dccsPoolCategories)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
Category val = new Category();
val.name = Helpers.MonsterPoolCategories.Standard;
val.categoryWeight = Helpers.MonsterPoolCategories.StandardWeight;
val.alwaysIncluded = Array.Empty<PoolEntry>();
val.includedIfConditionsMet = Array.Empty<ConditionalPoolEntry>();
val.includedIfNoConditionsMet = (PoolEntry[])(object)new PoolEntry[1]
{
new PoolEntry
{
dccs = monsterCategories,
weight = 1f
}
};
dccsPoolCategories.Add(val);
}
private static void PortOldMonsterFamiliesToNewDccsPoolSystem(MonsterFamily[] possibleMonsterFamilies, List<Category> dccsPoolCategories)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//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_003c: 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_004f: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
Category val = new Category();
val.name = Helpers.MonsterPoolCategories.Family;
val.categoryWeight = ClassicStageInfo.monsterFamilyChance;
val.alwaysIncluded = Array.Empty<PoolEntry>();
List<ConditionalPoolEntry> list = new List<ConditionalPoolEntry>();
foreach (MonsterFamily val2 in possibleMonsterFamilies)
{
DirectorCardCategorySelection monsterFamilyCategories = val2.monsterFamilyCategories;
FamilyDirectorCardCategorySelection val3 = (FamilyDirectorCardCategorySelection)(object)((monsterFamilyCategories is FamilyDirectorCardCategorySelection) ? monsterFamilyCategories : null);
if (val3 != null)
{
list.Add(new ConditionalPoolEntry
{
dccs = (DirectorCardCategorySelection)(object)val3,
weight = val2.selectionWeight,
requiredExpansions = Array.Empty<ExpansionDef>()
});
}
else
{
DirectorPlugin.Logger.LogError((object)("classicStageInfo.possibleMonsterFamilies " + ((Object)val2.monsterFamilyCategories).name + " not setup correctly"));
}
}
val.includedIfConditionsMet = list.ToArray();
val.includedIfNoConditionsMet = Array.Empty<PoolEntry>();
dccsPoolCategories.Add(val);
}
private static void PortToNewInteractableSystem(ClassicStageInfo classicStageInfo)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//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_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)classicStageInfo.interactableDccsPool) && Object.op_Implicit((Object)(object)classicStageInfo.interactableCategories))
{
DirectorPlugin.Logger.LogInfo((object)"Current scene is using old interactable dccs system, porting to new one");
DccsPool val = ScriptableObject.CreateInstance<DccsPool>();
((Object)val).name = "R2API_dp" + ((Object)classicStageInfo).name + "Interactables";
List<Category> list = new List<Category>();
Category val2 = new Category();
val2.name = Helpers.InteractablePoolCategories.Standard;
val2.categoryWeight = Helpers.InteractablePoolCategories.StandardWeight;
val2.alwaysIncluded = Array.Empty<PoolEntry>();
val2.includedIfConditionsMet = Array.Empty<ConditionalPoolEntry>();
val2.includedIfNoConditionsMet = (PoolEntry[])(object)new PoolEntry[1]
{
new PoolEntry
{
dccs = classicStageInfo.interactableCategories,
weight = 1f
}
};
list.Add(val2);
val.poolCategories = list.ToArray();
classicStageInfo.interactableDccsPool = val;
}
}
private static void ApplyMonsterChanges(ClassicStageInfo classicStageInfo, StageInfo stageInfo)
{
InitCustomMixEnemyArtifactDccs();
List<DirectorCardHolder> directorCardHoldersFromDCCS = GetDirectorCardHoldersFromDCCS(_dccsMixEnemyArtifact);
if (DirectorAPI.MonsterActions != null)
{
Delegate[] invocationList = DirectorAPI.MonsterActions.GetInvocationList();
for (int i = 0; i < invocationList.Length; i++)
{
Action<DccsPool, List<DirectorCardHolder>, StageInfo> action = (Action<DccsPool, List<DirectorCardHolder>, StageInfo>)invocationList[i];
try
{
action(classicStageInfo.monsterDccsPool, directorCardHoldersFromDCCS, stageInfo);
}
catch (Exception ex)
{
DirectorPlugin.Logger.LogError((object)ex);
}
}
}
ApplyNewCardHoldersToDCCS(_dccsMixEnemyArtifact, directorCardHoldersFromDCCS);
}
private static void BackupOrRestoreClassicStageInfoToOriginalState(ClassicStageInfo classicStageInfo, StageInfo stageInfo)
{
string key = ((stageInfo.stage == Stage.Custom) ? stageInfo.CustomStageName : stageInfo.stage.ToString());
if (!_classicStageInfoNameToOriginalClassicStageInfos.TryGetValue(key, out OriginalClassicStageInfo value))
{
BackupClassicStageInfoToOriginalState(classicStageInfo, key);
}
else
{
RestoreClassicStageInfoToOriginalState(classicStageInfo, value);
}
}
private static void BackupClassicStageInfoToOriginalState(ClassicStageInfo classicStageInfo, string key)
{
OriginalClassicStageInfo originalClassicStageInfo = new OriginalClassicStageInfo();
if (Object.op_Implicit((Object)(object)classicStageInfo.monsterDccsPool))
{
originalClassicStageInfo.monsterDccsPoolCategories = CopyDccsPoolCategories(classicStageInfo.monsterDccsPool.poolCategories);
}
if (Object.op_Implicit((Object)(object)classicStageInfo.monsterCategories))
{
originalClassicStageInfo.monsterCategories = Object.Instantiate<DirectorCardCategorySelection>(classicStageInfo.monsterCategories);
((Object)originalClassicStageInfo.monsterCategories).name = ((Object)classicStageInfo.monsterCategories).name;
}
if (classicStageInfo.possibleMonsterFamilies != null)
{
originalClassicStageInfo.possibleMonsterFamilies = classicStageInfo.possibleMonsterFamilies.ToList();
}
if (Object.op_Implicit((Object)(object)classicStageInfo.interactableDccsPool))
{
originalClassicStageInfo.interactableDccsPoolCategories = CopyDccsPoolCategories(classicStageInfo.interactableDccsPool.poolCategories);
}
if (Object.op_Implicit((Object)(object)classicStageInfo.interactableCategories))
{
originalClassicStageInfo.interactableCategories = Object.Instantiate<DirectorCardCategorySelection>(classicStageInfo.interactableCategories);
((Object)originalClassicStageInfo.interactableCategories).name = ((Object)classicStageInfo.interactableCategories).name;
}
_classicStageInfoNameToOriginalClassicStageInfos[key] = originalClassicStageInfo;
}
private static void RestoreClassicStageInfoToOriginalState(ClassicStageInfo classicStageInfo, OriginalClassicStageInfo originalClassicStageInfo)
{
if (originalClassicStageInfo.monsterDccsPoolCategories != null)
{
classicStageInfo.monsterDccsPool.poolCategories = CopyDccsPoolCategories(originalClassicStageInfo.monsterDccsPoolCategories).ToArray();
}
if (Object.op_Implicit((Object)(object)originalClassicStageInfo.monsterCategories))
{
classicStageInfo.monsterCategories = Object.Instantiate<DirectorCardCategorySelection>(originalClassicStageInfo.monsterCategories);
((Object)classicStageInfo.monsterCategories).name = ((Object)originalClassicStageInfo.monsterCategories).name;
}
if (originalClassicStageInfo.possibleMonsterFamilies != null)
{
classicStageInfo.possibleMonsterFamilies = originalClassicStageInfo.possibleMonsterFamilies.ToArray();
}
if (originalClassicStageInfo.interactableDccsPoolCategories != null)
{
classicStageInfo.interactableDccsPool.poolCategories = CopyDccsPoolCategories(originalClassicStageInfo.interactableDccsPoolCategories).ToArray();
}
if (Object.op_Implicit((Object)(object)originalClassicStageInfo.interactableCategories))
{
classicStageInfo.interactableCategories = Object.Instantiate<DirectorCardCategorySelection>(originalClassicStageInfo.interactableCategories);
((Object)classicStageInfo.interactableCategories).name = ((Object)originalClassicStageInfo.interactableCategories).name;
}
}
private static List<Category> CopyDccsPoolCategories(IEnumerable<Category> dccsPoolCategories)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
List<Category> list = new List<Category>();
foreach (Category dccsPoolCategory in dccsPoolCategories)
{
Category val = new Category();
val.name = dccsPoolCategory.name;
val.categoryWeight = dccsPoolCategory.categoryWeight;
val.alwaysIncluded = CopyPoolEntries(dccsPoolCategory.alwaysIncluded).ToArray();
val.includedIfConditionsMet = CopyConditionalPoolEntries(dccsPoolCategory.includedIfConditionsMet).ToArray();
val.includedIfNoConditionsMet = CopyPoolEntries(dccsPoolCategory.includedIfNoConditionsMet).ToArray();
list.Add(val);
}
return list;
}
private static List<ConditionalPoolEntry> CopyConditionalPoolEntries(IEnumerable<ConditionalPoolEntry> poolEntries)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
List<ConditionalPoolEntry> list = new List<ConditionalPoolEntry>();
foreach (ConditionalPoolEntry poolEntry in poolEntries)
{
ConditionalPoolEntry val = new ConditionalPoolEntry();
val.requiredExpansions = ArrayUtils.Clone<ExpansionDef>(poolEntry.requiredExpansions);
((PoolEntry)val).weight = ((PoolEntry)poolEntry).weight;
((PoolEntry)val).dccs = Object.Instantiate<DirectorCardCategorySelection>(((PoolEntry)poolEntry).dccs);
((Object)((PoolEntry)val).dccs).name = ((Object)((PoolEntry)poolEntry).dccs).name;
list.Add(val);
}
return list;
}
private static List<PoolEntry> CopyPoolEntries(IEnumerable<PoolEntry> poolEntries)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
List<PoolEntry> list = new List<PoolEntry>();
foreach (PoolEntry poolEntry in poolEntries)
{
PoolEntry val = new PoolEntry();
val.weight = poolEntry.weight;
val.dccs = Object.Instantiate<DirectorCardCategorySelection>(poolEntry.dccs);
((Object)val.dccs).name = ((Object)poolEntry.dccs).name;
list.Add(val);
}
return list;
}
private static List<DirectorCardHolder> GetDirectorCardHoldersFromDCCS(DirectorCardCategorySelection dccs)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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)
//IL_0090: 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_00ad: 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)
List<DirectorCardHolder> list = new List<DirectorCardHolder>();
if (Object.op_Implicit((Object)(object)dccs))
{
Category[] categories = dccs.categories;
foreach (Category val in categories)
{
if (val.cards.Length == 0)
{
continue;
}
bool flag = false;
flag = IsInteractableDccsCategory(val);
DirectorCard[] cards = val.cards;
foreach (DirectorCard card in cards)
{
DirectorCardHolder directorCardHolder = new DirectorCardHolder();
directorCardHolder.Card = card;
if (flag)
{
if ((directorCardHolder.InteractableCategory = Helpers.GetInteractableCategory(val.name)) == InteractableCategory.Custom)
{
directorCardHolder.CustomInteractableCategory = val.name;
}
}
else if ((directorCardHolder.MonsterCategory = Helpers.GetMonsterCategory(val.name)) == MonsterCategory.Custom)
{
directorCardHolder.CustomMonsterCategory = val.name;
}
list.Add(directorCardHolder);
}
}
}
return list;
}
private static bool IsInteractableDccsCategory(Category dccsCategory)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
bool result = false;
DirectorCard[] cards = dccsCategory.cards;
foreach (DirectorCard val in cards)
{
if (Object.op_Implicit((Object)(object)val.spawnCard) && Reflection.IsSameOrSubclassOf<InteractableSpawnCard>(((object)val.spawnCard).GetType()))
{
result = true;
break;
}
}
return result;
}
private static void ApplyNewCardHoldersToDCCS(DirectorCardCategorySelection dccs, List<DirectorCardHolder> directorCardHolders)
{
dccs.Clear();
foreach (DirectorCardHolder directorCardHolder in directorCardHolders)
{
dccs.AddCard(directorCardHolder);
}
}
private static void ApplyInteractableChanges(ClassicStageInfo classicStageInfo, StageInfo stageInfo)
{
if (DirectorAPI.InteractableActions == null)
{
return;
}
Delegate[] invocationList = DirectorAPI.InteractableActions.GetInvocationList();
for (int i = 0; i < invocationList.Length; i++)
{
Action<DccsPool, StageInfo> action = (Action<DccsPool, StageInfo>)invocationList[i];
try
{
action(classicStageInfo.interactableDccsPool, stageInfo);
}
catch (Exception ex)
{
DirectorPlugin.Logger.LogError((object)ex);
}
}
}
private static StageSettings GetStageSettings(ClassicStageInfo classicStageInfo)
{
//IL_0036: 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_003c: 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_0055: Unknown result type (might be due to invalid IL or missing references)
StageSettings stageSettings = new StageSettings
{
SceneDirectorInteractableCredits = classicStageInfo.sceneDirectorInteractibleCredits,
SceneDirectorMonsterCredits = classicStageInfo.sceneDirectorMonsterCredits,
BonusCreditObjects = new Dictionary<GameObject, int>()
};
BonusInteractibleCreditObject[] bonusInteractibleCreditObjects = classicStageInfo.bonusInteractibleCreditObjects;
foreach (BonusInteractibleCreditObject val in bonusInteractibleCreditObjects)
{
if (Object.op_Implicit((Object)(object)val.objectThatGrantsPointsIfEnabled))
{
stageSettings.BonusCreditObjects[val.objectThatGrantsPointsIfEnabled] = val.points;
}
}
GetMonsterCategoryWeightsPerDccs(classicStageInfo, stageSettings);
GetInteractableCategoryWeightsPerDccs(classicStageInfo, stageSettings);
return stageSettings;
}
private static void InitCustomMixEnemyArtifactDccs()
{
_dccsMixEnemyArtifact = Object.Instantiate<DirectorCardCategorySelection>(RoR2Content.mixEnemyMonsterCards);
((Object)_dccsMixEnemyArtifact).name = "dccsR2APIMixEnemyArtifact";
}
private static void GetMonsterCategoryWeightsPerDccs(ClassicStageInfo classicStageInfo, StageSettings stageSettings)
{
stageSettings.MonsterCategoryWeightsPerDccs = new Dictionary<DirectorCardCategorySelection, Dictionary<string, float>>();
GetMonsterCategoryWeights(stageSettings, _dccsMixEnemyArtifact);
if (Object.op_Implicit((Object)(object)classicStageInfo.monsterDccsPool))
{
Category[] poolCategories = classicStageInfo.monsterDccsPool.poolCategories;
foreach (Category val in poolCategories)
{
GetMonsterCategoryWeights(stageSettings, val.alwaysIncluded);
PoolEntry[] includedIfConditionsMet = (PoolEntry[])(object)val.includedIfConditionsMet;
GetMonsterCategoryWeights(stageSettings, includedIfConditionsMet);
GetMonsterCategoryWeights(stageSettings, val.includedIfNoConditionsMet);
}
}
}
private static void GetMonsterCategoryWeights(StageSettings stageSettings, DirectorCardCategorySelection dccs)
{
//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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
stageSettings.MonsterCategoryWeightsPerDccs[dccs] = new Dictionary<string, float>();
Category[] categories = dccs.categories;
foreach (Category val in categories)
{
stageSettings.MonsterCategoryWeightsPerDccs[dccs][val.name] = val.selectionWeight;
}
}
private static void GetMonsterCategoryWeights(StageSettings stageSettings, PoolEntry[] poolCategories)
{
foreach (PoolEntry val in poolCategories)
{
GetMonsterCategoryWeights(stageSettings, val.dccs);
}
}
private static void GetInteractableCategoryWeightsPerDccs(ClassicStageInfo classicStageInfo, StageSettings stageSettings)
{
stageSettings.InteractableCategoryWeightsPerDccs = new Dictionary<DirectorCardCategorySelection, Dictionary<string, float>>();
if (Object.op_Implicit((Object)(object)classicStageInfo.interactableDccsPool))
{
Category[] poolCategories = classicStageInfo.interactableDccsPool.poolCategories;
foreach (Category val in poolCategories)
{
GetInteractableCategoryWeights(stageSettings, val.alwaysIncluded);
PoolEntry[] includedIfConditionsMet = (PoolEntry[])(object)val.includedIfConditionsMet;
GetInteractableCategoryWeights(stageSettings, includedIfConditionsMet);
GetInteractableCategoryWeights(stageSettings, val.includedIfNoConditionsMet);
}
}
}
private static void GetInteractableCategoryWeights(StageSettings stageSettings, PoolEntry[] poolCategories)
{
foreach (PoolEntry val in poolCategories)
{
GetInteractableCategoryWeights(stageSettings, val.dccs);
}
}
private static void GetInteractableCategoryWeights(StageSettings stageSettings, DirectorCardCategorySelection dccs)
{
//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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
stageSettings.InteractableCategoryWeightsPerDccs[dccs] = new Dictionary<string, float>();
Category[] categories = dccs.categories;
foreach (Category val in categories)
{
stageSettings.InteractableCategoryWeightsPerDccs[dccs][val.name] = val.selectionWeight;
}
}
private static void SetStageSettings(ClassicStageInfo classicStageInfo, StageSettings stageSettings)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
classicStageInfo.sceneDirectorInteractibleCredits = stageSettings.SceneDirectorInteractableCredits;
classicStageInfo.sceneDirectorMonsterCredits = stageSettings.SceneDirectorMonsterCredits;
GameObject[] array = stageSettings.BonusCreditObjects.Keys.ToArray();
BonusInteractibleCreditObject[] array2 = (BonusInteractibleCreditObject[])(object)new BonusInteractibleCreditObject[array.Length];
for (int i = 0; i < array.Length; i++)
{
array2[i] = new BonusInteractibleCreditObject
{
objectThatGrantsPointsIfEnabled = array[i],
points = stageSettings.BonusCreditObjects[array[i]]
};
}
classicStageInfo.bonusInteractibleCreditObjects = array2;
SetMonsterCategoryWeightsPerDccs(classicStageInfo, stageSettings);
SetInteractableCategoryWeightsPerDccs(classicStageInfo, stageSettings);
}
private static void SetMonsterCategoryWeightsPerDccs(ClassicStageInfo classicStageInfo, StageSettings stageSettings)
{
SetMonsterCategoryWeights(_dccsMixEnemyArtifact, stageSettings.MonsterCategoryWeightsPerDccs[_dccsMixEnemyArtifact]);
if (Object.op_Implicit((Object)(object)classicStageInfo.monsterDccsPool))
{
Category[] poolCategories = classicStageInfo.monsterDccsPool.poolCategories;
foreach (Category val in poolCategories)
{
SetMonsterCategoryWeights(stageSettings, val.alwaysIncluded);
PoolEntry[] includedIfConditionsMet = (PoolEntry[])(object)val.includedIfConditionsMet;
SetMonsterCategoryWeights(stageSettings, includedIfConditionsMet);
SetMonsterCategoryWeights(stageSettings, val.includedIfNoConditionsMet);
}
}
}
private static void SetMonsterCategoryWeights(DirectorCardCategorySelection dccs, Dictionary<string, float> newMonsterCategoryWeights)
{
//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_0011: 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_002e: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < dccs.categories.Length; i++)
{
Category val = dccs.categories[i];
string name = val.name;
val.selectionWeight = newMonsterCategoryWeights[name];
dccs.categories[i] = val;
}
}
private static void SetMonsterCategoryWeights(StageSettings stageSettings, PoolEntry[] poolCategories)
{
foreach (PoolEntry val in poolCategories)
{
SetMonsterCategoryWeights(val.dccs, stageSettings.MonsterCategoryWeightsPerDccs[val.dccs]);
}
}
private static void SetInteractableCategoryWeightsPerDccs(ClassicStageInfo classicStageInfo, StageSettings stageSettings)
{
if (Object.op_Implicit((Object)(object)classicStageInfo.interactableDccsPool))
{
Category[] poolCategories = classicStageInfo.interactableDccsPool.poolCategories;
foreach (Category val in poolCategories)
{
SetInteractableCategoryWeights(stageSettings, val.alwaysIncluded);
PoolEntry[] includedIfConditionsMet = (PoolEntry[])(object)val.includedIfConditionsMet;
SetInteractableCategoryWeights(stageSettings, includedIfConditionsMet);
SetInteractableCategoryWeights(stageSettings, val.includedIfNoConditionsMet);
}
}
}
private static void SetInteractableCategoryWeights(StageSettings stageSettings, PoolEntry[] poolCategories)
{
foreach (PoolEntry val in poolCategories)
{
SetInteractableCategoryWeights(val.dccs, stageSettings.InteractableCategoryWeightsPerDccs[val.dccs]);
}
}
private static void SetInteractableCategoryWeights(DirectorCardCategorySelection dccs, Dictionary<string, float> newInteractableCategoryWeights)
{
//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_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < dccs.categories.Length; i++)
{
Category val = dccs.categories[i];
val.selectionWeight = newInteractableCategoryWeights[val.name];
dccs.categories[i] = val;
}
}
}
[BepInPlugin("com.bepis.r2api.director", "R2API.Director", "2.3.2")]
public sealed class DirectorPlugin : BaseUnityPlugin
{
internal static ManualLogSource Logger { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
DirectorAPI.SetHooks();
}
private void OnEnable()
{
DirectorAPI.SetHooks();
}
private void OnDisable()
{
DirectorAPI.UnsetHooks();
}
}
}
namespace R2API.AutoVersionGen
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
internal class AutoVersionAttribute : Attribute
{
}
}
namespace R2API.AddressReferencedAssets
{
[Serializable]
public class AddressReferencedFamilyDirectorCardCategorySelection : AddressReferencedAsset<FamilyDirectorCardCategorySelection>
{
public static implicit operator bool(AddressReferencedFamilyDirectorCardCategorySelection addressReferencedAsset)
{
return Object.op_Implicit((Object)(object)((AddressReferencedAsset<FamilyDirectorCardCategorySelection>)(object)addressReferencedAsset)?.Asset);
}
public static implicit operator FamilyDirectorCardCategorySelection(AddressReferencedFamilyDirectorCardCategorySelection addressReferencedAsset)
{
return ((AddressReferencedAsset<FamilyDirectorCardCategorySelection>)(object)addressReferencedAsset)?.Asset;
}
public static implicit operator AddressReferencedFamilyDirectorCardCategorySelection(string address)
{
return new AddressReferencedFamilyDirectorCardCategorySelection(address);
}
public static implicit operator AddressReferencedFamilyDirectorCardCategorySelection(FamilyDirectorCardCategorySelection asset)
{
return new AddressReferencedFamilyDirectorCardCategorySelection(asset);
}
public AddressReferencedFamilyDirectorCardCategorySelection()
{
}
public AddressReferencedFamilyDirectorCardCategorySelection(FamilyDirectorCardCategorySelection gameObject)
: base(gameObject)
{
}
public AddressReferencedFamilyDirectorCardCategorySelection(string address)
: base(address)
{
}
}
}