using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ExpansionManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("chaos")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e1d42888e48d172c1ff18deb32e055dafada34ac")]
[assembly: AssemblyProduct("chaos")]
[assembly: AssemblyTitle("chaos")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace chaos.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("chaos.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal Resources()
{
}
}
}
namespace ChaosMode
{
internal static class Actions
{
public static Events eventing = new Events();
public static void StartingItems()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
List<PickupIndex> list = RollType(0);
PickupIndex val = list[ChaosMode.random.Next(0, list.Count)];
for (int i = 0; i < 3; i++)
{
val = list[ChaosMode.random.Next(0, list.Count)];
GiveToAllPlayers(val);
}
list = RollType(1);
for (int j = 0; j < 2; j++)
{
val = list[ChaosMode.random.Next(0, list.Count)];
GiveToAllPlayers(val);
}
list = RollType(2);
val = list[ChaosMode.random.Next(0, list.Count)];
GiveToAllPlayers(val);
}
public static void SpawnEveryMinute()
{
//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
List<SpawnCardData> list = new List<SpawnCardData>
{
Models.ADBeetleGuard,
Models.ADGreaterWisp,
Models.ADGolem,
Models.ADTitan,
Models.ADParent,
Models.ADBigLemurian,
Models.ADRoboBall,
Models.ADTemplar,
Models.ADArchWisp,
Models.ADBeetleQueen,
Models.ADLunarGolem,
Models.ADLunarWisp
};
List<SpawnCardData> list2 = new List<SpawnCardData>
{
Models.ADBeetleQueen,
Models.ADTitan,
Models.ADTitanGold,
Models.ADOverlord,
Models.ADMagmaWorm,
Models.ADOverWorm,
Models.ADNullifier,
Models.ADDunestrider,
Models.ADGhibli,
Models.ADGrandparent,
Models.ADMagmaWorm,
Models.ADBrother,
Models.ADScav
};
List<SpawnCardData> list3 = new List<SpawnCardData>
{
Models.ADBeetle,
Models.ADWisp,
Models.ADGreaterWisp,
Models.ADBell,
Models.ADBison,
Models.ADImp,
Models.ADGolem,
Models.ADLemurian,
Models.ADJellyfish,
Models.ADHermitCrab,
Models.ADParent,
Models.ADVulture,
Models.ADLunarBomb,
Models.ADMushroom
};
if (ChaosMode.expansion1)
{
List<SpawnCardData> collection = new List<SpawnCardData>
{
Models.ADGup,
Models.ADJailer,
Models.ADApothecary,
Models.ADBarnacle
};
List<SpawnCardData> collection2 = new List<SpawnCardData>
{
Models.ADJailer,
Models.ADMegaCrab,
Models.ADMega,
Models.ADMajor,
Models.ADVoidling
};
List<SpawnCardData> collection3 = new List<SpawnCardData>
{
Models.ADLarva,
Models.ADPest,
Models.ADVermin,
Models.ADMinor,
Models.ADApothecary,
Models.ADAssassin,
Models.ADInfestor,
Models.ADBarnacle
};
list.AddRange(collection);
list2.AddRange(collection2);
list3.AddRange(collection3);
}
if (ChaosMode.expansion2)
{
List<SpawnCardData> collection4 = new List<SpawnCardData> { Models.ADScorchling };
List<SpawnCardData> collection5 = new List<SpawnCardData> { Models.ADFalseSon };
List<SpawnCardData> collection6 = new List<SpawnCardData> { Models.ADChild };
list.AddRange(collection4);
list2.AddRange(collection5);
list3.AddRange(collection6);
}
SpawnCardData spawnCardData = null;
List<PickupIndex> list4 = null;
int num = 0;
int num2 = 1;
ChaosMode.directorValue += (float)Run.instance.GetDifficultyScaledCost(ChaosMode.random.Next(1, 3)) / Mathf.Clamp(10f - (float)Init.ambushRate.Value / 100f * 8f, 2f, 10f);
Console.WriteLine("[CHAOS] Director Aggro Value: {0}", ChaosMode.directorValue);
switch (Tables.SummonDropTable())
{
case 0:
Console.WriteLine("[CHAOS] spawn swarm");
spawnCardData = list3[ChaosMode.random.Next(0, list3.Count)];
num2 = Mathf.Clamp(Run.instance.GetDifficultyScaledCost(ChaosMode.random.Next(2, 4)) * Mathf.Clamp(Init.swarmAggression.Value, 1, Init.spawnLimit.Value ? 3 : 1024), 5, Init.spawnLimit.Value ? Init.maxEnemies.Value : 65536);
SummonEnemy(spawnCardData, num2);
ItemEveryMinute();
break;
case 1:
Console.WriteLine("[CHAOS] spawn single enemy");
spawnCardData = list[ChaosMode.random.Next(0, list.Count)];
num2 = Mathf.Clamp(Run.instance.GetDifficultyScaledCost(ChaosMode.random.Next(1, 3)), 1, Init.spawnLimit.Value ? Init.maxEnemies.Value : 65536);
SummonEnemy(spawnCardData, num2);
ItemEveryMinute();
break;
case 2:
{
Console.WriteLine("[CHAOS] spawn event");
List<IEnumerator> list5 = new List<IEnumerator>
{
eventing.JellyfishEvent(),
eventing.EliteParentEvent(),
eventing.FinalEncounter(),
eventing.GainFriend(),
eventing.GoldEvent()
};
if (Init.purgeRate.Value > 0)
{
list5.Add(eventing.PurgeAllItems());
}
if (Init.enableOrder.Value)
{
list5.Add(eventing.SequenceEvent());
}
if (ChaosMode.expansion1)
{
list5.AddRange(new List<IEnumerator>
{
eventing.Corruption(),
eventing.VoidEncounter()
});
}
if (ChaosMode.expansion2)
{
list5.AddRange(new List<IEnumerator> { eventing.StormEncounter() });
}
((MonoBehaviour)ChaosMode.instance).StartCoroutine(list5[Tables.EventDropTable()]);
break;
}
case 3:
Console.WriteLine("[CHAOS] spawn boss");
spawnCardData = list2[ChaosMode.random.Next(0, list2.Count)];
num2 = Mathf.Clamp(Run.instance.GetDifficultyScaledCost(1), 1, Init.spawnLimit.Value ? Init.maxEnemies.Value : 65536);
SummonEnemy(spawnCardData, num2);
if (Init.giveItems.Value)
{
num = Tables.GetDropTable(restrictVoid: false, restrictEquipment: true);
list4 = RollType(Tables.GetDropTable());
GiveToAllPlayers(list4[ChaosMode.random.Next(0, list4.Count)]);
}
break;
}
}
private static void ItemEveryMinute()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (Init.giveItems.Value)
{
int dropTable = Tables.GetDropTable(restrictVoid: false, restrictEquipment: true, Init.includeLunar.Value);
List<PickupIndex> list = RollType(dropTable);
GiveToAllPlayers(list[ChaosMode.random.Next(0, list.Count)]);
}
}
public static void GiveToAllPlayers(PickupIndex pickupIndex, int count = 1)
{
//IL_0036: 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_006f: Unknown result type (might be due to invalid IL or missing references)
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
try
{
string displayName = instance.GetDisplayName();
Console.WriteLine(displayName);
CharacterMaster master = instance.master;
master.inventory.GiveItem(PickupCatalog.GetPickupDef(pickupIndex).itemIndex, count);
MethodInfo method = typeof(GenericPickupController).GetMethod("SendPickupMessage", BindingFlags.Static | BindingFlags.NonPublic);
method.Invoke(null, new object[2] { master, pickupIndex });
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
public static void GiveToOnePlayer(PlayerCharacterMasterController playerCharacterMasterController, PickupIndex pickupIndex, int count = 1)
{
//IL_0015: 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_004c: Unknown result type (might be due to invalid IL or missing references)
string displayName = playerCharacterMasterController.GetDisplayName();
CharacterMaster master = playerCharacterMasterController.master;
master.inventory.GiveItem(PickupCatalog.GetPickupDef(pickupIndex).itemIndex, count);
MethodInfo method = typeof(GenericPickupController).GetMethod("SendPickupMessage", BindingFlags.Static | BindingFlags.NonPublic);
method.Invoke(null, new object[2] { master, pickupIndex });
}
public static void EquipAllPlayers(int pickupIndex)
{
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
string displayName = instance.GetDisplayName();
CharacterMaster master = instance.master;
master.inventory.SetEquipmentIndex((EquipmentIndex)pickupIndex);
MethodInfo method = typeof(GenericPickupController).GetMethod("SendPickupMessage", BindingFlags.Static | BindingFlags.NonPublic);
method.Invoke(null, new object[2] { master, pickupIndex });
}
}
public static void EquipOneElite(Inventory inventory, EliteEquipment eliteType)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
EquipmentDef val = null;
val = Addressables.LoadAssetAsync<EquipmentDef>((object)eliteType.addressable).WaitForCompletion();
inventory.SetEquipmentIndex(val.equipmentIndex);
}
public static void SummonEnemy(SpawnCardData enemyType, int reps)
{
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Expected O, but got Unknown
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
reps = Mathf.Clamp(reps, 1, Init.spawnLimit.Value ? Init.maxEnemies.Value : 50);
string text = "";
float num = 0f;
float num2 = 1f;
float num3 = 0f;
List<EliteEquipment> list = new List<EliteEquipment>
{
Models.ADFire,
Models.ADIce,
Models.ADLightning,
Models.ADGhost,
Models.ADPoison,
Models.ADEcho
};
if (ChaosMode.expansion1)
{
list.AddRange(new List<EliteEquipment>
{
Models.ADEarth,
Models.ADVoid
});
}
num2 = Mathf.Clamp((float)Init.eliteRate.Value / 100f, 0f, 1f);
num = Mathf.Clamp((float)Run.instance.GetDifficultyScaledCost(1) / 100f, 0f, 1f - num2);
num3 = (float)ChaosMode.random.Next(0, (int)Mathf.Clamp(num2 * 100f + (float)Run.instance.GetDifficultyScaledCost(1), 0f, 100f)) / 100f;
Console.WriteLine("[Chaos Log] Roll is {0} >= Elite Threshold is {1}", num3, num2 + num);
bool flag = ((num3 >= num2 + num) ? true : false);
EliteEquipment eliteEquipment = list[Tables.EliteDropTable()];
try
{
int num4 = Mathf.Clamp(reps / ((!flag) ? 1 : 2), 1, reps);
ReadOnlyCollection<PlayerCharacterMasterController> instances = PlayerCharacterMasterController.instances;
CharacterSpawnCard val = null;
val = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)enemyType.location).WaitForCompletion();
int num5 = 0;
for (int i = 0; i < Mathf.Clamp(num4 / instances.Count, 1, reps); i++)
{
foreach (PlayerCharacterMasterController item in instances)
{
GameObject spawnedInstance = SpawnEnemy(val, item.master.GetBody().transform.position).spawnedInstance;
if (flag & Object.op_Implicit((Object)(object)spawnedInstance))
{
EquipOneElite(spawnedInstance.GetComponent<CharacterMaster>().inventory, eliteEquipment);
text = eliteEquipment.prefix;
}
((MonoBehaviour)ChaosMode.instance).StartCoroutine(eventing.CheckIfEnemyDied(spawnedInstance, (int)enemyType.rewardBase));
}
num5 = i + 1;
}
SimpleChatMessage val2 = new SimpleChatMessage();
val2.baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Summoning " + num5 + (flag ? (" " + text + " ") : " ") + enemyType.name + ((num5 > 1) ? "s" : "") + "!</color>";
Chat.SendBroadcastChat((ChatMessageBase)(object)val2);
}
catch
{
Console.WriteLine("[Chaos Log] Can't find SpawnCard: {0}!", enemyType.name);
}
}
public static SpawnResult SpawnEnemy(CharacterSpawnCard spawnCard, Vector3 center, bool ally = false)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_0023: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
spawnCard.noElites = false;
((SpawnCard)spawnCard).eliteRules = (EliteRules)0;
DirectorPlacementRule val = new DirectorPlacementRule
{
placementMode = (PlacementMode)0,
preventOverhead = true
};
DirectorSpawnRequest val2 = new DirectorSpawnRequest((SpawnCard)(object)spawnCard, val, new Xoroshiro128Plus((ulong)Run.instance.stageRng.nextUint))
{
teamIndexOverride = (TeamIndex)(ally ? 1 : 2),
ignoreTeamMemberLimit = true
};
Vector3 val3 = default(Vector3);
((Vector3)(ref val3))..ctor((float)ChaosMode.random.Next(-25, 25), 0f, (float)ChaosMode.random.Next(-25, 25));
Vector3 val4 = center + new Vector3((val3.x >= 0f) ? Mathf.Clamp(val3.x, 5f, 25f) : Mathf.Clamp(val3.x, -5f, -25f), 10f, (val3.z >= 0f) ? Mathf.Clamp(val3.z, 5f, 25f) : Mathf.Clamp(val3.z, -5f, -25f));
return ((SpawnCard)spawnCard).DoSpawn(val4, Quaternion.identity, val2);
}
public static List<PickupIndex> RollType(int item)
{
List<PickupIndex> result = Run.instance.availableTier1DropList;
switch (item)
{
case 1:
result = Run.instance.availableTier2DropList;
break;
case 2:
result = Run.instance.availableTier3DropList;
break;
case 3:
result = Run.instance.availableBossDropList;
break;
case 4:
result = Run.instance.availableLunarItemDropList;
break;
case 5:
result = Run.instance.availableEquipmentDropList;
break;
case 6:
{
List<List<PickupIndex>> list = new List<List<PickupIndex>>
{
Run.instance.availableVoidTier1DropList,
Run.instance.availableVoidTier2DropList,
Run.instance.availableVoidTier3DropList,
Run.instance.availableVoidBossDropList
};
result = list[Tables.VoidDropTable()];
break;
}
}
return result;
}
}
public class Tables
{
public static int GetDropTable(bool restrictVoid = false, bool restrictEquipment = false, bool restrictLunar = false)
{
int[] array = new int[7]
{
Init.commonRate.Value,
Init.uncommonRate.Value,
Init.legendRate.Value,
Init.bossRate.Value,
(!restrictLunar) ? Init.lunarRate.Value : 0,
(!restrictEquipment) ? 15 : 0,
ChaosMode.expansion1 ? ((!restrictVoid) ? Init.corruptRate.Value : 0) : 0
};
int num = 0;
int num2 = 0;
int[] array2 = array;
foreach (int num3 in array2)
{
num += num3;
}
int num4 = ChaosMode.random.Next(0, num);
for (int j = 0; j < array.Length; j++)
{
if (array[j] != 0)
{
num2 += array[j];
if (num4 < num2)
{
return j;
}
}
}
return 0;
}
public static int GetInstanceTable()
{
int[] array = new int[3]
{
Init.swarmRate.Value,
Mathf.Clamp(100 - Init.swarmRate.Value - Init.eventRate.Value, 0, 100),
Init.eventRate.Value
};
int num = 0;
int num2 = 0;
int[] array2 = array;
foreach (int num3 in array2)
{
num += num3;
}
int num4 = ChaosMode.random.Next(0, num);
for (int j = 0; j < array.Length; j++)
{
if (array[j] != 0)
{
num2 += array[j];
if (num4 < num2)
{
return j;
}
}
}
return 0;
}
public static int ItemDropTable(bool restrictVoid = false, bool restrictEquipment = false, bool restrictLunar = false)
{
int[] weights = new int[7]
{
Init.commonRate.Value,
Init.uncommonRate.Value,
Init.legendRate.Value,
Init.bossRate.Value,
(!restrictLunar) ? Init.lunarRate.Value : 0,
(!restrictEquipment) ? 15 : 0,
ChaosMode.expansion1 ? ((!restrictVoid) ? Init.corruptRate.Value : 0) : 0
};
return CreateDropTable(weights);
}
public static int VoidDropTable()
{
int[] weights = new int[4] { 40, 35, 20, 5 };
return CreateDropTable(weights);
}
public static int SummonDropTable()
{
int[] weights = new int[4]
{
Mathf.Clamp(Init.swarmRate.Value - (int)ChaosMode.directorValue / 3, 0, 100),
Mathf.Clamp(50 - (int)ChaosMode.directorValue / 3, 0, 100),
Mathf.Clamp(Init.eventRate.Value, 0, 100),
Mathf.Clamp(5 + (int)ChaosMode.directorValue, 0, 100)
};
return CreateDropTable(weights);
}
public static int EventDropTable()
{
List<int> list = new List<int> { 20, 5, 8, 20, 15 };
if (Init.purgeRate.Value > 0)
{
list.Add(2);
}
if (Init.enableOrder.Value)
{
list.Add(2);
}
if (ChaosMode.expansion1)
{
list.AddRange(new List<int> { 10, 5 });
}
if (ChaosMode.expansion1)
{
list.AddRange(new List<int> { 8 });
}
int num = CreateDropTable(list.ToArray());
Console.WriteLine("[CHAOS] event return is {0}", num);
return num;
}
public static int EliteDropTable()
{
List<int> list = new List<int> { 25, 25, 25, 15, 10, 10 };
if (ChaosMode.expansion1)
{
list.AddRange(new List<int> { 25, 10 });
}
return CreateDropTable(list.ToArray());
}
public static int CreateDropTable(int[] weights)
{
double num = 0.0;
double num2 = 0.0;
double[] array = new double[weights.Length];
foreach (int num3 in weights)
{
num += (double)num3;
}
for (int j = 0; j < weights.Length; j++)
{
array[j] = (double)weights[j] / num;
}
double num4 = ChaosMode.random.NextDouble() * 100.0;
for (int k = 0; k < array.Length; k++)
{
num2 += array[k] * 100.0;
if (array[k] != 0.0 && num4 < num2)
{
return k;
}
}
return 0;
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Pocket.ChaosMode", "ChaosMode", "3.0.1")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class ChaosMode : BaseUnityPlugin
{
public static ChaosMode instance;
public static Random random = new Random();
private static int oldTimer;
public static float directorValue;
private static bool initialized;
private static bool spawning;
public static bool expansion1;
public static bool expansion2;
public void Awake()
{
Init.Initialize(((BaseUnityPlugin)this).Config);
instance = this;
}
public static void Reset()
{
directorValue = (oldTimer = 0);
spawning = (initialized = false);
((MonoBehaviour)instance).StartCoroutine(instance.GameLoop());
}
private IEnumerator GameLoop()
{
yield return null;
if (!Object.op_Implicit((Object)(object)Run.instance))
{
yield break;
}
Scene activeScene = SceneManager.GetActiveScene();
string scene = ((Scene)(ref activeScene)).name;
if (!initialized)
{
if (scene == "lobby")
{
((MonoBehaviour)this).StartCoroutine(GameLoop());
}
initialized = true;
((MonoBehaviour)instance).StartCoroutine(instance.RunInit());
}
float t = Run.instance.GetRunStopwatch();
bool onTimer = Mathf.FloorToInt(t) % Mathf.Clamp(Init.chaosSpeed.Value, 5, 600) == 0;
bool timeParam = t > 5f && t != (float)oldTimer;
if (onTimer && timeParam && scene != "bazaar")
{
oldTimer = (int)t;
if (!spawning)
{
spawning = true;
Actions.SpawnEveryMinute();
((MonoBehaviour)instance).StartCoroutine(instance.FailSafeDelay());
}
}
else
{
spawning = false;
}
((MonoBehaviour)this).StartCoroutine(GameLoop());
}
private unsafe IEnumerator RunInit()
{
expansion1 = Run.instance.IsExpansionEnabled((ExpansionDef)Unsafe.Read<object>((void*)ExpansionCatalog.expansionDefs[0]));
expansion2 = Run.instance.IsExpansionEnabled((ExpansionDef)Unsafe.Read<object>((void*)ExpansionCatalog.expansionDefs[1]));
Console.WriteLine("[CHAOS] Expansion1 loaded: {0}", expansion1);
Console.WriteLine("[CHAOS] Expansion2 loaded: {0}", expansion2);
random = new Random((int)Run.instance.seed);
if (Init.startingItems.Value)
{
Actions.StartingItems();
}
yield return (object)new WaitForSeconds(20f);
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] The Avatar of Chaos invades!"
});
}
private IEnumerator FailSafeDelay()
{
yield return (object)new WaitForSeconds(1f);
spawning = false;
}
public static T FindObjectOfType<T>()
{
return FindObjectOfType<T>();
}
public static T[] FindObjectsOfType<T>()
{
return FindObjectsOfType<T>();
}
}
public class Events
{
public void JellyfishEventVoid()
{
((MonoBehaviour)ChaosMode.instance).StartCoroutine(JellyfishEvent());
}
public IEnumerator JellyfishEvent()
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Jellyfish event! Zzzap!</color>"
});
CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)Models.ADJellyfish.location).WaitForCompletion();
for (int i = 0; i < 50; i++)
{
foreach (PlayerCharacterMasterController player in PlayerCharacterMasterController.instances)
{
GameObject spawnedInstance = Actions.SpawnEnemy(spawnCard, player.master.GetBody().transform.position).spawnedInstance;
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance));
}
yield return (object)new WaitForSeconds(0.5f - (float)(i / 100));
}
}
public IEnumerator EliteParentEvent()
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Elite Parent event! The council will see you now!</color>"
});
ReadOnlyCollection<PlayerCharacterMasterController> players = PlayerCharacterMasterController.instances;
PlayerCharacterMasterController chosen = players[ChaosMode.random.Next(0, players.Count)];
CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)Models.ADParent.location).WaitForCompletion();
GameObject spawnedInstance7 = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position).spawnedInstance;
Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADFire);
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
spawnedInstance7 = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position).spawnedInstance;
Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADIce);
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
spawnedInstance7 = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position).spawnedInstance;
Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADLightning);
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
spawnedInstance7 = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position).spawnedInstance;
Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADGhost);
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
spawnedInstance7 = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position).spawnedInstance;
Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADPoison);
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
spawnedInstance7 = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position).spawnedInstance;
Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADEcho);
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
spawnedInstance7 = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position).spawnedInstance;
Actions.EquipOneElite(spawnedInstance7.GetComponent<CharacterMaster>().inventory, Models.ADEarth);
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance7));
yield return null;
}
public IEnumerator FinalEncounter()
{
if (ChaosMode.expansion1)
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Mutated event! The King of Nothing loses control!</color>"
});
}
else
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Empty event! The King of Nothing invades!</color>"
});
}
ReadOnlyCollection<PlayerCharacterMasterController> players = PlayerCharacterMasterController.instances;
PlayerCharacterMasterController chosen = players[ChaosMode.random.Next(0, players.Count)];
CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)Models.ADBrother.location).WaitForCompletion();
GameObject spawnedInstance = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position).spawnedInstance;
if (ChaosMode.expansion1)
{
Actions.EquipOneElite(spawnedInstance.GetComponent<CharacterMaster>().inventory, Models.ADVoid);
}
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance));
yield return null;
}
public IEnumerator VoidEncounter()
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>[VO?ID E??VEN?T][E?SCA?PE!]</color>"
});
ReadOnlyCollection<PlayerCharacterMasterController> players = PlayerCharacterMasterController.instances;
PlayerCharacterMasterController chosen = players[ChaosMode.random.Next(0, players.Count)];
CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)Models.ADVoidling.location).WaitForCompletion();
GameObject spawnedInstance = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position).spawnedInstance;
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance));
yield return null;
}
public IEnumerator StormEncounter()
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Storm event! Seek and ye shall find!</color>"
});
ReadOnlyCollection<PlayerCharacterMasterController> players = PlayerCharacterMasterController.instances;
PlayerCharacterMasterController chosen = players[ChaosMode.random.Next(0, players.Count)];
CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)Models.ADFalseSon.location).WaitForCompletion();
GameObject spawnedInstance = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position).spawnedInstance;
((MonoBehaviour)ChaosMode.instance).StartCoroutine(CheckIfEnemyDied(spawnedInstance));
yield return null;
}
public IEnumerator PurgeAllItems()
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[Chaos] <color=#ff0000>Purge event! You don't need these, right?</color>"
});
foreach (PlayerCharacterMasterController player in PlayerCharacterMasterController.instances)
{
((MonoBehaviour)ChaosMode.instance).StartCoroutine(Purge(player));
}
yield return null;
}
public IEnumerator Purge(PlayerCharacterMasterController player)
{
CharacterMaster master = player.master;
List<ItemIndex> inventory = master.inventory.itemAcquisitionOrder;
int cap = ChaosMode.random.Next(3, inventory.Count - 2);
int j = 0;
for (int i = inventory.Count - 1; i >= cap; i--)
{
ItemIndex slot = inventory[ChaosMode.random.Next(0, inventory.Count)];
master.inventory.RemoveItem(slot, Mathf.Min(master.inventory.GetItemCount(slot), int.MaxValue));
yield return (object)new WaitForSeconds(1f);
j++;
if (j > Init.purgeRate.Value)
{
break;
}
}
}
public IEnumerator Corruption()
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>[VO?ID E??VEN?T][B?EC?OME O??NE OF U?S]</color>"
});
int corrupt = ChaosMode.random.Next(1, 5);
for (int i = 0; i < corrupt; i++)
{
List<PickupIndex> corruption = Actions.RollType(6);
Actions.GiveToAllPlayers(corruption[ChaosMode.random.Next(0, corruption.Count)]);
yield return (object)new WaitForSeconds(1f);
}
}
public IEnumerator GainFriend()
{
List<SpawnCardData> allies = new List<SpawnCardData>
{
Models.ADBeetleGuard,
Models.ADBrother,
Models.ADNullifier,
Models.ADTitanGold,
Models.ADLunarGolem,
Models.ADVagrant
};
if (ChaosMode.expansion1)
{
allies.Add(Models.ADGup);
}
if (ChaosMode.expansion2)
{
allies.AddRange(new List<SpawnCardData>
{
Models.ADChild,
Models.ADHalcyonite,
Models.ADScorchling
});
}
SpawnCardData ally = allies[ChaosMode.random.Next(0, allies.Count)];
CharacterSpawnCard spawnCard = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)ally.location).WaitForCompletion();
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Friendly event! " + ally.name + " wants to help you this stage!</color>"
});
ReadOnlyCollection<PlayerCharacterMasterController> players = PlayerCharacterMasterController.instances;
PlayerCharacterMasterController chosen = players[ChaosMode.random.Next(0, players.Count)];
_ = Actions.SpawnEnemy(spawnCard, chosen.master.GetBody().transform.position, ally: true).spawnedInstance;
yield return null;
}
public IEnumerator SequenceEvent()
{
foreach (PlayerCharacterMasterController player in PlayerCharacterMasterController.instances)
{
CharacterMaster master = player.master;
int[] tiers = new int[6]
{
master.inventory.GetTotalItemCountOfTier((ItemTier)0),
master.inventory.GetTotalItemCountOfTier((ItemTier)1),
master.inventory.GetTotalItemCountOfTier((ItemTier)2),
master.inventory.GetTotalItemCountOfTier((ItemTier)4),
master.inventory.GetTotalItemCountOfTier((ItemTier)3),
0
};
if (ChaosMode.expansion1)
{
tiers[5] = master.inventory.GetTotalItemCountOfTier((ItemTier)6);
tiers[5] += master.inventory.GetTotalItemCountOfTier((ItemTier)7);
tiers[5] += master.inventory.GetTotalItemCountOfTier((ItemTier)8);
tiers[5] += master.inventory.GetTotalItemCountOfTier((ItemTier)9);
}
Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", tiers[0], tiers[1], tiers[2], tiers[3], tiers[4], tiers[5]);
List<ItemIndex> inventory = master.inventory.itemAcquisitionOrder;
while (master.inventory.itemAcquisitionOrder.Count > 0)
{
ItemIndex slot = inventory[0];
master.inventory.RemoveItem(slot, Mathf.Min(master.inventory.GetItemCount(slot), int.MaxValue));
}
for (int i = 0; i < 5; i++)
{
if (tiers[i] > 0)
{
List<PickupIndex> tieredItem = Actions.RollType(i);
Actions.GiveToOnePlayer(player, tieredItem[ChaosMode.random.Next(0, tieredItem.Count)], tiers[i]);
}
}
if (ChaosMode.expansion1 && tiers[5] > 0)
{
List<PickupIndex> tieredItem2 = Actions.RollType(6);
Actions.GiveToOnePlayer(player, tieredItem2[ChaosMode.random.Next(0, tieredItem2.Count)], tiers[5]);
}
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Order event! Your body has been sequenced!</color>"
});
}
yield return null;
}
public IEnumerator ForceTeleportEvent()
{
if (!((NetworkBehaviour)Run.instance).isServer)
{
yield return null;
}
SceneDef newScene = Addressables.LoadAssetAsync<SceneDef>((object)Models.scenes[ChaosMode.random.Next(0, Models.scenes.Length)]).WaitForCompletion();
SceneExitController sceneExitController = ChaosMode.FindObjectOfType<SceneExitController>();
if ((Object)(object)sceneExitController == (Object)null)
{
sceneExitController = new SceneExitController();
}
sceneExitController.useRunNextStageScene = false;
sceneExitController.destinationScene = newScene;
sceneExitController.SetState((ExitState)2);
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Teleportation event! Disappear!</color>"
});
yield return null;
}
public IEnumerator GoldEvent()
{
foreach (PlayerCharacterMasterController player in PlayerCharacterMasterController.instances)
{
CharacterMaster master = player.master;
master.money = (uint)ChaosMode.random.Next(0, 100000);
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Halcyon event! Random Number Gold-erator!</color>"
});
}
yield return null;
}
public IEnumerator TeleporterEvent()
{
if (!((NetworkBehaviour)Run.instance).isServer)
{
yield return null;
}
ChaosMode.FindObjectOfType<TeleporterInteraction>().isActivated = true;
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Haste event! Start the teleporter!</color>"
});
yield return null;
}
public IEnumerator PortalEvent()
{
if (!((NetworkBehaviour)Run.instance).isServer)
{
yield return null;
}
ChaosMode.FindObjectOfType<TeleporterInteraction>().shouldAttemptToSpawnGoldshoresPortal = ChaosMode.random.Next(0, 2) == 0;
ChaosMode.FindObjectOfType<TeleporterInteraction>().shouldAttemptToSpawnMSPortal = ChaosMode.random.Next(0, 2) == 0;
ChaosMode.FindObjectOfType<TeleporterInteraction>().shouldAttemptToSpawnShopPortal = ChaosMode.random.Next(0, 2) == 0;
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "<color=#bb0011>[CHAOS] <color=#ff0000>Orb event! The teleporter has changed!</color>"
});
yield return null;
}
public IEnumerator CheckIfEnemyDied(GameObject enemy, int reward = 20)
{
while ((Object)(object)enemy != (Object)null)
{
yield return (object)new WaitForSeconds(0.1f);
}
foreach (PlayerCharacterMasterController player in PlayerCharacterMasterController.instances)
{
((Component)player).GetComponent<CharacterMaster>().GiveMoney((uint)Run.instance.GetDifficultyScaledCost(reward));
}
}
}
internal class Hooks
{
public static void ChestBehavior_ItemDrop(orig_ItemDrop orig, ChestBehavior self)
{
//IL_0037: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
if (!CheckChestTypeIsValid(self))
{
orig.Invoke(self);
return;
}
PropertyInfo property = typeof(ChestBehavior).GetProperty("dropPickup", BindingFlags.Instance | BindingFlags.Public);
if (!((PickupIndex)property.GetValue(self) == PickupIndex.none))
{
List<PickupIndex> list = Actions.RollType(Tables.ItemDropTable());
PickupIndex val = list[ChaosMode.random.Next(0, list.Count)];
property.SetValue(self, val);
orig.Invoke(self);
}
}
public static void ShrineChanceBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineChanceBehavior self, Interactor activator)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
int num = Reflection.GetFieldValue<int>((object)self, "successfulPurchaseCount") + 1;
Reflection.SetFieldValue<int>((object)self, "successfulPurchaseCount", num);
List<PickupIndex> list = Actions.RollType(Tables.GetDropTable(restrictVoid: false, restrictEquipment: true));
PickupIndex val = list[ChaosMode.random.Next(0, list.Count)];
PickupDropletController.CreatePickupDroplet(val, self.dropletOrigin.position, self.dropletOrigin.forward * 20f);
Chat.SendBroadcastChat((ChatMessageBase)new SubjectFormatChatMessage
{
subjectAsCharacterBody = ((Component)activator).GetComponent<CharacterBody>(),
baseToken = "SHRINE_CHANCE_SUCCESS_MESSAGE"
});
Reflection.GetFieldValue<Action<bool, Interactor>>((object)self, "onShrineChancePurchaseGlobal")?.Invoke(arg1: true, activator);
Reflection.SetFieldValue<bool>((object)self, "waitingForRefresh", true);
Reflection.SetFieldValue<float>((object)self, "refreshTimer", 2f);
if (Reflection.GetFieldValue<int>((object)self, "successfulPurchaseCount") >= self.maxPurchaseCount)
{
((Component)self.symbolTransform).gameObject.SetActive(false);
}
}
public static bool CheckChestTypeIsValid(ChestBehavior self)
{
string text = ((Object)((Component)self).gameObject).name.Replace("(Clone)", "").Trim();
Console.WriteLine("[CHAOS] ChestBehavior gameobject name: {0}", text);
return text != "EquipmentBarrel" && text != "LunarChest" && text != "VoidChest" && text != "GoldChest";
}
public static void Run_Start(orig_Start orig, Run self)
{
ChaosMode.Reset();
orig.Invoke(self);
}
}
internal class Init
{
[CompilerGenerated]
private static class <>O
{
public static ArtifactStateChangeDelegate <0>__OnArtifactEnabled;
public static ArtifactStateChangeDelegate <1>__OnArtifactDisabled;
}
public static ArtifactDef ChaosArtifact;
public static bool multiplayerMode = true;
public static ConfigEntry<bool> artifactMode { get; set; }
public static ConfigEntry<int> chaosSpeed { get; set; }
public static ConfigEntry<bool> startingItems { get; set; }
public static ConfigEntry<bool> giveItems { get; set; }
public static ConfigEntry<bool> randomShrines { get; set; }
public static ConfigEntry<bool> randomSpecialChests { get; set; }
public static ConfigEntry<bool> includeLunar { get; set; }
public static ConfigEntry<int> commonRate { get; set; }
public static ConfigEntry<int> uncommonRate { get; set; }
public static ConfigEntry<int> legendRate { get; set; }
public static ConfigEntry<int> bossRate { get; set; }
public static ConfigEntry<int> lunarRate { get; set; }
public static ConfigEntry<int> corruptRate { get; set; }
public static ConfigEntry<int> swarmRate { get; set; }
public static ConfigEntry<int> eventRate { get; set; }
public static ConfigEntry<int> ambushRate { get; set; }
public static ConfigEntry<int> eliteRate { get; set; }
public static ConfigEntry<bool> spawnLimit { get; set; }
public static ConfigEntry<int> maxEnemies { get; set; }
public static ConfigEntry<int> swarmAggression { get; set; }
public static ConfigEntry<bool> enableOrder { get; set; }
public static ConfigEntry<int> purgeRate { get; set; }
public static void Initialize(ConfigFile Config)
{
InitConfig(Config);
if (artifactMode.Value)
{
InitArtifact();
}
else
{
AddHooks();
}
}
public static void InitArtifact()
{
//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_009e: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
ChaosArtifact = ScriptableObject.CreateInstance<ArtifactDef>();
ChaosArtifact.cachedName = "ARTIFACT_ChaosMode";
ChaosArtifact.nameToken = "Artifact of Chaos Mode";
ChaosArtifact.descriptionToken = "Randomizes chest drops, spawns bosses on a timer, manipulates items and causes ABSOLUTE CHAOS!";
AssetBundle val = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("chaos.chaosmode_assets"));
ChaosArtifact.smallIconSelectedSprite = val.LoadAsset<Sprite>("Assets/ChaosMode/Selected.png");
ChaosArtifact.smallIconDeselectedSprite = val.LoadAsset<Sprite>("Assets/ChaosMode/Unselected.png");
ContentAddition.AddArtifactDef(ChaosArtifact);
object obj = <>O.<0>__OnArtifactEnabled;
if (obj == null)
{
ArtifactStateChangeDelegate val2 = OnArtifactEnabled;
<>O.<0>__OnArtifactEnabled = val2;
obj = (object)val2;
}
RunArtifactManager.onArtifactEnabledGlobal += (ArtifactStateChangeDelegate)obj;
object obj2 = <>O.<1>__OnArtifactDisabled;
if (obj2 == null)
{
ArtifactStateChangeDelegate val3 = OnArtifactDisabled;
<>O.<1>__OnArtifactDisabled = val3;
obj2 = (object)val3;
}
RunArtifactManager.onArtifactDisabledGlobal += (ArtifactStateChangeDelegate)obj2;
}
public static void OnArtifactEnabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
{
if ((Object)(object)artifactDef == (Object)(object)ChaosArtifact && NetworkServer.active)
{
AddHooks();
}
}
public static void OnArtifactDisabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
{
if ((Object)(object)artifactDef == (Object)(object)ChaosArtifact && NetworkServer.active)
{
RemoveHooks();
}
}
public static void AddHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
ChestBehavior.ItemDrop += new hook_ItemDrop(Hooks.ChestBehavior_ItemDrop);
if (randomShrines.Value)
{
ShrineChanceBehavior.AddShrineStack += new hook_AddShrineStack(Hooks.ShrineChanceBehavior_AddShrineStack);
}
Run.Start += new hook_Start(Hooks.Run_Start);
}
public static void RemoveHooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
ChestBehavior.ItemDrop -= new hook_ItemDrop(Hooks.ChestBehavior_ItemDrop);
if (randomShrines.Value)
{
ShrineChanceBehavior.AddShrineStack -= new hook_AddShrineStack(Hooks.ShrineChanceBehavior_AddShrineStack);
}
Run.Start -= new hook_Start(Hooks.Run_Start);
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void EnableMultiplayer(ConCommandArgs args)
{
if (!multiplayerMode)
{
AddHooks();
}
multiplayerMode = true;
}
[ConCommand(/*Could not decode attribute arguments.*/)]
private static void DisableMultiplayer(ConCommandArgs args)
{
if (multiplayerMode)
{
RemoveHooks();
}
multiplayerMode = false;
}
public static void InitConfig(ConfigFile Config)
{
artifactMode = Config.Bind<bool>("Mode Settings", "ArtifactMode", true, "Enable or disable the mod as an artifact.\nTurn this off if playing multiplayer with unmodded clients.");
chaosSpeed = Config.Bind<int>("Chaos Settings", "ChaosSpeed", 60, "Raises the speed that Chaos Mode activates.\nIndicates how many seconds to wait before each Event or Spawn.");
startingItems = Config.Bind<bool>("Chaos Settings", "StartingItems", true, "Start each run with 3 Common items, 2 Uncommon items and 1 Legendary item.\nApplies to all players.");
giveItems = Config.Bind<bool>("Chaos Settings", "GiveItems", true, "Turn random item distribution on or off.\nItems either will or won't be added to your inventory when an event triggers.");
randomShrines = Config.Bind<bool>("Chaos Settings", "RandomShrines", true, "Randomizes drop pools for Shrines of Chance.\nItems either will or won't be added to your inventory when an event triggers.");
randomSpecialChests = Config.Bind<bool>("Chaos Settings", "RandomSpecialChests", false, "Randomizes drop pools for Special Chest types.\nItems dropped from Legendary Chests, Lunar Pods, Equipment Barrels, and Void Chests are randomized.");
includeLunar = Config.Bind<bool>("Item Settings", "IncludeLunar", false, "Include or exclude Lunar items with randomly dispersed items.\nLunar items can still be found in chests.");
commonRate = Config.Bind<int>("Item Settings", "CommonRate", 20, "Raises the likelyhood that a common item will be rolled.\nRoughly CommonRate% of items.");
uncommonRate = Config.Bind<int>("Item Settings", "UncommonRate", 15, "Raises the likelyhood that an uncommon item will be rolled.\nRoughly UncommonRate% of items.");
legendRate = Config.Bind<int>("Item Settings", "LegendRate", 10, "Raises the likelyhood that a legendary item will be rolled.\nRoughly LegendRate% of items.");
bossRate = Config.Bind<int>("Item Settings", "BossRate", 10, "Raises the likelyhood that a boss item will be rolled.\nRoughly BossRate% of items.");
lunarRate = Config.Bind<int>("Item Settings", "LunarRate", 10, "Raises the likelyhood that a lunar item will be rolled.\nRoughly LunarRate% of items.");
corruptRate = Config.Bind<int>("Item Settings", "CorruptRate", 10, "Raises the likelyhood that a corrupted item will be rolled.\nRoughly CorruptRate% of items. (Requires Survivors of The Void)");
swarmRate = Config.Bind<int>("Spawn Settings", "SwarmRate", 15, "Boosts the lilelyhood of enemies being spawned in swarms.\nRoughly SwarmRate% of spawns.");
eventRate = Config.Bind<int>("Spawn Settings", "EventRate", 20, "Boosts how often events are triggered.\nRoughly EventRate% of spawns.");
ambushRate = Config.Bind<int>("Spawn Settings", "AmbushRate", 15, "Boosts how often higher-tier boss enemies are spawned (not during swarms).\nRoughly AmbushRate% of enemies.");
eliteRate = Config.Bind<int>("Spawn Settings", "EliteRate", 50, "Percent likelyhood that enemies spawned will be Elite.\nRoughly EliteRate% of enemies.");
spawnLimit = Config.Bind<bool>("Spawn Settings", "SpawnLimit", true, "Places or removes an internal cap on enemy spawns.\n*WARNING! EXPERIMENTAL AND CAN CAUSE MASSIVE LAG!*");
maxEnemies = Config.Bind<int>("Spawn Settings", "MaxEnemies", 20, "Maximum amount of enemies that *CAN* be spawned during a swarm.\n*Disabling SpawnLimit will cause the mod to ignore this value.*");
swarmAggression = Config.Bind<int>("Spawn Settings", "SwarmAggression", 1, "Multiplies the amount of enemies that are spawned during swarms!");
enableOrder = Config.Bind<bool>("Event Settings", "EnableOrder", false, "Enable or disable the Sequencing order event.\nThe order event takes your items and redistributes them similar to the Shrine of Order.");
purgeRate = Config.Bind<int>("Event Settings", "PurgeRate", 5, "Limits how many items a Purge can take (limited to all but 3).\nPurge will remove *UP TO* PurgeRate of your items. (Set to 0 to disable Purge events.)");
}
}
internal static class Models
{
public static EliteEquipment ADFire = new EliteEquipment
{
prefix = "Blazing",
addressable = "RoR2/Base/EliteFire/EliteFireEquipment.asset"
};
public static EliteEquipment ADIce = new EliteEquipment
{
prefix = "Glacial",
addressable = "RoR2/Base/EliteIce/EliteIceEquipment.asset"
};
public static EliteEquipment ADLightning = new EliteEquipment
{
prefix = "Overloading",
addressable = "RoR2/Base/EliteLightning/EliteLightningEquipment.asset"
};
public static EliteEquipment ADGhost = new EliteEquipment
{
prefix = "Celestine",
addressable = "RoR2/Base/EliteHaunted/EliteHauntedEquipment.asset"
};
public static EliteEquipment ADPoison = new EliteEquipment
{
prefix = "Malachite",
addressable = "RoR2/Base/ElitePoison/ElitePoisonEquipment.asset"
};
public static EliteEquipment ADEcho = new EliteEquipment
{
prefix = "Perfected",
addressable = "RoR2/Base/EliteLunar/EliteLunarEquipment.asset"
};
public static EliteEquipment ADEarth = new EliteEquipment
{
prefix = "Mending",
addressable = "RoR2/DLC1/EliteEarth/EliteEarthEquipment.asset"
};
public static EliteEquipment ADVoid = new EliteEquipment
{
prefix = "Voidtouched",
addressable = "RoR2/DLC1/EliteVoid/EliteVoidEquipment.asset"
};
public static EliteEquipment ADSpeed = new EliteEquipment
{
prefix = "Speedy?",
addressable = "RoR2/DLC1/EliteSecretSpeedEquipment.asset"
};
public static EliteEquipment ADGold = new EliteEquipment
{
prefix = "Golden?",
addressable = "RoR2/Junk/EliteGold/EliteGoldEquipment.asset"
};
public static EliteEquipment ADYellow = new EliteEquipment
{
prefix = "Yellow?",
addressable = "RoR2/Junk/EliteYellow/EliteYellowEquipment.asset"
};
public static SpawnCardData ADBeetle = new SpawnCardData
{
name = "Beetle",
location = "RoR2/Base/Beetle/cscBeetle.asset",
difficultyBase = 0.1f,
rewardBase = 5f
};
public static SpawnCardData ADBeetleGuard = new SpawnCardData
{
name = "Beetle Guard",
location = "RoR2/Base/Beetle/cscBeetleGuard.asset",
difficultyBase = 0.4f,
rewardBase = 12f
};
public static SpawnCardData ADBeetleQueen = new SpawnCardData
{
name = "Beetle Queen",
location = "RoR2/Base/Beetle/cscBeetleQueen.asset",
difficultyBase = 1f,
rewardBase = 23f
};
public static SpawnCardData ADLemurian = new SpawnCardData
{
name = "Lemurian",
location = "RoR2/Base/Lemurian/cscLemurian.asset",
difficultyBase = 0.2f,
rewardBase = 23f
};
public static SpawnCardData ADBigLemurian = new SpawnCardData
{
name = "Elder Lemurian",
location = "RoR2/Base/LemurianBruiser/cscLemurianBruiser.asset",
difficultyBase = 0.9f,
rewardBase = 23f
};
public static SpawnCardData ADBell = new SpawnCardData
{
name = "Brass Contraption",
location = "RoR2/Base/Bell/cscBell.asset",
difficultyBase = 0.8f,
rewardBase = 16f
};
public static SpawnCardData ADBison = new SpawnCardData
{
name = "Bison",
location = "RoR2/Base/Bison/cscBison.asset",
difficultyBase = 0.3f,
rewardBase = 9f
};
public static SpawnCardData ADTemplar = new SpawnCardData
{
name = "Clay Templar",
location = "RoR2/Base/ClayBruiser/cscClayBruiser.asset",
difficultyBase = 0.9f,
rewardBase = 21f
};
public static SpawnCardData ADApothecary = new SpawnCardData
{
name = "Clay Apothecary",
location = "RoR2/DLC1/ClayGrenadier/cscClayGrenadier.asset",
difficultyBase = 0.8f,
rewardBase = 18f
};
public static SpawnCardData ADGolem = new SpawnCardData
{
name = "Stone Golem",
location = "RoR2/Base/Golem/cscGolem.asset",
difficultyBase = 0.4f,
rewardBase = 10f
};
public static SpawnCardData ADWisp = new SpawnCardData
{
name = "Lesser Wisp",
location = "RoR2/Base/Wisp/cscLesserWisp.asset",
difficultyBase = 0.1f,
rewardBase = 4f
};
public static SpawnCardData ADGreaterWisp = new SpawnCardData
{
name = "Greater Wisp",
location = "RoR2/Base/GreaterWisp/cscGreaterWisp.asset",
difficultyBase = 0.7f,
rewardBase = 14f
};
public static SpawnCardData ADJellyfish = new SpawnCardData
{
name = "Jellyfish",
location = "RoR2/Base/Jellyfish/cscJellyfish.asset",
difficultyBase = 0.2f,
rewardBase = 7f
};
public static SpawnCardData ADMushroom = new SpawnCardData
{
name = "Mini Mushroom",
location = "RoR2/Base/MiniMushroom/cscMiniMushroom.asset",
difficultyBase = 0.9f,
rewardBase = 19f
};
public static SpawnCardData ADVulture = new SpawnCardData
{
name = "Alloy Vulture",
location = "RoR2/Base/Vulture/cscVulture.asset",
difficultyBase = 0.7f,
rewardBase = 14f
};
public static SpawnCardData ADImp = new SpawnCardData
{
name = "Imp",
location = "RoR2/Base/Imp/cscImp.asset",
difficultyBase = 0.6f,
rewardBase = 16f
};
public static SpawnCardData ADParent = new SpawnCardData
{
name = "Parent",
location = "RoR2/Base/Parent/cscParent.asset",
difficultyBase = 0.9f,
rewardBase = 23f
};
public static SpawnCardData ADLunarGolem = new SpawnCardData
{
name = "Lunar Chimera",
location = "RoR2/Base/LunarGolem/cscLunarGolem.asset",
difficultyBase = 1.1f,
rewardBase = 25f
};
public static SpawnCardData ADLunarWisp = new SpawnCardData
{
name = "Lunar Chimera",
location = "RoR2/Base/LunarWisp/cscLunarWisp.asset",
difficultyBase = 1.3f,
rewardBase = 27f
};
public static SpawnCardData ADLunarBomb = new SpawnCardData
{
name = "Lunar Chimera",
location = "RoR2/Base/LunarExploder/cscLunarExploder.asset",
difficultyBase = 0.8f,
rewardBase = 19f
};
public static SpawnCardData ADNullifier = new SpawnCardData
{
name = "Void Reaver",
location = "RoR2/Base/Nullifier/cscNullifier.asset",
difficultyBase = 1.5f,
rewardBase = 32f
};
public static SpawnCardData ADArchWisp = new SpawnCardData
{
name = "Archaic Wisp",
location = "RoR2/Junk/ArchWisp/cscArchWisp.asset",
difficultyBase = 0.8f,
rewardBase = 23f
};
public static SpawnCardData ADHermitCrab = new SpawnCardData
{
name = "Hermit Crab",
location = "RoR2/Base/HermitCrab/cscHermitCrab.asset",
difficultyBase = 0.5f,
rewardBase = 8f
};
public static SpawnCardData ADTitan = new SpawnCardData
{
name = "Stone Titan",
location = "RoR2/Base/Titan/cscTitanBlackBeach.asset",
difficultyBase = 1.2f,
rewardBase = 24f
};
public static SpawnCardData ADVagrant = new SpawnCardData
{
name = "Wandering Vagrant",
location = "RoR2/Base/Vagrant/cscVagrant.asset",
difficultyBase = 0.7f,
rewardBase = 17f
};
public static SpawnCardData ADOverlord = new SpawnCardData
{
name = "Imp Overlord",
location = "RoR2/Base/ImpBoss/cscImpBoss.asset",
difficultyBase = 1.3f,
rewardBase = 19f
};
public static SpawnCardData ADTitanGold = new SpawnCardData
{
name = "Aurelionite",
location = "RoR2/Base/Titan/cscTitanGold.asset",
difficultyBase = 1.4f,
rewardBase = 30f
};
public static SpawnCardData ADDunestrider = new SpawnCardData
{
name = "Clay Dunestrider",
location = "RoR2/Base/ClayBoss/cscClayBoss.asset",
difficultyBase = 1f,
rewardBase = 22f
};
public static SpawnCardData ADGrandparent = new SpawnCardData
{
name = "Grandparent",
location = "RoR2/Base/Grandparent/cscGrandparent.asset",
difficultyBase = 1.6f,
rewardBase = 34f
};
public static SpawnCardData ADGhibli = new SpawnCardData
{
name = "Grovetender",
location = "RoR2/Base/Gravekeeper/cscGravekeeper.asset",
difficultyBase = 1.3f,
rewardBase = 31f
};
public static SpawnCardData ADMagmaWorm = new SpawnCardData
{
name = "Magma Worm",
location = "RoR2/Base/MagmaWorm/cscMagmaWorm.asset",
difficultyBase = 1.5f,
rewardBase = 32f
};
public static SpawnCardData ADOverWorm = new SpawnCardData
{
name = "Overloading Worm",
location = "RoR2/Base/ElectricWorm/cscElectricWorm.asset",
difficultyBase = 1.8f,
rewardBase = 36f
};
public static SpawnCardData ADRoboBall = new SpawnCardData
{
name = "Solus Control Unit",
location = "RoR2/Base/RoboBallBoss/cscRoboBallBoss.asset",
difficultyBase = 1.4f,
rewardBase = 23f
};
public static SpawnCardData ADScav = new SpawnCardData
{
name = "Scavenger",
location = "RoR2/Base/Scav/cscScav.asset",
difficultyBase = 1.6f,
rewardBase = 37f
};
public static SpawnCardData ADLarva = new SpawnCardData
{
name = "Acid Larva",
location = "RoR2/DLC1/AcidLarva/cscAcidLarva.asset",
difficultyBase = 0.6f,
rewardBase = 10f
};
public static SpawnCardData ADAssassin = new SpawnCardData
{
name = "Assassin",
location = "RoR2/DLC1/Assassin2/cscAssassin2.asset",
difficultyBase = 0.5f,
rewardBase = 14f
};
public static SpawnCardData ADPest = new SpawnCardData
{
name = "Blind Pest",
location = "RoR2/DLC1/FlyingVermin/cscFlyingVermin.asset",
difficultyBase = 0.7f,
rewardBase = 16f
};
public static SpawnCardData ADVermin = new SpawnCardData
{
name = "Blind Vermin",
location = "RoR2/DLC1/Vermin/cscVermin.asset",
difficultyBase = 0.6f,
rewardBase = 12f
};
public static SpawnCardData ADBarnacle = new SpawnCardData
{
name = "Void Barnacle",
location = "RoR2/DLC1/VoidBarnacle/cscVoidBarnacle.asset",
difficultyBase = 1f,
rewardBase = 20f
};
public static SpawnCardData ADJailer = new SpawnCardData
{
name = "Void Jailer",
location = "RoR2/DLC1/VoidJailer/cscVoidJailer.asset",
difficultyBase = 1.8f,
rewardBase = 38f
};
public static SpawnCardData ADMegaCrab = new SpawnCardData
{
name = "Void Devastator",
location = "RoR2/DLC1/VoidMegaCrab/cscVoidMegaCrab.asset",
difficultyBase = 2f,
rewardBase = 43f
};
public static SpawnCardData ADGup = new SpawnCardData
{
name = "Gup",
location = "RoR2/DLC1/Gup/cscGupBody.asset",
difficultyBase = 1f,
rewardBase = 20f
};
public static SpawnCardData ADInfestor = new SpawnCardData
{
name = "Void Infestor",
location = "RoR2/DLC1/EliteVoid/cscVoidInfestor.asset",
difficultyBase = 0.6f,
rewardBase = 13f
};
public static SpawnCardData ADMajor = new SpawnCardData
{
name = "??? Construct",
location = "RoR2/DLC1/MajorAndMinorConstruct/cscMajorConstruct.asset",
difficultyBase = 1f,
rewardBase = 20f
};
public static SpawnCardData ADMinor = new SpawnCardData
{
name = "Alpha Construct",
location = "RoR2/DLC1/MajorAndMinorConstruct/cscMinorConstruct.asset",
difficultyBase = 0.5f,
rewardBase = 11f
};
public static SpawnCardData ADMega = new SpawnCardData
{
name = "Xi Construct",
location = "RoR2/DLC1/MajorAndMinorConstruct/cscMegaConstruct.asset",
difficultyBase = 1f,
rewardBase = 20f
};
public static SpawnCardData ADHalcyonite = new SpawnCardData
{
name = "Halcyonite",
location = "RoR2/DLC2/Halcyonite/cscHalcyonite.asset",
difficultyBase = 2f,
rewardBase = 34f
};
public static SpawnCardData ADScorchling = new SpawnCardData
{
name = "Scorch Wurm",
location = "RoR2/DLC2/Scorchling/cscScorchling.asset",
difficultyBase = 1.2f,
rewardBase = 28f
};
public static SpawnCardData ADChild = new SpawnCardData
{
name = "Child",
location = "RoR2/DLC2/Child/cscChild.asset",
difficultyBase = 0.6f,
rewardBase = 12f
};
public static SpawnCardData ADBrother = new SpawnCardData
{
name = "Mithrix",
location = "RoR2/Base/Brother/cscBrother.asset",
difficultyBase = 2f,
rewardBase = 40f
};
public static SpawnCardData ADVoidling = new SpawnCardData
{
name = "Voidling",
location = "RoR2/DLC1/VoidRaidCrab/cscMiniVoidRaidCrabBase.asset",
difficultyBase = 2f,
rewardBase = 45f
};
public static SpawnCardData ADFalseSon = new SpawnCardData
{
name = "False Son",
location = "RoR2/DLC2/FalseSonBoss/cscFalseSonBoss.asset",
difficultyBase = 3f,
rewardBase = 60f
};
public static string[] scenes = new string[15]
{
"RoR2/Base/blackbeach/blackbeach.asset", "RoR2/Base/blackbeach2/blackbeach2.asset", "RoR2/Base/dampcavesimple/dampcavesimple.asset", "RoR2/Base/foggyswamp/foggyswamp.asset", "RoR2/Base/frozenwall/frozenwall.asset", "RoR2/Base/golemplains/golemplains.asset", "RoR2/Base/golemplains2/golemplains2.asset", "RoR2/Base/goolake/goolake.asset", "RoR2/Base/rootjungle/rootjungle.asset", "RoR2/Base/shipgraveyard/shipgraveyard.asset",
"RoR2/Base/skymeadow/skymeadow.asset", "RoR2/Base/wispgraveyard/wispgraveyard.asset", "RoR2/DLC1/ancientloft/ancientloft.asset", "RoR2/DLC1/snowyforest/snowyforest.asset", "RoR2/DLC1/sulfurpools/sulfurpools.asset"
};
}
internal class SpawnCardData
{
public string name { get; set; }
public string location { get; set; }
public float difficultyBase { get; set; }
public float rewardBase { get; set; }
public int spawnCost { get; set; }
public SpawnCardData()
{
name = "Test Enemy";
location = "RoR2/Base/Beetle/cscBeetle.asset";
difficultyBase = 0.1f;
rewardBase = 5f;
spawnCost = 1;
}
}
internal class EliteEquipment
{
public string prefix { get; set; }
public string addressable { get; set; }
}
}