using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HG; using HG.Reflection; using IL.RoR2; using LeTai.Asset.TranslucentImage; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using On.RoR2.UI; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RiskOfRoutes; using RiskOfRoutes.StageModifiers; using RiskOfRoutes.StageModifiers.CombatModifiers; using RiskOfRoutes.StageModifiers.OtherModifiers; using RiskOfRoutes.StageModifiers.SceneModifiers; using RoR2; using RoR2.Artifacts; using RoR2.CharacterAI; using RoR2.ExpansionManagement; using RoR2.Navigation; using RoR2.UI; using SamplePlugin; using SamplePlugin.StageModifiers; using SamplePlugin.StageModifiers.BossRewardModifiers; using SamplePlugin.StageModifiers.CombatModifiers; using SamplePlugin.StageModifiers.OtherModifiers; using SamplePlugin.StageModifiers.SceneModifiers; using TMPro; using Unity; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyInformationalVersion("1.0.0+1027ebc23d4b579fb2e8fe94723bf2ece01c5281")] [assembly: AssemblyProduct("RiskOfRoutes")] [assembly: AssemblyTitle("RiskOfRoutes")] [assembly: AssemblyCompany("RiskOfRoutes")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] 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; } } } public class RouteMap { public class RouteNode { public RoutePortalType portalType; public int x; public int y; public bool visited; public bool shopVisited; public bool goldshoresVisited; public bool voidFieldsVisited; public RouteNode left; public RouteNode front; public RouteNode right; public RouteNode portalNode; public RouteNode(int x, int y) { portalType = RoutePortalType.None; this.x = x; this.y = y; } public List GetPaths(bool usePortalNode = false) { List list = new List(); if (left != null) { list.Add(left); } if (front != null) { list.Add(front); } if (right != null) { list.Add(right); } if (portalNode != null && usePortalNode) { list.Add(portalNode); } return list; } public override string ToString() { return $"Node:{x}.{y} with {GetPaths().Count} paths"; } } public int width; public int height; public int startingRoutes = 3; public bool isMoonVisited = false; public RouteNode[,] mapGrid; public RouteNode root; public bool isDirty = false; public RouteMap(Xoroshiro128Plus rng) { width = global::RiskOfRoutes.RiskOfRoutes.routeMapWidth.Value; height = 5; mapGrid = new RouteNode[width + 1, height]; mapGrid[0, 0] = new RouteNode(0, 0); root = mapGrid[0, 0]; root.visited = true; root.portalType = RoutePortalType.Starting; for (int i = 0; i < width; i++) { for (int j = 1; j < height; j++) { mapGrid[i, j] = new RouteNode(i, j); } } List list = SetupPaths(rng); list.Sort((RouteNode a, RouteNode b) => a.x.CompareTo(b.x)); if (list.Count >= 1) { root.left = list[0]; } if (list.Count >= 2) { root.front = list[1]; } if (list.Count >= 3) { root.right = list[2]; } SetupRewards(rng); isDirty = true; } public void SetupRewards(Xoroshiro128Plus rng) { WeightedSelection val = new WeightedSelection(8); val.AddChoice(RoutePortalType.Heal, 1f); val.AddChoice(RoutePortalType.Combat, 1f); val.AddChoice(RoutePortalType.Utility, 1f); val.AddChoice(RoutePortalType.DroneType, 1f); WeightedSelection val2 = new WeightedSelection(8); val2.AddChoice(RoutePortalType.Heal, 1f); val2.AddChoice(RoutePortalType.Combat, 1f); val2.AddChoice(RoutePortalType.Utility, 1f); val2.AddChoice(RoutePortalType.DroneType, 1f); val2.AddChoice(RoutePortalType.ChefType, 0.8f); val2.AddChoice(RoutePortalType.Rare, 0.8f); for (int i = 0; i < width; i++) { if (mapGrid[i, 1].portalType != 0) { mapGrid[i, 1].portalType = val.Evaluate(rng.nextNormalizedFloat); } if (mapGrid[i, 3].portalType != 0) { mapGrid[i, 3].portalType = val2.Evaluate(rng.nextNormalizedFloat); } if (mapGrid[i, 2].portalType != 0) { mapGrid[i, 2].portalType = val2.Evaluate(rng.nextNormalizedFloat); } if (mapGrid[i, 4].portalType != 0) { mapGrid[i, 4].portalType = RoutePortalType.ChefType; } } HashSet memory = new HashSet(); List paths = root.GetPaths(); CheckNodeCorrect(root, rng, memory); foreach (RouteNode item in paths) { CheckNodeCorrect(item, rng, memory); } } private void CheckNodeCorrect(RouteNode node, Xoroshiro128Plus rng, HashSet memory) { //IL_0017: 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) Vector2 item = default(Vector2); ((Vector2)(ref item))..ctor((float)node.x, (float)node.y); if (memory.Contains(item)) { return; } memory.Add(item); RoutePortalType routePortalType = RoutePortalType.None; List paths = node.GetPaths(); if (paths.Count == 0) { return; } routePortalType = node.portalType; foreach (RouteNode item2 in paths) { if (item2.portalType == node.portalType) { item2.portalType = RollPortalType(rng, node.portalType); } } if (paths.Count > 1) { if (paths.Count == 2) { if (paths[0].portalType == paths[1].portalType) { paths[1].portalType = RollPortalType(rng, paths[0].portalType, routePortalType); } } else if (paths.Count == 3) { if (paths[0].portalType == paths[1].portalType) { paths[1].portalType = RollPortalType(rng, paths[0].portalType, routePortalType); } if (paths[2].portalType == paths[0].portalType || paths[2].portalType == paths[1].portalType) { paths[2].portalType = RollPortalType(rng, paths[0].portalType, paths[1].portalType, routePortalType); } } } foreach (RouteNode item3 in paths) { CheckNodeCorrect(item3, rng, memory); } } private RoutePortalType RollPortalType(Xoroshiro128Plus rng, params RoutePortalType[] skipTypes) { WeightedSelection val = new WeightedSelection(8); RoutePortalType[] array = new RoutePortalType[6] { RoutePortalType.Combat, RoutePortalType.Heal, RoutePortalType.Utility, RoutePortalType.DroneType, RoutePortalType.Rare, RoutePortalType.ChefType }; RoutePortalType[] array2 = array; foreach (RoutePortalType routePortalType in array2) { if (!skipTypes.Contains(routePortalType)) { if (routePortalType == RoutePortalType.Rare || routePortalType == RoutePortalType.ChefType) { val.AddChoice(routePortalType, 0.8f); } else { val.AddChoice(routePortalType, 1f); } } } return val.Evaluate(rng.nextNormalizedFloat); } public List SetupPaths(Xoroshiro128Plus rng) { List list = new List(); List list2 = new List(); for (int i = 0; i < width; i++) { list2.Add(i); } for (int j = 0; j < startingRoutes; j++) { if (list2.Count == 0) { break; } int num = rng.NextElementUniform(list2); list2.Remove(num); RouteNode routeNode = mapGrid[num, 1]; if (routeNode != null) { routeNode.portalType = RoutePortalType.Rare; CreateRoute(routeNode, routeNode.x, routeNode.y, rng); list.Add(routeNode); } } return list; } public void CreateRoute(RouteNode curr, int x, int y, Xoroshiro128Plus rng) { if (y >= height - 1) { return; } List list = new List(); for (int i = 0; i < 3; i++) { int num = x - 1 + i; int num2 = y + 1; if (num >= 0 && num <= width - 1 && (i != 0 || mapGrid[num, y].right == null) && (i != 2 || mapGrid[num, y].left == null)) { list.Add(mapGrid[x - 1 + i, y + 1]); } } if (list.Count != 0) { RouteNode routeNode = rng.NextElementUniform(list); if (list.Count > 1 && rng.nextNormalizedFloat < 0.2f) { list.Remove(routeNode); RouteNode routeNode2 = rng.NextElementUniform(list); routeNode2.portalType = RoutePortalType.Rare; Connect(curr, routeNode2); CreateRoute(routeNode2, routeNode2.x, routeNode2.y, rng); } routeNode.portalType = RoutePortalType.Rare; Connect(curr, routeNode); CreateRoute(routeNode, routeNode.x, routeNode.y, rng); } } public RouteNode CreateColossusNode(RouteNode current, bool currentLayer = false) { if (current.y == height - 1 || current.y > 3) { return null; } int num = (currentLayer ? current.y : (current.y + 1)); Log.Info("Creating colossus node"); isDirty = true; RouteNode routeNode = null; for (int i = 0; i < width + 1; i++) { if (mapGrid[i, num] != null && (mapGrid[i, num].portalType == RoutePortalType.Colossus || mapGrid[i, num].portalType == RoutePortalType.FalseSon)) { routeNode = mapGrid[i, num]; Log.Info("Floor already has colossus node"); return routeNode; } } Log.Info("Has no colossus nodes"); for (int j = 0; j < width; j++) { int[] array = new int[2] { current.x + j, current.x - j }; int[] array2 = array; foreach (int num2 in array2) { if (num2 >= 0 && num2 < width && mapGrid[num2, num].portalType == RoutePortalType.None) { routeNode = mapGrid[num2, num]; break; } } if (routeNode != null) { break; } } if (routeNode == null) { Log.Warning("No place for colossus node, placing on extra"); mapGrid[width, num] = new RouteNode(width, num); routeNode = mapGrid[width, num]; } if (routeNode != null) { routeNode.portalType = ((num != 3) ? RoutePortalType.Colossus : RoutePortalType.FalseSon); current.portalNode = routeNode; if (routeNode.portalType == RoutePortalType.FalseSon) { ConnectToRandomNode(routeNode, thisLayer: true); } else { ConnectToRandomNode(routeNode); } return routeNode; } Log.Error("Still null"); return null; } public RouteNode CreateHardwareNode(RouteNode current) { int num = current.y + 1; Log.Info("Creating hardware node"); isDirty = true; RouteNode routeNode = null; for (int i = 0; i < width + 1; i++) { if (mapGrid[i, num] != null && (mapGrid[i, num].portalType == RoutePortalType.Hardware || mapGrid[i, num].portalType == RoutePortalType.SolusWing)) { routeNode = mapGrid[i, num]; Log.Info("Floor already has hardware node"); return routeNode; } } Log.Info("Has no hardware nodes"); for (int j = 0; j < width; j++) { int[] array = new int[2] { current.x + j, current.x - j }; int[] array2 = array; foreach (int num2 in array2) { if (num2 >= 0 && num2 < width && mapGrid[num2, num].portalType == RoutePortalType.None) { routeNode = mapGrid[num2, num]; break; } } if (routeNode != null) { break; } } if (routeNode == null) { Log.Warning("No place for hardware node, placing on extra"); mapGrid[width, num] = new RouteNode(width, num); routeNode = mapGrid[width, num]; } if (routeNode != null) { routeNode.portalType = ((num != 4) ? RoutePortalType.Hardware : RoutePortalType.SolusWing); current.portalNode = routeNode; return routeNode; } Log.Error("Still null"); return null; } private void ConnectToRandomNode(RouteNode node, bool thisLayer = false) { int y = node.y; int num = (thisLayer ? y : (y + 1)); List list = new List(); for (int i = 0; i < width; i++) { RouteNode routeNode = mapGrid[i, num]; if (routeNode != null && routeNode.portalType != 0 && routeNode != node) { list.Add(routeNode); } } if (list.Count > 0) { node.front = Run.instance.stageRng.NextElementUniform(list); } else { Log.Warning("ConnectToRandomNode: No valid target nodes to connect"); } } private void Connect(RouteNode curr, RouteNode next) { if (curr.x - next.x == -1) { curr.right = next; } else if (curr.x - next.x == 0) { curr.front = next; } else { curr.left = next; } } public RouteNode GetStartingNode() { return mapGrid[0, 0]; } } public enum RoutePortalType { None, Rare, ItemType, DroneType, ChefType, Colossus, Hardware, SolusWing, Goldshores, Shop, Arena, FalseSon, Starting, Combat, Heal, Utility } public enum ModifierTier { Tier1 = 1, Tier2, Tier3 } public enum ModifierRarity { Common, Rare } namespace SamplePlugin { public class CommandHelper : MonoBehaviour { [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetNextStagesScenes(ConCommandArgs args) { Log.Info("Next stages available:"); foreach (SceneDef nextStagesScenes in SceneHelper.GetNextStagesScenesList()) { Log.Info(nextStagesScenes.cachedName); } Log.Info(Run.instance.nextStageScene.destinationsGroup); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetBannedStage(ConCommandArgs args) { Log.Info("Banned on stage: "); foreach (string item in StageModifierDirector.instance.bannedModifiersStage) { Log.Info("\t" + item); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetBannedRun(ConCommandArgs args) { Log.Info("Banned in run: "); foreach (string item in StageModifierDirector.instance.bannedModifiersRun) { Log.Info("\t" + item); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetAvailablePrinters(ConCommandArgs args) { Log.Info("Printer items: "); Log.Info("\tUtility pool: "); foreach (string item in StageModifierCatalog.utilityPool) { Log.Info("\t\t" + item); } Log.Info("Heal pool: "); foreach (string item2 in StageModifierCatalog.healPool) { Log.Info("\t\t" + item2); } Log.Info("Damage pool: "); foreach (string item3 in StageModifierCatalog.combatPool) { Log.Info("\t\t" + item3); } Log.Info("Food-related pool: "); foreach (string item4 in StageModifierCatalog.chefPool) { Log.Info("\t\t" + item4); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetAvailableEnemyItems(ConCommandArgs args) { Log.Info("Enemy items: "); foreach (string item in StageModifierCatalog.generalNegativePool) { if (item.EndsWith("_EnemyItem")) { Log.Info("\t" + item); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetAvailableLunarItems(ConCommandArgs args) { Log.Info("Lunar items: "); foreach (string item in StageModifierCatalog.generalNegativePool) { if (item.EndsWith("_LunarItem")) { Log.Info("\t" + item); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetAvailableArtifacts(ConCommandArgs args) { Log.Info("Artifacts available: "); foreach (string item in StageModifierCatalog.generalNegativePool.Where((string def) => StageModifierCatalog.FindModifier(def).isArtifact)) { Log.Info("\t" + item); } foreach (string item2 in StageModifierCatalog.rarePool.Where((string def) => StageModifierCatalog.FindModifier(def).isArtifact)) { Log.Info("\t" + item2); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetAllArtifactDefs(ConCommandArgs args) { Log.Info("Artifacts defs: "); ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; foreach (ArtifactDef val in artifactDefs) { Log.Info("\t" + val.cachedName + " - " + val.nameToken); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCReinit(ConCommandArgs args) { StageModifierCatalog.Init(AssetManager.bundle); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetNextGreenStage(ConCommandArgs args) { Log.Info($"Modul:{Stage.instance.sceneDef.stageOrder}"); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetDccs(ConCommandArgs args) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) Log.Info("Available enemies"); WeightedSelection monsterSelection = ClassicStageInfo.instance.monsterSelection; if (monsterSelection != null) { for (int i = 0; i < monsterSelection.Count; i++) { DirectorCard value = monsterSelection.GetChoice(i).value; Log.Info($"DirectorCard {((Object)value.spawnCard).name}, cost: {value.cost}, weight: {value.selectionWeight}"); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetCurrentNode(ConCommandArgs args) { List routeNodesSynced = StageModifierDirector.instance.routeNodesSynced; if (routeNodesSynced.Count == 0) { Log.Error("none"); } foreach (RouteNodeSync item in routeNodesSynced) { Log.Info($"{item.x}.{item.y}:{item.portalType}-{item.visited}"); } RouteMap.RouteNode currentNode = StageModifierDirector.instance.currentNode; Log.Info($"Current node is {currentNode.x},{currentNode.y} with {currentNode.GetPaths().Count} children, visited {currentNode.visited}"); Log.Info("\tNext scene:" + Run.instance.nextStageScene.cachedName); Log.Info("\tCurr scene:" + Stage.instance.sceneDef.cachedName); Log.Info($"\tLoop clear count:{Run.instance.loopClearCount}"); Log.Info($"Child node: {currentNode.GetPaths()[0].x}.{currentNode.GetPaths()[0].y}: {currentNode.GetPaths()[0].portalType}"); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetElitesAvailable(ConCommandArgs args) { FieldInfo field = typeof(CombatDirector).GetField("eliteTiers", BindingFlags.Static | BindingFlags.NonPublic); if (!(field != null)) { return; } EliteTierDef[] array = (EliteTierDef[])field.GetValue(null); Log.Info($"Tier count{array.Length}"); for (int i = 0; i < array.Length; i++) { Log.Info($"Tier{i + 1}: {array[i].availableDefs.Count}"); foreach (EliteDef availableDef in array[i].availableDefs) { if ((Object)(object)availableDef != (Object)null) { Log.Info("\t " + ((Object)availableDef).name); } } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetItemDefs(ConCommandArgs args) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Log.Info("Enemies can have"); foreach (ItemDef item in ((IEnumerable)(object)ItemCatalog.allItemDefs).Where((ItemDef def) => def.DoesNotContainTag((ItemTag)4))) { Log.Info($"\t{((Object)item).name}, {item.requiredExpansion}"); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSetPunish(ConCommandArgs args) { if (NetworkServer.active) { int value = ((ConCommandArgs)(ref args)).TryGetArgInt(0).Value; StageModifierDirector.instance.commandAddedStack = value; Log.Info($"Set additional punish to {value}"); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCItemTags(ConCommandArgs args) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Invalid comparison between Unknown and I4 //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Invalid comparison between Unknown and I4 Log.Info("Items with damage tag"); Enumerator enumerator = ItemCatalog.allItemDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { ItemDef current = enumerator.Current; if (current.tags.Contains((ItemTag)1) && ((int)current.tier == 0 || (int)current.tier == 1)) { Log.Info("\t" + ((Object)current).name + ":" + Language.GetString(current.nameToken)); } } } finally { ((IDisposable)enumerator).Dispose(); } Log.Info("Items with healing tag"); Enumerator enumerator2 = ItemCatalog.allItemDefs.GetEnumerator(); try { while (enumerator2.MoveNext()) { ItemDef current2 = enumerator2.Current; if (current2.tags.Contains((ItemTag)2) && ((int)current2.tier == 0 || (int)current2.tier == 1)) { Log.Info("\t" + ((Object)current2).name + ":" + Language.GetString(current2.nameToken)); } } } finally { ((IDisposable)enumerator2).Dispose(); } Log.Info("Items with utility tag"); Enumerator enumerator3 = ItemCatalog.allItemDefs.GetEnumerator(); try { while (enumerator3.MoveNext()) { ItemDef current3 = enumerator3.Current; if (current3.tags.Contains((ItemTag)3) && ((int)current3.tier == 0 || (int)current3.tier == 1)) { Log.Info("\t" + ((Object)current3).name + ":" + Language.GetString(current3.nameToken)); } } } finally { ((IDisposable)enumerator3).Dispose(); } Log.Info("Items with food-related tag"); Enumerator enumerator4 = ItemCatalog.allItemDefs.GetEnumerator(); try { while (enumerator4.MoveNext()) { ItemDef current4 = enumerator4.Current; if (current4.tags.Contains((ItemTag)28) && ((int)current4.tier == 0 || (int)current4.tier == 1)) { Log.Info("\t" + ((Object)current4).name + ":" + Language.GetString(current4.nameToken)); } } } finally { ((IDisposable)enumerator4).Dispose(); } Log.Info("Items with ai_blacklist tag"); Enumerator enumerator5 = ItemCatalog.allItemDefs.GetEnumerator(); try { while (enumerator5.MoveNext()) { ItemDef current5 = enumerator5.Current; if (current5.tags.Contains((ItemTag)4)) { Log.Info("\t" + ((Object)current5).name + ":" + Language.GetString(current5.nameToken)); } } } finally { ((IDisposable)enumerator5).Dispose(); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetActiveModifiers(ConCommandArgs args) { Log.Info("Getting synced modifiers"); if (!((Object)(object)StageModifierDirector.instance != (Object)null)) { return; } SyncListModifier modifiersSynced = StageModifierDirector.instance.modifiersSynced; if (modifiersSynced != null) { if (((SyncListStruct)modifiersSynced).Count > 0) { foreach (ModifierSync item in (SyncList)(object)modifiersSynced) { Log.Info($"{item.name}:{item.stack}"); } return; } Log.Info("There are no modifiers"); } else { Log.Error("Modifiers list is null"); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetSyncedData(ConCommandArgs args) { Log.Info("Getting synced modifiers"); if ((Object)(object)StageModifierDirector.instance != (Object)null) { Log.Info("Modifiers synced"); { foreach (ModifierSync item in (SyncList)(object)StageModifierDirector.instance.modifiersSynced) { Log.Info($"{item.name}:{item.stack}:{item.isArtifact}"); } return; } } Log.Info("StageModifierDirector is null"); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCGetReservedModifiers(ConCommandArgs args) { if ((Object)(object)StageModifierDirector.instance != (Object)null) { List reservedModifiers = StageModifierDirector.instance.reservedModifiers; if (reservedModifiers != null) { if (reservedModifiers.Count > 0) { foreach (ModifierSync item in reservedModifiers) { Log.Info(item); } return; } Log.Info("There are no modifiers"); } else { Log.Error("Modifiers list is null"); } } else { Log.Error("It is null"); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCFindShopPortal(ConCommandArgs args) { GameObject val = GameObject.Find("Node"); if ((Object)(object)val == (Object)null) { Log.Error("Could not find it"); return; } Log.Info("Found it"); Component[] componentsInChildren = val.GetComponentsInChildren(); foreach (Component val2 in componentsInChildren) { Log.Info(((object)val2).GetType()); } SceneExitController component = val.GetComponent(); Log.Info(component.destinationScene); Log.Info(component.useRunNextStageScene); } } [Serializable] public struct ModifierSync : IEquatable { public string name; public int stack; public bool isArtifact; public ModifierSync(ModifierDef mod) { name = mod.name; stack = 1; isArtifact = mod.isArtifact; } public ModifierSync(ModifierDef mod, int stack) { name = mod.name; this.stack = stack; isArtifact = mod.isArtifact; } public bool Equals(ModifierSync other) { return name == other.name; } } [Serializable] public struct RouteNodeSync : IEquatable { public RoutePortalType portalType; public int x; public int y; public int frontX; public int frontY; public int leftX; public int leftY; public int rightX; public int rightY; public int bonusX; public int bonusY; public bool visited; public bool shopVisited; public bool goldshoresVisited; public bool voidFieldsVisited; public RouteNodeSync(RouteMap.RouteNode node) { x = -1; y = -1; frontX = -1; frontY = -1; leftX = -1; leftY = -1; rightX = -1; rightY = -1; bonusX = -1; bonusY = -1; x = node.x; y = node.y; visited = node.visited; portalType = node.portalType; RouteMap.RouteNode front = node.front; if (front != null) { frontX = front.x; frontY = front.y; } RouteMap.RouteNode left = node.left; if (left != null) { leftX = left.x; leftY = left.y; } RouteMap.RouteNode right = node.right; if (node.right != null) { rightX = right.x; rightY = right.y; } if (node.portalNode != null) { bonusX = node.portalNode.x; bonusY = node.portalNode.y; } shopVisited = node.shopVisited; goldshoresVisited = node.goldshoresVisited; voidFieldsVisited = node.voidFieldsVisited; } public bool Equals(RouteNodeSync other) { return x == other.x && y == other.y && visited == other.visited && portalType == other.portalType && frontX == other.frontX && frontY == other.frontY && leftX == other.leftX && leftY == other.leftY && rightX == other.rightX && rightY == other.rightY && bonusX == other.bonusX && bonusY == other.bonusY; } } public class SyncListModifier : SyncListStruct { public override void SerializeItem(NetworkWriter writer, ModifierSync item) { writer.Write(item.name); writer.WritePackedUInt32((uint)item.stack); writer.Write(item.isArtifact); } public override ModifierSync DeserializeItem(NetworkReader reader) { ModifierSync result = default(ModifierSync); result.name = reader.ReadString(); result.stack = (int)reader.ReadPackedUInt32(); result.isArtifact = reader.ReadBoolean(); return result; } } public class SyncListRouteNode : SyncListStruct { public override void SerializeItem(NetworkWriter writer, RouteNodeSync item) { writer.Write((int)item.portalType); writer.WritePackedUInt32((uint)item.x); writer.WritePackedUInt32((uint)item.y); writer.WritePackedUInt32((uint)item.frontX); writer.WritePackedUInt32((uint)item.frontY); writer.WritePackedUInt32((uint)item.leftX); writer.WritePackedUInt32((uint)item.leftY); writer.WritePackedUInt32((uint)item.rightX); writer.WritePackedUInt32((uint)item.rightY); writer.WritePackedUInt32((uint)item.bonusX); writer.WritePackedUInt32((uint)item.bonusY); writer.Write(item.visited); writer.Write(item.shopVisited); writer.Write(item.goldshoresVisited); writer.Write(item.voidFieldsVisited); } public override RouteNodeSync DeserializeItem(NetworkReader reader) { RouteNodeSync result = default(RouteNodeSync); result.portalType = (RoutePortalType)reader.ReadInt32(); result.x = (int)reader.ReadPackedUInt32(); result.y = (int)reader.ReadPackedUInt32(); result.frontX = (int)reader.ReadPackedUInt32(); result.frontY = (int)reader.ReadPackedUInt32(); result.leftX = (int)reader.ReadPackedUInt32(); result.leftY = (int)reader.ReadPackedUInt32(); result.rightX = (int)reader.ReadPackedUInt32(); result.rightY = (int)reader.ReadPackedUInt32(); result.bonusX = (int)reader.ReadPackedUInt32(); result.bonusY = (int)reader.ReadPackedUInt32(); result.visited = reader.ReadBoolean(); result.shopVisited = reader.ReadBoolean(); result.goldshoresVisited = reader.ReadBoolean(); result.voidFieldsVisited = reader.ReadBoolean(); return result; } } public class ModifierSlotConfiguration { public Dictionary positive = new Dictionary(); public Dictionary negative = new Dictionary(); } public class StageModifierDirector : NetworkBehaviour { public static StageModifierDirector instance; public static List activePortalInstances; public List runArtifactsApplied; public SyncListModifier modifiersSynced = new SyncListModifier(); public List routeNodesSynced = new List(); public int mapState = 0; public float stageEnterTime = 0f; [SyncVar] public int mapWidth; [SyncVar] public int mapHeight; [SyncVar] public bool isMoonVisited; [SyncVar] public Vector2 currentNodeSync = new Vector2(-1f, -1f); public int uniqueModifierLimit = 5; public Inventory monsterTeamInventory; public RouteMap routeMap; public RouteMap.RouteNode currentNode; [SyncVar(hook = "OnBaseCurseSyncedUpdate")] public float syncedBaseCurse = 0f; [SyncVar] public int soulCostStack = 0; public int commandAddedStack = 0; [SyncVar] public float punishmentTime = -1f; [SyncVar] public bool purifyLunarItemModifier; [SyncVar] public int doppelStackTime = 30; [SyncVar] public bool modifiersCanBeBanned = true; [SyncVar] public bool enemyItemsModifierCanStack = false; [SyncVar] public int commonDefaultStack = 5; [SyncVar] public int uncommonDefaultStack = 3; [SyncVar] public int legendaryDefaultStack = 1; [SyncVar] public int bossDefaultStack = 1; [SyncVar] public int commonExtraRange = 3; [SyncVar] public int uncommonExtraRange = 2; [SyncVar] public int legendaryExtraRange = 1; [SyncVar] public int bossExtraRange = 1; [SyncVar] public int chanceForExtra = 0; private static int kListmodifiersSynced; private static int kRpcRpcReceiveFullMap; public List activeModifiers { get; set; } public List reservedModifiers { get; set; } public HashSet bannedModifiersRun { get; set; } public HashSet bannedModifiersStage { get; set; } public int NetworkmapWidth { get { return mapWidth; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref mapWidth, 2u); } } public int NetworkmapHeight { get { return mapHeight; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref mapHeight, 4u); } } public bool NetworkisMoonVisited { get { return isMoonVisited; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref isMoonVisited, 8u); } } public Vector2 NetworkcurrentNodeSync { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return currentNodeSync; } [param: In] set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).SetSyncVar(value, ref currentNodeSync, 16u); } } public float NetworksyncedBaseCurse { get { return syncedBaseCurse; } [param: In] set { ref float reference = ref syncedBaseCurse; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; OnBaseCurseSyncedUpdate(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref reference, 32u); } } public int NetworksoulCostStack { get { return soulCostStack; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref soulCostStack, 64u); } } public float NetworkpunishmentTime { get { return punishmentTime; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref punishmentTime, 128u); } } public bool NetworkpurifyLunarItemModifier { get { return purifyLunarItemModifier; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref purifyLunarItemModifier, 256u); } } public int NetworkdoppelStackTime { get { return doppelStackTime; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref doppelStackTime, 512u); } } public bool NetworkmodifiersCanBeBanned { get { return modifiersCanBeBanned; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref modifiersCanBeBanned, 1024u); } } public bool NetworkenemyItemsModifierCanStack { get { return enemyItemsModifierCanStack; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref enemyItemsModifierCanStack, 2048u); } } public int NetworkcommonDefaultStack { get { return commonDefaultStack; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref commonDefaultStack, 4096u); } } public int NetworkuncommonDefaultStack { get { return uncommonDefaultStack; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref uncommonDefaultStack, 8192u); } } public int NetworklegendaryDefaultStack { get { return legendaryDefaultStack; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref legendaryDefaultStack, 16384u); } } public int NetworkbossDefaultStack { get { return bossDefaultStack; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref bossDefaultStack, 32768u); } } public int NetworkcommonExtraRange { get { return commonExtraRange; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref commonExtraRange, 65536u); } } public int NetworkuncommonExtraRange { get { return uncommonExtraRange; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref uncommonExtraRange, 131072u); } } public int NetworklegendaryExtraRange { get { return legendaryExtraRange; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref legendaryExtraRange, 262144u); } } public int NetworkbossExtraRange { get { return bossExtraRange; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref bossExtraRange, 524288u); } } public int NetworkchanceForExtra { get { return chanceForExtra; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref chanceForExtra, 1048576u); } } public void Awake() { instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); activeModifiers = new List(); reservedModifiers = new List(); bannedModifiersRun = new HashSet(); bannedModifiersStage = new HashSet(); activePortalInstances = new List(); Log.Info("Awake: StageModifierDirector created"); if (NetworkServer.active) { Run.onRunStartGlobal += Run_onRunStartGlobal; Run.onRunDestroyGlobal += Run_onRunDestroyGlobal; SceneDirector.onPrePopulateSceneServer += SceneDirector_onPrePopulateSceneServer; Stage.onServerStageComplete += Stage_onServerStageComplete; } ((SyncList)(object)modifiersSynced).InitializeBehaviour((NetworkBehaviour)(object)this, kListmodifiersSynced); } public void OnDestroy() { Run.onRunDestroyGlobal -= Run_onRunDestroyGlobal; Run.onRunStartGlobal -= Run_onRunStartGlobal; SceneDirector.onPrePopulateSceneServer -= SceneDirector_onPrePopulateSceneServer; Stage.onServerStageComplete -= Stage_onServerStageComplete; } private void Run_onRunStartGlobal(Run run) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) Log.Info("Run_onRunStartGlobal: Run started"); if (NetworkServer.active) { GameObject val = Object.Instantiate(global::RiskOfRoutes.RiskOfRoutes.networkedInventoryPrefab); Object.DontDestroyOnLoad((Object)(object)val); monsterTeamInventory = val.GetComponent(); val.GetComponent().teamIndex = (TeamIndex)2; NetworkServer.Spawn(val); CreateRunConfiguration(); Log.Info(string.Format("{0}: Got punishmentTimeMinutes value - {1}", "Run_onRunStartGlobal", punishmentTime)); Log.Info("Creating route map"); routeMap = new RouteMap(run.runRNG); currentNode = routeMap.GetStartingNode(); currentNode.visited = true; NetworkcurrentNodeSync = new Vector2((float)currentNode.x, (float)currentNode.y); Log.Info($"Current:{currentNode.x},{currentNode.y} that has {currentNode.GetPaths().Count} paths"); routeMap.isDirty = true; } } private void CreateRunConfiguration() { NetworkenemyItemsModifierCanStack = global::RiskOfRoutes.RiskOfRoutes.enemyItemsModifierCanStack.Value; NetworkcommonDefaultStack = global::RiskOfRoutes.RiskOfRoutes.commonDefaultStack.Value; NetworkuncommonDefaultStack = global::RiskOfRoutes.RiskOfRoutes.uncommonDefaultStack.Value; NetworklegendaryDefaultStack = global::RiskOfRoutes.RiskOfRoutes.legendaryDefaultStack.Value; NetworkbossDefaultStack = global::RiskOfRoutes.RiskOfRoutes.bossDefaultStack.Value; NetworkcommonExtraRange = global::RiskOfRoutes.RiskOfRoutes.commonExtraRange.Value; NetworkuncommonExtraRange = global::RiskOfRoutes.RiskOfRoutes.uncommonExtraRange.Value; NetworklegendaryExtraRange = global::RiskOfRoutes.RiskOfRoutes.legendaryExtraRange.Value; NetworkbossExtraRange = global::RiskOfRoutes.RiskOfRoutes.bossExtraRange.Value; NetworkchanceForExtra = global::RiskOfRoutes.RiskOfRoutes.chanceForExtra.Value; runArtifactsApplied = GetArtifactsAppliedThisRun(); if (global::RiskOfRoutes.RiskOfRoutes.negativeStackPunishment.Value) { NetworkpunishmentTime = global::RiskOfRoutes.RiskOfRoutes.punishmentTimeMinutes.Value; } else { NetworkpunishmentTime = -1f; } NetworkpurifyLunarItemModifier = global::RiskOfRoutes.RiskOfRoutes.lunarTurnToPearl.Value; NetworkdoppelStackTime = global::RiskOfRoutes.RiskOfRoutes.doppelStackTime.Value; NetworkmodifiersCanBeBanned = global::RiskOfRoutes.RiskOfRoutes.modifiersCanBeBanned.Value; bannedModifiersRun.Clear(); if (!global::RiskOfRoutes.RiskOfRoutes.allowAurelioniteModifier.Value) { bannedModifiersRun.Add("Aurelionite"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowBossRedItemModifier.Value) { bannedModifiersRun.Add("BossRedItem"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowBossYellowItemModifier.Value) { bannedModifiersRun.Add("BossYellowItem"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowDroneBossGreenModifier.Value) { bannedModifiersRun.Add("DroneBossGreen"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowDroneBossRedModifier.Value) { bannedModifiersRun.Add("DroneBossRed"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowMoreElitesModifier.Value) { bannedModifiersRun.Add("MoreElites"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowMoreDronesModifier.Value) { bannedModifiersRun.Add("MoreDrones"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowUpgradeDronesModifier.Value) { bannedModifiersRun.Add("UpgradeDrones"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowLunarEnemiesModifier.Value) { bannedModifiersRun.Add("LunarEnemies"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowVoidEnemiesModifier.Value) { bannedModifiersRun.Add("VoidEnemies"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowYellowPrinterModifier.Value) { bannedModifiersRun.Add("YellowPrinter"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowRedPrinterModifier.Value) { bannedModifiersRun.Add("RedPrinter"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowOnlyFlyingModifier.Value) { bannedModifiersRun.Add("OnlyFlying"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowPowerfulElitesModifier.Value) { bannedModifiersRun.Add("PowerfulElites"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowRepairModifier.Value) { bannedModifiersRun.Add("Repair"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowWanderingChefModifier.Value) { bannedModifiersRun.Add("WanderingChef"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowMountainModifier.Value) { bannedModifiersRun.Add("Mountain"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowSoulCostModifier.Value) { bannedModifiersRun.Add("SoulCost"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowDoppelgangerModifier.Value) { bannedModifiersRun.Add("Doppelganger"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowMysteryArtifact.Value) { bannedModifiersRun.Add("Mystery"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowChaosArtifact.Value) { bannedModifiersRun.Add("FriendlyFire"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowCommandArtifact.Value) { bannedModifiersRun.Add("Command"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowDelusionArtifact.Value) { bannedModifiersRun.Add("Delusion"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowDevotionArtifact.Value) { bannedModifiersRun.Add("Devotion"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowDissonanceArtifact.Value) { bannedModifiersRun.Add("MixEnemy"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowEnigmaArtifact.Value) { bannedModifiersRun.Add("Enigma"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowEvolutionArtifact.Value) { bannedModifiersRun.Add("MonsterTeamGainsItems"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowFrailtyArtifact.Value) { bannedModifiersRun.Add("WeakAssKnees"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowGlassArtifact.Value) { bannedModifiersRun.Add("Glass"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowHonorArtifact.Value) { bannedModifiersRun.Add("EliteOnly"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowKinArtifact.Value) { bannedModifiersRun.Add("SingleMonsterType"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowMetamorphosisArtifact.Value) { bannedModifiersRun.Add("RandomSurvivorOnRespawn"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowRebirthArtifact.Value) { bannedModifiersRun.Add("Rebirth"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowSacrificeArtifact.Value) { bannedModifiersRun.Add("Sacrifice"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowSoulArtifact.Value) { bannedModifiersRun.Add("WispOnDeath"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowSpiteArtifact.Value) { bannedModifiersRun.Add("Bomb"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowSwarmsArtifact.Value) { bannedModifiersRun.Add("Swarms"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowVengeanceArtifact.Value) { bannedModifiersRun.Add("ShadowClone"); } if (!global::RiskOfRoutes.RiskOfRoutes.allowDeathArtifact.Value) { bannedModifiersRun.Add("TeamDeath"); } StageModifierCatalog.CreateRunPools(global::RiskOfRoutes.RiskOfRoutes.printerItemPool.Value, global::RiskOfRoutes.RiskOfRoutes.lunarItemPool.Value, global::RiskOfRoutes.RiskOfRoutes.enemyItemPool.Value, global::RiskOfRoutes.RiskOfRoutes.canAppearWithAIBlacklisted.Value, global::RiskOfRoutes.RiskOfRoutes.enemyItemsAllowBoss.Value, global::RiskOfRoutes.RiskOfRoutes.enemyItemsAllowVoid.Value, bannedModifiersRun); List list = (from s in global::RiskOfRoutes.RiskOfRoutes.tier1EnemyItems.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list2 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier2EnemyItems.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list3 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier3EnemyItems.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list4 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier1PrinterItems.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list5 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier2PrinterItems.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list6 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier3PrinterItems.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list7 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier1LunarItems.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list8 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier2LunarItems.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list9 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier3LunarItems.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list10 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier1Artifacts.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list11 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier2Artifacts.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); List list12 = (from s in global::RiskOfRoutes.RiskOfRoutes.tier3Artifacts.Value.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries) select s.Trim()).ToList(); foreach (string item in list) { StageModifierCatalog.TryRegEnemy(item, ModifierTier.Tier1, isAdditional: true); Log.Info(item + " registering as Tier1 enemy item"); } foreach (string item2 in list2) { StageModifierCatalog.TryRegEnemy(item2, ModifierTier.Tier2, isAdditional: true); Log.Info(item2 + " registering as Tier2 enemy item"); } foreach (string item3 in list3) { StageModifierCatalog.TryRegEnemy(item3, ModifierTier.Tier3, isAdditional: true); Log.Info(item3 + " registering as Tier3 enemy item"); } foreach (string item4 in list4) { StageModifierCatalog.TryRegPrinter(item4, ModifierTier.Tier1, isAdditional: true); Log.Info(item4 + " registering as Tier1 printer item"); } foreach (string item5 in list5) { StageModifierCatalog.TryRegPrinter(item5, ModifierTier.Tier2, isAdditional: true); Log.Info(item5 + " registering as Tier2 printer item"); } foreach (string item6 in list6) { StageModifierCatalog.TryRegPrinter(item6, ModifierTier.Tier3, isAdditional: true); Log.Info(item6 + " registering as Tier3 printer item"); } foreach (string item7 in list7) { StageModifierCatalog.TryRegLunar(item7, ModifierTier.Tier1, isAdditional: true); Log.Info(item7 + " registering as Tier1 lunar item"); } foreach (string item8 in list8) { StageModifierCatalog.TryRegLunar(item8, ModifierTier.Tier2, isAdditional: true); Log.Info(item8 + " registering as Tier2 lunar item"); } foreach (string item9 in list9) { StageModifierCatalog.TryRegLunar(item9, ModifierTier.Tier3, isAdditional: true); Log.Info(item9 + " registering as Tier3 lunar item"); } foreach (string item10 in list10) { StageModifierCatalog.TryRegArtifact(new ArtifactInfo(item10, 1, isNegative: true), isAdditional: true); Log.Info(item10 + " registering as Tier1 artifact"); } foreach (string item11 in list11) { StageModifierCatalog.TryRegArtifact(new ArtifactInfo(item11, 2, isNegative: true), isAdditional: true); Log.Info(item11 + " registering as Tier2 artifact"); } foreach (string item12 in list12) { StageModifierCatalog.TryRegArtifact(new ArtifactInfo(item12, 3, isNegative: true), isAdditional: true); Log.Info(item12 + " registering as Tier3 artifact"); } } private void OnEnable() { Stage.onStageStartGlobal += OnStageStartClient; } private void OnDisable() { Stage.onStageStartGlobal -= OnStageStartClient; } private void OnStageStartClient(Stage obj) { if (!NetworkServer.active) { Log.Info("OnStageStartClient: on client"); LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); NetworkUser val = ((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null); if (!((Object)(object)val == (Object)null)) { Console.instance.SubmitCmd(val, "request_map", false); } } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCRequestMap(ConCommandArgs args) { if ((Object)(object)instance != (Object)null && instance.routeMap != null) { Log.Info("CCRequestMap: requested the map"); instance.routeMap.isDirty = true; } } protected virtual void FixedUpdate() { if (NetworkServer.active && routeMap != null && routeMap.isDirty) { UpdateRouteMap(); routeMap.isDirty = false; } } private void UpdateRouteMap() { Log.Info("UpdateRouteMap: Updating route map"); int width = routeMap.width; int height = routeMap.height; RouteNodeSync[] array = new RouteNodeSync[(width + 1) * height]; for (int i = 0; i < width + 1; i++) { for (int j = 0; j < height; j++) { int num = i * height + j; if (routeMap.mapGrid[i, j] != null) { array[num] = new RouteNodeSync(routeMap.mapGrid[i, j]); } else { array[num] = new RouteNodeSync(new RouteMap.RouteNode(-1, -1)); } } } NetworkmapWidth = width; NetworkmapHeight = height; NetworkisMoonVisited = routeMap.isMoonVisited; routeNodesSynced = new List(array); CallRpcReceiveFullMap(array, width, height, routeMap.isMoonVisited, stageEnterTime); } [ClientRpc] private void RpcReceiveFullMap(RouteNodeSync[] map, int width, int height, bool moon, float hostStageEnterTime) { NetworkmapWidth = width; NetworkmapHeight = height; NetworkisMoonVisited = moon; routeNodesSynced = new List(map); mapState++; stageEnterTime = hostStageEnterTime; Debug.Log((object)"RpcReceiveFullMap: Got map on client"); } private void Run_onRunDestroyGlobal(Run obj) { if (!NetworkServer.active) { return; } Log.Info(string.Format("{0}: Run ended, clearing {1} modifiers", "Run_onRunDestroyGlobal", activeModifiers.Count)); foreach (StageModifier activeModifier in activeModifiers) { if (activeModifier == null) { Log.Error("Run_onRunDestroyGlobal: Some active modifier is null"); } else { activeModifier.OnEnd(); } } reservedModifiers.Clear(); runArtifactsApplied.Clear(); ((SyncList)(object)modifiersSynced).Clear(); routeNodesSynced.Clear(); if (Object.op_Implicit((Object)(object)((Component)this).gameObject)) { Object.Destroy((Object)(object)((Component)this).gameObject); Log.Info("Run_onRunDestroyGlobal: StageModifierDirector destroyed"); } if (Object.op_Implicit((Object)(object)monsterTeamInventory)) { NetworkServer.Destroy(((Component)monsterTeamInventory).gameObject); } monsterTeamInventory = null; } private void OnBaseCurseSyncedUpdate(float newValue) { NetworksyncedBaseCurse = newValue; foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (!((Object)(object)readOnlyInstances.playerCharacterMasterController == (Object)null) && Object.op_Implicit((Object)(object)readOnlyInstances) && Object.op_Implicit((Object)(object)readOnlyInstances.GetBody())) { readOnlyInstances.GetBody().RecalculateStats(); } } } public List GetArtifactsAppliedThisRun() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) List list = new List(); RunEnabledArtifacts enumerator = RunArtifactManager.enabledArtifactsEnumerable.GetEnumerator(); try { while (((RunEnabledArtifacts)(ref enumerator)).MoveNext()) { ArtifactDef current = ((RunEnabledArtifacts)(ref enumerator)).Current; list.Add(current.cachedName); Log.Info("Added " + current.cachedName); } } finally { ((IDisposable)(RunEnabledArtifacts)(ref enumerator)).Dispose(); } return list; } private void SceneDirector_onPrePopulateSceneServer(SceneDirector obj) { Log.Info(string.Format("{0}: Stage started, applying {1} modifiers", "SceneDirector_onPrePopulateSceneServer", reservedModifiers.Count)); if (reservedModifiers.Count == 0) { return; } Log.Info(reservedModifiers.Count); activeModifiers.Clear(); bannedModifiersStage.Clear(); Log.Info("Active"); foreach (ModifierSync reservedModifier in reservedModifiers) { StageModifier stageModifier = StageModifierCatalog.StageModifierFromDef(reservedModifier.name, reservedModifier.stack); if (stageModifier == null) { Log.Error("SceneDirector_onPrePopulateSceneServer: Modifier with def " + reservedModifier.name + " is null"); continue; } activeModifiers.Add(stageModifier); if (modifiersCanBeBanned) { bannedModifiersStage.Add(reservedModifier.name); } } foreach (ModifierSync reservedModifier2 in reservedModifiers) { ((SyncList)(object)modifiersSynced).Add(reservedModifier2); if (reservedModifier2.name == "SoulCost") { NetworksoulCostStack = reservedModifier2.stack; } } foreach (StageModifier activeModifier in activeModifiers) { activeModifier.OnStart(); } activePortalInstances.Clear(); reservedModifiers.Clear(); SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); stageEnterTime = Run.instance.GetRunStopwatch(); } private void Stage_onServerStageComplete(Stage obj) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Invalid comparison between Unknown and I4 //IL_01a2: Unknown result type (might be due to invalid IL or missing references) Log.Info($"Stage completed, clearing {activeModifiers.Count} modifiers"); foreach (StageModifier activeModifier in activeModifiers) { activeModifier.OnEnd(); } activeModifiers.Clear(); ((SyncList)(object)modifiersSynced).Clear(); Log.Info($"Modul:{Stage.instance.sceneDef.stageOrder}"); if (Stage.instance.sceneDef.stageOrder == 5 || (currentNode.x == 0 && currentNode.y == 0 && Stage.instance.sceneDef.baseSceneName != "bazaar" && (int)Stage.instance.sceneDef.sceneType == 1)) { Log.Info("Trying to create new map"); if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) && TeleporterInteraction.instance.sceneExitController.destinationScene.baseSceneName == "moon2" && TeleporterInteraction.instance.isCharged) { routeMap.isMoonVisited = true; } else { routeMap = new RouteMap(Run.instance.runRNG); Log.Info("Created new map"); currentNode = routeMap.GetStartingNode(); NetworkcurrentNodeSync = new Vector2((float)currentNode.x, (float)currentNode.y); Log.Info($"Current:{currentNode.x},{currentNode.y} that has {currentNode.GetPaths().Count} paths"); Log.Info($"Teleporter:{TeleporterInteraction.instance.sceneExitController.useRunNextStageScene}"); } } else { Log.Info("Not creating new map yet"); Log.Info($"\t{currentNode.x}:{currentNode.y}"); Log.Info($"\t{Stage.instance.sceneDef.stageOrder}"); } currentNode.visited = true; routeMap.isDirty = true; } public void GetNextStageModifiers(GameObject portal) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Invalid comparison between I4 and Unknown RoutePortalManager component = portal.GetComponent(); if ((Object)(object)component == (Object)null || component.routeNode == null) { Log.Error("GetNextStageModifiers: Portal doesn't have routePortalManager or RouteNode, couldn't get modifiers."); return; } HashSet hashSet = new HashSet(bannedModifiersRun); hashSet.UnionWith(bannedModifiersStage); Dictionary dictionary = new Dictionary(); ModifierSlotConfiguration modifierSlots = GetModifierSlots(Run.instance.stageRng, component.routeNode.portalType, hashSet); if (SceneHelper.IsSceneColossus((SceneIndex)component.destinationSceneIndex, includeFalseSonScene: false)) { if (!bannedModifiersRun.Contains("Aurelionite")) { dictionary.Add("Aurelionite", 1); Log.Info("GetNextStageModifiers: Added aurelionite modifier to colossus portal"); } else { Log.Warning("Not adding aurelionite reward to collosus portal because modifier is banned"); } } if (component.destinationSceneIndex == (int)SceneCatalog.FindSceneIndex("conduitcanyon")) { List list = new List { "UpgradeDrones", "DroneBossRed" }; dictionary.Add(Run.instance.stageRng.NextElementUniform(list), 1); Log.Info("GetNextStageModifiers: Added rare drone modifier to hardware portal"); } if (component.routeNode.portalType == RoutePortalType.ChefType) { if (!bannedModifiersRun.Contains("WanderingChef")) { dictionary.Add("WanderingChef", 1); Log.Info("GetNextStageModifiers: Added chef modifier to route portal"); } else { Log.Warning("Not adding wandering chef to chef portal because modifier is banned"); } } if (CheckMountainShrine() && Run.instance.stageRng.nextNormalizedFloat > 0.5f && !bannedModifiersRun.Contains("Mountain")) { dictionary.Add("Mountain", TeleporterInteraction.instance.shrineBonusStacks); } if (CheckPlayersHaveConsumedItems() && Run.instance.stageRng.nextNormalizedFloat > 0.8f && !bannedModifiersRun.Contains("Repair")) { dictionary.Add("Repair", 1); } Dictionary positive = modifierSlots.positive; foreach (KeyValuePair item in positive) { for (int i = 0; i < item.Value; i++) { List pool = StageModifierCatalog.GetPool(component.routeNode.portalType); ModifierDef modifierDef = StageModifierCatalog.SelectModifier(hashSet, component.routeNode.portalType, item.Key, pool); if (modifierDef == null) { continue; } hashSet.Add(modifierDef.name); if (modifierDef.conflictList != null) { foreach (string conflict in modifierDef.conflictList) { hashSet.Add(conflict); } } int num = CalculateStack(modifierDef, item.Key); if (dictionary.ContainsKey(modifierDef.name)) { dictionary[modifierDef.name] += num; } else { dictionary.Add(modifierDef.name, num); } } } Dictionary negative = modifierSlots.negative; List list2 = new List(); foreach (KeyValuePair item2 in negative) { for (int j = 0; j < item2.Value; j++) { List pool2 = StageModifierCatalog.GetPool(component.routeNode.portalType, isNegative: true); ModifierDef modifierDef2 = StageModifierCatalog.SelectModifier(hashSet, component.routeNode.portalType, item2.Key, pool2); if (modifierDef2 == null) { continue; } hashSet.Add(modifierDef2.name); if (modifierDef2.conflictList != null) { foreach (string conflict2 in modifierDef2.conflictList) { hashSet.Add(conflict2); } } int num2 = CalculateStack(modifierDef2, item2.Key); if (dictionary.ContainsKey(modifierDef2.name)) { dictionary[modifierDef2.name] += num2; continue; } dictionary.Add(modifierDef2.name, num2); list2.Add(modifierDef2); } } int num3 = (int)((Run.instance.GetRunStopwatch() - stageEnterTime) / (punishmentTime * 60f)); num3 += commandAddedStack; if (num3 > 0) { Log.Info(string.Format("{0}: Adding {1} punishment stacks", "GetNextStageModifiers", num3)); } IEnumerable source = list2.Where((ModifierDef s) => s.isStackable); if (num3 > 0) { if (source.Count() == 0) { Log.Warning("GetNextStageModifiers: There are no stackable negative modifiers to apply punish, adding new"); List pool3 = StageModifierCatalog.GetPool(component.routeNode.portalType, isNegative: true); while (num3 > 0) { int num4 = Mathf.Min(num3, 3); int num5 = Run.instance.stageRng.RangeInt(1, num4 + 1); ModifierTier tier = (ModifierTier)num5; ModifierDef modifierDef3 = StageModifierCatalog.SelectModifier(hashSet, component.routeNode.portalType, tier, pool3); while (modifierDef3 == null && num5 > 1) { num5--; tier = (ModifierTier)num5; modifierDef3 = StageModifierCatalog.SelectModifier(hashSet, component.routeNode.portalType, tier, pool3); } if (modifierDef3 == null) { Log.Warning("GetNextStageModifiers: Couldnt add new negative modifiers"); break; } hashSet.Add(modifierDef3.name); if (modifierDef3.conflictList != null) { foreach (string conflict3 in modifierDef3.conflictList) { hashSet.Add(conflict3); } } num3 -= num5; int num6 = 0; if (num3 > 0 && modifierDef3.isStackable) { num6 = Run.instance.stageRng.RangeInt(0, num3 + 1); num3 -= num6; } dictionary.Add(modifierDef3.name, 1 + num6); Log.Info(string.Format("{0}: Punish added new modifier {1} with stack {2}", "GetNextStageModifiers", modifierDef3.name, 1 + num6)); } } else { for (int k = 0; k < num3; k++) { ModifierDef modifierDef4 = Run.instance.stageRng.NextElementUniform(source.ToArray()); if (dictionary.ContainsKey(modifierDef4.name)) { dictionary[modifierDef4.name]++; Log.Info("GetNextStageModifiers: Added 1 additional stack to " + modifierDef4.name); } } } } List list3 = new List(); foreach (KeyValuePair item3 in dictionary) { ModifierDef modifierDef5 = StageModifierCatalog.FindModifier(item3.Key); if (modifierDef5 == null) { return; } list3.Add(new ModifierSync(modifierDef5, item3.Value)); } ((SyncList)(object)component.stageModifiers).Clear(); foreach (ModifierSync item4 in list3) { ((SyncList)(object)component.stageModifiers).Add($"{item4.name}={item4.stack}={item4.isArtifact}"); } } private int CalculateStack(ModifierDef def, ModifierTier targetTier) { ModifierTier tier = def.tier; if (tier == targetTier) { return 1; } if ((tier == ModifierTier.Tier1 && targetTier == ModifierTier.Tier2) || (tier == ModifierTier.Tier2 && targetTier == ModifierTier.Tier3)) { return 2; } if (tier == ModifierTier.Tier1 && targetTier == ModifierTier.Tier3) { return 3; } return 1; } public static ModifierSlotConfiguration GetModifierSlots(Xoroshiro128Plus rng, RoutePortalType type, HashSet banned) { WeightedSelection val = new WeightedSelection(8); if (type != RoutePortalType.Rare) { val.AddChoice(new ModifierSlotConfiguration { positive = { { ModifierTier.Tier1, 1 } }, negative = { { ModifierTier.Tier1, 1 } } }, 1f); val.AddChoice(new ModifierSlotConfiguration { positive = { { ModifierTier.Tier1, 2 } }, negative = { { ModifierTier.Tier2, 1 } } }, 1f); val.AddChoice(new ModifierSlotConfiguration { positive = { { ModifierTier.Tier2, 1 } }, negative = { { ModifierTier.Tier1, 2 } } }, 1f); } val.AddChoice(new ModifierSlotConfiguration { positive = { { ModifierTier.Tier3, 1 } }, negative = { { ModifierTier.Tier3, 1 } } }, 0.3f); val.AddChoice(new ModifierSlotConfiguration { positive = { { ModifierTier.Tier3, 1 } }, negative = { { ModifierTier.Tier2, 1 }, { ModifierTier.Tier1, 1 } } }, 0.3f); ModifierSlotConfiguration modifierSlotConfiguration = val.Evaluate(rng.nextNormalizedFloat); if (modifierSlotConfiguration.positive.ContainsKey(ModifierTier.Tier3)) { List pool = StageModifierCatalog.GetPool(type); if (StageModifierCatalog.SelectModifier(banned, type, ModifierTier.Tier3, pool) == null) { Log.Warning(string.Format("{0}: Couldnt get Tier3 modifier for node type {1}, using Tier2", "GetModifierSlots", type)); modifierSlotConfiguration.positive.Remove(ModifierTier.Tier3); if (modifierSlotConfiguration.positive.ContainsKey(ModifierTier.Tier2)) { modifierSlotConfiguration.positive[ModifierTier.Tier2] = modifierSlotConfiguration.positive[ModifierTier.Tier2] + 1; } else { modifierSlotConfiguration.positive.Add(ModifierTier.Tier2, 2); } } } return modifierSlotConfiguration; } public bool IsModifierActive(string name) { foreach (ModifierSync item in (SyncList)(object)modifiersSynced) { if (item.name == name) { return true; } } return false; } public void AddRoutePortalInstance(GameObject portal) { if ((Object)(object)portal == (Object)null) { Log.Error("AddRoutePortalInstance: Route portal is null, cant add instance"); return; } RoutePortalManager component = portal.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("AddRoutePortalInstance: Route portal manager is null, cant add instance"); } activePortalInstances.Add(portal); } public void GetModifiersFromRandomPortal() { if (activePortalInstances == null || activePortalInstances.Count == 0) { Log.Warning("GetModifiersFromRandomPortal: There are no portal instances to get modifiers from"); return; } GameObject val = Run.instance.stageRng.NextElementUniform(activePortalInstances); RoutePortalManager component = val.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Warning("GetModifiersFromRandomPortal: Route portal manager is null, cant get modifiers"); return; } reservedModifiers.Clear(); foreach (string item in (SyncList)(object)component.stageModifiers) { string[] array = item.Split('='); instance.reservedModifiers.Add(new ModifierSync { name = array[0], stack = int.Parse(array[1]) }); } foreach (GameObject activePortalInstance in activePortalInstances) { GenericInteraction component2 = activePortalInstance.GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = false; } } } public void GetRouteNodeFromRandomPortal() { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (activePortalInstances == null || activePortalInstances.Count == 0) { Log.Warning("GetRouteNodeFromRandomPortal: There are no portal active instances to get routeNode from"); return; } Log.Info(string.Format("{0}: Trying to get routeNode from {1} portal instances", "GetRouteNodeFromRandomPortal", activePortalInstances.Count)); GameObject val = Run.instance.stageRng.NextElementUniform(activePortalInstances); RoutePortalManager component = val.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Warning("GetRouteNodeFromRandomPortal: Selected portal instance missing RoutePortalManager"); return; } currentNode = component.routeNode; NetworkcurrentNodeSync = new Vector2((float)currentNode.x, (float)currentNode.y); foreach (GameObject activePortalInstance in activePortalInstances) { GenericInteraction component2 = activePortalInstance.GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = false; } } } [Server] public bool CheckPlayersRedItem() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Boolean SamplePlugin.StageModifierDirector::CheckPlayersRedItem()' called on client"); return false; } int num = 0; foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances.playerCharacterMasterController == (Object)null) { continue; } foreach (ItemIndex item in readOnlyInstances.inventory.itemAcquisitionOrder) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if ((Object)(object)itemDef != (Object)null && (int)itemDef.tier == 2) { num += readOnlyInstances.inventory.GetItemCount(item); Log.Info(string.Format("{0}: Found red item:{1}", "CheckPlayersRedItem", itemDef)); } } } Log.Info(string.Format("{0}: Players have {1} red items right now", "CheckPlayersRedItem", num)); return num > 0; } [Server] public bool CheckPlayersYellowItem() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Invalid comparison between Unknown and I4 //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Boolean SamplePlugin.StageModifierDirector::CheckPlayersYellowItem()' called on client"); return false; } int num = 0; foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances.playerCharacterMasterController == (Object)null || !Object.op_Implicit((Object)(object)readOnlyInstances.inventory)) { continue; } foreach (ItemIndex item in readOnlyInstances.inventory.itemAcquisitionOrder) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if ((Object)(object)itemDef != (Object)null && (int)itemDef.tier == 4) { num += readOnlyInstances.inventory.GetItemCount(item); Log.Info(string.Format("{0}: Found yellow item:{1}", "CheckPlayersYellowItem", itemDef)); } } } Log.Info(string.Format("{0}: Players have {1} yellow items right now", "CheckPlayersYellowItem", num)); return num > 0; } [Server] public bool CheckPlayersHaveConsumedItems() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Boolean SamplePlugin.StageModifierDirector::CheckPlayersHaveConsumedItems()' called on client"); return false; } int num = 0; foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances.playerCharacterMasterController == (Object)null || !Object.op_Implicit((Object)(object)readOnlyInstances.inventory)) { continue; } foreach (ItemIndex item in readOnlyInstances.inventory.itemAcquisitionOrder) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if ((Object)(object)itemDef != (Object)null && itemDef.isConsumed && (Object)(object)itemDef != (Object)(object)Items.RegeneratingScrapConsumed && (Object)(object)itemDef != (Object)(object)Items.LowerPricedChestsConsumed && (Object)(object)itemDef != (Object)(object)Items.TeleportOnLowHealthConsumed) { num++; } } } Log.Info($"Players have {num} consumed items right now"); return num > 0; } [Server] public bool CheckMountainShrine() { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Boolean SamplePlugin.StageModifierDirector::CheckMountainShrine()' called on client"); return false; } if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance)) { return TeleporterInteraction.instance.shrineBonusStacks > 0; } return false; } [Server] public bool CheckArtifactOfDeathAvailable() { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Boolean SamplePlugin.StageModifierDirector::CheckArtifactOfDeathAvailable()' called on client"); return false; } return Run.instance.participatingPlayerCount > 1 && !runArtifactsApplied.Contains("TeamDeath"); } [Server] public bool CheckArtifactAvailable(string name) { if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Boolean SamplePlugin.StageModifierDirector::CheckArtifactAvailable(System.String)' called on client"); return false; } return !runArtifactsApplied.Contains(name); } [Server] public int CheckPlayersHaveFoodItems() { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Int32 SamplePlugin.StageModifierDirector::CheckPlayersHaveFoodItems()' called on client"); return 0; } List list = new List { Items.FlatHealth, Items.Mushroom, Items.Infusion, Items.HealWhileSafe, Items.MushroomVoid }; int num = 0; foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances.playerCharacterMasterController == (Object)null || !Object.op_Implicit((Object)(object)readOnlyInstances.inventory)) { continue; } foreach (ItemIndex item in readOnlyInstances.inventory.itemAcquisitionOrder) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if ((Object)(object)itemDef != (Object)null && list.Contains(itemDef)) { num += readOnlyInstances.inventory.GetItemCount(itemDef); } } } Log.Info($"Players have {num} food related items right now"); return num; } public List GetAvailableNodes() { if (currentNode != null) { return currentNode.GetPaths(); } Log.Error("GetAvailableNodes: Current node is null"); return null; } private void UNetVersion() { } protected static void InvokeSyncListmodifiersSynced(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"SyncList modifiersSynced called on server."); } else { ((SyncList)(object)((StageModifierDirector)(object)obj).modifiersSynced).HandleMsg(reader); } } protected static void InvokeRpcRpcReceiveFullMap(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcReceiveFullMap called on server."); } else { ((StageModifierDirector)(object)obj).RpcReceiveFullMap(GeneratedNetworkCode._ReadArrayRouteNodeSync_None(reader), (int)reader.ReadPackedUInt32(), (int)reader.ReadPackedUInt32(), reader.ReadBoolean(), reader.ReadSingle()); } } public void CallRpcReceiveFullMap(RouteNodeSync[] map, int width, int height, bool moon, float hostStageEnterTime) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcReceiveFullMap called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcRpcReceiveFullMap); val.Write(((Component)this).GetComponent().netId); GeneratedNetworkCode._WriteArrayRouteNodeSync_None(val, map); val.WritePackedUInt32((uint)width); val.WritePackedUInt32((uint)height); val.Write(moon); val.Write(hostStageEnterTime); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcReceiveFullMap"); } static StageModifierDirector() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown kRpcRpcReceiveFullMap = -1012231583; NetworkBehaviour.RegisterRpcDelegate(typeof(StageModifierDirector), kRpcRpcReceiveFullMap, new CmdDelegate(InvokeRpcRpcReceiveFullMap)); kListmodifiersSynced = -163976013; NetworkBehaviour.RegisterSyncListDelegate(typeof(StageModifierDirector), kListmodifiersSynced, new CmdDelegate(InvokeSyncListmodifiersSynced)); NetworkCRC.RegisterBehaviour("StageModifierDirector", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) if (forceAll) { GeneratedNetworkCode._WriteStructSyncListModifier_None(writer, modifiersSynced); writer.WritePackedUInt32((uint)mapWidth); writer.WritePackedUInt32((uint)mapHeight); writer.Write(isMoonVisited); writer.Write(currentNodeSync); writer.Write(syncedBaseCurse); writer.WritePackedUInt32((uint)soulCostStack); writer.Write(punishmentTime); writer.Write(purifyLunarItemModifier); writer.WritePackedUInt32((uint)doppelStackTime); writer.Write(modifiersCanBeBanned); writer.Write(enemyItemsModifierCanStack); writer.WritePackedUInt32((uint)commonDefaultStack); writer.WritePackedUInt32((uint)uncommonDefaultStack); writer.WritePackedUInt32((uint)legendaryDefaultStack); writer.WritePackedUInt32((uint)bossDefaultStack); writer.WritePackedUInt32((uint)commonExtraRange); writer.WritePackedUInt32((uint)uncommonExtraRange); writer.WritePackedUInt32((uint)legendaryExtraRange); writer.WritePackedUInt32((uint)bossExtraRange); writer.WritePackedUInt32((uint)chanceForExtra); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } GeneratedNetworkCode._WriteStructSyncListModifier_None(writer, modifiersSynced); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)mapWidth); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 4u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)mapHeight); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 8u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(isMoonVisited); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x10u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(currentNodeSync); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x20u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(syncedBaseCurse); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x40u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)soulCostStack); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x80u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(punishmentTime); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x100u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(purifyLunarItemModifier); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x200u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)doppelStackTime); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x400u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(modifiersCanBeBanned); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x800u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(enemyItemsModifierCanStack); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x1000u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)commonDefaultStack); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x2000u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)uncommonDefaultStack); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x4000u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)legendaryDefaultStack); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x8000u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)bossDefaultStack); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x10000u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)commonExtraRange); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x20000u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)uncommonExtraRange); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x40000u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)legendaryExtraRange); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x80000u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)bossExtraRange); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x100000u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)chanceForExtra); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { //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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) if (initialState) { GeneratedNetworkCode._ReadStructSyncListModifier_None(reader, modifiersSynced); mapWidth = (int)reader.ReadPackedUInt32(); mapHeight = (int)reader.ReadPackedUInt32(); isMoonVisited = reader.ReadBoolean(); currentNodeSync = reader.ReadVector2(); syncedBaseCurse = reader.ReadSingle(); soulCostStack = (int)reader.ReadPackedUInt32(); punishmentTime = reader.ReadSingle(); purifyLunarItemModifier = reader.ReadBoolean(); doppelStackTime = (int)reader.ReadPackedUInt32(); modifiersCanBeBanned = reader.ReadBoolean(); enemyItemsModifierCanStack = reader.ReadBoolean(); commonDefaultStack = (int)reader.ReadPackedUInt32(); uncommonDefaultStack = (int)reader.ReadPackedUInt32(); legendaryDefaultStack = (int)reader.ReadPackedUInt32(); bossDefaultStack = (int)reader.ReadPackedUInt32(); commonExtraRange = (int)reader.ReadPackedUInt32(); uncommonExtraRange = (int)reader.ReadPackedUInt32(); legendaryExtraRange = (int)reader.ReadPackedUInt32(); bossExtraRange = (int)reader.ReadPackedUInt32(); chanceForExtra = (int)reader.ReadPackedUInt32(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { GeneratedNetworkCode._ReadStructSyncListModifier_None(reader, modifiersSynced); } if (((uint)num & 2u) != 0) { mapWidth = (int)reader.ReadPackedUInt32(); } if (((uint)num & 4u) != 0) { mapHeight = (int)reader.ReadPackedUInt32(); } if (((uint)num & 8u) != 0) { isMoonVisited = reader.ReadBoolean(); } if (((uint)num & 0x10u) != 0) { currentNodeSync = reader.ReadVector2(); } if (((uint)num & 0x20u) != 0) { OnBaseCurseSyncedUpdate(reader.ReadSingle()); } if (((uint)num & 0x40u) != 0) { soulCostStack = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x80u) != 0) { punishmentTime = reader.ReadSingle(); } if (((uint)num & 0x100u) != 0) { purifyLunarItemModifier = reader.ReadBoolean(); } if (((uint)num & 0x200u) != 0) { doppelStackTime = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x400u) != 0) { modifiersCanBeBanned = reader.ReadBoolean(); } if (((uint)num & 0x800u) != 0) { enemyItemsModifierCanStack = reader.ReadBoolean(); } if (((uint)num & 0x1000u) != 0) { commonDefaultStack = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x2000u) != 0) { uncommonDefaultStack = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x4000u) != 0) { legendaryDefaultStack = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x8000u) != 0) { bossDefaultStack = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x10000u) != 0) { commonExtraRange = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x20000u) != 0) { uncommonExtraRange = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x40000u) != 0) { legendaryExtraRange = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x80000u) != 0) { bossExtraRange = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x100000u) != 0) { chanceForExtra = (int)reader.ReadPackedUInt32(); } } } } namespace SamplePlugin.StageModifiers { public abstract class StageModifier { public int stack = 1; public abstract void OnStart(); public abstract void OnEnd(); protected GameObject TryPlaceObjectOnScene(SpawnCard spawnCard, string name = "object") { //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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return null; } if ((Object)(object)spawnCard == (Object)null) { Log.Error("Something went wrong with " + name + " spawncard"); return null; } if (!Object.op_Implicit((Object)(object)Run.instance)) { return null; } Log.Info("Trying to place " + name); GameObject val = null; for (int i = 0; i < 15; i++) { DirectorPlacementRule val2 = new DirectorPlacementRule { placementMode = (PlacementMode)4 }; val = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(spawnCard, val2, Run.instance.stageRng)); if (Object.op_Implicit((Object)(object)val)) { Log.Info($"Succesfully placed {name} on {val.transform.position}"); break; } Log.Error("Failed to place " + name + ", retrying"); } if ((Object)(object)val == (Object)null) { Log.Error("It was impossible to place " + name); } return val; } } } namespace SamplePlugin.StageModifiers.SceneModifiers { public class MoreDronesModifier : StageModifier { public MoreDronesModifier(int stack) { base.stack = stack; } public override void OnEnd() { Log.Info("MoreDronesModifier end"); } public override void OnStart() { Log.Info("MoreDronesModifier start"); PopulateDrones(); } public void PopulateDrones() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Invalid comparison between Unknown and I4 int num = 0; int sceneDirectorInteractibleCredits = ClassicStageInfo.instance.sceneDirectorInteractibleCredits; float num2 = (float)global::RiskOfRoutes.RiskOfRoutes.droneStackPercent.Value / 100f; Log.Info($"Drone stack percent is {num2}"); int num3 = (int)((float)(sceneDirectorInteractibleCredits * stack) * num2); Log.Info("Spawning more drones"); ClassicStageInfo instance = ClassicStageInfo.instance; WeightedSelection val = new WeightedSelection(8); Category val2 = ((IEnumerable)instance.interactableCategories.categories).FirstOrDefault((Func)((Category c) => c.name == "Drones")); if (val2.cards.Length == 0) { Log.Error("No drones available on stage"); return; } DirectorCard[] cards = val2.cards; foreach (DirectorCard val3 in cards) { if (val3.IsAvailable()) { val.AddChoice(val3, (float)val3.selectionWeight); } } int num4 = 100; while (num3 > 0 && num4 > 0) { DirectorCard val4 = SelectCard(val, num3); if (val4 == null) { break; } if (!val4.IsAvailable()) { continue; } GameObject val5 = TryPlaceObjectOnScene(val4.spawnCard, ((Object)val4.spawnCard).name); if ((Object)(object)val5 != (Object)null) { PurchaseInteraction component = val5.GetComponent(); if (Object.op_Implicit((Object)(object)component) && (int)component.costType == 1) { component.Networkcost = Run.instance.GetDifficultyScaledCost(component.cost); } num3 -= val4.cost; num++; } num4--; } Log.Info($"Spawned {num} more drones"); } private static DirectorCard SelectCard(WeightedSelection deck, int maxCost) { //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_001c: 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) WeightedSelection val = new WeightedSelection(maxCost); int i = 0; for (int count = deck.Count; i < count; i++) { ChoiceInfo choice = deck.GetChoice(i); if (choice.value.cost <= maxCost) { val.AddChoice(choice); } } if (val.Count == 0) { return null; } return val.Evaluate(Run.instance.stageRng.nextNormalizedFloat); } } public class PrinterItemModifier : StageModifier { public ItemDef selectedItem; public static InteractableSpawnCard printerSpawnCard; public PrinterItemModifier(string internalName) { selectedItem = stringToItemDef(internalName); if (!((Object)(object)selectedItem == (Object)null)) { CreatePrinterSpawnCard(); } } public static ItemDef stringToItemDef(string selectedItemName) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) ItemIndex val = ItemCatalog.FindItemIndex(selectedItemName); if ((int)val != -1) { return ItemCatalog.GetItemDef(val); } Log.Error("Error finding item"); return null; } public override void OnEnd() { Log.Info("PrinterItemModifier end"); } public override void OnStart() { Log.Info("PrinterItemModifier start"); SpawnPrinter(); } private void SpawnPrinter() { //IL_0038: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) GameObject val = TryPlaceObjectOnScene((SpawnCard)(object)printerSpawnCard, "Printer with " + ((Object)selectedItem).name); if (Object.op_Implicit((Object)(object)val)) { Log.Info($"printer appeared at {val.transform.position} on stage"); ShopTerminalBehavior component = val.GetComponent(); component.dropTable = null; component.selfGeneratePickup = false; component.itemTier = selectedItem.tier; PickupIndex pickupIndex = PickupCatalog.FindPickupIndex(selectedItem.itemIndex); UniquePickup val2 = default(UniquePickup); val2.pickupIndex = pickupIndex; UniquePickup val3 = val2; component.SetPickup(val3, false); } } private void CreatePrinterSpawnCard() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_002b: Expected I4, but got Unknown ItemTier tier = selectedItem.tier; if (1 == 0) { } InteractableSpawnCard val = (InteractableSpawnCard)((int)tier switch { 0 => AssetManager.tier1Printer, 1 => AssetManager.tier2Printer, 2 => AssetManager.tier3Printer, 4 => AssetManager.bossPrinter, _ => AssetManager.tier1Printer, }); if (1 == 0) { } InteractableSpawnCard val2 = val; if ((Object)(object)val2 != (Object)null) { printerSpawnCard = val2; } else { Log.Error("Asset path is invalid"); } } } public class RedPrinterModifier : StageModifier { public static InteractableSpawnCard redPrinterSpawnCard; public ItemTag tag; public RedPrinterModifier(int stack, ItemTag tag = 0) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) CreateRedPrinterSpawnCard(); base.stack = stack; this.tag = tag; } public override void OnEnd() { Log.Info("RedPrinter on end"); } public override void OnStart() { Log.Info("RedPrinter on start"); SpawnRedPrinter(); } private void SpawnRedPrinter() { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) List availableTier3DropList = Run.instance.availableTier3DropList; List list = new List(); foreach (PickupIndex item in availableTier3DropList) { PickupDef pickupDef = PickupCatalog.GetPickupDef(item); if (pickupDef != null && (int)pickupDef.itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if ((Object)(object)itemDef != (Object)null && itemDef.tags.Contains(tag)) { list.Add(item); } } } if (list.Count == 0) { Log.Error($"No red items available for tag {tag}"); list = availableTier3DropList; } for (int i = 0; i < stack; i++) { GameObject val = TryPlaceObjectOnScene((SpawnCard)(object)redPrinterSpawnCard, "Red item printer"); if (Object.op_Implicit((Object)(object)val)) { ShopTerminalBehavior component = val.GetComponent(); component.dropTable = null; component.selfGeneratePickup = false; PickupIndex pickupIndex = Run.instance.stageRng.NextElementUniform(list); UniquePickup val2 = default(UniquePickup); val2.pickupIndex = pickupIndex; UniquePickup val3 = val2; component.SetPickup(val3, false); } } } private void CreateRedPrinterSpawnCard() { InteractableSpawnCard tier3Printer = AssetManager.tier3Printer; if ((Object)(object)tier3Printer != (Object)null) { redPrinterSpawnCard = tier3Printer; } } } public class WanderingChefModifier : StageModifier { public static bool spawnCardCreated; public static InteractableSpawnCard chefSpawnCard; public override void OnEnd() { Log.Info("WanderingChef on end"); } public override void OnStart() { Log.Info("WanderingChef on start"); SpawnWanderingChef(); } private void SpawnWanderingChef() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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) InteractableSpawnCard wanderingChefSpawnCard = AssetManager.wanderingChefSpawnCard; GameObject val = TryPlaceObjectOnScene((SpawnCard)(object)wanderingChefSpawnCard, "Wandering Chef"); if (Object.op_Implicit((Object)(object)val)) { Transform transform = val.transform; transform.position += val.transform.up * 1f; } } } public class YellowPrinterModifier : StageModifier { public static InteractableSpawnCard yellowPrinterSpawnCard; public ItemTag tag; public YellowPrinterModifier(int stack, ItemTag tag = 0) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) CreateYellowPrinterSpawnCard(); base.stack = stack; this.tag = tag; } public override void OnEnd() { Log.Info("YellowPrinterModifier on end"); } public override void OnStart() { Log.Info("YellowPrinterModifier on start"); SpawnYellowPrinter(); } private void SpawnYellowPrinter() { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) List availableBossDropList = Run.instance.availableBossDropList; List list = new List(); foreach (PickupIndex item in availableBossDropList) { PickupDef pickupDef = PickupCatalog.GetPickupDef(item); if (pickupDef != null && (int)pickupDef.itemIndex != -1) { ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex); if ((Object)(object)itemDef != (Object)null && itemDef.tags.Contains(tag)) { list.Add(item); } } } if (list.Count == 0) { Log.Error($"No yellow items available for tag {tag}"); list = availableBossDropList; } for (int i = 0; i < stack; i++) { GameObject val = TryPlaceObjectOnScene((SpawnCard)(object)yellowPrinterSpawnCard, "Yellow item printer"); if (Object.op_Implicit((Object)(object)val)) { ShopTerminalBehavior component = val.GetComponent(); component.dropTable = null; component.selfGeneratePickup = false; PickupIndex pickupIndex = Run.instance.stageRng.NextElementUniform(list); UniquePickup val2 = default(UniquePickup); val2.pickupIndex = pickupIndex; UniquePickup val3 = val2; component.SetPickup(val3, false); } } } private void CreateYellowPrinterSpawnCard() { InteractableSpawnCard bossPrinter = AssetManager.bossPrinter; if ((Object)(object)bossPrinter != (Object)null) { yellowPrinterSpawnCard = bossPrinter; } else { Log.Error("Asset path is invalid"); } } } } namespace SamplePlugin.StageModifiers.OtherModifiers { public class ArtifactModifier : StageModifier { private ArtifactDef currentArtifact; public ArtifactModifier(ArtifactDef artifact) { currentArtifact = artifact; } public ArtifactModifier(string name, bool isPositive) { currentArtifact = ArtifactCatalog.FindArtifactDef(name); if ((Object)(object)currentArtifact == (Object)null) { Log.Error("Could not find artifact by the name " + name); } else { name = currentArtifact.cachedName; } } public ArtifactModifier() { currentArtifact = Artifacts.MixEnemy; if ((Object)(object)currentArtifact == (Object)null) { Log.Error("CurrentArtifact is null"); } } public override void OnEnd() { Log.Info("ArtifactModifier on end"); if (Object.op_Implicit((Object)(object)currentArtifact)) { if (Object.op_Implicit((Object)(object)Run.instance)) { RunArtifactManager.instance.SetArtifactEnabled(currentArtifact, false); Log.Info("Succesfully disabled artifact: " + currentArtifact.cachedName); } else { Log.Info("Run already ended"); } } else { Log.Info("No current artifact for some reason"); } } public override void OnStart() { Log.Info("ArtifactModifier on start start"); if (Object.op_Implicit((Object)(object)currentArtifact)) { RunArtifactManager.instance.SetArtifactEnabled(currentArtifact, true); } else { Log.Info("No such artifact"); } } } public class RepairConsumedItemsModifier : StageModifier { public override void OnEnd() { Log.Info("Repair on end"); } public override void OnStart() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Invalid comparison between Unknown and I4 //IL_0183: Unknown result type (might be due to invalid IL or missing references) Log.Info("Repair on start"); foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (!Object.op_Implicit((Object)(object)readOnlyInstances.inventory)) { continue; } List list = new List(readOnlyInstances.inventory.itemAcquisitionOrder); foreach (ItemIndex item in list) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if (!((Object)(object)itemDef != (Object)null) || !itemDef.isConsumed || !((Object)(object)itemDef != (Object)(object)Items.RegeneratingScrapConsumed) || !((Object)(object)itemDef != (Object)(object)Items.LowerPricedChestsConsumed) || !((Object)(object)itemDef != (Object)(object)Items.TeleportOnLowHealthConsumed)) { continue; } int itemCount = readOnlyInstances.inventory.GetItemCount(itemDef); readOnlyInstances.inventory.RemoveItem(itemDef, itemCount); ItemDef val = new ItemDef(); if ((Object)(object)itemDef == (Object)(object)Items.FragileDamageBonusConsumed) { val = Items.FragileDamageBonus; } else if ((Object)(object)itemDef == (Object)(object)Items.HealingPotionConsumed) { val = Items.HealingPotion; } else if ((Object)(object)itemDef == (Object)(object)Items.ExtraLifeVoidConsumed) { val = Items.ExtraLifeVoid; } else if ((Object)(object)itemDef == (Object)(object)Items.ExtraLifeConsumed) { val = Items.ExtraLife; } else { ItemIndex val2 = ItemCatalog.FindItemIndex(((Object)itemDef).name.Replace("Consumed", "")); if ((int)val2 != -1) { ItemDef itemDef2 = ItemCatalog.GetItemDef(val2); if ((Object)(object)itemDef2 != (Object)null) { val = itemDef2; } } } Log.Debug($"For consumed item{itemDef} in count {itemCount} found repaired {val}"); readOnlyInstances.inventory.GiveItem(val, itemCount); Log.Info("Succesfully repaired " + ((Object)itemDef).name); } } } } } namespace SamplePlugin.StageModifiers.CombatModifiers { public class EnemyItemsModifier : StageModifier { private ItemDef selectedItem; public EnemyItemsModifier(string internalName, int stack) { selectedItem = PrinterItemModifier.stringToItemDef(internalName); if (!((Object)(object)selectedItem == (Object)null)) { base.stack = stack; } } public override void OnEnd() { Log.Info("EnemyItems on end"); SpawnCard.onSpawnedServerGlobal -= SpawnCard_onSpawnedServerGlobal; StageModifierDirector.instance.monsterTeamInventory.CleanInventory(); } public override void OnStart() { Log.Info("EnemyItems on start"); int itemStack = GetItemStack(selectedItem, stack); StageModifierDirector.instance.monsterTeamInventory.GiveItemPermanent(selectedItem, itemStack); SpawnCard.onSpawnedServerGlobal += SpawnCard_onSpawnedServerGlobal; } private void SpawnCard_onSpawnedServerGlobal(SpawnResult spawnResult) { //IL_0001: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 CharacterMaster val = (Object.op_Implicit((Object)(object)spawnResult.spawnedInstance) ? spawnResult.spawnedInstance.GetComponent() : null); if (Object.op_Implicit((Object)(object)val) && (int)val.teamIndex == 2) { val.inventory.AddItemsFrom(StageModifierDirector.instance.monsterTeamInventory); } } public static int GetItemStack(ItemDef def, int modStack) { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected I4, but got Unknown int num = StageModifierDirector.instance?.commonDefaultStack ?? 5; int num2 = StageModifierDirector.instance?.uncommonDefaultStack ?? 3; int num3 = StageModifierDirector.instance?.legendaryDefaultStack ?? 1; int num4 = StageModifierDirector.instance?.bossDefaultStack ?? 1; int num5 = StageModifierDirector.instance?.commonExtraRange ?? 3; int num6 = StageModifierDirector.instance?.uncommonExtraRange ?? 2; int num7 = StageModifierDirector.instance?.legendaryExtraRange ?? 1; int num8 = StageModifierDirector.instance?.bossExtraRange ?? 1; int num9 = StageModifierDirector.instance?.chanceForExtra ?? 0; bool flag = false; if ((Object)(object)Run.instance != (Object)null && Run.instance.stageRng != null) { flag = Run.instance.stageRng.nextNormalizedFloat < (float)num9; } ItemTier tier = def.tier; ItemTier val = tier; return (int)val switch { 0 => num * modStack + (flag ? num5 : 0), 1 => num2 * modStack + (flag ? num6 : 0), 2 => num3 * modStack + (flag ? num7 : 0), 4 => num4 * modStack + (flag ? num4 : 0), 6 => num * modStack + (flag ? num5 : 0), 7 => num2 * modStack + (flag ? num6 : 0), 8 => num3 * modStack + (flag ? num7 : 0), 9 => num4 * modStack + (flag ? num4 : 0), _ => 1, }; } } public class LunarEnemiesModifier : StageModifier { public List lunarEnemies; public LunarEnemiesModifier(int stack) { base.stack = stack; } public override void OnEnd() { Log.Info("LunarEnemies on end"); } public override void OnStart() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) Log.Info("LunarEnemies on start"); int num = 0; int num2 = 0; if ((Object)(object)ClassicStageInfo.instance.monsterCategories == (Object)null || ClassicStageInfo.instance.monsterCategories.categories == null) { return; } Category[] categories = ClassicStageInfo.instance.monsterCategories.categories; foreach (Category val in categories) { if (val.name == "Basic Monsters") { DirectorCard[] cards = val.cards; foreach (DirectorCard val2 in cards) { num = Mathf.Max(num, val2.cost); } } if (val.name == "Minibosses") { DirectorCard[] cards2 = val.cards; foreach (DirectorCard val3 in cards2) { num2 = Mathf.Max(num2, val3.cost); } } } if (num == 0) { num = 40; } if (num2 == 0) { num2 = 200; } float num3 = Mathf.Max(0.1f, 1f - (float)(global::RiskOfRoutes.RiskOfRoutes.lunarStackPercent.Value * (stack - 1)) / 100f); num = (int)((float)num * num3); num2 = (int)((float)num2 * num3); CreateLunarEnemiesSpawnCards(num, num2); if (Object.op_Implicit((Object)(object)ClassicStageInfo.instance) && ClassicStageInfo.instance.monsterSelection != null) { ClassicStageInfo.instance.monsterSelection = GetSelectionFromCategories(ClassicStageInfo.instance.monsterCategories.categories); } foreach (CombatDirector instances in CombatDirector.instancesList) { if ((Object)(object)instances.monsterCards == (Object)null) { instances.currentMonsterCard = null; } } } private WeightedSelection GetSelectionFromCategories(Category[] categories) { //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) WeightedSelection val = new WeightedSelection(8); for (int i = 0; i < categories.Length; i++) { if (categories[i].name == "Basic Monsters") { ref DirectorCard[] cards = ref categories[i].cards; DirectorCard val2 = lunarEnemies[2]; ArrayUtils.ArrayAppend(ref cards, ref val2); Log.Info("Succesfully added " + ((Object)lunarEnemies[2].spawnCard).name + " to category " + categories[i].name); } else if (categories[i].name == "Minibosses") { ref DirectorCard[] cards2 = ref categories[i].cards; DirectorCard val2 = lunarEnemies[0]; ArrayUtils.ArrayAppend(ref cards2, ref val2); Log.Info("Succesfully added " + ((Object)lunarEnemies[0].spawnCard).name + " to category " + categories[i].name); ref DirectorCard[] cards3 = ref categories[i].cards; val2 = lunarEnemies[1]; ArrayUtils.ArrayAppend(ref cards3, ref val2); Log.Info("Succesfully added " + ((Object)lunarEnemies[1].spawnCard).name + " to category " + categories[i].name); } Category val3 = categories[i]; float num = SumAllWeightsInCategory(val3); float num2 = val3.selectionWeight / num; if (!(num > 0f)) { continue; } DirectorCard[] cards4 = val3.cards; foreach (DirectorCard val4 in cards4) { if (val4.IsAvailable()) { float num3 = (float)val4.selectionWeight * num2; val.AddChoice(val4, num3); } } } return val; } public float SumAllWeightsInCategory(Category category) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_002c: Unknown result type (might be due to invalid IL or missing references) float num = 0f; for (int i = 0; i < category.cards.Length; i++) { if (category.cards[i] != null && category.cards[i].IsAvailable()) { num += (float)category.cards[i].selectionWeight; } } return num; } public void CreateLunarEnemiesSpawnCards(int basicCost, int miniBossCost) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown lunarEnemies = new List(); List list = new List(); CharacterSpawnCard val = Addressables.LoadAssetAsync((object)"RoR2/Base/LunarWisp/cscLunarWisp.asset").WaitForCompletion(); CharacterSpawnCard val2 = Addressables.LoadAssetAsync((object)"RoR2/Base/LunarGolem/cscLunarGolem.asset").WaitForCompletion(); CharacterSpawnCard val3 = Addressables.LoadAssetAsync((object)"RoR2/Base/LunarExploder/cscLunarExploder.asset").WaitForCompletion(); CharacterSpawnCard val4 = Object.Instantiate(val); CharacterSpawnCard val5 = Object.Instantiate(val2); CharacterSpawnCard val6 = Object.Instantiate(val3); ((SpawnCard)val4).directorCreditCost = miniBossCost; ((SpawnCard)val5).directorCreditCost = miniBossCost; ((SpawnCard)val6).directorCreditCost = basicCost; list.Add(val4); list.Add(val5); list.Add(val6); foreach (CharacterSpawnCard item2 in list) { DirectorCard item = new DirectorCard { spawnCard = (SpawnCard)(object)item2, selectionWeight = stack, minimumStageCompletions = 0 }; lunarEnemies.Add(item); } } } public class MoreElitesModifier : StageModifier { public Dictionary tierAndInitialPrice = new Dictionary(); public float defaultPercent = 0.33f; public MoreElitesModifier(int stack) { base.stack = stack; } public override void OnEnd() { Log.Info("MoreElites on end"); Log.Info("Restoring elite tier costs"); foreach (KeyValuePair item in tierAndInitialPrice) { item.Key.costMultiplier = item.Value; } } public override void OnStart() { Log.Info("MoreElites on start"); FieldInfo field = typeof(CombatDirector).GetField("eliteTiers", BindingFlags.Static | BindingFlags.NonPublic); if (!(field != null)) { return; } EliteTierDef[] array = (EliteTierDef[])field.GetValue(null); Log.Info($"Tier count{array.Length}"); for (int i = 0; i < array.Length - 1; i++) { EliteTierDef val = array[i]; if (val != null && val.costMultiplier != 1f) { float num = 1f - defaultPercent - (float)(stack - 1) * (float)global::RiskOfRoutes.RiskOfRoutes.elitesStackPercent.Value / 100f; Log.Info($"Cost for elite tier {val} lowered by {(float)(stack - 1) * (float)global::RiskOfRoutes.RiskOfRoutes.elitesStackPercent.Value / 100f}: {val.costMultiplier}->{val.costMultiplier * num}"); tierAndInitialPrice.Add(val, val.costMultiplier); val.costMultiplier = Mathf.Max(val.costMultiplier * num, 1f); } } } } public class OnlyFlyingEnemiesModifier : StageModifier { public override void OnEnd() { } public override void OnStart() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Log.Info("OnlyFlying on start"); Category[] categories = ClassicStageInfo.instance.monsterCategories.categories; if (categories == null) { Log.Error("Could not access categories"); return; } DirectorCardCategorySelection monsterCategories = ClassicStageInfo.instance.monsterCategories; ClassicStageInfo.instance.monsterSelection.Clear(); ClassicStageInfo.instance.monsterSelection = GetSelectionFromCategories(categories); Log.Info("Available"); for (int i = 0; i < ClassicStageInfo.instance.monsterSelection.Count; i++) { Log.Info("\t" + ((Object)ClassicStageInfo.instance.monsterSelection.GetChoice(i).value.spawnCard).name); } foreach (CombatDirector instances in CombatDirector.instancesList) { if ((Object)(object)instances.monsterCards == (Object)null) { instances.currentMonsterCard = null; } } } private WeightedSelection GetSelectionFromCategories(Category[] categories) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) WeightedSelection val = new WeightedSelection(8); for (int i = 0; i < categories.Length; i++) { DirectorCard[] cards = categories[i].cards; DirectorCard[] array = cards.Where((DirectorCard card) => (int)card.spawnCard.nodeGraphType == 1).ToArray(); DirectorCard[] array2 = array; foreach (DirectorCard val2 in array2) { Log.Info("Flying enemy from Category:" + categories[i].name + ":" + ((Object)val2.spawnCard).name); } categories[i].cards = array; Category val3 = categories[i]; float num = SumAllWeightsInCategory(val3); float num2 = val3.selectionWeight / num; if (!(num > 0f)) { continue; } DirectorCard[] cards2 = val3.cards; DirectorCard[] array3 = cards2; foreach (DirectorCard val4 in array3) { if (val4.IsAvailable()) { float num3 = (float)val4.selectionWeight * num2; val.AddChoice(val4, num3); } } } return val; } public float SumAllWeightsInCategory(Category category) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_002c: Unknown result type (might be due to invalid IL or missing references) float num = 0f; for (int i = 0; i < category.cards.Length; i++) { if (category.cards[i] != null && category.cards[i].IsAvailable()) { num += (float)category.cards[i].selectionWeight; } } return num; } } public class Tier2ElitesEarlierModifier : StageModifier { public EliteTierDef modifiedTier; public Func modifiedAvailability; public float modifiedCostMultiplier; public Tier2ElitesEarlierModifier(int stack) { base.stack = stack; } public override void OnEnd() { Log.Info("Tier2Elites on end"); Log.Info("Restoring elite tier costs"); if (modifiedTier != null) { modifiedTier.isAvailable = modifiedAvailability; modifiedTier.costMultiplier = modifiedCostMultiplier; } else { Log.Error("Could not access elite tier that was modified"); } } public override void OnStart() { Log.Info("Tier2 elites start"); FieldInfo field = typeof(CombatDirector).GetField("eliteTiers", BindingFlags.Static | BindingFlags.NonPublic); if (!(field != null)) { return; } EliteTierDef[] array = (EliteTierDef[])field.GetValue(null); Log.Info($"Tier count{array.Length}"); for (int i = 0; i < array.Length - 1; i++) { EliteTierDef val = array[i]; EliteDef[] eliteTypes = val.eliteTypes; foreach (EliteDef val2 in eliteTypes) { if ((Object)(object)val2 != (Object)null && ((Object)val2).name.Contains("Poison")) { modifiedTier = val; modifiedAvailability = val.isAvailable; modifiedCostMultiplier = val.costMultiplier; val.isAvailable = (EliteRules rules) => true; float num = Mathf.Max(0.1f, 1f - (float)(global::RiskOfRoutes.RiskOfRoutes.tier2ElitesStackPercent.Value * (stack - 1)) / 100f); val.costMultiplier = Math.Max(6f * num, 1f); return; } } } } } public class VoidEnemiesModifier : StageModifier { public List voidEnemies; public VoidEnemiesModifier(int stack) { base.stack = stack; } public override void OnEnd() { Log.Info("VoidEnemies on end"); } public override void OnStart() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) Log.Info("VoidEnemies on start"); int num = 0; int num2 = 0; int num3 = 0; if ((Object)(object)ClassicStageInfo.instance.monsterCategories == (Object)null || ClassicStageInfo.instance.monsterCategories.categories == null) { return; } Category[] categories = ClassicStageInfo.instance.monsterCategories.categories; foreach (Category val in categories) { if (val.name == "Basic Monsters") { DirectorCard[] cards = val.cards; foreach (DirectorCard val2 in cards) { num = Mathf.Max(num, val2.cost); } } if (val.name == "Minibosses") { DirectorCard[] cards2 = val.cards; foreach (DirectorCard val3 in cards2) { num2 = Mathf.Max(num2, val3.cost); } } if (val.name == "Champions") { DirectorCard[] cards3 = val.cards; foreach (DirectorCard val4 in cards3) { num3 = Mathf.Max(num3, val4.cost); } } } if (num == 0) { num = 40; } if (num2 == 0) { num2 = 200; } if (num3 == 0 || num3 > 800) { num3 = 800; } float num4 = Mathf.Max(0.1f, 1f - (float)(global::RiskOfRoutes.RiskOfRoutes.voidStackPercent.Value * (stack - 1)) / 100f); num = (int)((float)num * num4); num2 = (int)((float)num2 * num4); num3 = (int)((float)num3 * num4); CreateVoidEnemiesSpawnCard(num, num2, num3); if (Object.op_Implicit((Object)(object)ClassicStageInfo.instance) && ClassicStageInfo.instance.monsterSelection != null) { ClassicStageInfo.instance.monsterSelection = GetSelectionFromCategories(ClassicStageInfo.instance.monsterCategories.categories); } foreach (CombatDirector instances in CombatDirector.instancesList) { if ((Object)(object)instances.monsterCards == (Object)null) { instances.currentMonsterCard = null; } } } private WeightedSelection GetSelectionFromCategories(Category[] categories) { //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) WeightedSelection val = new WeightedSelection(8); for (int i = 0; i < categories.Length; i++) { if (categories[i].name == "Basic Monsters") { ref DirectorCard[] cards = ref categories[i].cards; DirectorCard val2 = voidEnemies[2]; ArrayUtils.ArrayAppend(ref cards, ref val2); Log.Info("Succesfully added " + ((Object)voidEnemies[2].spawnCard).name + " to category " + categories[i].name); ref DirectorCard[] cards2 = ref categories[i].cards; val2 = voidEnemies[3]; ArrayUtils.ArrayAppend(ref cards2, ref val2); Log.Info("Succesfully added " + ((Object)voidEnemies[3].spawnCard).name + " to category " + categories[i].name); } else if (categories[i].name == "Minibosses") { ref DirectorCard[] cards3 = ref categories[i].cards; DirectorCard val2 = voidEnemies[0]; ArrayUtils.ArrayAppend(ref cards3, ref val2); Log.Info("Succesfully added " + ((Object)voidEnemies[0].spawnCard).name + " to category " + categories[i].name); } else if (categories[i].name == "Champions") { ref DirectorCard[] cards4 = ref categories[i].cards; DirectorCard val2 = voidEnemies[1]; ArrayUtils.ArrayAppend(ref cards4, ref val2); Log.Info("Succesfully added " + ((Object)voidEnemies[1].spawnCard).name + " to category " + categories[i].name); } Category val3 = categories[i]; float num = SumAllWeightsInCategory(val3); float num2 = categories[i].selectionWeight / num; if (!(num > 0f)) { continue; } DirectorCard[] cards5 = val3.cards; foreach (DirectorCard val4 in cards5) { if (val4.IsAvailable()) { float num3 = (float)val4.selectionWeight * num2; val.AddChoice(val4, num3); } } } return val; } public float SumAllWeightsInCategory(Category category) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_002c: Unknown result type (might be due to invalid IL or missing references) float num = 0f; for (int i = 0; i < category.cards.Length; i++) { if (category.cards[i] != null && category.cards[i].IsAvailable()) { num += (float)category.cards[i].selectionWeight; } } return num; } public void CreateVoidEnemiesSpawnCard(int basicCost, int eliteCost, int championCost) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown voidEnemies = new List(); List list = new List(); CharacterSpawnCard val = Addressables.LoadAssetAsync((object)"RoR2/DLC1/VoidJailer/cscVoidJailer.asset").WaitForCompletion(); CharacterSpawnCard val2 = Addressables.LoadAssetAsync((object)"RoR2/DLC1/VoidMegaCrab/cscVoidMegaCrab.asset").WaitForCompletion(); CharacterSpawnCard val3 = Addressables.LoadAssetAsync((object)"RoR2/Base/Nullifier/cscNullifier.asset").WaitForCompletion(); CharacterSpawnCard val4 = Addressables.LoadAssetAsync((object)"RoR2/DLC1/VoidBarnacle/cscVoidBarnacle.asset").WaitForCompletion(); CharacterSpawnCard val5 = Object.Instantiate(val); CharacterSpawnCard val6 = Object.Instantiate(val2); CharacterSpawnCard val7 = Object.Instantiate(val3); CharacterSpawnCard val8 = Object.Instantiate(val4); ((SpawnCard)val5).directorCreditCost = eliteCost; ((SpawnCard)val6).directorCreditCost = championCost; ((SpawnCard)val7).directorCreditCost = eliteCost; ((SpawnCard)val8).directorCreditCost = basicCost; list.Add(val5); list.Add(val6); list.Add(val7); list.Add(val8); foreach (CharacterSpawnCard item2 in list) { DirectorCard item = new DirectorCard { spawnCard = (SpawnCard)(object)item2, selectionWeight = stack, minimumStageCompletions = 0 }; voidEnemies.Add(item); } } } } namespace SamplePlugin.StageModifiers.BossRewardModifiers { public class AurelioniteModifier : StageModifier { public override void OnEnd() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Log.Info("Aurelionite on end"); BossGroup.DropRewards -= new Manipulator(BossGroup_DropRewards); } public override void OnStart() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Log.Info("Aurelionite on start"); BossGroup.DropRewards += new Manipulator(BossGroup_DropRewards); } private void BossGroup_DropRewards(ILContext il) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown PickupDropTable halcyoniteDropTableTier2 = Addressables.LoadAssetAsync((object)"RoR2/DLC2/dtShrineHalcyoniteTier2.asset").WaitForCompletion(); PickupDropTable halcyoniteDropTableTier3 = Addressables.LoadAssetAsync((object)"RoR2/DLC2/dtShrineHalcyoniteTier3.asset").WaitForCompletion(); GameObject rewardPickupPrefab = Addressables.LoadAssetAsync((object)"RoR2/DLC2/FragmentPotentialPickup.prefab").WaitForCompletion(); ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(PickupDropletController), "CreatePickupDroplet") })) { return; } val.Remove(); val.EmitDelegate>((Action)delegate(UniquePickup origPickup, Vector3 position, Vector3 vector) { //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) bool flag = StageModifierDirector.instance.IsModifierActive("DroneBossGreen"); bool flag2 = StageModifierDirector.instance.IsModifierActive("DroneBossRed"); bool flag3 = StageModifierDirector.instance.IsModifierActive("BossYellowItem"); bool flag4 = StageModifierDirector.instance.IsModifierActive("BossRedItem"); CreatePickupInfo val3; CreatePickupInfo val4; if (flag || flag2) { Log.Info("BossGroup_DropRewards: Dropping drone reward"); List list = new List(); List list2 = new List(); if (flag) { list2 = Run.instance.availableTier2DroneList; list2.Remove(DroneDefs.EquipmentDrone.droneIndex); } else { list2 = Run.instance.availableTier3DroneList; } foreach (DroneIndex item in list2) { PickupIndex val2 = PickupCatalog.FindPickupIndex(item); bool flag5 = true; list.Add(new UniquePickup(PickupCatalog.FindPickupIndex(item))); } Util.ShuffleList(list); val3 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val3)).pickup = new UniquePickup(PickupCatalog.FindPickupIndex((ItemTier)0)); val3.pickerOptions = PickupPickerController.GenerateOptionsFromList>(list.Take(5).ToList()); val3.rotation = Quaternion.identity; val3.position = position; val3.prefabOverride = rewardPickupPrefab; val4 = val3; } else if (flag3 || flag4) { Log.Info("BossGroup_DropRewards: Dropping boss or red reward"); List list3 = new List(); List list4 = new List(); list4 = ((!flag3) ? Run.instance.availableTier3DropList : Run.instance.availableBossDropList); foreach (PickupIndex item2 in list4) { bool flag6 = true; list3.Add(new UniquePickup(item2)); } Util.ShuffleList(list3); val3 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val3)).pickup = new UniquePickup(PickupCatalog.FindPickupIndex((ItemTier)0)); val3.pickerOptions = PickupPickerController.GenerateOptionsFromList>(list3.Take(5).ToList()); val3.rotation = Quaternion.identity; val3.position = position; val3.prefabOverride = rewardPickupPrefab; val4 = val3; } else { val3 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val3)).pickup = new UniquePickup(PickupCatalog.FindPickupIndex((ItemTier)0)); val3.pickerOptions = PickupPickerController.GenerateOptionsFromDropTablePlusForcedStorm(3, halcyoniteDropTableTier3, halcyoniteDropTableTier2, Run.instance.stageRng); val3.rotation = Quaternion.identity; val3.position = position; val3.prefabOverride = rewardPickupPrefab; val4 = val3; } PickupDropletController.CreatePickupDroplet(val4, position, vector); Log.Info("Created pickup"); }); } } public class BossRedItemModifier : StageModifier { public override void OnEnd() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Log.Info("BossRedItem on end"); BossGroup.DropRewards -= new Manipulator(BossGroup_DropRewards); } public override void OnStart() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Log.Info("BossRedItem on start"); BossGroup.DropRewards += new Manipulator(BossGroup_DropRewards); } private void BossGroup_DropRewards(ILContext il) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (StageModifierDirector.instance.IsModifierActive("Aurelionite")) { return; } ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(PickupDropletController), "CreatePickupDroplet") })) { val.Remove(); val.EmitDelegate>((Action)delegate(UniquePickup origPickup, Vector3 position, Vector3 vector) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) PickupIndex pickupIndex = Run.instance.stageRng.NextElementUniform(Run.instance.availableTier3DropList); UniquePickup val2 = default(UniquePickup); val2.pickupIndex = pickupIndex; UniquePickup pickup = val2; CreatePickupInfo val3 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val3)).pickup = pickup; val3.rotation = Quaternion.identity; val3.position = position; CreatePickupInfo val4 = val3; PickupDropletController.CreatePickupDroplet(val4, position, vector); Log.Info("Created pickup"); }); } } } public class BossYellowItemModifier : StageModifier { public override void OnEnd() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown BossGroup.DropRewards -= new Manipulator(BossGroup_DropRewards); Log.Info("BossYellowItem on end"); } public override void OnStart() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown BossGroup.DropRewards += new Manipulator(BossGroup_DropRewards); Log.Info("BossYellowItem on start"); } private void BossGroup_DropRewards(ILContext il) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (StageModifierDirector.instance.IsModifierActive("Aurelionite")) { return; } ILCursor val = new ILCursor(il); if (1 == 0 || !val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(PickupDropletController), "CreatePickupDroplet") })) { return; } val.Remove(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)delegate(UniquePickup origPickup, Vector3 position, Vector3 vector, BossGroup self) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) UniquePickup pickup = origPickup; bool flag = self.bossDropTables != null && self.bossDropTables.Count > 0; bool flag2 = self.bossDrops != null && self.bossDrops.Count > 0; if (flag) { PickupDropTable val2 = self.rng.NextElementUniform(self.bossDropTables); Log.Info($"Boss has dropTable:{val2}"); if ((Object)(object)val2 != (Object)null) { pickup = val2.GeneratePickup(self.rng); } } else if (flag2) { Log.Info($"Boss has bossDrops:{self.bossDrops}"); ((UniquePickup)(ref pickup))..ctor(self.rng.NextElementUniform(self.bossDrops).pickupIndex); } else { Log.Info("Boss is group of enemies"); if (Object.op_Implicit((Object)(object)Run.instance) && Run.instance.availableBossDropList.Count > 0) { PickupIndex val3 = Run.instance.stageRng.NextElementUniform(Run.instance.availableBossDropList); ((UniquePickup)(ref pickup))..ctor(val3); } } CreatePickupInfo val4 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val4)).pickup = pickup; val4.rotation = Quaternion.identity; val4.position = position; CreatePickupInfo val5 = val4; PickupDropletController.CreatePickupDroplet(val5, position, vector); }); } } public class DroneBossModifier : StageModifier { public bool dropLegendary = false; public bool isAurelioniteActive = false; public DroneBossModifier(bool dropLegendary = false) { this.dropLegendary = dropLegendary; } public override void OnEnd() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown BossGroup.DropRewards -= new Manipulator(BossGroup_DropRewards); Log.Info("BossDroneReward on end"); } public override void OnStart() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown BossGroup.DropRewards += new Manipulator(BossGroup_DropRewards); Log.Info("BossItemModifier on start"); } private void BossGroup_DropRewards(ILContext il) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (StageModifierDirector.instance.IsModifierActive("Aurelionite")) { return; } ILCursor val = new ILCursor(il); if (1 == 0 || !val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(PickupDropletController), "CreatePickupDroplet") })) { return; } val.Remove(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Action)delegate(UniquePickup origPickup, Vector3 position, Vector3 vector, BossGroup self) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) UniquePickup pickup = origPickup; DroneIndex val2; if (dropLegendary) { val2 = Run.instance.stageRng.NextElementUniform(Run.instance.availableTier3DroneList); } else { List availableTier2DroneList = Run.instance.availableTier2DroneList; availableTier2DroneList.Remove(DroneDefs.EquipmentDrone.droneIndex); val2 = Run.instance.stageRng.NextElementUniform(availableTier2DroneList); } PickupIndex val3 = PickupCatalog.FindPickupIndex(val2); bool flag = false; ((UniquePickup)(ref pickup))..ctor(val3); CreatePickupInfo val4 = default(CreatePickupInfo); ((CreatePickupInfo)(ref val4)).pickup = pickup; val4.rotation = Quaternion.identity; val4.position = position; CreatePickupInfo val5 = val4; PickupDropletController.CreatePickupDroplet(val5, position, vector); }); } } } namespace RiskOfRoutes { public class AssetManager { public static AssetBundle bundle; public static GameObject routePortalPrefab; public static GameObject iconBubblePrefab; public static GameObject chefPrefab; public static Texture2D droneSymbolTexture; public static Texture2D rewardSymbolTexture; public static Texture2D aurelioniteSymbolTexture; public static InteractableSpawnCard tier1Printer; public static InteractableSpawnCard tier2Printer; public static InteractableSpawnCard tier3Printer; public static InteractableSpawnCard bossPrinter; public static InteractableSpawnCard wanderingChefSpawnCard; public static TMP_FontAsset bomb; public static Sprite placeholderIcon; public static Sprite expansionIcon; public static Sprite modIcon; public static Sprite lockedIcon; public static Sprite mysteryEnabled; public static Sprite mysteryDisabled; public static ObjectScaleCurve pingCurve; public static Animator progressBarAnimator; public static void Initialize(AssetBundle assetBundle) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) bundle = assetBundle; routePortalPrefab = CreateRoutePortalPrefab(); iconBubblePrefab = CreateIconBubblePrefab(); chefPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync((object)"RoR2/DLC3/MealPrep/MealPrep.prefab").WaitForCompletion(), "mealPrep"); droneSymbolTexture = bundle.LoadAsset("teleporterDrone"); rewardSymbolTexture = bundle.LoadAsset("teleporterReward"); aurelioniteSymbolTexture = bundle.LoadAsset("teleporterAurelionite"); tier1Printer = Addressables.LoadAssetAsync((object)"RoR2/Base/Duplicator/iscDuplicator.asset").WaitForCompletion(); tier2Printer = Addressables.LoadAssetAsync((object)"RoR2/Base/DuplicatorLarge/iscDuplicatorLarge.asset").WaitForCompletion(); tier3Printer = Addressables.LoadAssetAsync((object)"RoR2/Base/DuplicatorMilitary/iscDuplicatorMilitary.asset").WaitForCompletion(); bossPrinter = Addressables.LoadAssetAsync((object)"RoR2/Base/DuplicatorWild/iscDuplicatorWild.asset").WaitForCompletion(); CreateChefSpawnCard(); mysteryEnabled = bundle.LoadAsset("texArtifactMysteryEnabled"); mysteryDisabled = bundle.LoadAsset("texArtifactMysteryDisabled"); bomb = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/Fonts/Bombardier/tmpBombDropShadow.asset").WaitForCompletion(); placeholderIcon = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); expansionIcon = bundle.LoadAsset("routesExpansionIcon"); modIcon = bundle.LoadAsset("modIcon"); lockedIcon = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/MiscIcons/texUnlockIcon.png").WaitForCompletion(); GameObject val = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/PingIndicator.prefab").WaitForCompletion(); PingIndicator component = val.GetComponent(); pingCurve = component.pingObjectScaleCurve; CheckAssetsLoaded(); } private static GameObject CreateRoutePortalPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync((object)"RoR2/Base/PortalShop/PortalShop.prefab").WaitForCompletion(), "RoutePortal"); Object.Destroy((Object)(object)val.GetComponent()); Object.Destroy((Object)(object)val.GetComponent()); ObjectScaleCurve componentInChildren = val.GetComponentInChildren(); float num = 1f; float num2 = 1f; ((Object)val).name = "RoutePortal"; val.transform.localScale = new Vector3(num, num2, num); Transform val2 = val.transform.Find("PortalCenter"); if ((Object)(object)val2 != (Object)null) { Transform val3 = val2.Find("Point Light"); if ((Object)(object)val3 != (Object)null) { Light component = ((Component)val3).GetComponent(); if ((Object)(object)component != (Object)null) { component.intensity = 2f; } else { Log.Error("Not ifound lighthh"); } } else { Log.Info("Not found poitn lignt"); } } else { Log.Info("Not found center"); } Renderer[] componentsInChildren = val.GetComponentsInChildren(); RoutePortalManager routePortalManager = val.AddComponent(); Texture2D val4 = null; Texture2D val5 = null; if (RiskOfRoutes.usePortalTypeColors.Value) { val4 = bundle.LoadAsset("bwCenter"); val5 = bundle.LoadAsset("bwEdge"); } else { val4 = bundle.LoadAsset("darkerBlueEdge"); val5 = bundle.LoadAsset("darkerBlueCenter"); } Renderer[] array = componentsInChildren; foreach (Renderer val6 in array) { if (((Object)val6.material).name.Contains("Center") && !RiskOfRoutes.usePortalMaterial.Value) { val6.material.SetTexture("_RemapTex", (Texture)(object)val5); } } GenericInteraction val7 = val.AddComponent(); SceneExitController sceneExitController = val.AddComponent(); GenericDisplayNameProvider val8 = val.AddComponent(); GenericInspectInfoProvider val9 = val.AddComponent(); routePortalManager.genericInteraction = val7; routePortalManager.sceneExitController = sceneExitController; val7.contextToken = Language.GetString("ENTER_ROUTE_PORTAL"); return val; } public static GameObject CreateIconBubblePrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync((object)"RoR2/Base/bazaar/SeerStation.prefab").WaitForCompletion(), "seer"); Transform val2 = val.transform.Find("Model").Find("DisplayPivot"); Transform val3 = val2.Find("PortalActiveDisplay"); if (Object.op_Implicit((Object)(object)val3)) { GameObject val4 = new GameObject("IconBubblePrefab"); Object.DontDestroyOnLoad((Object)(object)val4); val4.SetActive(false); val3.SetParent(val4.transform); ((Component)val3).transform.localPosition = new Vector3(0f, 0f, 0f); ((Component)val3).transform.localRotation = Quaternion.Euler(0f, 180f, 0f); ((Component)val3).transform.localScale = new Vector3(0.25f, 0.25f, 0.25f); Transform val5 = ((Component)val3).transform.Find("Point Light"); Light component = ((Component)val5).GetComponent(); component.intensity = 1f; Renderer[] componentsInChildren = ((Component)val3).GetComponentsInChildren(); Renderer[] array = componentsInChildren; foreach (Renderer val6 in array) { if (((Object)val6).name == "Portal") { Material val7 = val6.materials[0]; val7.SetTexture("_Cloud1Tex", (Texture)null); val7.SetTexture("_Cloud2Tex", (Texture)null); val7.SetFloat("_Boost", 1f); val7.SetFloat("_AlphaBoost", 1f); val7.SetFloat("_DistortionStrength", 0f); val7.SetTextureScale("_MainTex", new Vector2(1.75f, 1.75f)); val7.SetTextureOffset("_MainTex", new Vector2(-0.4f, -0.4f)); val6.materials = (Material[])(object)new Material[2] { val7, val7 }; } } Object.Destroy((Object)(object)val); return val4; } return val; } private static void CreateChefSpawnCard() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) Log.Info("Trying to create CHEF"); InteractableSpawnCard val = ScriptableObject.CreateInstance(); GameObject val2 = Addressables.LoadAssetAsync((object)"RoR2/Base/bazaar/Bazaar_LunarTable.prefab").WaitForCompletion(); GameObject val3 = chefPrefab; GameObject val4 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync((object)"RoR2/Base/FlatHealth/DisplaySteakFlat.prefab").WaitForCompletion(), "steak1"); GameObject val5 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync((object)"RoR2/Base/FlatHealth/DisplaySteakFlat.prefab").WaitForCompletion(), "steak2"); GameObject val6 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync((object)"RoR2/Base/FlatHealth/DisplaySteakFlat.prefab").WaitForCompletion(), "steak3"); GameObject val7 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync((object)"RoR2/Base/Seed/PickupSeed.prefab").WaitForCompletion(), "seed"); GameObject val8 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync((object)"RoR2/DLC2/Chef/meshChefCleaverGhost1.FBX").WaitForCompletion(), "cleaverGhost"); GameObject val9 = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync((object)"RoR2/DLC2/lemuriantemple/Assets/LTWok.prefab").WaitForCompletion(), "wok"); val4.transform.SetParent(val3.transform, false); val5.transform.SetParent(val3.transform, false); val6.transform.SetParent(val3.transform, false); val7.transform.SetParent(val3.transform, false); val8.transform.SetParent(val3.transform, false); val9.transform.SetParent(val3.transform, false); val2.transform.SetParent(val3.transform, false); val4.transform.localPosition = default(Vector3); val4.transform.rotation = Quaternion.Euler(default(Vector3)); val4.transform.localScale = default(Vector3); val4.transform.localPosition = new Vector3(0.806f, -0.061f, 1.474f); val4.transform.localRotation = Quaternion.Euler(272.0293f, 356.7472f, 66.6001f); val4.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f); val5.transform.localPosition = new Vector3(-0.522f, -0.061f, 2.164f); val5.transform.localRotation = Quaternion.Euler(272.0291f, 245.6929f, 66.6f); val5.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f); val6.transform.localPosition = new Vector3(-0.492f, 0.088f, 2.209f); val6.transform.localRotation = Quaternion.Euler(274.538f, 270.5f, 90.0001f); val6.transform.localScale = new Vector3(0.4f, 0.4f, 0.4f); val7.transform.localPosition = new Vector3(0.366f, -0.162f, 1.872f); val7.transform.localRotation = Quaternion.Euler(48.0785f, 327.5262f, 319.4f); val7.transform.localScale = new Vector3(0.1043f, 0.1043f, 0.1043f); val8.transform.localPosition = new Vector3(0.922f, -0.7f, -0.01f); val8.transform.localRotation = Quaternion.Euler(0f, 205.2114f, 127.0116f); val8.transform.localScale = new Vector3(1f, 1f, 1f); val9.transform.localPosition = new Vector3(-0.28f, 0.7f, -1.79f); val9.transform.localRotation = Quaternion.Euler(270f, 302.2861f, 0f); val9.transform.localScale = new Vector3(3.1129f, 3.1129f, 3.1129f); val2.transform.localPosition = new Vector3(-0.289f, -1.256f, 0.01f); val2.transform.localRotation = Quaternion.Euler(270f, 90f, 0f); val2.transform.localScale = new Vector3(0.9041f, 0.9041f, 0.9041f); Material material = Addressables.LoadAssetAsync((object)"RoR2/DLC2/Chef/matChef_Cleaver.mat").WaitForCompletion(); Renderer componentInChildren = val8.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.material = material; } ((SpawnCard)val).prefab = chefPrefab; ((SpawnCard)val).directorCreditCost = 0; ((SpawnCard)val).sendOverNetwork = true; ((SpawnCard)val).hullSize = (HullClassification)0; val.orientToFloor = true; ((SpawnCard)val).nodeGraphType = (GraphType)0; wanderingChefSpawnCard = val; } public static InteractableSpawnCard CreateRoutePortalSpawnCard(SceneDef destination) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected I4, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) RoutePortalManager component = routePortalPrefab.GetComponent(); component.NetworkdestinationSceneIndex = (int)destination.sceneDefIndex; InteractableSpawnCard val = ScriptableObject.CreateInstance(); ((Object)val).name = "iscRoutePortal"; ((SpawnCard)val).prefab = routePortalPrefab; ((SpawnCard)val).sendOverNetwork = true; ((SpawnCard)val).hullSize = (HullClassification)0; ((SpawnCard)val).nodeGraphType = (GraphType)0; ((SpawnCard)val).requiredFlags = (NodeFlags)0; ((SpawnCard)val).forbiddenFlags = (NodeFlags)16; ((SpawnCard)val).directorCreditCost = 0; ((SpawnCard)val).occupyPosition = true; val.orientToFloor = false; val.skipSpawnWhenSacrificeArtifactEnabled = false; return val; } public static void CheckAssetsLoaded() { bool flag = false; if ((Object)(object)bundle == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load bundle"); } if ((Object)(object)routePortalPrefab == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load routePortalPrefab"); } if ((Object)(object)iconBubblePrefab == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load iconBubblePrefab"); } if ((Object)(object)chefPrefab == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load chefPrefab"); } if ((Object)(object)droneSymbolTexture == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load droneSymbolTexture"); } if ((Object)(object)rewardSymbolTexture == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load rewardSymbolTexture"); } if ((Object)(object)aurelioniteSymbolTexture == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load aurelioniteSymbolTexture"); } if ((Object)(object)tier1Printer == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load tier1Printer"); } if ((Object)(object)tier2Printer == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load tier2Printer"); } if ((Object)(object)tier3Printer == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load tier3Printer"); } if ((Object)(object)bossPrinter == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load bossPrinter"); } if ((Object)(object)wanderingChefSpawnCard == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load wanderingChefSpawnCard"); } if ((Object)(object)bomb == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load bomb"); } if ((Object)(object)placeholderIcon == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load placeholderIcon"); } if ((Object)(object)pingCurve == (Object)null) { flag = true; Log.Warning("CheckAssetsLoaded Failed to load pingCurve"); } if (flag) { Log.Error("CheckAssetsLoaded: One or more assets failed to load"); } else { Log.Info("CheckAssetsLoaded: All assets loaded"); } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } public class ModifierHologramController : MonoBehaviour { private GameObject droneIcon; private GameObject rewardIcon; private GameObject aurelioniteIcon; public Texture2D droneTex; public Texture2D rewardTex; public Texture2D aurelioniteTex; public Color uncommon = new Color(12f / 85f, 0.7490196f, 0f, 1f); public Color legendary = new Color(1f, 0.21960784f, 10f / 51f, 1f); public Color boss = new Color(1f, 47f / 51f, 0.19215687f, 1f); public Color aurelionite = new Color(1f, 48f / 85f, 0f, 1f); private void Start() { //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) Transform val = ((Component)this).transform.Find("TeleporterBaseMesh/HologramPivot/ShrineBossIndicator"); if (!((Object)(object)val == (Object)null)) { GameObject prefab = Addressables.LoadAssetAsync((object)"RoR2/Base/ShrineBoss/ShrineBossSymbol.prefab").WaitForCompletion(); droneIcon = CreateIcon(prefab, val, droneTex, "Hologram_Drone"); rewardIcon = CreateIcon(prefab, val, rewardTex, "Hologram_Reward"); aurelioniteIcon = CreateIcon(prefab, val, aurelioniteTex, "Hologram_Aurelionite"); RefreshIcons(); } } public void RefreshIcons() { if ((Object)(object)StageModifierDirector.instance != (Object)null) { bool flag = StageModifierDirector.instance.IsModifierActive("Aurelionite"); bool flag2 = StageModifierDirector.instance.IsModifierActive("DroneBossGreen"); bool flag3 = StageModifierDirector.instance.IsModifierActive("DroneBossRed"); bool flag4 = StageModifierDirector.instance.IsModifierActive("BossYellowItem"); bool flag5 = StageModifierDirector.instance.IsModifierActive("BossRedItem"); if (flag) { SetAurelioniteIconActive(active: true); } if (flag2) { SetDroneIconActive(active: true); } if (flag3) { SetDroneIconActive(active: true, isLegendary: true); } if (flag4) { SetRewardIconActive(active: true); } if (flag5) { SetRewardIconActive(active: true, isLegendary: true); } } } private GameObject CreateIcon(GameObject prefab, Transform parent, Texture2D texture, string iconName) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0029: 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) GameObject val = new GameObject(iconName); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent(); val2.sizeDelta = new Vector2(1f, 1f); ((Transform)val2).localScale = Vector3.one; GameObject val3 = Object.Instantiate(prefab, val.transform, false); ((Object)val3).name = iconName + "_Visual"; MeshRenderer component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { ((Renderer)component).material.SetTexture("_MainTex", (Texture)(object)texture); } val.SetActive(false); return val; } public void SetDroneIconActive(bool active, bool isLegendary = false) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) GameObject obj = droneIcon; MeshRenderer val = ((obj != null) ? obj.GetComponent() : null); if ((Object)(object)val != (Object)null) { if (isLegendary) { ((Renderer)val).material.SetColor("_TintColor", legendary); } else { ((Renderer)val).material.SetColor("_TintColor", uncommon); } } GameObject obj2 = droneIcon; if (obj2 != null) { obj2.SetActive(active); } } public void SetRewardIconActive(bool active, bool isLegendary = false) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) GameObject obj = droneIcon; MeshRenderer val = ((obj != null) ? obj.GetComponent() : null); if ((Object)(object)val != (Object)null) { if (isLegendary) { ((Renderer)val).material.SetColor("_TintColor", legendary); } else { ((Renderer)val).material.SetColor("_TintColor", boss); } } GameObject obj2 = rewardIcon; if (obj2 != null) { obj2.SetActive(active); } } public void SetAurelioniteIconActive(bool active) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) GameObject obj = droneIcon; MeshRenderer val = ((obj != null) ? obj.GetComponent() : null); if ((Object)(object)val != (Object)null) { ((Renderer)val).material.SetColor("_TintColor", aurelionite); } GameObject obj2 = aurelioniteIcon; if (obj2 != null) { obj2.SetActive(active); } } } public class ModUIManager : MonoBehaviour { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__HUD_Awake; public static hook_Refresh <1>__CurrentRunArtifactDisplayDataDriver_Refresh; } public static GameObject routePortalPanel; public static GameObject routeMapPanel; private RoutePortalManager lastViewedManager = null; private Vector2 lastViewedNodeCoords = new Vector2(-1f, -1f); private int lastViewedMapState = -1; public static void Initialize() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: 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_003d: Expected O, but got Unknown object obj = <>O.<0>__HUD_Awake; if (obj == null) { hook_Awake val = HUD_Awake; <>O.<0>__HUD_Awake = val; obj = (object)val; } HUD.Awake += (hook_Awake)obj; object obj2 = <>O.<1>__CurrentRunArtifactDisplayDataDriver_Refresh; if (obj2 == null) { hook_Refresh val2 = CurrentRunArtifactDisplayDataDriver_Refresh; <>O.<1>__CurrentRunArtifactDisplayDataDriver_Refresh = val2; obj2 = (object)val2; } CurrentRunArtifactDisplayDataDriver.Refresh += (hook_Refresh)obj2; } private static void CurrentRunArtifactDisplayDataDriver_Refresh(orig_Refresh orig, CurrentRunArtifactDisplayDataDriver self) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) RunEnabledArtifacts enumerator = RunArtifactManager.enabledArtifactsEnumerable.GetEnumerator(); if (((RunEnabledArtifacts)(ref enumerator)).MoveNext()) { orig.Invoke(self); } if (!Object.op_Implicit((Object)(object)self.artifactDisplayPanelController) || !Object.op_Implicit((Object)(object)self.artifactDisplayPanelController.iconContainer)) { return; } if ((Object)(object)StageModifierDirector.instance == (Object)null || ((SyncListStruct)StageModifierDirector.instance.modifiersSynced).Count == 0) { orig.Invoke(self); return; } self.dirty = false; AddCustomIcon(self.artifactDisplayPanelController); if (!self.artifactDisplayPanelController.panelObject.activeSelf) { self.artifactDisplayPanelController.panelObject.SetActive(true); } } private static void AddCustomIcon(ArtifactDisplayPanelController controller) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) foreach (ModifierSync item in (SyncList)(object)StageModifierDirector.instance.modifiersSynced) { if (item.isArtifact || item.name.EndsWith("_EnemyItem")) { continue; } ModifierDef modifierDef = StageModifierCatalog.FindModifier(item.name); if (modifierDef == null) { continue; } string name = item.name; Transform iconContainer = (Transform)(object)controller.iconContainer; if (!Object.op_Implicit((Object)(object)iconContainer.Find(name))) { GameObject val = new GameObject(name); val.transform.SetParent(iconContainer, false); Image val2 = val.AddComponent(); if (modifierDef.name != "Doppelganger") { val2.sprite = (((Object)(object)modifierDef.icon != (Object)null) ? modifierDef.icon : AssetManager.placeholderIcon); } else { val2.sprite = GetHostSprite(); ((Graphic)val2).color = new Color(0.6392157f, 0.23921569f, 41f / 51f, 1f); } LayoutElement val3 = val.AddComponent(); val3.preferredHeight = 32f; val3.preferredWidth = 32f; val3.flexibleHeight = 0f; val3.flexibleWidth = 0f; RectTransform component = val.GetComponent(); component.sizeDelta = new Vector2(32f, 32f); AddStackTextToImage(item.stack, val2); TooltipProvider val4 = val.AddComponent(); ModifierDef modifierDef2 = StageModifierCatalog.FindModifier(item.name); val4.titleToken = Language.GetString(modifierDef2.nameToken); val4.bodyToken = StageModifierCatalog.GetModifierDescriptionFormatted(item, modifierDef2); val4.titleColor = new Color(82f / 85f, 0.3529412f, 0.22745098f); if (Object.op_Implicit((Object)(object)controller.panelObject) && !controller.panelObject.activeSelf) { controller.panelObject.SetActive(true); } } } } private static void AddStackTextToImage(int modStack, Image img) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //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) GameObject val = new GameObject("StackText"); val.transform.SetParent(((Component)img).transform, false); HGTextMeshProUGUI val2 = val.AddComponent(); RectTransform component = ((Component)val2).GetComponent(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; ((TMP_Text)val2).font = AssetManager.bomb; ((TMP_Text)val2).fontSize = 12f; ((TMP_Text)val2).alignment = (TextAlignmentOptions)260; if (modStack > 1) { ((TMP_Text)val2).text = $"x{modStack}"; } } private static void HUD_Awake(orig_Awake orig, HUD self) { orig.Invoke(self); if (!Run.instance.IsExpansionEnabled(RoutesExpansion.routesExpansion)) { Log.Warning("HUD_Awake: Expansion is disabled, map ui is not attached"); return; } ModUIManager modUIManager = ((Component)self).gameObject.AddComponent(); if ((Object)(object)routePortalPanel != (Object)null) { TranslucentImage component = routePortalPanel.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)((Graphic)component).material != (Object)null) { Object.Destroy((Object)(object)((Graphic)component).material); } Object.Destroy((Object)(object)routePortalPanel); } if ((Object)(object)routeMapPanel != (Object)null) { TranslucentImage component2 = routeMapPanel.GetComponent(); if ((Object)(object)component2 != (Object)null && (Object)(object)((Graphic)component2).material != (Object)null) { Object.Destroy((Object)(object)((Graphic)component2).material); } Object.Destroy((Object)(object)routeMapPanel); } SetupRoutePortalPanel(); SetupRouteMapPanel(); if ((Object)(object)routePortalPanel != (Object)null) { routePortalPanel.transform.SetParent(self.mainContainer.transform, false); } else { Log.Error("Route portal panel is null"); } if ((Object)(object)routeMapPanel != (Object)null) { CanvasGroup val = routeMapPanel.GetComponent(); if ((Object)(object)val == (Object)null) { val = routeMapPanel.AddComponent(); } val.alpha = 1f; routeMapPanel.SetActive(false); UIJuice component3 = self.scoreboardPanel.GetComponent(); UIJuice val2 = routeMapPanel.AddComponent(); RouteMapUI component4 = routeMapPanel.GetComponent(); if ((Object)(object)component3 != (Object)null) { val2.transitionDuration = 0.2f; val2.panningMagnitude = component3.panningMagnitude; val2.panningRect = component4.mainContainer; val2.canvasGroup = val; } routeMapPanel.transform.SetParent(self.mainContainer.transform, false); if (!((Object)(object)component4 != (Object)null)) { Log.Error("Script is not available"); } } routePortalPanel.SetActive(false); } private static void SetupRoutePortalPanel() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) GameObject val = AssetManager.bundle.LoadAsset("RoutePortalPortraitPanel"); if ((Object)(object)val == (Object)null) { Log.Error("What?"); } TranslucentImage val2 = val.AddComponent(); Shader val3 = Shader.Find("UI/TranslucentImage"); ((Graphic)val2).material = new Material(val3); ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.7f); TextMeshProUGUI componentInChildren = val.GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { Log.Error("No text meshprougui"); } if ((Object)(object)componentInChildren == (Object)null) { Log.Error("Not found"); } ((TMP_Text)componentInChildren).text = "Placeholder"; ((TMP_Text)componentInChildren).font = AssetManager.bomb; routePortalPanel = Object.Instantiate(val); } private static void SetupRouteMapPanel() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) GameObject val = AssetManager.bundle.LoadAsset("RouteMapPanel"); if ((Object)(object)val == (Object)null) { Log.Error("SetupRouteMapPanel: Couldn't load RouteMapPanel"); return; } routeMapPanel = Object.Instantiate(val); TranslucentImage val2 = val.AddComponent(); Shader val3 = Shader.Find("UI/TranslucentImage"); ((Graphic)val2).material = new Material(val3); ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.7f); RouteMapUI component = routeMapPanel.GetComponent(); ((Component)component.barImageHorizontal).gameObject.AddComponent(); ((Component)component.barImageVertical).gameObject.AddComponent(); GameObject[] array = (GameObject[])(object)new GameObject[2] { component.labelHorizontal, component.labelVertical }; foreach (GameObject val4 in array) { if ((Object)(object)val4 == (Object)null) { Log.Error("SetupRouteMapPanel: No label found"); break; } val4.gameObject.AddComponent(); } } private void RoutePortalPanelUpdateText(GameObject routePortalPanel, RoutePortalManager mg) { //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Expected O, but got Unknown //IL_0312: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI[] componentsInChildren = routePortalPanel.GetComponentsInChildren(); TextMeshProUGUI val = null; TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val2 in array) { if (((Object)val2).name == "BodyLabel") { val = val2; break; } } RawImage[] componentsInChildren2 = routePortalPanel.GetComponentsInChildren(); RawImage val3 = null; RawImage[] array2 = componentsInChildren2; foreach (RawImage val4 in array2) { if (((Object)val4).name == "ActualImage") { val3 = val4; break; } } if ((Object)(object)val == (Object)null || (Object)(object)val3 == (Object)null) { return; } if (mg.destinationSceneIndex != -1) { SceneDef sceneDef = SceneCatalog.GetSceneDef((SceneIndex)mg.destinationSceneIndex); if ((Object)(object)sceneDef != (Object)null && (Object)(object)sceneDef.portalMaterial != (Object)null) { val3.texture = sceneDef.portalMaterial.mainTexture; } } string text = "" + Language.GetString("POSITIVE") + "\n"; string text2 = "" + Language.GetString("NEGATIVE") + "\n"; bool flag = false; bool flag2 = false; GridLayoutGroup componentInChildren = routePortalPanel.GetComponentInChildren(); for (int num = ((Component)componentInChildren).transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)((Component)componentInChildren).transform.GetChild(num)).gameObject); } routePortalPanel.gameObject.SetActive(true); foreach (string item in (SyncList)(object)mg.stageModifiers) { string[] array3 = item.Split('='); if (array3.Length < 2) { continue; } string name = array3[0]; int num2 = int.Parse(array3[1]); ModifierDef modifierDef = StageModifierCatalog.FindModifier(name); if (modifierDef != null) { ModifierSync modifierSync = default(ModifierSync); modifierSync.name = name; modifierSync.stack = num2; ModifierSync mod = modifierSync; string text3 = ""; text3 = ((!RiskOfRoutes.routePanelShowsOnlyNames.Value) ? ("- " + StageModifierCatalog.GetModifierDescriptionFormatted(mod, modifierDef)) : ("- " + StageModifierCatalog.GetModifierNameFormatted(mod, modifierDef))); if (!modifierDef.isNegative) { text = text + text3 + "\n"; flag = true; } else { text2 = text2 + text3 + "\n"; flag2 = true; } GameObject val5 = new GameObject("ModifierIcon"); Image val6 = val5.AddComponent(); if (modifierDef.name != "Doppelganger") { val6.sprite = (((Object)(object)modifierDef.icon != (Object)null) ? modifierDef.icon : AssetManager.placeholderIcon); } else { val6.sprite = GetHostSprite(); ((Graphic)val6).color = new Color(0.4f, 0.15f, 0.5f, 1f); } ((Component)val6).transform.SetParent(((Component)componentInChildren).transform, false); val5.AddComponent(); LayoutElement component = val5.GetComponent(); component.minWidth = 16f; component.minHeight = 16f; component.preferredWidth = 64f; component.preferredHeight = 64f; AddStackTextToImage(num2, val6); } } string text4 = ""; ((TMP_Text)val).text = text4 + (flag ? text : "") + (flag2 ? text2 : ""); } public static Sprite GetHostSprite() { //IL_0081: 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) if (CharacterMaster.instancesList != null && CharacterMaster.instancesList.Count > 0) { CharacterBody body = CharacterMaster.instancesList[0].GetBody(); if ((Object)(object)body != (Object)null && (Object)(object)body.portraitIcon != (Object)null) { Texture portraitIcon = body.portraitIcon; Texture2D val = (Texture2D)(object)((portraitIcon is Texture2D) ? portraitIcon : null); if ((Object)(object)val != (Object)null) { return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } } } return AssetManager.placeholderIcon; } private void Update() { //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)routePortalPanel == (Object)null || (Object)(object)routeMapPanel == (Object)null || !Object.op_Implicit((Object)(object)Run.instance) || !Run.instance.IsExpansionEnabled(RoutesExpansion.routesExpansion)) { return; } LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser == null || !((Object)(object)firstLocalUser.cachedBody != (Object)null)) { return; } bool flag = firstLocalUser.inputPlayer != null && firstLocalUser.inputPlayer.GetButton("info"); bool flag2 = false; RoutePortalManager routePortalManager = null; InteractionDriver component = ((Component)firstLocalUser.cachedBody).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.currentInteractable != (Object)null) { routePortalManager = component.currentInteractable.GetComponentInChildren(); if (!Object.op_Implicit((Object)(object)routePortalManager)) { routePortalManager = component.currentInteractable.GetComponentInParent(); } if ((Object)(object)routePortalManager != (Object)null && routePortalManager.isUsingModifiers) { flag2 = true; } } if (flag2) { if ((Object)(object)lastViewedManager != (Object)(object)routePortalManager) { lastViewedManager = routePortalManager; if (((SyncList)(object)routePortalManager.stageModifiers).Count > 0) { RoutePortalPanelUpdateText(routePortalPanel, routePortalManager); } } if (!routePortalPanel.activeSelf) { routePortalPanel.SetActive(true); } } else { if (routePortalPanel.activeSelf) { routePortalPanel.SetActive(false); } lastViewedManager = null; } bool flag3 = lastViewedMapState != StageModifierDirector.instance.mapState; if (flag || flag2 || flag3) { Vector2 val = (flag2 ? routePortalManager.nodeSync : StageModifierDirector.instance.currentNodeSync); RouteMapUI component2 = routeMapPanel.GetComponent(); if (StageModifierDirector.instance.punishmentTime != -1f) { component2.DrawBar(); } if (val != lastViewedNodeCoords || !routeMapPanel.activeSelf || flag3) { component2.DrawMap(val); lastViewedNodeCoords = val; lastViewedMapState = StageModifierDirector.instance.mapState; } if (!routeMapPanel.activeSelf) { routeMapPanel.SetActive(true); UIJuice component3 = routeMapPanel.GetComponent(); if ((Object)(object)component3 != (Object)null) { component3.TransitionPanFromTop(); component3.TransitionAlphaFadeIn(); } } } else if (routeMapPanel.activeSelf) { routeMapPanel.SetActive(false); lastViewedNodeCoords = new Vector2(-1f, -1f); } } } internal class MyNetworkComponent : NetworkBehaviour { private static MyNetworkComponent _instance; private static int kTargetRpcTargetLog; private void Awake() { _instance = this; Log.Info("T MyNetworkComponesnt spawned on: " + (NetworkServer.active ? "Server" : "Client")); } public static void Invoke(NetworkUser user, string msg) { _instance.CallTargetLog(((NetworkBehaviour)user).connectionToClient, msg); } [TargetRpc] private void TargetLog(NetworkConnection target, string msg) { Log.Info(msg); } private void UNetVersion() { } protected static void InvokeRpcTargetLog(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"TargetRPC TargetLog called on server."); } else { ((MyNetworkComponent)(object)obj).TargetLog(ClientScene.readyConnection, reader.ReadString()); } } public void CallTargetLog(NetworkConnection target, string msg) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"TargetRPC Function TargetLog called on client."); return; } if (target is ULocalConnectionToServer) { Debug.LogError((object)"TargetRPC Function TargetLog called on connection to server"); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kTargetRpcTargetLog); val.Write(((Component)this).GetComponent().netId); val.Write(msg); ((NetworkBehaviour)this).SendTargetRPCInternal(target, val, 0, "TargetLog"); } static MyNetworkComponent() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown kTargetRpcTargetLog = 458293422; NetworkBehaviour.RegisterRpcDelegate(typeof(MyNetworkComponent), kTargetRpcTargetLog, new CmdDelegate(InvokeRpcTargetLog)); NetworkCRC.RegisterBehaviour("MyNetworkComponent", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } } public class MysteryArtifact { [CompilerGenerated] private static class <>O { public static hook_RebuildModel <0>__PickupDisplay_RebuildModel; public static hook_GetDisplayName <1>__GenericPickupController_GetDisplayName; public static hook_GetInspectInfoProvider <2>__GenericPickupController_GetInspectInfoProvider; public static hook_Start <3>__ShopTerminalBehavior_Start; public static hook_Update <4>__PickupDisplay_Update; } public static ArtifactDef Mystery = ScriptableObject.CreateInstance(); public static void InitializeArtifact() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //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_00b5: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown Mystery.nameToken = "ARTIFACT_MYSTERY_NAME"; Mystery.descriptionToken = "ARTIFACT_MYSTERY_DESCRIPTION"; Mystery.smallIconDeselectedSprite = AssetManager.mysteryDisabled; Mystery.smallIconSelectedSprite = AssetManager.mysteryEnabled; Mystery.cachedName = "Mystery"; ContentAddition.AddArtifactDef(Mystery); object obj = <>O.<0>__PickupDisplay_RebuildModel; if (obj == null) { hook_RebuildModel val = PickupDisplay_RebuildModel; <>O.<0>__PickupDisplay_RebuildModel = val; obj = (object)val; } PickupDisplay.RebuildModel += (hook_RebuildModel)obj; object obj2 = <>O.<1>__GenericPickupController_GetDisplayName; if (obj2 == null) { hook_GetDisplayName val2 = GenericPickupController_GetDisplayName; <>O.<1>__GenericPickupController_GetDisplayName = val2; obj2 = (object)val2; } GenericPickupController.GetDisplayName += (hook_GetDisplayName)obj2; object obj3 = <>O.<2>__GenericPickupController_GetInspectInfoProvider; if (obj3 == null) { hook_GetInspectInfoProvider val3 = GenericPickupController_GetInspectInfoProvider; <>O.<2>__GenericPickupController_GetInspectInfoProvider = val3; obj3 = (object)val3; } GenericPickupController.GetInspectInfoProvider += (hook_GetInspectInfoProvider)obj3; object obj4 = <>O.<3>__ShopTerminalBehavior_Start; if (obj4 == null) { hook_Start val4 = ShopTerminalBehavior_Start; <>O.<3>__ShopTerminalBehavior_Start = val4; obj4 = (object)val4; } ShopTerminalBehavior.Start += (hook_Start)obj4; object obj5 = <>O.<4>__PickupDisplay_Update; if (obj5 == null) { hook_Update val5 = PickupDisplay_Update; <>O.<4>__PickupDisplay_Update = val5; obj5 = (object)val5; } PickupDisplay.Update += (hook_Update)obj5; } private static void PickupDisplay_Update(orig_Update orig, PickupDisplay self) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if ((Object)(object)RunArtifactManager.instance != (Object)null && RunArtifactManager.instance.IsArtifactEnabled(Mystery) && self.hidden && Object.op_Implicit((Object)(object)self.modelObject)) { ShopTerminalBehavior componentInParent = ((Component)self).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && ((Object)componentInParent).name.Contains("Duplicator")) { Transform transform = self.modelObject.transform; transform.localPosition += Vector3.up * 1f; } else { Transform transform2 = self.modelObject.transform; transform2.localPosition += Vector3.up * 0.1f; } } } private static void ShopTerminalBehavior_Start(orig_Start orig, ShopTerminalBehavior self) { if (RunArtifactManager.instance.IsArtifactEnabled(Mystery)) { self.hidden = true; } orig.Invoke(self); } private static IInspectInfoProvider GenericPickupController_GetInspectInfoProvider(orig_GetInspectInfoProvider orig, GenericPickupController self) { if (RunArtifactManager.instance.IsArtifactEnabled(Mystery)) { return null; } return orig.Invoke(self); } private static string GenericPickupController_GetDisplayName(orig_GetDisplayName orig, GenericPickupController self) { if (RunArtifactManager.instance.IsArtifactEnabled(Mystery)) { return "???"; } return orig.Invoke(self); } private static void PickupDisplay_RebuildModel(orig_RebuildModel orig, PickupDisplay self, GameObject modelObjectOverride) { if (RunArtifactManager.instance.IsArtifactEnabled(Mystery)) { self.hidden = true; } orig.Invoke(self, modelObjectOverride); } } public class RouteMapUI : MonoBehaviour { private Dictionary MapNodes = new Dictionary(); public GameObject nodePrefab; public GameObject linePrefab; public RectTransform nodeContainer; public RectTransform mainContainer; public GameObject horizontalBars; public GameObject verticalBars; public Image barImageHorizontal; public Image barImageVertical; public GameObject labelHorizontal; public GameObject labelVertical; public bool isMapVertical; public bool isBarVertical; public Sprite empty; public Sprite drone; public Sprite chef; public Sprite item; public Sprite rare; public Sprite objective; public Sprite shop; public Sprite goldShores; public Sprite colossus; public Sprite hardware; public Sprite voidFields; public Sprite celestial; public Sprite falseSon; public Sprite lineImage; public Sprite starting; public Sprite solusWing; public Sprite heal; public Sprite combat; public Sprite utility; public void DrawMap() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) DrawMap(new Vector2(-1f, -1f)); } public void DrawBar() { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) isBarVertical = RiskOfRoutes.punishmentBarOrientation.Value == RiskOfRoutes.MapOrientation.Vertical; if (StageModifierDirector.instance.punishmentTime == -1f) { verticalBars.SetActive(false); horizontalBars.SetActive(false); return; } if (isBarVertical) { verticalBars.SetActive(true); horizontalBars.SetActive(false); } else { verticalBars.SetActive(false); horizontalBars.SetActive(true); } float fillAmount = (Run.instance.GetRunStopwatch() - StageModifierDirector.instance.stageEnterTime) / (StageModifierDirector.instance.punishmentTime * 60f) % 1f; int num = (int)((Run.instance.GetRunStopwatch() - StageModifierDirector.instance.stageEnterTime) / (StageModifierDirector.instance.punishmentTime * 60f)); barImageHorizontal.fillAmount = fillAmount; barImageVertical.fillAmount = fillAmount; ((Graphic)barImageHorizontal).color = RiskOfRoutes.punishmentBarColor.Value; ((Graphic)barImageVertical).color = RiskOfRoutes.punishmentBarColor.Value; Image[] array = (Image[])(object)new Image[2] { barImageHorizontal, barImageVertical }; foreach (Image val in array) { TooltipProvider component = ((Component)val).GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("DrawMap: No tooltip provider for bar images"); return; } component.titleToken = "PUNISHMENT_BAR_NAME"; component.bodyToken = Language.GetStringFormatted("PUNISHMENT_BAR_DESCRIPTION", new object[1] { (int)StageModifierDirector.instance.punishmentTime }); component.titleColor = RiskOfRoutes.punishmentBarColor.Value; } GameObject[] array2 = (GameObject[])(object)new GameObject[2] { labelHorizontal, labelVertical }; foreach (GameObject val2 in array2) { if ((Object)(object)val2 == (Object)null) { Log.Error("DrawMap: No label found"); break; } TooltipProvider component2 = val2.GetComponent(); if ((Object)(object)component2 == (Object)null) { Log.Error("DrawMap: No tooltip provider for punish label"); break; } component2.titleToken = Language.GetStringFormatted("PUNISHMENT_VALUE_NAME", new object[1] { num }); component2.bodyToken = "PUNISHMENT_VALUE_DESCRIPTION"; component2.titleColor = RiskOfRoutes.punishmentBarColor.Value; TextMeshProUGUI component3 = val2.GetComponent(); if ((Object)(object)component3 == (Object)null) { Log.Error("DrawMap: No text component found"); break; } if ((Object)(object)val2 == (Object)(object)labelVertical) { ((TMP_Text)component3).text = $"{num}"; continue; } ((TMP_Text)component3).text = Language.GetStringFormatted("PUNISHMENT_VALUE_NAME", new object[1] { num }); } } public void DrawMap(Vector2 selectedNodeCoords) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) ClearContainer(); MapNodes.Clear(); int mapWidth = StageModifierDirector.instance.mapWidth; int mapHeight = StageModifierDirector.instance.mapHeight; bool isMoonVisited = StageModifierDirector.instance.isMoonVisited; bool flag = false; DrawBar(); List routeNodesSynced = StageModifierDirector.instance.routeNodesSynced; if (routeNodesSynced == null || routeNodesSynced.Count == 0) { if (routeNodesSynced == null) { Log.Error("DrawMap: Map is null"); } if (routeNodesSynced.Count == 0) { Log.Error("DrawMap: Map is empty"); } return; } float num = (float)RiskOfRoutes.routeMapSize.Value / 100f; RectTransform component = ((Component)this).GetComponent(); ((Transform)component).localScale = new Vector3(num, num, 1f); float num2 = 48f * ((float)RiskOfRoutes.routeMapIconSize.Value / 100f); RouteNodeSync node = GetNode((int)selectedNodeCoords.x, (int)selectedNodeCoords.y, routeNodesSynced, mapHeight); Transform transform = new GameObject("Lines", new Type[1] { typeof(RectTransform) }).transform; transform.SetParent((Transform)(object)nodeContainer, false); Transform transform2 = new GameObject("Nodes", new Type[1] { typeof(RectTransform) }).transform; transform2.SetParent((Transform)(object)nodeContainer, false); ObjectScaleCurve pingCurve = AssetManager.pingCurve; GameObject val = Object.Instantiate(nodePrefab, transform2); RectTransform component2 = val.GetComponent(); List effectiveWidth = GetEffectiveWidth(node, mapWidth, mapHeight, routeNodesSynced); int count = effectiveWidth.Count; Rect rect = nodeContainer.rect; float width = ((Rect)(ref rect)).width; rect = nodeContainer.rect; float height = ((Rect)(ref rect)).height; float num3 = width / 20f; float num4 = height / 10f; float num5 = width - num3 * 2f; float num6 = height - num4 * 2f; float num7 = (isMapVertical ? (num5 / (float)(count - 1)) : (num5 / (float)mapHeight)); float num8 = (isMapVertical ? (num6 / (float)mapHeight) : (num6 / (float)(count - 1))); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); float num9 = (isMapVertical ? 0f : (num5 / 2f)); float num10 = (isMapVertical ? (num6 / 2f) : 0f); component2.anchoredPosition = new Vector2(num9, num10); component2.sizeDelta = new Vector2(75f, 75f); Image component3 = val.GetComponent(); component3.sprite = objective; if (isMoonVisited) { ((Graphic)component3).color = new Color(0.887f, 0.87f, 0.172f, 1f); } for (int i = 0; i < mapWidth + 1; i++) { int num11 = effectiveWidth.IndexOf(i); if (num11 == -1) { continue; } for (int j = 0; j < mapHeight; j++) { RouteNodeSync node2 = GetNode(i, j, routeNodesSynced, mapHeight); if (node2.portalType == RoutePortalType.FalseSon && node2.visited) { flag = true; } bool flag2 = node2.portalType == RoutePortalType.Colossus || node2.portalType == RoutePortalType.FalseSon || node2.portalType == RoutePortalType.Hardware || node2.portalType == RoutePortalType.SolusWing; if (node2.x == -1 || node2.y == -1 || (node2.portalType == RoutePortalType.None && j != 0) || (flag2 && !node2.visited && !node2.Equals(node))) { continue; } float num12; float num13; if (isMapVertical) { if (j == 0) { num12 = 0f; num13 = 0f - num6 / 2f; } else { num12 = 0f - num5 / 2f + (float)num11 * num7; num13 = 0f - num6 / 2f + (float)j * num8; } } else if (j == 0) { num12 = 0f - num5 / 2f; num13 = 0f; } else { num12 = 0f - num5 / 2f + (float)j * num7; num13 = 0f - num6 / 2f + (float)num11 * num8; } GameObject val2 = Object.Instantiate(nodePrefab, transform2); RectTransform component4 = val2.GetComponent(); if (node2.Equals(node) && (Object)(object)pingCurve != (Object)null && !isMoonVisited) { ObjectScaleCurve val3 = val2.AddComponent(); val3.useOverallCurveOnly = pingCurve.useOverallCurveOnly; val3.overallCurve = pingCurve.overallCurve; val3.curveX = pingCurve.curveX; val3.curveY = pingCurve.curveY; val3.curveZ = pingCurve.curveZ; val3.timeMax = pingCurve.timeMax; ((Behaviour)val3).enabled = false; ((Behaviour)val3).enabled = true; } component4.anchorMin = new Vector2(0.5f, 0.5f); component4.anchorMax = new Vector2(0.5f, 0.5f); component4.anchoredPosition = new Vector2(num12, num13); component4.sizeDelta = ((i == 0 && j == 0) ? new Vector2(4f, 4f) : new Vector2(num2, num2)); bool visited = node2.visited || node2.Equals(node); SetIconAndTooltip(val2, GetNode(i, j, routeNodesSynced, mapHeight).portalType, i, j, visited); MapNodes.Add(node2, component4); } } if (isMoonVisited) { ObjectScaleCurve val4 = val.AddComponent(); val4.useOverallCurveOnly = pingCurve.useOverallCurveOnly; val4.overallCurve = pingCurve.overallCurve; val4.curveX = pingCurve.curveX; val4.curveY = pingCurve.curveY; val4.curveZ = pingCurve.curveZ; val4.timeMax = pingCurve.timeMax; ((Behaviour)val4).enabled = false; ((Behaviour)val4).enabled = true; } foreach (KeyValuePair mapNode in MapNodes) { RouteNodeSync key = mapNode.Key; RectTransform value = mapNode.Value; if (key.y == mapHeight - 1) { DrawLine(value.anchoredPosition, component2.anchoredPosition, transform, key.visited && isMoonVisited); } foreach (RouteNodeSync child in GetChildren(key, routeNodesSynced, mapHeight, usePortalNode: true)) { if (((key.portalType != RoutePortalType.Colossus && key.portalType != RoutePortalType.FalseSon) || child.visited || child.Equals(node)) && !(key.portalType == RoutePortalType.Colossus && child.portalType != RoutePortalType.Colossus && child.portalType != RoutePortalType.FalseSon && flag) && MapNodes.TryGetValue(child, out var value2)) { DrawLine(value.anchoredPosition, value2.anchoredPosition, transform, child.visited && key.visited); if (RiskOfRoutes.showIntermissionNodes.Value && key.visited && child.visited) { DrawIntermissionNodes(transform2, value, child, value2); } } } } } private void DrawIntermissionNodes(Transform nodesContainer, RectTransform startRect, RouteNodeSync childNode, RectTransform endRect) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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) List list = new List(); if (childNode.shopVisited) { list.Add(RoutePortalType.Shop); } if (childNode.goldshoresVisited) { list.Add(RoutePortalType.Goldshores); } if (childNode.voidFieldsVisited) { list.Add(RoutePortalType.Arena); } for (int i = 0; i < list.Count; i++) { RoutePortalType portalType = list[i]; float num = i + 1; float num2 = 1 + list.Count; GameObject val = Object.Instantiate(nodePrefab, nodesContainer); RectTransform component = val.GetComponent(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(36f, 36f); component.anchoredPosition = startRect.anchoredPosition * ((num2 - num) / num2) + endRect.anchoredPosition * (num / num2); SetIconAndTooltip(val, portalType, -1, -1, visited: true); } } private void DrawLine(Vector2 start, Vector2 end, Transform lineContainer, bool visited = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(linePrefab, lineContainer); RectTransform component = val.GetComponent(); Vector2 val2 = end - start; float magnitude = ((Vector2)(ref val2)).magnitude; float num = Mathf.Atan2(val2.y, val2.x) * 57.29578f; if (visited) { ((Graphic)val.GetComponent()).color = new Color(0.887f, 0.87f, 0.172f, 1f); } val.GetComponent().sprite = lineImage; component.sizeDelta = new Vector2(magnitude, 3f); component.anchoredPosition = start + val2 / 2f; ((Transform)component).localRotation = Quaternion.Euler(0f, 0f, num); } private void SetIconAndTooltip(GameObject routeNode, RoutePortalType portalType, int x = -1, int y = -1, bool visited = false) { //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) Sprite val = empty; switch (portalType) { case RoutePortalType.None: return; case RoutePortalType.Rare: val = rare; break; case RoutePortalType.ItemType: val = item; break; case RoutePortalType.DroneType: val = drone; break; case RoutePortalType.ChefType: val = chef; break; case RoutePortalType.Colossus: val = colossus; break; case RoutePortalType.Hardware: val = hardware; break; case RoutePortalType.SolusWing: val = solusWing; break; case RoutePortalType.Goldshores: val = goldShores; break; case RoutePortalType.Shop: val = shop; break; case RoutePortalType.Arena: val = voidFields; break; case RoutePortalType.FalseSon: val = falseSon; break; case RoutePortalType.Combat: val = combat; break; case RoutePortalType.Heal: val = heal; break; case RoutePortalType.Utility: val = utility; break; default: val = empty; break; } Image component = routeNode.GetComponent(); TooltipProvider val2 = routeNode.AddComponent(); string text = portalType.ToString().ToUpper(); val2.titleToken = "ROUTENODE_" + text + "_NAME"; val2.bodyToken = "ROUTENODE_" + text + "_DESCRIPTION"; val2.titleColor = new Color(82f / 85f, 0.3529412f, 0.22745098f); component.sprite = val; if (visited) { ((Graphic)component).color = new Color(0.887f, 0.87f, 0.172f, 1f); } } private void ClearContainer() { for (int num = ((Transform)nodeContainer).childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)((Transform)nodeContainer).GetChild(num)).gameObject); } } public List GetEffectiveWidth(RouteNodeSync selectedNode, int width, int height, List map) { List list = new List(); int num = 0; for (int i = 0; i < width + 1; i++) { bool flag = false; for (int j = 0; j < height; j++) { RouteNodeSync node = GetNode(i, j, map, height); if (node.x != -1 && node.y != -1 && node.portalType != 0 && ((node.portalType != RoutePortalType.Colossus && node.portalType != RoutePortalType.FalseSon && node.portalType != RoutePortalType.Hardware && node.portalType != RoutePortalType.SolusWing) || node.visited || node.Equals(selectedNode))) { flag = true; break; } } if (flag) { list.Add(i); } } return list; } public List GetChildren(RouteNodeSync node, List map, int height, bool usePortalNode = false) { List list = new List(); if (node.leftX != -1 && node.leftY != -1) { list.Add(GetNode(node.leftX, node.leftY, map, height)); } if (node.frontX != -1 && node.frontY != -1) { list.Add(GetNode(node.frontX, node.frontY, map, height)); } if (node.rightX != -1 && node.rightY != -1) { list.Add(GetNode(node.rightX, node.rightY, map, height)); } if (usePortalNode && node.bonusX != -1 && node.bonusY != -1) { list.Add(GetNode(node.bonusX, node.bonusY, map, height)); } return list; } public RouteNodeSync GetNode(int x, int y, List map, int mapHeight) { int num = x * mapHeight + y; if (map != null && num >= 0 && num < map.Count) { return map[num]; } return default(RouteNodeSync); } } public class RoutePortalManager : NetworkBehaviour { public GenericInteraction genericInteraction; public SceneExitController sceneExitController; public PurchaseInteraction purchaseInteraction; [SyncVar] public bool isUsingModifiers = false; [SyncVar(hook = "OnOvalChanged")] public bool isOval = false; [SyncVar] public bool isSeerStation = false; [SyncVar] public bool isUsingSceneExit = false; public RouteMap.RouteNode routeNode; public SyncListString stageModifiers = new SyncListString(); [SyncVar] public Vector2 nodeSync = new Vector2(-1f, -1f); [SyncVar] public int destinationSceneIndex; [SyncVar(hook = "OnTypeChanged")] public int portalType; public bool isDirty = true; public bool usePositiveNegativeColors; public bool usePortalMaterial; public bool usePortalColor; private static int kListstageModifiers; public bool NetworkisUsingModifiers { get { return isUsingModifiers; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref isUsingModifiers, 1u); } } public bool NetworkisOval { get { return isOval; } [param: In] set { ref bool reference = ref isOval; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; OnOvalChanged(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref reference, 2u); } } public bool NetworkisSeerStation { get { return isSeerStation; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref isSeerStation, 4u); } } public bool NetworkisUsingSceneExit { get { return isUsingSceneExit; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref isUsingSceneExit, 8u); } } public Vector2 NetworknodeSync { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return nodeSync; } [param: In] set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).SetSyncVar(value, ref nodeSync, 32u); } } public int NetworkdestinationSceneIndex { get { return destinationSceneIndex; } [param: In] set { ((NetworkBehaviour)this).SetSyncVar(value, ref destinationSceneIndex, 64u); } } public int NetworkportalType { get { return portalType; } [param: In] set { ref int reference = ref portalType; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; OnTypeChanged(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref reference, 128u); } } public void Awake() { genericInteraction = ((Component)this).GetComponent(); sceneExitController = ((Component)this).GetComponent(); purchaseInteraction = ((Component)this).GetComponent(); ((SyncList)(object)stageModifiers).InitializeBehaviour((NetworkBehaviour)(object)this, kListstageModifiers); } public void Start() { RiskOfRoutes.usePortalTypeColors.SettingChanged += OnConfigChanged; RiskOfRoutes.usePositiveNegativeColors.SettingChanged += OnConfigChanged; RiskOfRoutes.usePortalMaterial.SettingChanged += OnConfigChanged; if (isSeerStation) { if (Object.op_Implicit((Object)(object)purchaseInteraction)) { ((UnityEvent)(object)purchaseInteraction.onPurchase).AddListener((UnityAction)OnSeerActivation); } else { Log.Error("Error with seer purchase interaction"); } return; } ((UnityEvent)(object)genericInteraction.onActivation).AddListener((UnityAction)OnPortalActivation); if (isUsingSceneExit) { sceneExitController.useRunNextStageScene = true; } } public void OnDestroy() { RiskOfRoutes.usePortalTypeColors.SettingChanged -= OnConfigChanged; RiskOfRoutes.usePositiveNegativeColors.SettingChanged -= OnConfigChanged; RiskOfRoutes.usePortalMaterial.SettingChanged -= OnConfigChanged; if ((Object)(object)genericInteraction != (Object)null) { ((UnityEvent)(object)genericInteraction.onActivation).RemoveListener((UnityAction)OnPortalActivation); } if ((Object)(object)purchaseInteraction != (Object)null) { ((UnityEvent)(object)purchaseInteraction.onPurchase).RemoveListener((UnityAction)OnSeerActivation); } } private void OnConfigChanged(object sender, EventArgs e) { isDirty = true; } protected virtual void Update() { if (isDirty) { UpdateBubbles(); UpdatePortalMaterials(); isDirty = false; } } public override void OnStartClient() { ((NetworkBehaviour)this).OnStartClient(); Log.Info("Called method onStartClient"); SyncListString obj = stageModifiers; ((SyncList)(object)obj).Callback = (SyncListChanged)(object)Delegate.Remove((Delegate?)(object)((SyncList)(object)obj).Callback, (Delegate?)(object)new SyncListChanged(OnModifiersChanged)); SyncListString obj2 = stageModifiers; ((SyncList)(object)obj2).Callback = (SyncListChanged)(object)Delegate.Combine((Delegate?)(object)((SyncList)(object)obj2).Callback, (Delegate?)(object)new SyncListChanged(OnModifiersChanged)); if (((Behaviour)this).enabled && ((SyncList)(object)stageModifiers).Count > 0) { UpdateBubbles(); } } private void OnModifiersChanged(Operation op, int itemIndex) { UpdateBubbles(); } private void OnOvalChanged(bool value) { NetworkisOval = value; if (((Behaviour)this).enabled && ((SyncList)(object)stageModifiers).Count > 0) { UpdateBubbles(); } } private void OnTypeChanged(int value) { NetworkportalType = value; UpdatePortalMaterials(); } public void UpdateBubbles() { if (isSeerStation) { return; } Transform val = ((Component)this).transform.Find("PortalCenter"); if ((Object)(object)val == (Object)null) { Log.Error("Portal center is null"); return; } for (int num = val.childCount - 1; num >= 0; num--) { Transform child = val.GetChild(num); if (((Object)child).name.Contains("Bubble")) { Renderer[] componentsInChildren = ((Component)child).GetComponentsInChildren(true); Renderer[] array = componentsInChildren; foreach (Renderer val2 in array) { Material[] materials = val2.materials; foreach (Material val3 in materials) { if ((Object)(object)val3 != (Object)null) { Object.Destroy((Object)(object)val3); } } } Object.Destroy((Object)(object)((Component)child).gameObject); } } AttachBubblesToPortal(); } public void UpdatePortalMaterials() { //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)this).name.Contains("Route")) { return; } GameObject gameObject = ((Component)this).gameObject; Transform val = gameObject.transform.Find("PortalCenter"); if ((Object)(object)val == (Object)null) { Log.Error("Portal center is null"); } Transform val2 = ((Component)val).transform.Find("Donut"); Transform val3 = ((Component)val).transform.Find("Quad"); Renderer component = ((Component)val2).GetComponent(); Renderer component2 = ((Component)val3).GetComponent(); Texture2D val4 = null; Texture2D val5 = null; if (RiskOfRoutes.usePortalTypeColors.Value) { val4 = AssetManager.bundle.LoadAsset("bwCenter"); val5 = AssetManager.bundle.LoadAsset("bwEdge"); } else { val4 = AssetManager.bundle.LoadAsset("darkerBlueEdge"); val5 = AssetManager.bundle.LoadAsset("darkerBlueCenter"); } List routeNodesSynced = StageModifierDirector.instance.routeNodesSynced; if (routeNodesSynced == null) { Log.Error("UpdatePortalMaterials: Map is null, couldnt get portal type to update material"); return; } Renderer[] array = (Renderer[])(object)new Renderer[2] { component, component2 }; foreach (Renderer val6 in array) { if (((Object)val6.material).name.Contains("Center")) { if (RiskOfRoutes.usePortalMaterial.Value) { Material portalMaterial = SceneCatalog.GetSceneDef((SceneIndex)destinationSceneIndex).portalMaterial; if ((Object)(object)portalMaterial == (Object)null) { Log.Error("UpdatePortalMaterials: Couldnt set scene material because mat is null"); break; } val6.material = portalMaterial; continue; } val6.material.SetTexture("_RemapTex", (Texture)(object)val5); if (portalType == 0) { Log.Error("UpdatePortalMaterials: Couldnt set color for portal because route node is null"); break; } if (RiskOfRoutes.usePortalTypeColors.Value) { val6.material.SetColor("_TintColor", GetPortalTypeColor((RoutePortalType)portalType)); } else { val6.material.SetColor("_TintColor", Color.white); } } else if (((Object)val6.material).name.Contains("Edge")) { val6.material.SetTexture("_RemapTex", (Texture)(object)val4); if (portalType == 0) { Log.Error("UpdatePortalMaterials: Couldnt set color for portal because route node is null"); break; } if (RiskOfRoutes.usePortalTypeColors.Value) { val6.material.SetColor("_TintColor", GetPortalTypeColor((RoutePortalType)portalType)); } else { val6.material.SetColor("_TintColor", Color.white); } } } } private Color GetPortalTypeColor(RoutePortalType type) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) return (Color)(type switch { RoutePortalType.Combat => GetHDRColor(191, 77, 0, 1.4f), RoutePortalType.Utility => GetHDRColor(22, 0, 191, 2f), RoutePortalType.Heal => GetHDRColor(34, 191, 0, 1.5f), RoutePortalType.ChefType => GetHDRColor(121, 191, 10, 1.5f), RoutePortalType.Rare => GetHDRColor(191, 8, 0, 2f), RoutePortalType.DroneType => GetHDRColor(27, 66, 191, 2f), _ => GetHDRColor(10, 64, 191, 1f), }); } private Color GetHDRColor(int r, int g, int b, float intensity) { //IL_0031: 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_0039: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Pow(2f, intensity); return new Color((float)r / 255f * num, (float)g / 255f * num, (float)b / 255f * num, 1f); } private void AttachBubblesToPortal() { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) if (isSeerStation) { return; } float num = 1f; float num2 = 1f; if (isOval) { num = 0.7f; num2 = 1.26f; } float num3 = 60f; float num4 = 90f; float num5 = 0f; float num6 = 5f; Color val7 = default(Color); for (int i = 0; i < ((SyncList)(object)stageModifiers).Count; i++) { if ((Object)(object)AssetManager.iconBubblePrefab == (Object)null) { Log.Warning("AttachBubblesToPortal: Bubble prefab is missing"); AssetManager.iconBubblePrefab = AssetManager.CreateIconBubblePrefab(); } GameObject val = Object.Instantiate(AssetManager.iconBubblePrefab); val.SetActive(true); val.transform.SetParent(((Component)((Component)this).transform.Find("PortalCenter")).transform, false); val.transform.localScale = new Vector3(1f / num, 1f / num2, 1f / num); val.transform.localRotation = Quaternion.identity; float num7 = 20f; num5 = (180f - num3) / 2f; num4 = 90f - num5; float num8 = num7 * (float)i * (MathF.PI / 180f); float num9 = 0f - Mathf.Cos(num8) * num6 / 1f; float num10 = Mathf.Sin(num8) * num6 / 1f; val.transform.localPosition = new Vector3(num9, num10, 0f); Transform val2 = val.transform.Find("PortalActiveDisplay"); Transform val3 = val2.Find("Portal"); Transform val4 = val2.Find("Donut"); Transform val5 = val2.Find("PortalEdges"); if ((Object)(object)val3 != (Object)null) { Renderer component = ((Component)val3).GetComponent(); Material material = component.material; material.SetTexture("_Cloud1Tex", (Texture)null); material.SetTexture("_Cloud2Tex", (Texture)null); material.SetFloat("_Boost", 1f); material.SetFloat("_AlphaBoost", 1f); material.SetFloat("_DistortionStrength", 0f); material.SetTextureScale("_MainTex", new Vector2(2f, 2f)); material.SetTextureOffset("_MainTex", new Vector2(-0.5f, -0.5f)); Texture2D val6 = null; if (((SyncList)(object)stageModifiers)[i] != "") { string[] array = ((SyncList)(object)stageModifiers)[i].Split('='); string name = array[0]; ModifierDef modifierDef = StageModifierCatalog.FindModifier(name); if (modifierDef != null && (Object)(object)modifierDef.icon != (Object)null) { val6 = ((!(modifierDef.name != "Doppelganger")) ? ModUIManager.GetHostSprite().texture : modifierDef.icon.texture); } else { Log.Info("Uing placehdolde"); val6 = AssetManager.placeholderIcon.texture; } } else { val6 = AssetManager.placeholderIcon.texture; } material.SetTexture("_MainTex", (Texture)(object)val6); component.materials = (Material[])(object)new Material[2] { material, material }; } if (!Object.op_Implicit((Object)(object)val5) || !((Object)(object)val4 != (Object)null) || !RiskOfRoutes.usePositiveNegativeColors.Value) { continue; } ((Color)(ref val7))..ctor(12f / 85f, 0.7490196f, 0f, 1f); Color val8 = new Color(1f, 0f, 0f, 1f) * 1.8f; Renderer component2 = ((Component)val4).GetComponent(); Renderer component3 = ((Component)val5).GetComponent(); Material val9 = component2.materials[0]; Material val10 = component3.materials[0]; string[] array2 = ((SyncList)(object)stageModifiers)[i].Split('='); string text = array2[0]; if (text != "") { ModifierDef modifierDef2 = StageModifierCatalog.FindModifier(text); if (modifierDef2 != null) { val9.SetColor("_TintColor", modifierDef2.isNegative ? val8 : val7); val10.SetColor("_TintColor", modifierDef2.isNegative ? val8 : val7); } } } } private Texture2D SpriteToTexture(Sprite sprite) { return null; } public void OnPortalActivation(Interactor interactor) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Invalid comparison between Unknown and I4 //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) if (!Run.instance.IsExpansionEnabled(RoutesExpansion.routesExpansion)) { return; } genericInteraction.interactability = (Interactability)0; if (!NetworkServer.active) { return; } if (stageModifiers != null && ((SyncList)(object)stageModifiers).Count > 0) { StageModifierDirector.instance.reservedModifiers.Clear(); StageModifierDirector.instance.bannedModifiersRun.Clear(); foreach (string item in (SyncList)(object)stageModifiers) { string[] array = item.Split('='); StageModifierDirector.instance.reservedModifiers.Add(new ModifierSync { name = array[0], stack = int.Parse(array[1]), isArtifact = bool.Parse(array[2]) }); StageModifierDirector.instance.bannedModifiersStage.Add(array[0]); } } ((Behaviour)genericInteraction).enabled = false; if (routeNode != null) { StageModifierDirector.instance.currentNode = routeNode; StageModifierDirector.instance.NetworkcurrentNodeSync = nodeSync; if (isUsingSceneExit) { SceneDef sceneDef = SceneCatalog.GetSceneDef((SceneIndex)destinationSceneIndex); if ((Object)(object)sceneDef != (Object)null && (int)sceneDef.sceneType == 1) { Run.instance.nextStageScene = sceneDef; } foreach (SceneExitController instances in InstanceTracker.GetInstancesList()) { instances.destinationScene = sceneDef; instances.useRunNextStageScene = false; } sceneExitController.Begin(); } } else { Log.Info("OnPortalActivation: Interacting with vanilla portal"); RoutePortalManager component = StageModifierDirector.activePortalInstances[0].GetComponent(); if ((Object)(object)component != (Object)null) { StageModifierDirector.instance.currentNode = component.routeNode; StageModifierDirector.instance.NetworkcurrentNodeSync = component.nodeSync; } } if ((Object)(object)sceneExitController != (Object)null && routeNode != null) { Log.Info(SceneCatalog.GetSceneDef(sceneExitController.destinationScene.sceneDefIndex).cachedName ?? ""); if (SceneCatalog.GetSceneDef(sceneExitController.destinationScene.sceneDefIndex).cachedName == "bazaar") { routeNode.shopVisited = true; } if (SceneCatalog.GetSceneDef(sceneExitController.destinationScene.sceneDefIndex).cachedName == "goldshores") { routeNode.goldshoresVisited = true; } if (SceneCatalog.GetSceneDef(sceneExitController.destinationScene.sceneDefIndex).cachedName == "arena") { routeNode.voidFieldsVisited = true; } } } public void OnSeerActivation(Interactor interactor) { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Invalid comparison between Unknown and I4 if (!NetworkServer.active || stageModifiers == null || ((SyncList)(object)stageModifiers).Count <= 0) { return; } StageModifierDirector.instance.reservedModifiers.Clear(); foreach (string item in (SyncList)(object)stageModifiers) { string[] array = item.Split('='); StageModifierDirector.instance.reservedModifiers.Add(new ModifierSync { name = array[0], stack = int.Parse(array[1]), isArtifact = bool.Parse(array[2]) }); } SceneDef sceneDef = SceneCatalog.GetSceneDef((SceneIndex)destinationSceneIndex); if ((Object)(object)sceneDef != (Object)null && (int)sceneDef.sceneType == 1) { Run.instance.nextStageScene = sceneDef; } Log.Info("OnSeerActivation: Seer got modifiers"); } private void UNetVersion() { } protected static void InvokeSyncListstageModifiers(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"SyncList stageModifiers called on server."); } else { ((SyncList)(object)((RoutePortalManager)(object)obj).stageModifiers).HandleMsg(reader); } } static RoutePortalManager() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown kListstageModifiers = 1176189144; NetworkBehaviour.RegisterSyncListDelegate(typeof(RoutePortalManager), kListstageModifiers, new CmdDelegate(InvokeSyncListstageModifiers)); NetworkCRC.RegisterBehaviour("RoutePortalManager", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) if (forceAll) { writer.Write(isUsingModifiers); writer.Write(isOval); writer.Write(isSeerStation); writer.Write(isUsingSceneExit); SyncListString.WriteInstance(writer, stageModifiers); writer.Write(nodeSync); writer.WritePackedUInt32((uint)destinationSceneIndex); writer.WritePackedUInt32((uint)portalType); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(isUsingModifiers); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(isOval); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 4u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(isSeerStation); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 8u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(isUsingSceneExit); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x10u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } SyncListString.WriteInstance(writer, stageModifiers); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x20u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(nodeSync); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x40u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)destinationSceneIndex); } if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x80u) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.WritePackedUInt32((uint)portalType); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) if (initialState) { isUsingModifiers = reader.ReadBoolean(); isOval = reader.ReadBoolean(); isSeerStation = reader.ReadBoolean(); isUsingSceneExit = reader.ReadBoolean(); SyncListString.ReadReference(reader, stageModifiers); nodeSync = reader.ReadVector2(); destinationSceneIndex = (int)reader.ReadPackedUInt32(); portalType = (int)reader.ReadPackedUInt32(); return; } int num = (int)reader.ReadPackedUInt32(); if (((uint)num & (true ? 1u : 0u)) != 0) { isUsingModifiers = reader.ReadBoolean(); } if (((uint)num & 2u) != 0) { OnOvalChanged(reader.ReadBoolean()); } if (((uint)num & 4u) != 0) { isSeerStation = reader.ReadBoolean(); } if (((uint)num & 8u) != 0) { isUsingSceneExit = reader.ReadBoolean(); } if (((uint)num & 0x10u) != 0) { SyncListString.ReadReference(reader, stageModifiers); } if (((uint)num & 0x20u) != 0) { nodeSync = reader.ReadVector2(); } if (((uint)num & 0x40u) != 0) { destinationSceneIndex = (int)reader.ReadPackedUInt32(); } if (((uint)num & 0x80u) != 0) { OnTypeChanged((int)reader.ReadPackedUInt32()); } } } public class RoutesExpansion { [CompilerGenerated] private static class <>O { public static Action <0>__TeleporterEventSpawnRoutePortals; public static hook_OnInteractionBegin <1>__TeleporterGetRoutePortal; public static hook_TrySpawnObject <2>__OnVanillaPortalSpawn; public static hook_Start <3>__ReplaceBazaarExits; public static hook_OnStartServer <4>__ArenaMissionController_OnStartServer; public static hook_SetRunNextStageToTarget <5>__SeerStationController_SetRunNextStageToTarget; } public static ExpansionDef routesExpansion = ScriptableObject.CreateInstance(); public static void InitializeExpansion(GameObject networkedObj) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00a5: 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_00b0: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown routesExpansion.nameToken = "EXPANSION_ROUTES_NAME"; routesExpansion.descriptionToken = "EXPANSION_ROUTES_DESCRIPTION"; routesExpansion.iconSprite = AssetManager.expansionIcon; routesExpansion.disabledIconSprite = AssetManager.lockedIcon; routesExpansion.runBehaviorPrefab = networkedObj; ContentAddition.AddExpansionDef(routesExpansion); TeleporterInteraction.onTeleporterChargedGlobal += TeleporterEventSpawnRoutePortals; object obj = <>O.<1>__TeleporterGetRoutePortal; if (obj == null) { hook_OnInteractionBegin val = TeleporterGetRoutePortal; <>O.<1>__TeleporterGetRoutePortal = val; obj = (object)val; } TeleporterInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj; object obj2 = <>O.<2>__OnVanillaPortalSpawn; if (obj2 == null) { hook_TrySpawnObject val2 = OnVanillaPortalSpawn; <>O.<2>__OnVanillaPortalSpawn = val2; obj2 = (object)val2; } DirectorCore.TrySpawnObject += (hook_TrySpawnObject)obj2; object obj3 = <>O.<3>__ReplaceBazaarExits; if (obj3 == null) { hook_Start val3 = ReplaceBazaarExits; <>O.<3>__ReplaceBazaarExits = val3; obj3 = (object)val3; } BazaarController.Start += (hook_Start)obj3; object obj4 = <>O.<4>__ArenaMissionController_OnStartServer; if (obj4 == null) { hook_OnStartServer val4 = ArenaMissionController_OnStartServer; <>O.<4>__ArenaMissionController_OnStartServer = val4; obj4 = (object)val4; } ArenaMissionController.OnStartServer += (hook_OnStartServer)obj4; object obj5 = <>O.<5>__SeerStationController_SetRunNextStageToTarget; if (obj5 == null) { hook_SetRunNextStageToTarget val5 = SeerStationController_SetRunNextStageToTarget; <>O.<5>__SeerStationController_SetRunNextStageToTarget = val5; obj5 = (object)val5; } SeerStationController.SetRunNextStageToTarget += (hook_SetRunNextStageToTarget)obj5; AddRouteManagersToPortalPrefabs(); AddHologramControllerToTeleporter(); } private static void ArenaMissionController_OnStartServer(orig_OnStartServer orig, ArenaMissionController self) { orig.Invoke(self); GameObject val = null; SceneExitController[] array = Object.FindObjectsOfType(true); SceneExitController[] array2 = array; foreach (SceneExitController val2 in array2) { if (((Object)((Component)val2).gameObject).name.Contains("Arena")) { val = ((Component)val2).gameObject; Log.Info("ReplaceBazaarExits:Found arena portal with name " + ((Object)((Component)val2).gameObject).name); } if ((Object)(object)val != (Object)null) { break; } } ReplaceArenaPortal(val, isExitFromArena: true); } private static void AddRouteManagersToPortalPrefabs() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) GameObject item = Addressables.LoadAssetAsync((object)"RoR2/Base/PortalShop/PortalShop.prefab").WaitForCompletion(); GameObject item2 = Addressables.LoadAssetAsync((object)"RoR2/Base/PortalGoldshores/PortalGoldshores.prefab").WaitForCompletion(); GameObject item3 = Addressables.LoadAssetAsync((object)"RoR2/DLC2/PortalColossus.prefab").WaitForCompletion(); GameObject item4 = Addressables.LoadAssetAsync((object)"RoR2/Base/PortalArena/PortalArena.prefab").WaitForCompletion(); GameObject item5 = Addressables.LoadAssetAsync((object)"RoR2/DLC3/HardwareProgPortal.prefab").WaitForCompletion(); GameObject item6 = Addressables.LoadAssetAsync((object)"RoR2/DLC3/HardwareProgPortal_Haunt.prefab").WaitForCompletion(); GameObject item7 = Addressables.LoadAssetAsync((object)"RoR2/DLC2/PM DestinationPortal.prefab").WaitForCompletion(); GameObject item8 = Addressables.LoadAssetAsync((object)"RoR2/Base/bazaar/SeerStation.prefab").WaitForCompletion(); List list = new List { item, item3, item2, item4, item5, item6, item7, item8 }; foreach (GameObject item9 in list) { Log.Info("AddRouteManagersToPortalPrefabs: Adding route portal manager to portal " + ((Object)item9).name); RoutePortalManager component = item9.GetComponent(); if ((Object)(object)component == (Object)null) { item9.AddComponent(); } Log.Info("AddRouteManagersToPortalPrefabs: Added route portal manager to " + ((Object)item9).name + " prefab"); } } private static void AddHologramControllerToTeleporter() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) GameObject val = Addressables.LoadAssetAsync((object)"RoR2/Base/Teleporters/Teleporter1.prefab").WaitForCompletion(); if ((Object)(object)val != (Object)null) { ModifierHologramController modifierHologramController = val.AddComponent(); modifierHologramController.droneTex = AssetManager.droneSymbolTexture; modifierHologramController.rewardTex = AssetManager.rewardSymbolTexture; modifierHologramController.aurelioniteTex = AssetManager.aurelioniteSymbolTexture; } } private static void TeleporterGetRoutePortal(orig_OnInteractionBegin orig, TeleporterInteraction self, Interactor activator) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, activator); if (!Run.instance.IsExpansionEnabled(routesExpansion) || !self.isCharged) { return; } if (Stage.instance.sceneDef.baseSceneName == "conduitcanyon") { Log.Info("TeleporterGetRoutePortal: Creating node to Solus Wing stage"); RouteMap.RouteNode routeNode = StageModifierDirector.instance.routeMap.CreateHardwareNode(StageModifierDirector.instance.currentNode); StageModifierDirector.instance.currentNode = routeNode; StageModifierDirector.instance.NetworkcurrentNodeSync = new Vector2((float)routeNode.x, (float)routeNode.y); return; } Log.Info("TeleporterGetRoutePortal: Trying to get node and modifiers from random portal"); StageModifierDirector.instance.GetRouteNodeFromRandomPortal(); if (RiskOfRoutes.teleporterUseRandomMods.Value) { StageModifierDirector.instance.GetModifiersFromRandomPortal(); } } private static void SeerStationController_SetRunNextStageToTarget(orig_SetRunNextStageToTarget orig, SeerStationController self) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected I4, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Invalid comparison between Unknown and I4 //IL_01fc: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!Run.instance.IsExpansionEnabled(routesExpansion) || !NetworkServer.active) { return; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "bazaar") { return; } SceneIndex val = (SceneIndex)self.targetSceneDefIndex; GameObject val2 = null; SceneExitController val3 = null; SceneExitController[] array = Object.FindObjectsOfType(true); SceneExitController[] array2 = array; foreach (SceneExitController val4 in array2) { if (((Object)((Component)val4).gameObject).name.Contains("Shop")) { val2 = ((Component)val4).gameObject; val3 = val4; val3.useRunNextStageScene = true; Log.Info("SeerStationController_SetRunNextStageToTarget: Found shop portal with name " + ((Object)((Component)val4).gameObject).name); break; } } if (!Object.op_Implicit((Object)(object)val2)) { Log.Error("SeerStationController_SetRunNextStageToTarget: Could not find shopportal on bazaar scene"); return; } if (!Object.op_Implicit((Object)(object)val2.GetComponent())) { Log.Error("SeerStationController_SetRunNextStageToTarget: Shop portal doesn't have manager"); return; } RoutePortalManager component = ((Component)self).gameObject.GetComponent(); RoutePortalManager component2 = val2.GetComponent(); int destinationSceneIndex = component2.destinationSceneIndex; component2.NetworkdestinationSceneIndex = (int)val; if (Object.op_Implicit((Object)(object)component)) { ((SyncList)(object)component2.stageModifiers).Clear(); foreach (string item in (SyncList)(object)component.stageModifiers) { ((SyncList)(object)component2.stageModifiers).Add(item); } } else { Log.Warning("SeerStationController_SetRunNextStageToTarget: Seer doensn't have route portal manager, getting random mods for shop portal"); StageModifierDirector.instance.GetNextStageModifiers(val2); } SceneDef sceneDef = SceneCatalog.GetSceneDef(val); if (SceneHelper.IsSceneColossus(sceneDef.sceneDefIndex)) { component2.routeNode = component.routeNode; component2.NetworknodeSync = new Vector2((float)component2.routeNode.x, (float)component2.routeNode.y); } else if ((int)sceneDef.sceneType == 2) { Log.Info("SeerStationController_SetRunNextStageToTarget:Seer scene is intermission, disabling portal mods"); component2.NetworkisUsingModifiers = false; } Log.Info(string.Format("{0}: Updated exit destination:{1}->{2}", "SeerStationController_SetRunNextStageToTarget", destinationSceneIndex, component2.destinationSceneIndex)); } private static void ReplaceBazaarExits(orig_Start orig, BazaarController self) { //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!Run.instance.IsExpansionEnabled(routesExpansion) || !NetworkServer.active) { return; } GameObject val = null; GameObject val2 = null; SceneExitController[] array = Object.FindObjectsOfType(true); SceneExitController[] array2 = array; foreach (SceneExitController val3 in array2) { if (((Object)((Component)val3).gameObject).name.Contains("Shop")) { val = ((Component)val3).gameObject; Log.Info("ReplaceBazaarExits:Found shop portal with name " + ((Object)((Component)val3).gameObject).name); } if (((Object)((Component)val3).gameObject).name.Contains("Arena")) { val2 = ((Component)val3).gameObject; Log.Info("ReplaceBazaarExits:Found arena portal with name " + ((Object)((Component)val3).gameObject).name); } if ((Object)(object)val2 != (Object)null && (Object)(object)val != (Object)null) { break; } } ReplaceShopPortal(val, out var portalSceneExit); ReplaceArenaPortal(val2); if ((Object)(object)portalSceneExit == (Object)null || self.seerStations == null) { if ((Object)(object)portalSceneExit == (Object)null) { Log.Error("ReplaceBazaarExits: Portal's sceneExitController is missing, couldn't set seer's destination"); } if (self.seerStations == null) { Log.Error("ReplaceBazaarExits: SeerStations are missing for some reason"); } return; } List list = new List(); SeerStationController[] seerStations = self.seerStations; foreach (SeerStationController val4 in seerStations) { if (!((Object)(object)val4 == (Object)null)) { GameObject gameObject = ((Component)val4).gameObject; Vector3 position = gameObject.transform.position; Quaternion rotation = gameObject.transform.rotation; int targetSceneDefIndex = val4.targetSceneDefIndex; NetworkServer.Destroy(gameObject); GameObject val5 = Addressables.LoadAssetAsync((object)"RoR2/Base/bazaar/SeerStation.prefab").WaitForCompletion(); GameObject val6 = Object.Instantiate(val5, position, rotation); SeerStationController component = val6.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("ReplaceBazaarExits: Seer station controller is missing"); return; } component.targetSceneDefIndex = targetSceneDefIndex; component.explicitTargetSceneExitController = portalSceneExit; RoutePortalManager component2 = val6.GetComponent(); if ((Object)(object)component2 == (Object)null) { Log.Error("ReplaceBazaarExits: Seer station prefab missing RoutePortalManager"); return; } component2.NetworkisSeerStation = true; component2.NetworkdestinationSceneIndex = targetSceneDefIndex; if (SceneHelper.IsSceneColossus((SceneIndex)targetSceneDefIndex)) { component2.routeNode = StageModifierDirector.instance.routeMap.CreateColossusNode(StageModifierDirector.instance.currentNode, currentLayer: true); } else { component2.routeNode = StageModifierDirector.instance.currentNode; } component2.NetworknodeSync = new Vector2((float)component2.routeNode.x, (float)component2.routeNode.y); if (!SceneHelper.IsSceneIntermission((SceneIndex)targetSceneDefIndex)) { component2.NetworkisUsingModifiers = true; StageModifierDirector.instance.GetNextStageModifiers(val6); } else { component2.NetworkisUsingModifiers = false; } ((Behaviour)component2).enabled = true; NetworkServer.Spawn(val6); list.Add(component); Log.Info("ReplaceBazaarExits: SeerStation was replaced"); } } self.seerStations = list.ToArray(); } private static void ReplaceShopPortal(GameObject shopPortalObject, out SceneExitController portalSceneExit) { //IL_0028: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected I4, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)shopPortalObject == (Object)null) { Log.Error("ReplaceShopPortal:Shop portal was not found"); portalSceneExit = null; return; } Vector3 position = shopPortalObject.transform.position; Quaternion rotation = shopPortalObject.transform.rotation; NetworkServer.Destroy(shopPortalObject); GameObject val = Addressables.LoadAssetAsync((object)"RoR2/Base/PortalShop/PortalShop.prefab").WaitForCompletion(); GameObject val2 = Object.Instantiate(val, position, rotation); RoutePortalManager component = val2.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("ReplaceShopPortal: Shop portal doesn't have manager"); portalSceneExit = null; return; } component.NetworkdestinationSceneIndex = (int)Run.instance.nextStageScene.sceneDefIndex; component.NetworkisOval = true; component.NetworkisUsingModifiers = true; component.NetworkisUsingSceneExit = true; component.routeNode = StageModifierDirector.instance.currentNode; component.NetworknodeSync = new Vector2((float)component.routeNode.x, (float)component.routeNode.y); ((Behaviour)component).enabled = true; StageModifierDirector.instance.GetNextStageModifiers(val2); Log.Info("ReplaceShopPortal: Shop portal was replaced"); NetworkServer.Spawn(val2); Log.Info("ReplaceShopPortal: Shop portal spawned on network"); portalSceneExit = val2.GetComponent(); } private static void ReplaceArenaPortal(GameObject arenaPortalObject, bool isExitFromArena = false) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected I4, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected I4, but got Unknown if ((Object)(object)arenaPortalObject == (Object)null) { Log.Error("ReplaceArenaPortal:Arena portal was not found"); return; } Vector3 position = arenaPortalObject.transform.position; Quaternion rotation = arenaPortalObject.transform.rotation; NetworkServer.Destroy(arenaPortalObject); GameObject val = Addressables.LoadAssetAsync((object)"RoR2/Base/PortalArena/PortalArena.prefab").WaitForCompletion(); GameObject val2 = Object.Instantiate(val, position, rotation); RoutePortalManager component = val2.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("ReplaceArenaPortal: Arena portal doesn't have manager"); return; } SceneExitController component2 = val2.GetComponent(); SceneDef destinationScene = component2.destinationScene; if (!isExitFromArena) { component.NetworkdestinationSceneIndex = (int)SceneCatalog.FindSceneIndex("arena"); } component.NetworkdestinationSceneIndex = (int)destinationScene.sceneDefIndex; component.NetworkisOval = true; component.NetworkisUsingSceneExit = !isExitFromArena; component.routeNode = StageModifierDirector.instance.currentNode; component.NetworknodeSync = new Vector2((float)component.routeNode.x, (float)component.routeNode.y); component.NetworkisUsingModifiers = isExitFromArena; if (component.isUsingModifiers) { StageModifierDirector.instance.GetNextStageModifiers(val2); } ((Behaviour)component).enabled = true; Log.Info("ReplaceArenaPortal: Arena portal was replaced"); NetworkServer.Spawn(val2); Log.Info("ReplaceArenaPortal: Arena portal spawned on network"); } private static GameObject OnVanillaPortalSpawn(orig_TrySpawnObject orig, DirectorCore self, DirectorSpawnRequest directorSpawnRequest) { //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Invalid comparison between Unknown and I4 //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected I4, but got Unknown //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Expected I4, but got Unknown //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Expected I4, but got Unknown //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) GameObject val = orig.Invoke(self, directorSpawnRequest); if (!NetworkServer.active) { return val; } if (!Run.instance.IsExpansionEnabled(routesExpansion)) { return val; } if ((Object)(object)val == (Object)null) { return val; } if ((Object)(object)directorSpawnRequest.spawnCard == (Object)null || ((Object)directorSpawnRequest.spawnCard).name == null) { return val; } string name = ((Object)directorSpawnRequest.spawnCard).name; if (!name.Contains("Portal")) { return val; } SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); Log.Info("OnVanillaPortalSpawn: Director spawned " + name + " portal"); RoutePortalManager component = val.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("OnVanillaPortalSpawn: RoutePortalManager is missing for portal " + name); return val; } switch (name) { case "iscRoutePortal": return val; case "iscColossusPortal": { component.NetworkdestinationSceneIndex = SceneHelper.GetGreenPortalSceneIndex(); component.NetworkisOval = true; component.NetworkisUsingModifiers = Stage.instance.sceneDef.stageOrder != 3; RouteMap.RouteNode routeNode2 = null; if ((Object)(object)sceneDefForCurrentScene != (Object)null && (int)sceneDefForCurrentScene.sceneType == 2) { Log.Info("OnVanillaPortalSpawn:Spawned colossus portal from intermission scene"); routeNode2 = StageModifierDirector.instance.routeMap.CreateColossusNode(StageModifierDirector.instance.currentNode, currentLayer: true); } else { Log.Info("OnVanillaPortalSpawn:Spawned colossus portal from default scene"); routeNode2 = StageModifierDirector.instance.routeMap.CreateColossusNode(StageModifierDirector.instance.currentNode); } if (routeNode2 != null) { component.routeNode = routeNode2; component.NetworknodeSync = new Vector2((float)routeNode2.x, (float)routeNode2.y); } Log.Info("OnVanillaPortalSpawn: Succesfuly set node to colossus"); break; } case "iscGoldshoresPortal": { component.NetworkisOval = true; Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != "goldshores") { Log.Info("OnVanillaPortalSpawn: Spawned portal leading to goldshores"); component.NetworkisUsingModifiers = false; component.routeNode = StageModifierDirector.instance.GetAvailableNodes()[0]; component.NetworknodeSync = new Vector2((float)component.routeNode.x, (float)component.routeNode.y); } else { Log.Info("OnVanillaPortalSpawn: Spawned portal leading from goldshores"); component.NetworkdestinationSceneIndex = (int)Run.instance.nextStageScene.sceneDefIndex; component.NetworkisUsingModifiers = true; component.NetworkisUsingSceneExit = false; component.routeNode = StageModifierDirector.instance.currentNode; component.NetworknodeSync = new Vector2((float)component.routeNode.x, (float)component.routeNode.y); } break; } case "iscShopPortal": { component.NetworkisOval = true; SceneExitController component2 = val.GetComponent(); if (Object.op_Implicit((Object)(object)component2) && !component2.useRunNextStageScene) { Log.Info("OnVanillaPortalSpawn: Spawned portal leading to shop"); List availableNodes = StageModifierDirector.instance.GetAvailableNodes(); if (availableNodes == null || availableNodes.Count == 0) { Log.Info("node zero"); component.routeNode = StageModifierDirector.instance.routeMap.root; component.NetworknodeSync = new Vector2(0f, 0f); } else { component.routeNode = StageModifierDirector.instance.GetAvailableNodes()[0]; component.NetworknodeSync = new Vector2((float)component.routeNode.x, (float)component.routeNode.y); } component.NetworkisUsingSceneExit = false; } break; } default: if (!(name == "iscHardwareProgPortal_Haunt")) { if (name == "iscDestinationPortal") { component.NetworkisOval = true; component.NetworkisUsingModifiers = true; component.routeNode = StageModifierDirector.instance.GetAvailableNodes()[0]; component.NetworkdestinationSceneIndex = (int)Run.instance.nextStageScene.sceneDefIndex; } break; } goto case "iscHardwareProgPortal"; case "iscHardwareProgPortal": { component.NetworkisOval = false; if (Stage.instance.sceneDef.stageOrder != 3) { if (name == "iscHardwareProgPortal_Haunt") { Log.Info("OnVanillaPortalSpawn: Spawned portal leading to Solus Wing"); } else { Log.Error("OnVanillaPortalSpawn: For some reason it's incorrect spawn card"); } component.NetworkisUsingModifiers = false; } else { component.NetworkdestinationSceneIndex = (int)SceneCatalog.FindSceneIndex("conduitcanyon"); component.NetworkisUsingModifiers = true; } RouteMap.RouteNode routeNode = (component.routeNode = StageModifierDirector.instance.routeMap.CreateHardwareNode(StageModifierDirector.instance.currentNode)); component.NetworknodeSync = new Vector2((float)routeNode.x, (float)routeNode.y); break; } } if (component.isUsingModifiers) { StageModifierDirector.instance.GetNextStageModifiers(val); } ((Behaviour)component).enabled = true; component.NetworknodeSync = new Vector2((float)component.routeNode.x, (float)component.routeNode.y); return val; } public static void SpawnRoutePortals(Vector3 position) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) if (!Run.instance.IsExpansionEnabled(routesExpansion)) { Log.Error("SpawnRoutePortals: Method spawning route portals was called, but expansion is disabled"); return; } List nextStagesScenesList = SceneHelper.GetNextStagesScenesList(); if (nextStagesScenesList.Count == 0) { Log.Error("SpawnRoutePortals: No stages available next"); return; } Util.ShuffleList(nextStagesScenesList, Run.instance.stageRng); List availableNodes = StageModifierDirector.instance.GetAvailableNodes(); for (int i = 0; i < availableNodes.Count; i++) { Log.Info(string.Format("{0}: Nodes count - {1}:{2}", "SpawnRoutePortals", availableNodes.Count, i)); RouteMap.RouteNode routeNode = availableNodes[i]; SceneDef val = new SceneDef(); if (RiskOfRoutes.useUniqueDestinations.Value) { int index = nextStagesScenesList.Count - 1; val = nextStagesScenesList[index]; nextStagesScenesList.RemoveAt(index); } else { val = Run.instance.runRNG.NextElementUniform(nextStagesScenesList); } SpawnCard val2 = (SpawnCard)(object)AssetManager.CreateRoutePortalSpawnCard(val); if ((Object)(object)val2 == (Object)null) { Log.Error("SpawnRoutePortals: RoutePortal spawncard is null"); break; } DirectorSpawnRequest val3 = new DirectorSpawnRequest(val2, new DirectorPlacementRule { minDistance = 10f, maxDistance = 40f, placementMode = (PlacementMode)1, position = position }, Run.instance.stageRng); GameObject val4 = DirectorCore.instance.TrySpawnObject(val3); if ((Object)(object)val4 == (Object)null) { break; } RoutePortalManager component = val4.GetComponent(); ((Behaviour)component).enabled = true; if (routeNode == null) { Log.Warning("SpawnRoutePortals: Child route node is null, skipping"); continue; } component.routeNode = routeNode; component.NetworkportalType = (int)routeNode.portalType; component.NetworknodeSync = new Vector2((float)routeNode.x, (float)routeNode.y); Log.Info($"MG route node:{component.routeNode.portalType}:{component.routeNode.x},{component.routeNode.y}"); component.NetworkisUsingModifiers = true; component.NetworkisUsingSceneExit = true; StageModifierDirector.instance.GetNextStageModifiers(val4); Vector3 val5 = position - val4.transform.position; val5.y = 0f; if (val5 != Vector3.zero) { val4.transform.rotation = Quaternion.LookRotation(val5); } Vector3 right = val4.transform.right; StageModifierDirector.instance.AddRoutePortalInstance(val4); } } private static void TeleporterEventSpawnRoutePortals(TeleporterInteraction interaction) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Run.instance.IsExpansionEnabled(routesExpansion)) { SpawnRoutePortals(((Component)interaction).transform.position); } } } public static class SceneHelper { public static bool IsSceneColossus(SceneIndex index, bool includeFalseSonScene = true) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) if (includeFalseSonScene) { return index == SceneCatalog.FindSceneIndex("lemuriantemple") || index == SceneCatalog.FindSceneIndex("habitat") || index == SceneCatalog.FindSceneIndex("meridian"); } return index == SceneCatalog.FindSceneIndex("lemuriantemple") || index == SceneCatalog.FindSceneIndex("habitat"); } public static bool IsSceneIntermission(SceneIndex index) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 SceneDef sceneDef = SceneCatalog.GetSceneDef(index); if ((Object)(object)sceneDef == (Object)null) { return false; } return (int)sceneDef.sceneType == 2; } public static int GetGreenPortalSceneIndex() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected I4, but got Unknown SceneIndex val = (SceneIndex)(-1); int stageOrder = Stage.instance.sceneDef.stageOrder; int num = Run.instance.nextStageScene.stageOrder; if (num != stageOrder + 1 && stageOrder <= 5) { num = stageOrder + 1; } Log.Info(stageOrder + " " + num); switch (num) { case 1: val = SceneCatalog.FindSceneIndex("lemuriantemple"); break; case 2: val = SceneCatalog.FindSceneIndex("lemurianTemple"); break; case 3: val = SceneCatalog.FindSceneIndex("habitat"); break; case 4: val = SceneCatalog.FindSceneIndex("meridian"); break; case 5: val = SceneCatalog.FindSceneIndex("lemuriantemple"); break; } Log.Info(string.Format("{0}: Selected scene for colossus portat - {1}", "GetGreenPortalSceneIndex", val)); return (int)val; } public static bool IsValidNextStage(SceneDef sceneDef) { SceneDef nextStageScene = Run.instance.nextStageScene; if ((Object)(object)nextStageScene != (Object)null && nextStageScene.baseSceneName == sceneDef.baseSceneName) { return false; } if (!sceneDef.hasAnyDestinations) { return false; } return sceneDef.validForRandomSelection; } public static List GetNextStagesScenesList() { //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 SceneDef nextStageScene = Run.instance.nextStageScene; List list = new List(); if ((Object)(object)nextStageScene == (Object)null) { return list; } int stageOrder = nextStageScene.stageOrder; SceneCollection destinationsGroup = SceneCatalog.mostRecentSceneDef.destinationsGroup; Enumerator enumerator = destinationsGroup.sceneEntries.GetEnumerator(); try { while (enumerator.MoveNext()) { SceneEntry current = enumerator.Current; SceneDef sceneDef = current.sceneDef; if ((int)sceneDef.sceneType == 1 && Object.op_Implicit((Object)(object)sceneDef.mainTrack) && sceneDef.stageOrder == stageOrder && ((Object)(object)sceneDef.requiredExpansion == (Object)null || Run.instance.IsExpansionEnabled(sceneDef.requiredExpansion)) && Run.instance.CanPickStage(sceneDef)) { list.Add(sceneDef); } } } finally { ((IDisposable)enumerator).Dispose(); } return list; } } [BepInPlugin("burboni4.RiskOfRoutes", "RiskOfRoutes", "1.0.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class RiskOfRoutes : BaseUnityPlugin { public enum MapOrientation { Vertical, Horizontal } public enum ItemPoolOptions { Default, VanillaEntire, Entire, None } public const string PluginGUID = "burboni4.RiskOfRoutes"; public const string PluginAuthor = "burboni4"; public const string PluginName = "RiskOfRoutes"; public const string PluginVersion = "1.0.4"; public static ConfigEntry routeMapWidth; public static ConfigEntry showIntermissionNodes; public static ConfigEntry tier1Artifacts; public static ConfigEntry tier2Artifacts; public static ConfigEntry tier3Artifacts; public static ConfigEntry allowMysteryArtifact; public static ConfigEntry allowChaosArtifact; public static ConfigEntry allowCommandArtifact; public static ConfigEntry allowDeathArtifact; public static ConfigEntry allowDelusionArtifact; public static ConfigEntry allowDevotionArtifact; public static ConfigEntry allowDissonanceArtifact; public static ConfigEntry allowEnigmaArtifact; public static ConfigEntry allowEvolutionArtifact; public static ConfigEntry allowFrailtyArtifact; public static ConfigEntry allowGlassArtifact; public static ConfigEntry allowHonorArtifact; public static ConfigEntry allowKinArtifact; public static ConfigEntry allowMetamorphosisArtifact; public static ConfigEntry allowRebirthArtifact; public static ConfigEntry allowSacrificeArtifact; public static ConfigEntry allowSoulArtifact; public static ConfigEntry allowSpiteArtifact; public static ConfigEntry allowSwarmsArtifact; public static ConfigEntry allowVengeanceArtifact; public static ConfigEntry allowAurelioniteModifier; public static ConfigEntry allowBossRedItemModifier; public static ConfigEntry allowBossYellowItemModifier; public static ConfigEntry allowDroneBossGreenModifier; public static ConfigEntry allowDroneBossRedModifier; public static ConfigEntry allowMoreElitesModifier; public static ConfigEntry allowMoreDronesModifier; public static ConfigEntry allowUpgradeDronesModifier; public static ConfigEntry allowLunarEnemiesModifier; public static ConfigEntry allowVoidEnemiesModifier; public static ConfigEntry allowYellowPrinterModifier; public static ConfigEntry allowRedPrinterModifier; public static ConfigEntry allowOnlyFlyingModifier; public static ConfigEntry allowPowerfulElitesModifier; public static ConfigEntry allowRepairModifier; public static ConfigEntry allowWanderingChefModifier; public static ConfigEntry allowMountainModifier; public static ConfigEntry allowSoulCostModifier; public static ConfigEntry allowDoppelgangerModifier; public static ConfigEntry droneStackPercent; public static ConfigEntry doppelStackTime; public static ConfigEntry elitesStackPercent; public static ConfigEntry lunarStackPercent; public static ConfigEntry voidStackPercent; public static ConfigEntry soulCostStackPercent; public static ConfigEntry tier2ElitesStackPercent; public static ConfigEntry printerItemPool; public static ConfigEntry tier1PrinterItems; public static ConfigEntry tier2PrinterItems; public static ConfigEntry tier3PrinterItems; public static ConfigEntry enemyItemPool; public static ConfigEntry canAppearWithAIBlacklisted; public static ConfigEntry tier1EnemyItems; public static ConfigEntry tier2EnemyItems; public static ConfigEntry tier3EnemyItems; public static ConfigEntry enemyItemsModifierCanStack; public static ConfigEntry enemyItemsAllowBoss; public static ConfigEntry enemyItemsAllowVoid; public static ConfigEntry commonDefaultStack; public static ConfigEntry uncommonDefaultStack; public static ConfigEntry legendaryDefaultStack; public static ConfigEntry bossDefaultStack; public static ConfigEntry commonExtraRange; public static ConfigEntry uncommonExtraRange; public static ConfigEntry legendaryExtraRange; public static ConfigEntry bossExtraRange; public static ConfigEntry chanceForExtra; public static ConfigEntry lunarItemPool; public static ConfigEntry tier1LunarItems; public static ConfigEntry tier2LunarItems; public static ConfigEntry tier3LunarItems; public static ConfigEntry lunarTurnToPearl; public static GameObject networkedInventoryPrefab; internal static GameObject CentralNetworkObject; private static GameObject _centralNetworkObjectSpawned; public static ConfigEntry usePortalMaterial { get; set; } public static ConfigEntry usePositiveNegativeColors { get; set; } public static ConfigEntry usePortalTypeColors { get; set; } public static ConfigEntry useUniqueDestinations { get; set; } public static ConfigEntry showPortalDestination { get; set; } public static ConfigEntry teleporterUseRandomMods { get; set; } public static ConfigEntry modifiersCanBeBanned { get; set; } public static ConfigEntry negativeStackPunishment { get; set; } public static ConfigEntry punishmentTimeMinutes { get; set; } public static ConfigEntry routeMapSize { get; set; } public static ConfigEntry routeMapIconSize { get; set; } public static ConfigEntry routePanelShowsOnlyNames { get; set; } public static ConfigEntry punishmentBarOrientation { get; set; } public static ConfigEntry punishmentBarColor { get; set; } public void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); BindConfig(); GameObject val = new GameObject("tmpGo"); val.AddComponent(); CentralNetworkObject = PrefabAPI.InstantiateClone(val, "somethingUnique", false); CentralNetworkObject.AddComponent(); CentralNetworkObject.AddComponent(); PrefabAPI.RegisterNetworkPrefab(CentralNetworkObject); networkedInventoryPrefab = PrefabAPI.InstantiateClone(val, "monsterInventory", false); networkedInventoryPrefab.AddComponent(); networkedInventoryPrefab.AddComponent(); networkedInventoryPrefab.AddComponent(); PrefabAPI.RegisterNetworkPrefab(networkedInventoryPrefab); Object.Destroy((Object)(object)val); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "riskofroutes"); AssetBundle bundle = AssetBundle.LoadFromFile(text); AssetManager.Initialize(bundle); ModUIManager.Initialize(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { StageModifierCatalog.Init(bundle); }); MysteryArtifact.InitializeArtifact(); RoutesExpansion.InitializeExpansion(CentralNetworkObject); SoulCostController.Initialize(); Sprite modIcon = AssetManager.modIcon; ModSettingsManager.SetModIcon(modIcon); ModSettingsManager.SetModDescription("Risk Of Routes. Mod that adds routing system and run map to the game."); } private void BindConfig() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Expected O, but got Unknown //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Expected O, but got Unknown //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Expected O, but got Unknown //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Expected O, but got Unknown //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Expected O, but got Unknown //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Expected O, but got Unknown //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Expected O, but got Unknown //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Expected O, but got Unknown //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Expected O, but got Unknown //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Expected O, but got Unknown //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Expected O, but got Unknown //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Expected O, but got Unknown //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Expected O, but got Unknown //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Expected O, but got Unknown //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Expected O, but got Unknown //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Expected O, but got Unknown //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Expected O, but got Unknown //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Expected O, but got Unknown //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Expected O, but got Unknown //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Expected O, but got Unknown //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Expected O, but got Unknown //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Expected O, but got Unknown //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Expected O, but got Unknown //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Expected O, but got Unknown //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_0748: Expected O, but got Unknown //IL_076e: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Expected O, but got Unknown //IL_079e: Unknown result type (might be due to invalid IL or missing references) //IL_07a8: Expected O, but got Unknown //IL_07ce: Unknown result type (might be due to invalid IL or missing references) //IL_07d8: Expected O, but got Unknown //IL_07fe: Unknown result type (might be due to invalid IL or missing references) //IL_0808: Expected O, but got Unknown //IL_082e: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Expected O, but got Unknown //IL_085e: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Expected O, but got Unknown //IL_088e: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Expected O, but got Unknown //IL_08c2: Unknown result type (might be due to invalid IL or missing references) //IL_08cc: Expected O, but got Unknown //IL_08f6: Unknown result type (might be due to invalid IL or missing references) //IL_0900: Expected O, but got Unknown //IL_092a: Unknown result type (might be due to invalid IL or missing references) //IL_0934: Expected O, but got Unknown //IL_095a: Unknown result type (might be due to invalid IL or missing references) //IL_0964: Expected O, but got Unknown //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_0998: Expected O, but got Unknown //IL_09c2: Unknown result type (might be due to invalid IL or missing references) //IL_09cc: Expected O, but got Unknown //IL_09f6: Unknown result type (might be due to invalid IL or missing references) //IL_0a00: Expected O, but got Unknown //IL_0a26: Unknown result type (might be due to invalid IL or missing references) //IL_0a30: Expected O, but got Unknown //IL_0a56: Unknown result type (might be due to invalid IL or missing references) //IL_0a60: Expected O, but got Unknown //IL_0a86: Unknown result type (might be due to invalid IL or missing references) //IL_0a90: Expected O, but got Unknown //IL_0ab6: Unknown result type (might be due to invalid IL or missing references) //IL_0ac0: Expected O, but got Unknown //IL_0ae6: Unknown result type (might be due to invalid IL or missing references) //IL_0af0: Expected O, but got Unknown //IL_0b16: Unknown result type (might be due to invalid IL or missing references) //IL_0b20: Expected O, but got Unknown //IL_0b46: Unknown result type (might be due to invalid IL or missing references) //IL_0b50: Expected O, but got Unknown //IL_0b76: Unknown result type (might be due to invalid IL or missing references) //IL_0b80: Expected O, but got Unknown //IL_0ba6: Unknown result type (might be due to invalid IL or missing references) //IL_0bb0: Expected O, but got Unknown //IL_0bd6: Unknown result type (might be due to invalid IL or missing references) //IL_0be0: Expected O, but got Unknown //IL_0c06: Unknown result type (might be due to invalid IL or missing references) //IL_0c10: Expected O, but got Unknown //IL_0c36: Unknown result type (might be due to invalid IL or missing references) //IL_0c40: Expected O, but got Unknown //IL_0c66: Unknown result type (might be due to invalid IL or missing references) //IL_0c70: Expected O, but got Unknown //IL_0c96: Unknown result type (might be due to invalid IL or missing references) //IL_0ca0: Expected O, but got Unknown //IL_0cc6: Unknown result type (might be due to invalid IL or missing references) //IL_0cd0: Expected O, but got Unknown //IL_0cf6: Unknown result type (might be due to invalid IL or missing references) //IL_0d00: Expected O, but got Unknown //IL_0d26: Unknown result type (might be due to invalid IL or missing references) //IL_0d30: Expected O, but got Unknown //IL_0d56: Unknown result type (might be due to invalid IL or missing references) //IL_0d60: Expected O, but got Unknown //IL_0d86: Unknown result type (might be due to invalid IL or missing references) //IL_0d90: Expected O, but got Unknown //IL_0db6: Unknown result type (might be due to invalid IL or missing references) //IL_0dc0: Expected O, but got Unknown //IL_0de6: Unknown result type (might be due to invalid IL or missing references) //IL_0df0: Expected O, but got Unknown //IL_0e16: Unknown result type (might be due to invalid IL or missing references) //IL_0e20: Expected O, but got Unknown //IL_0e46: Unknown result type (might be due to invalid IL or missing references) //IL_0e50: Expected O, but got Unknown //IL_0e76: Unknown result type (might be due to invalid IL or missing references) //IL_0e80: Expected O, but got Unknown //IL_0ea6: Unknown result type (might be due to invalid IL or missing references) //IL_0eb0: Expected O, but got Unknown //IL_0ed6: Unknown result type (might be due to invalid IL or missing references) //IL_0ee0: Expected O, but got Unknown //IL_0f06: Unknown result type (might be due to invalid IL or missing references) //IL_0f10: Expected O, but got Unknown //IL_0f36: Unknown result type (might be due to invalid IL or missing references) //IL_0f40: Expected O, but got Unknown //IL_0f66: Unknown result type (might be due to invalid IL or missing references) //IL_0f70: Expected O, but got Unknown //IL_0f96: Unknown result type (might be due to invalid IL or missing references) //IL_0fa0: Expected O, but got Unknown //IL_0fc6: Unknown result type (might be due to invalid IL or missing references) //IL_0fd0: Expected O, but got Unknown //IL_0ff6: Unknown result type (might be due to invalid IL or missing references) //IL_1000: Expected O, but got Unknown //IL_1026: Unknown result type (might be due to invalid IL or missing references) //IL_1030: Expected O, but got Unknown //IL_1056: Unknown result type (might be due to invalid IL or missing references) //IL_1060: Expected O, but got Unknown //IL_1086: Unknown result type (might be due to invalid IL or missing references) //IL_1090: Expected O, but got Unknown //IL_10b6: Unknown result type (might be due to invalid IL or missing references) //IL_10c0: Expected O, but got Unknown //IL_10e6: Unknown result type (might be due to invalid IL or missing references) //IL_10f0: Expected O, but got Unknown //IL_1116: Unknown result type (might be due to invalid IL or missing references) //IL_1120: Expected O, but got Unknown //IL_1146: Unknown result type (might be due to invalid IL or missing references) //IL_1150: Expected O, but got Unknown useUniqueDestinations = ((BaseUnityPlugin)this).Config.Bind("General", "Unique Destinations", true, "Makes each route portal have unique scene as destination, otherwise they might repeat."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(useUniqueDestinations)); teleporterUseRandomMods = ((BaseUnityPlugin)this).Config.Bind("General", "Teleporter Use Random mods", true, "Makes the teleporter use random modifiers of spawned route portals after interacting with it, set false if you want it to not have any stage modifiers."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(teleporterUseRandomMods)); modifiersCanBeBanned = ((BaseUnityPlugin)this).Config.Bind("General", "Modifiers Can Be Banned", true, "Prevents some of the stage modifiers appearing on the next stage, if they were active on the current stage."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(modifiersCanBeBanned)); routeMapWidth = ((BaseUnityPlugin)this).Config.Bind("General", "Route Map Width", 4, "Width of the map created at the start of each loop."); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(routeMapWidth, new IntSliderConfig { min = 3, max = 5 })); negativeStackPunishment = ((BaseUnityPlugin)this).Config.Bind("General", "Time Spent Punishment", true, "Adds one negative stack per punishment. Punishment is given by spending too much time on current stage, by default it's 8 minutes."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(negativeStackPunishment)); punishmentTimeMinutes = ((BaseUnityPlugin)this).Config.Bind("General", "Punishment Time", 8, "Adds one negative stack per punishment, punishment is given by spending too much time on current stage, by default it's 8 minutes."); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(punishmentTimeMinutes, new IntSliderConfig { min = 1, max = 20 })); usePositiveNegativeColors = ((BaseUnityPlugin)this).Config.Bind("Visual", "Use Positive/Negative colors", true, "Makes bubbles on portals red and green, otherwise they are just blue."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(usePositiveNegativeColors)); usePortalTypeColors = ((BaseUnityPlugin)this).Config.Bind("Visual", "Portal Color Type", true, "Portal color is changed according to its node type, otherwise they are just blue."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(usePortalTypeColors)); routeMapSize = ((BaseUnityPlugin)this).Config.Bind("Visual", "Route Map Panel Size", 90, "Size of Route Map panel in percents."); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(routeMapSize)); routeMapIconSize = ((BaseUnityPlugin)this).Config.Bind("Visual", "Route Map Icons Size", 100, "Size of icons on Route Map panel."); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(routeMapIconSize)); showIntermissionNodes = ((BaseUnityPlugin)this).Config.Bind("Visual", "Show Intermission Nodes", true, "Shows nodes for intermission stages."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(showIntermissionNodes)); routePanelShowsOnlyNames = ((BaseUnityPlugin)this).Config.Bind("Visual", "Route Panel Shows Only Names", false, "Makes route portal panel show only names of modifiers. Use if descriptions seem too cluttered."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(routePanelShowsOnlyNames)); punishmentBarOrientation = ((BaseUnityPlugin)this).Config.Bind("Visual", "Punishment Bar Orientation", MapOrientation.Vertical, "Orientation of punishment bar."); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)punishmentBarOrientation)); punishmentBarColor = ((BaseUnityPlugin)this).Config.Bind("Visual", "Punishment Bar Color", Color.red, "Color of punishment bar."); ModSettingsManager.AddOption((BaseOption)new ColorOption(punishmentBarColor)); usePortalMaterial = ((BaseUnityPlugin)this).Config.Bind("Visual", "WIP Use Scene Material", false, "[WIP] Sets destination scene portrait as a portal texture."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(usePortalMaterial)); droneStackPercent = ((BaseUnityPlugin)this).Config.Bind("Modifier Options", "Drone Increase", 33, "Percent per stack of initial scene director budget, used only to spawn additional drones. By default it's 33%."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(droneStackPercent)); elitesStackPercent = ((BaseUnityPlugin)this).Config.Bind("Modifier Options", "Elite Increase", 33, "Percent of elite discount for director. By default it's 33%."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(elitesStackPercent)); doppelStackTime = ((BaseUnityPlugin)this).Config.Bind("Modifier Options", "Doppelganger Cooldown Decrease", 30, "Cooldown reduction with one stack in seconds. By default it's 30s."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(doppelStackTime)); lunarStackPercent = ((BaseUnityPlugin)this).Config.Bind("Modifier Options", "Lunar Enemies Discount", 15, "Discount on lunar enemies in percents for more than one stack. By default it's 15%."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(lunarStackPercent)); voidStackPercent = ((BaseUnityPlugin)this).Config.Bind("Modifier Options", "Void Enemies Discount", 15, "Discount on void enemies in percents for more than one stack. By default it's 15%."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(voidStackPercent)); soulCostStackPercent = ((BaseUnityPlugin)this).Config.Bind("Modifier Options", "Soul Cost Increase", 2, "Percents added to hp curse for stack. By default it's 2%."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(soulCostStackPercent)); tier2ElitesStackPercent = ((BaseUnityPlugin)this).Config.Bind("Modifier Options", "Post-Loop Elites Increase", 15, "Discount on tier2 elites in percents for more than one stack. By default it's 15%."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(tier2ElitesStackPercent)); printerItemPool = ((BaseUnityPlugin)this).Config.Bind("Printer Items", "Printer Item Pool", ItemPoolOptions.Default, "The configuration of what items printer modifier can have, use fields below to add other items from vanilla or mods to configuration.\n\nDefault - intended configuration that consists of the items that affect run the most\nVanillaEntire - configuration with all printer-allowed items from vanilla\nEntire - configuration with all printer-allowed items from all active mods, registered as Tier1 if not specified in the fields below\nNone - only the fields below"); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)printerItemPool)); tier1PrinterItems = ((BaseUnityPlugin)this).Config.Bind("Printer Items", "Add Tier 1 Items", "", "Adds item defs separated by comma to a printer modifier as Tier1. All available for selected pool can be seen in the run using command 'printerpool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier1PrinterItems)); tier2PrinterItems = ((BaseUnityPlugin)this).Config.Bind("Printer Items", "Add Tier 2 Items", "", "Adds item defs separated by comma to a printer modifier as Tier2. All available for selected pool can be seen in the run using command 'printerpool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier2PrinterItems)); tier3PrinterItems = ((BaseUnityPlugin)this).Config.Bind("Printer Items", "Add Tier 3 Items", "", "Adds item defs separated by comma to a printer modifier as Tier3. All available for selected pool can be seen in the run using command 'printerpool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier3PrinterItems)); enemyItemPool = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Enemy Item Pool", ItemPoolOptions.Default, "The configuration of what items enemy item modifier can have, use fields below to add other items from vanilla or mods to configuration.\n\nDefault - intended configuration that consists of the items that affect run the most\nVanillaEntire - configuration with all items from vanilla\nEntire - configuration with all items from all active mods, registered as Tier1 if not specified in the fields below\nNone - only the fields below"); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)enemyItemPool)); enemyItemsAllowBoss = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Allow Boss Tier", false, "Adds items with boss tier to the enemy item pool."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enemyItemsAllowBoss)); enemyItemsAllowVoid = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Allow Void Tiers", false, "Adds items with void tiers to the enemy item pool."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enemyItemsAllowVoid)); canAppearWithAIBlacklisted = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Allow AI Blacklisted", false, "Adds items with AI-blacklisted tag to the enemy pool."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(canAppearWithAIBlacklisted)); tier1EnemyItems = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Add Tier 1 Items", "", "Adds item defs separated by comma to an enemy item modifier as Tier1. All available for selected pool can be seen in the run using command 'enemypool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier1EnemyItems)); tier2EnemyItems = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Add Tier 2 Items", "", "Adds item defs separated by comma to an enemy item modifier as Tier2. All available for selected pool can be seen in the run using command 'enemypool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier2EnemyItems)); tier3EnemyItems = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Add Tier 3 Items", "", "Adds item defs separated by comma to an enemy item modifier as Tier3. All available for selected pool can be seen in the run using command 'enemypool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier3EnemyItems)); enemyItemsModifierCanStack = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Modifier can stack", false, "Allows enemy item modifier to be stacked, so enemies can have more than one default stack for item.\nDefault amount for stack is:\nCommon - x5,\nUncommon - x3,\nLegendary - x1."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enemyItemsModifierCanStack)); commonDefaultStack = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Common Default Stack", 5, "Default amount per stack."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(commonDefaultStack)); uncommonDefaultStack = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Uncommon Default Stack", 3, "Default amount per stack."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(uncommonDefaultStack)); legendaryDefaultStack = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Legendary Default Stack", 1, "Default amount per stack."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(legendaryDefaultStack)); bossDefaultStack = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Boss Default Stack", 1, "Default amount per stack."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(bossDefaultStack)); chanceForExtra = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Chance For Extra", 0, "Chance for enemy items to have extra stacks."); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(chanceForExtra)); commonExtraRange = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Common Extra Range", 3, "Amount of item stacks added as extra."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(commonExtraRange)); uncommonExtraRange = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Uncommon Extra Range", 2, "Amount of item stacks added as extra."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(uncommonExtraRange)); legendaryExtraRange = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Legendary Extra Range", 1, "Amount of item stacks added as extra."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(legendaryExtraRange)); bossExtraRange = ((BaseUnityPlugin)this).Config.Bind("Enemy Items", "Boss Extra Range", 1, "Amount of item stacks added as extra."); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(bossExtraRange)); lunarItemPool = ((BaseUnityPlugin)this).Config.Bind("Lunar Items", "Lunar Item Pool", ItemPoolOptions.Default, "The configuration of what items printer modifier can have, use fields below to add other items from vanilla or mods to configuration.\n\nDefault - configuration that consists of the items that affect run the most\nVanillaEntire - configuration with all lunar items from vanilla\nEntire - configuration with all lunar items from all active mods, registered as Tier3 if not specified in the fields below\nNone - only the fields below"); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)lunarItemPool)); tier1LunarItems = ((BaseUnityPlugin)this).Config.Bind("Lunar Items", "Add Tier 1 Items", "", "Adds item defs separated by comma to a lunar modifier as Tier1. All available for selected pool can be seen in the run using command 'lunarpool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier1LunarItems)); tier2LunarItems = ((BaseUnityPlugin)this).Config.Bind("Lunar Items", "Add Tier 2 Items", "", "Adds item defs separated by comma to a lunar item modifier as Tier2. All available for selected pool can be seen in the run using command 'lunarpool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier2LunarItems)); tier3LunarItems = ((BaseUnityPlugin)this).Config.Bind("Lunar Items", "Add Tier 3 Items", "", "Adds item defs separated by comma to a lunar item modifier as Tier3. All available for selected pool can be seen in the run using command 'lunarpool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier3LunarItems)); lunarTurnToPearl = ((BaseUnityPlugin)this).Config.Bind("Lunar Items", "Purify At The End", true, "By default the lunar item given by the modifier is turned into a pearl at the end of the stage."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(lunarTurnToPearl)); tier1Artifacts = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Add Tier 1 Artifacts", "", "Adds artifact defs separated by comma to the artifact modifier as Tier1, use it to add artifacts from other mods. All available can be seen in the run using command 'artifactpool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier1Artifacts)); tier2Artifacts = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Add Tier 2 Artifacts", "", "Adds artifact defs separated by comma to the artifact modifier as Tier2, use it to add artifacts from other mods. All available can be seen in the run using command 'artifactpool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier2Artifacts)); tier3Artifacts = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Add Tier 3 Artifacts", "", "Adds artifact defs separated by comma to the artifact modifier as Tier3, use it to add artifacts from other mods. All available can be seen in the run using command 'artifactpool'."); ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(tier3Artifacts)); allowMysteryArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Mystery", true, "Mystery artifact available as artifact stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowMysteryArtifact)); allowChaosArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Chaos", true, "Chaos artifact available as artifact stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowChaosArtifact)); allowDeathArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Death", true, "Death artifact available as artifact stage modifier. Appears if run is launched in multiplayer."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowDeathArtifact)); allowDissonanceArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Dissonance", true, "Dissonance artifact available as artifact stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowDissonanceArtifact)); allowFrailtyArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Frailty", true, "Frailty artifact available as artifact stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowFrailtyArtifact)); allowHonorArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Honor", true, "Honor artifact available as artifact stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowHonorArtifact)); allowSacrificeArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Sacrifice", true, "Sacrifice artifact available as artifact stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowSacrificeArtifact)); allowSoulArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Soul", true, "Soul artifact available as artifact stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowSoulArtifact)); allowSpiteArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Spite", true, "Spite artifact available as artifact stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowSpiteArtifact)); allowSwarmsArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Swarms", true, "Swarms artifact available as artifact stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowSwarmsArtifact)); allowVengeanceArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Vengeance", false, "Vengeance artifact available as artifact stage modifier. Not intended to be available, replaced by Doppelganger modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowVengeanceArtifact)); allowCommandArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Command", false, "Command artifact available as artifact stage modifier. Not intended to be available."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowCommandArtifact)); allowDelusionArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Delusion", false, "Delusion artifact available as artifact stage modifier. Not intended to be available."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowDelusionArtifact)); allowDevotionArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Devotion", false, "Devotion artifact available as artifact stage modifier. Not intended to be available."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowDevotionArtifact)); allowEnigmaArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Enigma", false, "Enigma artifact available as artifact stage modifier. Not intended to be available."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowEnigmaArtifact)); allowEvolutionArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Evolution", false, "Evolution artifact available as artifact stage modifier. Not intended to be available."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowEvolutionArtifact)); allowGlassArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Glass", false, "Glass artifact available as artifact stage modifier. Not intended to be available."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowGlassArtifact)); allowKinArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Kin", false, "Kin artifact available as artifact stage modifier. Not intended to be available."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowKinArtifact)); allowMetamorphosisArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Metamorphosis", false, "Metamorphosis artifact available as artifact stage modifier. Not intended to be available."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowMetamorphosisArtifact)); allowRebirthArtifact = ((BaseUnityPlugin)this).Config.Bind("Artifacts", "Rebirth", false, "Rebirth artifact available as artifact stage modifier. Not intended to be available."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowRebirthArtifact)); allowAurelioniteModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Aurelionite", true, "Aurelionite reward available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowAurelioniteModifier)); allowBossRedItemModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Boss Red Item", true, "Boss Red Item available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowBossRedItemModifier)); allowBossYellowItemModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Boss Yellow Item", true, "Boss Yellow Item available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowBossYellowItemModifier)); allowDroneBossGreenModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Drone Boss Green", true, "Drone Boss Green available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowDroneBossGreenModifier)); allowDroneBossRedModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Drone Boss Red", true, "Drone Boss Red available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowDroneBossRedModifier)); allowMoreElitesModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "More Elites", true, "More Elites available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowMoreElitesModifier)); allowMoreDronesModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "More Drones", true, "More Drones available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowMoreDronesModifier)); allowUpgradeDronesModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Upgrade Drones", true, "Upgrade Drones available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowUpgradeDronesModifier)); allowLunarEnemiesModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Lunar Enemies", true, "Lunar Enemies available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowLunarEnemiesModifier)); allowVoidEnemiesModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Void Enemies", true, "Void Enemies available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowVoidEnemiesModifier)); allowYellowPrinterModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Yellow Printers", true, "Yellow Printer available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowYellowPrinterModifier)); allowRedPrinterModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Red Printers", true, "Red Printer available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowRedPrinterModifier)); allowOnlyFlyingModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Only Flying", true, "Only Flying enemies available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowOnlyFlyingModifier)); allowPowerfulElitesModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Post-Loop Elites", true, "Earlier Tier2 Elites available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowPowerfulElitesModifier)); allowRepairModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Repair Items", true, "Repair Items available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowRepairModifier)); allowWanderingChefModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Wandering Chef", true, "Wandering Chef available as a stage modifier. why would you even disable it???"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowWanderingChefModifier)); allowMountainModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Mountain Shrine", true, "Mountain Shrine available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowMountainModifier)); allowSoulCostModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Soul Cost", true, "Soul Cost available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowSoulCostModifier)); allowDoppelgangerModifier = ((BaseUnityPlugin)this).Config.Bind("Stage Modifiers", "Doppelganger", true, "Doppelganger available as a stage modifier."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowDoppelgangerModifier)); } private void Update() { } } } namespace RiskOfRoutes.StageModifiers { public class ModifierDef { public string name; public ModifierTier tier; public int cost; public float selectionWeight; public Func isAvailable = () => true; public List conflictList = new List(); public int maxStack = -1; public Sprite icon; public string nameToken; public string descriptionToken; public bool isNegative = false; public bool isArtifact = false; public bool isStackable = false; public ModifierDef(string name, ModifierTier tier, float weight, bool isStackable, bool isNegative, string[] conflicts = null, int maxStack = -1) { this.name = name; this.tier = tier; selectionWeight = weight; this.isNegative = isNegative; this.isStackable = isStackable; if (conflicts != null) { foreach (string item in conflicts) { conflictList.Add(item); } } } public ModifierDef(string name, ModifierTier tier, float weight, Func isAvailable, bool isStackable, bool isNegative, string[] conflicts = null, int maxStack = -1) { this.name = name; this.tier = tier; selectionWeight = weight; this.isNegative = isNegative; this.isAvailable = isAvailable; this.isStackable = isStackable; if (conflicts != null) { foreach (string item in conflicts) { conflictList.Add(item); } } } } public class ArtifactInfo { public string name; public int tier; public bool isNegative; public ArtifactInfo(string name, int tier, bool isNegative) { this.name = name; this.tier = tier; this.isNegative = isNegative; } } public class LunarItemInfo { public string name; public int tier; public bool isDefault; public LunarItemInfo(string name, int tier, bool isDefault) { this.name = name; this.tier = tier; this.isDefault = isDefault; } } public class ItemInfo { public int printerTier; public bool isPrinterDefault; public int enemyTier; public bool isEnemyDefault; public ItemInfo(int printerTier, bool isPrinterDefault, int enemyTier, bool isEnemyDefault) { this.printerTier = printerTier; this.isPrinterDefault = isPrinterDefault; this.enemyTier = enemyTier; this.isEnemyDefault = isEnemyDefault; } } public static class StageModifierCatalog { private static AssetBundle assetBundle; public static Dictionary AllDefs = new Dictionary(); public static List generalPositivePool = new List(); public static List generalNegativePool = new List(); public static List droneTypePool = new List(); public static List rarePool = new List(); public static List chefPool = new List(); public static List combatPool = new List(); public static List healPool = new List(); public static List utilityPool = new List(); public static List itemTypePool = new List(); public static List enemyItemPool = new List(); public static List lunarItemPool = new List(); public static List additionalDefs = new List(); public static readonly List AllDefNames = new List { "Aurelionite", "BossRedItem", "BossYellowItem", "DroneBossGreen", "DroneBossRed", "MoreElites", "MoreDrones", "UpgradeDrones", "LunarEnemies", "VoidEnemies", "YellowPrinter", "RedPrinter", "OnlyFlying", "PowerfulElites", "Repair", "WanderingChef", "Mountain", "SoulCost", "Doppelganger", "FriendlyFire", "Command", "Delusion", "Devotion", "MixEnemy", "Enigma", "MonsterTeamGainsItems", "WeakAssKnees", "Glass", "EliteOnly", "SingleMonsterType", "RandomSurvivorOnRespawn", "Rebirth", "Sacrifice", "WispOnDeath", "Bomb", "Swarms", "ShadowClone", "TeamDeath", "Mystery" }; public static readonly Dictionary vanillaItemsInfo = new Dictionary { { "BossDamageBonus", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "SecondarySkillMagazine", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "FlatHealth", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: true) }, { "AttackSpeedPerNearbyAllyOrEnemy", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "Firework", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "Mushroom", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "HealWhileSafe", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "IncreaseDamageOnMultiKill", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "Crowbar", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "FragileDamageBonus", new ItemInfo(2, isPrinterDefault: true, 3, isEnemyDefault: true) }, { "BarrierOnCooldown", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "SpeedBoostPickup", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "SprintBonus", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "IgniteOnKill", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "CritAtLowerElevation", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "CritGlasses", new ItemInfo(3, isPrinterDefault: true, 3, isEnemyDefault: true) }, { "Medkit", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "AttackSpeedAndMoveSpeed", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "Tooth", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "OutOfCombatArmor", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "Hoof", new ItemInfo(1, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "PersonalShield", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: true) }, { "HealingPotion", new ItemInfo(1, isPrinterDefault: false, 2, isEnemyDefault: true) }, { "ArmorPlate", new ItemInfo(1, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "GoldOnHurt", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "TreasureCache", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "Syringe", new ItemInfo(3, isPrinterDefault: true, 3, isEnemyDefault: true) }, { "StickyBomb", new ItemInfo(3, isPrinterDefault: true, 3, isEnemyDefault: true) }, { "StunChanceOnHit", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "BarrierOnKill", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "Bear", new ItemInfo(3, isPrinterDefault: true, 3, isEnemyDefault: true) }, { "BleedOnHit", new ItemInfo(3, isPrinterDefault: true, 3, isEnemyDefault: true) }, { "WardOnLevel", new ItemInfo(1, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "DelayedDamage", new ItemInfo(1, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "Missile", new ItemInfo(3, isPrinterDefault: true, 3, isEnemyDefault: true) }, { "Bandolier", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "WarCryOnMultiKill", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "DronesDropDynamite", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "KnockBackHitEnemies", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "ExtraShrineItem", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "SlowOnHit", new ItemInfo(1, isPrinterDefault: false, 2, isEnemyDefault: true) }, { "SpeedOnPickup", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "DeathMark", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "JumpDamageStrike", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "EquipmentMagazine", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "BonusGoldPackOnKill", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "HealOnCrit", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "Feather", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: true) }, { "MoveSpeedOnKill", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "StrengthenBurn", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "Infusion", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "ShieldBooster", new ItemInfo(1, isPrinterDefault: true, 1, isEnemyDefault: true) }, { "FireRing", new ItemInfo(3, isPrinterDefault: true, 3, isEnemyDefault: true) }, { "Seed", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "TPHealingNova", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "IncreasePrimaryDamage", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "TriggerEnemyDebuffs", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "ExecuteLowHealthElite", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "Phasing", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "ExtraStatsOnLevelUp", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "AttackSpeedOnCrit", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: true) }, { "Thorns", new ItemInfo(1, isPrinterDefault: true, 3, isEnemyDefault: false) }, { "SprintOutOfCombat", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "RegeneratingScrap", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "SprintArmor", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "IceRing", new ItemInfo(3, isPrinterDefault: true, 3, isEnemyDefault: true) }, { "LowerPricedChests", new ItemInfo(3, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "FreeChest", new ItemInfo(2, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "PrimarySkillShuriken", new ItemInfo(2, isPrinterDefault: true, 2, isEnemyDefault: true) }, { "Squid", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "ChainLightning", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: true) }, { "TeleportOnLowHealth", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: false) }, { "EnergizedOnEquipmentUse", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "JumpBoost", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "ExplodeOnDeath", new ItemInfo(2, isPrinterDefault: true, 1, isEnemyDefault: false) }, { "Clover", new ItemInfo(3, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "BarrierOnOverHeal", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "AlienHead", new ItemInfo(2, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "ImmuneToDebuff", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "RandomEquipmentTrigger", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "KillEliteFrenzy", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "Behemoth", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "Dagger", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "CaptainDefenseMatrix", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: false) }, { "ExtraLife", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "StunAndPierce", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "Icicle", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "BoostAllStats", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "FallBoots", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "GhostOnKill", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "UtilitySkillMagazine", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "Plant", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "ScrapRed", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "CritDamage", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "NovaOnHeal", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "SharedSuffering", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "PhysicsProjectile", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: false) }, { "MoreMissile", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "IncreaseHealing", new ItemInfo(1, isPrinterDefault: false, 2, isEnemyDefault: true) }, { "LaserTurbine", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "MeteorAttackOnHighDamage", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "BounceNearby", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "ArmorReductionOnHit", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "ItemDropChanceOnKill", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "Talisman", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "DroneWeapons", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: false) }, { "Duplicator", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "PermanentDebuffOnHit", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: false) }, { "ShockNearby", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: false) }, { "HeadHunter", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "BarrageOnBoss", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "ArtifactKey", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "LightningStrikeOnHit", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "MinorConstructOnKill", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "RoboBallBuddy", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: false) }, { "MasterBattery", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "MasterCore", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "ShockDamageAura", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "ExtraEquipment", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "NovaOnLowHealth", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "TitanGoldDuringTP", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "ShinyPearl", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "ScrapYellow", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "SprintWisp", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "SiphonOnLowHealth", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: false) }, { "FireballsOnHit", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "Pearl", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) }, { "ParentEgg", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: true) }, { "PowerCube", new ItemInfo(1, isPrinterDefault: false, 3, isEnemyDefault: false) }, { "BeetleGland", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "PowerPyramid", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "BleedOnHitAndExplode", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: false) }, { "Knurl", new ItemInfo(1, isPrinterDefault: false, 1, isEnemyDefault: true) } }; public static readonly Dictionary lunarItemTiers = new Dictionary { { "LunarTrinket", new LunarItemInfo("LunarTrinket", 1, isDefault: false) }, { "GoldOnHit", new LunarItemInfo("GoldOnHit", 2, isDefault: true) }, { "RepeatHeal", new LunarItemInfo("RepeatHeal", 1, isDefault: true) }, { "MonstersOnShrineUse", new LunarItemInfo("MonstersOnShrineUse", 1, isDefault: true) }, { "LunarSun", new LunarItemInfo("LunarSun", 3, isDefault: false) }, { "LunarSpecialReplacement", new LunarItemInfo("LunarSpecialReplacement", 3, isDefault: false) }, { "RandomlyLunar", new LunarItemInfo("RandomlyLunar", 1, isDefault: false) }, { "FocusConvergence", new LunarItemInfo("FocusConvergence", 1, isDefault: true) }, { "AutoCastEquipment", new LunarItemInfo("AutoCastEquipment", 1, isDefault: false) }, { "LunarSecondaryReplacement", new LunarItemInfo("LunarSecondaryReplacement", 3, isDefault: false) }, { "HalfAttackSpeedHalfCooldowns", new LunarItemInfo("HalfAttackSpeedHalfCooldowns", 3, isDefault: true) }, { "OnLevelUpFreeUnlock", new LunarItemInfo("OnLevelUpFreeUnlock", 3, isDefault: false) }, { "RandomDamageZone", new LunarItemInfo("RandomDamageZone", 1, isDefault: false) }, { "TransferDebuffOnHit", new LunarItemInfo("TransferDebuffOnHit", 1, isDefault: false) }, { "LunarBadLuck", new LunarItemInfo("LunarBadLuck", 3, isDefault: true) }, { "LunarDagger", new LunarItemInfo("LunarDagger", 3, isDefault: true) }, { "HalfSpeedDoubleHealth", new LunarItemInfo("HalfSpeedDoubleHealth", 3, isDefault: true) }, { "LunarUtilityReplacement", new LunarItemInfo("LunarUtilityReplacement", 3, isDefault: true) }, { "ShieldOnly", new LunarItemInfo("ShieldOnly", 3, isDefault: true) }, { "LunarPrimaryReplacement", new LunarItemInfo("LunarPrimaryReplacement", 3, isDefault: false) } }; public static readonly Dictionary artifactTiers = new Dictionary { { "Mystery", new ArtifactInfo("Mystery", 2, isNegative: true) }, { "FriendlyFire", new ArtifactInfo("FriendlyFire", 1, isNegative: true) }, { "Command", new ArtifactInfo("Command", 3, isNegative: false) }, { "Delusion", new ArtifactInfo("Delusion", 3, isNegative: true) }, { "Devotion", new ArtifactInfo("Devotion", 2, isNegative: true) }, { "MixEnemy", new ArtifactInfo("MixEnemy", 2, isNegative: true) }, { "Enigma", new ArtifactInfo("Enigma", 3, isNegative: true) }, { "MonsterTeamGainsItems", new ArtifactInfo("MonsterTeamGainsItems", 1, isNegative: true) }, { "WeakAssKnees", new ArtifactInfo("WeakAssKnees", 1, isNegative: true) }, { "Glass", new ArtifactInfo("Glass", 3, isNegative: true) }, { "EliteOnly", new ArtifactInfo("EliteOnly", 3, isNegative: true) }, { "SingleMonsterType", new ArtifactInfo("SingleMonsterType", 2, isNegative: true) }, { "RandomSurvivorOnRespawn", new ArtifactInfo("RandomSurvivorOnRespawn", 3, isNegative: true) }, { "Rebirth", new ArtifactInfo("Rebirth", 1, isNegative: false) }, { "Sacrifice", new ArtifactInfo("Sacrifice", 3, isNegative: true) }, { "WispOnDeath", new ArtifactInfo("WispOnDeath", 1, isNegative: true) }, { "Bomb", new ArtifactInfo("Bomb", 1, isNegative: true) }, { "Swarms", new ArtifactInfo("Swarms", 1, isNegative: true) }, { "ShadowClone", new ArtifactInfo("ShadowClone", 1, isNegative: true) }, { "TeamDeath", new ArtifactInfo("TeamDeath", 2, isNegative: true) } }; public static void Init(AssetBundle bundle) { //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Invalid comparison between Unknown and I4 assetBundle = bundle; AllDefs.Clear(); generalPositivePool.Clear(); generalNegativePool.Clear(); itemTypePool.Clear(); enemyItemPool.Clear(); lunarItemPool.Clear(); rarePool.Clear(); droneTypePool.Clear(); chefPool.Clear(); combatPool.Clear(); healPool.Clear(); utilityPool.Clear(); additionalDefs.Clear(); generalPositivePool.AddRange(new string[0]); generalNegativePool.AddRange(new string[7] { "Doppelganger", "SoulCost", "VoidEnemies", "MoreElites", "LunarEnemies", "PowerfulElites", "OnlyFlying" }); itemTypePool.AddRange(new string[2] { "YellowPrinter", "RedPrinter" }); combatPool.AddRange(new string[2] { "YellowPrinter_Damage", "RedPrinter_Damage" }); healPool.AddRange(new string[2] { "YellowPrinter_Healing", "RedPrinter_Healing" }); utilityPool.AddRange(new string[2] { "YellowPrinter_Utility", "RedPrinter_Utility" }); droneTypePool.AddRange(new string[4] { "DroneBossGreen", "DroneBossRed", "UpgradeDrones", "MoreDrones" }); rarePool.AddRange(new string[2] { "BossRedItem", "BossYellowItem" }); chefPool.AddRange(new string[2] { "RedPrinter_FoodRelated", "YellowPrinter_FoodRelated" }); List list = new List(); ArtifactDef[] artifactDefs = ArtifactCatalog.artifactDefs; foreach (ArtifactDef val in artifactDefs) { ArtifactInfo value = null; if (artifactTiers.TryGetValue(val.cachedName, out value)) { TryRegArtifact(value); continue; } ArtifactInfo artifactInfo = new ArtifactInfo(val.cachedName, 1, isNegative: true); list.Add(val.cachedName); } Log.Warning("Init: Those modded artifacts can are not available, you can add them in config"); foreach (string item in list) { Log.Info("\t" + item); } ItemDef[] itemDefs = ItemCatalog.itemDefs; foreach (ItemDef val2 in itemDefs) { ItemInfo value3; if ((int)val2.tier == 3) { if (lunarItemTiers.TryGetValue(((Object)val2).name, out var value2)) { TryRegLunar(((Object)val2).name, (ModifierTier)value2.tier); continue; } TryRegLunar(((Object)val2).name, ModifierTier.Tier3); Log.Info(string.Format("{0}: trying to register lunar {1} as Tier3", "Init", val2)); } else if (vanillaItemsInfo.TryGetValue(((Object)val2).name, out value3)) { TryRegPrinter(((Object)val2).name, (ModifierTier)value3.printerTier); TryRegEnemy(((Object)val2).name, (ModifierTier)value3.enemyTier); } else { TryRegPrinter(((Object)val2).name, ModifierTier.Tier1); Log.Info(string.Format("{0}: trying to register printer {1} as Tier1", "Init", val2)); TryRegEnemy(((Object)val2).name, ModifierTier.Tier1); Log.Info(string.Format("{0}: trying to register enemy item {1} as Tier1", "Init", val2)); } } Register(new ModifierDef("Aurelionite", ModifierTier.Tier3, 1f, isStackable: false, isNegative: false), "texBuffAurelioniteBlessingIcon"); Register(new ModifierDef("BossRedItem", ModifierTier.Tier3, 1f, isStackable: false, isNegative: false, new string[2] { "BossYellowItem", "DroneBossGreen" }), "redBossItem"); Register(new ModifierDef("BossYellowItem", ModifierTier.Tier2, 1f, isStackable: false, isNegative: false, new string[2] { "BossRedItem", "DroneBossGreen" }), "yellowBossItem"); Register(new ModifierDef("DroneBossGreen", ModifierTier.Tier1, 1f, isStackable: false, isNegative: false, new string[1] { "DroneBossRed" }), "uncommonDroneReward"); Register(new ModifierDef("DroneBossRed", ModifierTier.Tier3, 1f, isStackable: false, isNegative: false, new string[1] { "DroneBossGreen" }), "legendaryDroneReward"); Register(new ModifierDef("MoreElites", ModifierTier.Tier1, 1f, isStackable: true, isNegative: true), "moreElitesIcon"); Register(new ModifierDef("MoreDrones", ModifierTier.Tier1, 1f, isStackable: true, isNegative: false), "texMoreDronesModifier"); Register(new ModifierDef("UpgradeDrones", ModifierTier.Tier3, 1f, isStackable: true, isNegative: false), "RoR2/DLC3/UI/texUIdroneupgradeIcon.png"); Register(new ModifierDef("LunarEnemies", ModifierTier.Tier3, 1f, isStackable: true, isNegative: true), "RoR2/DLC1/GameModes/InfiniteTowerRun/ITAssets/texITWaveLunarIcon.png"); Register(new ModifierDef("VoidEnemies", ModifierTier.Tier3, 1f, isStackable: true, isNegative: true), "RoR2/DLC1/GameModes/InfiniteTowerRun/ITAssets/texITWaveVoidIcon.png"); Register(new ModifierDef("YellowPrinter", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckPlayersYellowItem() ?? false, isStackable: true, isNegative: false), "yellowPrinter"); Register(new ModifierDef("RedPrinter", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckPlayersRedItem() ?? false, isStackable: true, isNegative: false), "redPrinter"); Register(new ModifierDef("YellowPrinter_Damage", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckPlayersYellowItem() ?? false, isStackable: true, isNegative: false), "yellowPrinterDamage"); Register(new ModifierDef("YellowPrinter_Healing", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckPlayersYellowItem() ?? false, isStackable: true, isNegative: false), "yellowPrinterHeal"); Register(new ModifierDef("YellowPrinter_Utility", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckPlayersYellowItem() ?? false, isStackable: true, isNegative: false), "yellowPrinterUtility"); Register(new ModifierDef("YellowPrinter_FoodRelated", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckPlayersYellowItem() ?? false, isStackable: true, isNegative: false), "yellowPrinterFood"); Register(new ModifierDef("RedPrinter_Damage", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckPlayersRedItem() ?? false, isStackable: true, isNegative: false), "redPrinterDamage"); Register(new ModifierDef("RedPrinter_Healing", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckPlayersRedItem() ?? false, isStackable: true, isNegative: false), "redPrinterHealing"); Register(new ModifierDef("RedPrinter_Utility", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckPlayersRedItem() ?? false, isStackable: true, isNegative: false), "redPrinterUtility"); Register(new ModifierDef("RedPrinter_FoodRelated", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckPlayersRedItem() ?? false, isStackable: true, isNegative: false), "redPrinterFood"); Register(new ModifierDef("OnlyFlying", ModifierTier.Tier2, 1f, isStackable: false, isNegative: true), "onlyFlying"); Register(new ModifierDef("PowerfulElites", ModifierTier.Tier3, 1f, isStackable: true, isNegative: true), "tier2ElitesIcon"); Register(new ModifierDef("Repair", ModifierTier.Tier3, 1f, () => StageModifierDirector.instance?.CheckPlayersHaveConsumedItems() ?? false, isStackable: false, isNegative: false), "repair"); Register(new ModifierDef("WanderingChef", ModifierTier.Tier3, 1f, isStackable: false, isNegative: false), "RoR2/DLC3/MealPrep/texMealPrepIcon.png"); Register(new ModifierDef("Mountain", ModifierTier.Tier1, 1f, () => StageModifierDirector.instance?.CheckMountainShrine() ?? false, isStackable: false, isNegative: false), "mountIcon"); Register(new ModifierDef("SoulCost", ModifierTier.Tier2, 1f, isStackable: true, isNegative: true), "RoR2/DLC2/texBuffSoulCostIcon.png"); Register(new ModifierDef("Doppelganger", ModifierTier.Tier2, 1f, isStackable: true, isNegative: true), "texAurelioniteIcon"); } public static void CreateRunPools(RiskOfRoutes.ItemPoolOptions printer, RiskOfRoutes.ItemPoolOptions lunar, RiskOfRoutes.ItemPoolOptions enemy, bool allowAIBlacklisted, bool allowBoss, bool allowVoid, HashSet bannedRun) { //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) generalNegativePool.Clear(); itemTypePool.Clear(); enemyItemPool.Clear(); lunarItemPool.Clear(); rarePool.Clear(); droneTypePool.Clear(); chefPool.Clear(); combatPool.Clear(); healPool.Clear(); utilityPool.Clear(); additionalDefs.Clear(); generalPositivePool.AddRange(new string[0]); generalNegativePool.AddRange(new string[7] { "Doppelganger", "SoulCost", "VoidEnemies", "MoreElites", "LunarEnemies", "PowerfulElites", "OnlyFlying" }); itemTypePool.AddRange(new string[2] { "YellowPrinter", "RedPrinter" }); combatPool.AddRange(new string[2] { "YellowPrinter_Damage", "RedPrinter_Damage" }); healPool.AddRange(new string[2] { "YellowPrinter_Healing", "RedPrinter_Healing" }); utilityPool.AddRange(new string[2] { "YellowPrinter_Utility", "RedPrinter_Utility" }); droneTypePool.AddRange(new string[4] { "DroneBossGreen", "DroneBossRed", "UpgradeDrones", "MoreDrones" }); rarePool.AddRange(new string[2] { "BossRedItem", "BossYellowItem" }); chefPool.AddRange(new string[2] { "RedPrinter_FoodRelated", "YellowPrinter_FoodRelated" }); foreach (ModifierDef item3 in AllDefs.Values.Where((ModifierDef def) => def.isArtifact)) { if (artifactTiers.ContainsKey(item3.name) && !bannedRun.Contains(item3.name)) { if (item3.isNegative) { generalNegativePool.Add(item3.name); } else { rarePool.Add(item3.name); } } } if (printer != RiskOfRoutes.ItemPoolOptions.None) { List list = ((IEnumerable)(object)ItemCatalog.allItemDefs).Where((ItemDef def) => (int)def.tier == 0 || ((int)def.tier == 1 && def.DoesNotContainTag((ItemTag)15))).ToList(); switch (printer) { case RiskOfRoutes.ItemPoolOptions.VanillaEntire: list = list.Where((ItemDef def) => vanillaItemsInfo.ContainsKey(((Object)def).name)).ToList(); break; case RiskOfRoutes.ItemPoolOptions.Default: { list = list.Where((ItemDef def) => vanillaItemsInfo.TryGetValue(((Object)def).name, out var value4) && value4.isPrinterDefault).ToList(); break; } } foreach (ItemDef item4 in list) { string item = ((Object)item4).name + "_Printer"; if (item4.tags.Contains((ItemTag)1) && !combatPool.Contains(item)) { combatPool.Add(item); } else if (item4.tags.Contains((ItemTag)2) && !healPool.Contains(item)) { healPool.Add(item); } else if (item4.tags.Contains((ItemTag)3) && !utilityPool.Contains(item)) { utilityPool.Add(item); } if (item4.tags.Contains((ItemTag)28) && !chefPool.Contains(item)) { chefPool.Add(item); } if (!itemTypePool.Contains(item)) { itemTypePool.Add(item); } } } else { Log.Warning("Printer pool is set to none"); } if (enemy != RiskOfRoutes.ItemPoolOptions.None) { List list2 = ((IEnumerable)(object)ItemCatalog.allItemDefs).Where((ItemDef def) => (int)def.tier == 0 || (int)def.tier == 1 || (int)def.tier == 2 || (allowBoss && (int)def.tier == 4) || (allowVoid && (int)def.tier == 6) || (allowVoid && (int)def.tier == 7) || (allowVoid && (int)def.tier == 8)).ToList(); if (!allowAIBlacklisted) { list2 = list2.Where((ItemDef def) => def.DoesNotContainTag((ItemTag)4)).ToList(); } switch (enemy) { case RiskOfRoutes.ItemPoolOptions.VanillaEntire: list2 = list2.Where((ItemDef def) => vanillaItemsInfo.ContainsKey(((Object)def).name)).ToList(); break; case RiskOfRoutes.ItemPoolOptions.Default: { list2 = list2.Where((ItemDef def) => vanillaItemsInfo.TryGetValue(((Object)def).name, out var value3) && value3.isEnemyDefault).ToList(); break; } } bool enemyItemsModifierCanStack = StageModifierDirector.instance.enemyItemsModifierCanStack; foreach (ItemDef item5 in list2) { string text = ((Object)item5).name + "_EnemyItem"; if (AllDefs.TryGetValue(text, out var value)) { value.isStackable = enemyItemsModifierCanStack; } if (!generalNegativePool.Contains(text)) { generalNegativePool.Add(text); } } } else { Log.Warning("Enemy pool is set to none"); } if (lunar != RiskOfRoutes.ItemPoolOptions.None) { List list3 = ((IEnumerable)(object)ItemCatalog.allItemDefs).Where((ItemDef def) => (int)def.tier == 3).ToList(); switch (lunar) { case RiskOfRoutes.ItemPoolOptions.VanillaEntire: list3 = list3.Where((ItemDef def) => lunarItemTiers.ContainsKey(((Object)def).name)).ToList(); break; case RiskOfRoutes.ItemPoolOptions.Default: { list3 = list3.Where((ItemDef def) => lunarItemTiers.TryGetValue(((Object)def).name, out var value2) && value2.isDefault).ToList(); break; } } { foreach (ItemDef item6 in list3) { string item2 = ((Object)item6).name + "_LunarItem"; if (!generalNegativePool.Contains(item2)) { generalNegativePool.Add(item2); } } return; } } Log.Warning("Lunar pool is set to none"); } public static void Register(ModifierDef def, string iconAddress, bool isArtifact = false, bool isItem = false, bool isAdditional = false) { if (AllDefs.ContainsKey(def.name)) { if (AllDefs[def.name].tier == def.tier) { Log.Warning("Trying to register modifier " + def.name + " that already exists and has the same tier, check config"); return; } Log.Warning("Trying to register modifier " + def.name + " that already exists with the different tier"); AllDefs.Remove(def.name); } def.icon = LoadSprite(iconAddress, isArtifact, isItem); def.isArtifact = isArtifact; AllDefs.Add(def.name, def); string text = ""; string text2 = ""; if (isArtifact) { ArtifactDef val = ArtifactCatalog.FindArtifactDef(def.name); if ((Object)(object)val != (Object)null) { text = val.nameToken; text2 = (((Object)(object)val == (Object)(object)Artifacts.TeamDeath) ? "ARTIFACT_DEATH_DESCRIPTION_SHORT" : val.descriptionToken); def.nameToken = text; def.descriptionToken = text2; } else { Log.Error("StageModifierCatalog: Init - Something went wrong for artifact:" + def.name); text = "MODIFIER_" + def.name.ToUpper() + "_NAME"; text2 = "MODIFIER_" + def.name.ToUpper() + "_DESCRIPTION"; def.nameToken = text; def.descriptionToken = text2; } } else if (isItem) { string selectedItemName = def.name.Split('_')[0]; ItemDef val2 = PrinterItemModifier.stringToItemDef(selectedItemName); if ((Object)(object)val2 != (Object)null) { text = val2.nameToken; text2 = val2.nameToken; def.nameToken = text; def.descriptionToken = text2; } else { Log.Error("StageModifierCatalog: Init - Something went wrong for item:" + def.name); } } else { text = "MODIFIER_" + def.name.ToUpper() + "_NAME"; text2 = "MODIFIER_" + def.name.ToUpper() + "_DESCRIPTION"; def.nameToken = text; def.descriptionToken = text2; } } public static void TryRegArtifact(ArtifactInfo artifactInfo, bool isAdditional = false) { string name = artifactInfo.name; ModifierTier tier = (ModifierTier)artifactInfo.tier; bool isNegative = artifactInfo.isNegative; Func isAvailable = ((name == "TeamDeath") ? ((Func)(() => StageModifierDirector.instance?.CheckArtifactOfDeathAvailable() ?? false)) : ((Func)(() => StageModifierDirector.instance?.CheckArtifactAvailable(name) ?? false))); Register(new ModifierDef(name, tier, 1f, isAvailable, isStackable: false, isNegative), name, isArtifact: true); if (isAdditional) { if (isNegative) { generalNegativePool.Add(name); Log.Info("ad"); } else { rarePool.Add(name); } } } public static void TryRegEnemy(string itemName, ModifierTier tier, bool isAdditional = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) ItemIndex val = ItemCatalog.FindItemIndex(itemName); ItemDef itemDef = ItemCatalog.GetItemDef(val); if ((Object)(object)itemDef == (Object)null) { Log.Warning("TryRegEnemy: Tried registering enemy item " + itemName + " but def is null, check config"); return; } string text = itemName + "_EnemyItem"; bool isStackable = StageModifierDirector.instance?.enemyItemsModifierCanStack ?? RiskOfRoutes.enemyItemsModifierCanStack.Value; if (AllDefs.TryGetValue(text, out var value)) { value.isStackable = isStackable; } Register(new ModifierDef(text, tier, 1f, StageModifierDirector.instance?.enemyItemsModifierCanStack ?? RiskOfRoutes.enemyItemsModifierCanStack.Value, isNegative: true), itemName, isArtifact: false, isItem: true); if (isAdditional && !generalNegativePool.Contains(text)) { generalNegativePool.Add(text); } } public static void TryRegPrinter(string itemName, ModifierTier tier, bool isAdditional = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) ItemIndex val = ItemCatalog.FindItemIndex(itemName); ItemDef itemDef = ItemCatalog.GetItemDef(val); if ((Object)(object)itemDef == (Object)null) { Log.Warning("TryRegPrinter: Tried registering printer item " + itemName + " but def is null, check config"); return; } string text = itemName + "_Printer"; Register(new ModifierDef(text, tier, 1f, isStackable: false, isNegative: false), itemName, isArtifact: false, isItem: true); if (!itemTypePool.Contains(text)) { itemTypePool.Add(text); } if (isAdditional) { if (itemDef.tags.Contains((ItemTag)1) && !combatPool.Contains(text)) { combatPool.Add(text); } else if (itemDef.tags.Contains((ItemTag)2) && !healPool.Contains(text)) { healPool.Add(text); } else if (itemDef.tags.Contains((ItemTag)3) && !utilityPool.Contains(text)) { utilityPool.Add(text); } if (itemDef.tags.Contains((ItemTag)28) && !chefPool.Contains(text)) { chefPool.Add(text); } if (!itemTypePool.Contains(text)) { itemTypePool.Add(text); } } } public static void TryRegLunar(string itemName, ModifierTier tier, bool isAdditional = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 ItemIndex val = ItemCatalog.FindItemIndex(itemName); ItemDef itemDef = ItemCatalog.GetItemDef(val); if ((Object)(object)itemDef == (Object)null) { Log.Warning("TryRegLunar: Tried registering lunar item " + itemName + " but def is null, check config"); return; } if ((int)itemDef.tier != 3) { Log.Warning("TryRegLunar: Tried registering non-lunar item " + itemName + " as LunarItemModifier, check config"); return; } string text = itemName + "_LunarItem"; Register(new ModifierDef(text, tier, 1f, isStackable: false, isNegative: true), itemName, isArtifact: false, isItem: true); if (isAdditional && !generalNegativePool.Contains(text)) { generalNegativePool.Add(text); } } public static ModifierDef FindModifier(string name) { if (AllDefs.TryGetValue(name, out var value)) { return value; } Log.Warning("FindModifier: Missing the host modifier with name " + name); return null; } public static StageModifier StageModifierFromDef(string def, int stack = 1) { //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_09a8: Unknown result type (might be due to invalid IL or missing references) //IL_09ab: Invalid comparison between Unknown and I4 //IL_09ff: Unknown result type (might be due to invalid IL or missing references) //IL_0a04: Unknown result type (might be due to invalid IL or missing references) //IL_0a06: Unknown result type (might be due to invalid IL or missing references) //IL_0a09: Invalid comparison between Unknown and I4 //IL_0a5e: Unknown result type (might be due to invalid IL or missing references) //IL_0a63: Unknown result type (might be due to invalid IL or missing references) //IL_0a65: Unknown result type (might be due to invalid IL or missing references) //IL_0a68: Invalid comparison between Unknown and I4 switch (def) { case "Aurelionite": return new AurelioniteModifier(); case "BossRedItem": return new BossRedItemModifier(); case "BossYellowItem": return new BossYellowItemModifier(); case "DroneBossGreen": return new DroneBossModifier(); case "DroneBossRed": return new DroneBossModifier(dropLegendary: true); case "MoreElites": return new MoreElitesModifier(stack); case "MoreDrones": return new MoreDronesModifier(stack); case "LunarEnemies": return new LunarEnemiesModifier(stack); case "VoidEnemies": return new VoidEnemiesModifier(stack); case "YellowPrinter": return new YellowPrinterModifier(stack, (ItemTag)0); case "YellowPrinter_Damage": return new YellowPrinterModifier(stack, (ItemTag)1); case "YellowPrinter_Healing": return new YellowPrinterModifier(stack, (ItemTag)2); case "YellowPrinter_Utility": return new YellowPrinterModifier(stack, (ItemTag)3); case "YellowPrinter_FoodRelated": return new YellowPrinterModifier(stack, (ItemTag)28); case "RedPrinter": return new RedPrinterModifier(stack, (ItemTag)0); case "RedPrinter_Damage": return new RedPrinterModifier(stack, (ItemTag)1); case "RedPrinter_Healing": return new RedPrinterModifier(stack, (ItemTag)2); case "RedPrinter_Utility": return new RedPrinterModifier(stack, (ItemTag)3); case "RedPrinter_FoodRelated": return new RedPrinterModifier(stack, (ItemTag)28); case "OnlyFlying": return new OnlyFlyingEnemiesModifier(); case "PowerfulElites": return new Tier2ElitesEarlierModifier(stack); case "Repair": return new RepairConsumedItemsModifier(); case "WanderingChef": return new WanderingChefModifier(); case "Mountain": return new SaveMountainEffectModifier(stack); case "SoulCost": return new SoulCostModifier(stack); case "Doppelganger": return new DoppelgangerModifier(stack); case "UpgradeDrones": return new UpgradeDronesModifier(stack); case "FriendlyFire": return new ArtifactModifier(Artifacts.FriendlyFire); case "Command": return new ArtifactModifier(Artifacts.Command); case "Delusion": return new ArtifactModifier(Artifacts.Delusion); case "Devotion": return new ArtifactModifier(Artifacts.Devotion); case "MixEnemy": return new ArtifactModifier(Artifacts.MixEnemy); case "Enigma": return new ArtifactModifier(Artifacts.Enigma); case "MonsterTeamGainsItems": return new ArtifactModifier(Artifacts.MonsterTeamGainsItems); case "WeakAssKnees": return new ArtifactModifier(Artifacts.WeakAssKnees); case "Glass": return new ArtifactModifier(Artifacts.Glass); case "EliteOnly": return new ArtifactModifier(Artifacts.EliteOnly); case "SingleMonsterType": return new ArtifactModifier(Artifacts.SingleMonsterType); case "RandomSurvivorOnRespawn": return new ArtifactModifier(Artifacts.RandomSurvivorOnRespawn); case "Rebirth": return new ArtifactModifier(Artifacts.Rebirth); case "Sacrifice": return new ArtifactModifier(Artifacts.Sacrifice); case "WispOnDeath": return new ArtifactModifier(Artifacts.WispOnDeath); case "Bomb": return new ArtifactModifier(Artifacts.Bomb); case "Swarms": return new ArtifactModifier(Artifacts.Swarms); case "ShadowClone": return new ArtifactModifier(Artifacts.ShadowClone); case "TeamDeath": return new ArtifactModifier(Artifacts.TeamDeath); case "Mystery": return new ArtifactModifier(MysteryArtifact.Mystery); default: { if (def.Contains("_Printer")) { string text = def.Split('_')[0]; ItemIndex val = ItemCatalog.FindItemIndex(text); if ((int)val == -1) { Log.Error("Could not find item by the name " + text); return null; } return new PrinterItemModifier(text); } if (def.Contains("_EnemyItem")) { string text2 = def.Split('_')[0]; ItemIndex val2 = ItemCatalog.FindItemIndex(text2); if ((int)val2 == -1) { Log.Error("Could not find item by the name " + text2); return null; } return new EnemyItemsModifier(text2, stack); } if (def.Contains("_LunarItem")) { string text3 = def.Split('_')[0]; ItemIndex val3 = ItemCatalog.FindItemIndex(text3); if ((int)val3 == -1) { Log.Error("Could not find lunar item by the name " + text3); return null; } return new LunarItemsModifier(text3); } ArtifactDef val4 = ArtifactCatalog.FindArtifactDef(def); if ((Object)(object)val4 != (Object)null) { return new ArtifactModifier(val4); } Log.Error("Could not find artifact by the name " + def); return null; } } } public static List GetPool(RoutePortalType routePortalType, bool isNegative = false) { if (isNegative) { return generalNegativePool; } return routePortalType switch { RoutePortalType.ItemType => itemTypePool, RoutePortalType.DroneType => droneTypePool, RoutePortalType.Rare => rarePool, RoutePortalType.Combat => combatPool, RoutePortalType.Heal => healPool, RoutePortalType.Utility => utilityPool, RoutePortalType.ChefType => chefPool, RoutePortalType.Colossus => GetRandomPool(), _ => itemTypePool, }; } public static List GetRandomPool() { List[] array = new List[5] { droneTypePool, rarePool, combatPool, healPool, utilityPool }; List list = Run.instance.stageRng.NextElementUniform>(array); Log.Info("GetRandomPool: For collosus got random pool with " + list[0]); return list; } public static ModifierDef SelectModifier(HashSet banned, RoutePortalType portalType, ModifierTier tier, List typePool) { if (typePool.Count == 0) { Log.Warning(string.Format("{0}: Couldnt get pool for portal type - {1}", "SelectModifier", portalType)); } else { Log.Info(string.Format("{0}: {1} - Got pool with {2} modifiers", "SelectModifier", portalType, typePool.Count)); } WeightedSelection val = new WeightedSelection(8); foreach (string item in typePool) { if (!banned.Contains(item)) { ModifierDef modifierDef = FindModifier(item); if (modifierDef == null) { Log.Error("SelectModifier: Returning null for name " + item); } else if (modifierDef.isAvailable() && (modifierDef.tier == tier || (modifierDef.tier < tier && modifierDef.isStackable))) { val.AddChoice(modifierDef, 1f); } } } if (val.Count > 0) { return val.Evaluate(Run.instance.stageRng.nextNormalizedFloat); } Log.Warning(string.Format("{0}: Selection is empty for Type: {1}, Tier: {2}, banlist:", "SelectModifier", portalType, tier)); foreach (string item2 in banned) { Log.Warning("\t" + item2); } return null; } private static Sprite LoadSprite(string address, bool isArtifact, bool isItem) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (address.Contains("RoR2/")) { return Addressables.LoadAssetAsync((object)address).WaitForCompletion(); } if (isArtifact) { ArtifactDef val = ArtifactCatalog.FindArtifactDef(address); return ((Object)(object)val != (Object)null) ? val.smallIconSelectedSprite : AssetManager.placeholderIcon; } if (isItem) { ItemIndex val2 = ItemCatalog.FindItemIndex(address); if ((int)val2 != -1) { return ItemCatalog.GetItemDef(val2).pickupIconSprite; } } if ((Object)(object)assetBundle != (Object)null && assetBundle.Contains(address)) { return assetBundle.LoadAsset(address); } Log.Warning("Not found sprite for " + address); return AssetManager.placeholderIcon; } public static bool isPortalTypeAvailable(RoutePortalType type) { return true; } public static string GetModifierNameFormatted(ModifierSync mod, ModifierDef def) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected I4, but got Unknown string text = ((mod.stack > 1) ? $" - x{mod.stack}" : ""); if (def.name.Contains("_Printer") || def.name.Contains("_EnemyItem") || def.name.Contains("_LunarItem")) { string text2 = def.name.Split('_')[0]; ItemIndex val = ItemCatalog.FindItemIndex(text2); ItemDef itemDef = ItemCatalog.GetItemDef(val); string text3 = text2; if ((Object)(object)itemDef != (Object)null) { string @string = Language.GetString(itemDef.nameToken); string text4 = "#FFFFFF"; ItemTier tier = itemDef.tier; ItemTier val2 = tier; text4 = (int)val2 switch { 0 => "#FFFFFF", 1 => "#72ff13", 2 => "#e65541", 4 => "#E4C415", 3 => "#4AE2F7", 6 => "#e95fae", 7 => "#e95fae", 8 => "#e95fae", 9 => "#e95fae", _ => "#FFFFFF", }; text3 = "" + @string + ""; } if (def.name.Contains("_Printer")) { return Language.GetStringFormatted("PRINTER_ITEMS_MODIFIER_NAME", new object[1] { text3 }); } if (def.name.Contains("_EnemyItem")) { if ((Object)(object)itemDef != (Object)null) { int itemStack = EnemyItemsModifier.GetItemStack(itemDef, mod.stack); return Language.GetStringFormatted("ENEMY_ITEMS_MODIFIER_NAME", new object[2] { text3, itemStack }); } return Language.GetStringFormatted("ENEMY_ITEMS_MODIFIER_NAME", new object[2] { text3, mod.stack }); } if (def.name.Contains("_LunarItem")) { return Language.GetStringFormatted("LUNAR_ITEMS_MODIFIER_NAME", new object[1] { text3 }); } } return Language.GetString(def.nameToken) + text; } public static string GetModifierDescriptionFormatted(ModifierSync mod, ModifierDef def) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected I4, but got Unknown string text = ((mod.stack > 1) ? $" - x{mod.stack}" : ""); if (def.name.Contains("_Printer") || def.name.Contains("_EnemyItem") || def.name.Contains("_LunarItem")) { string text2 = def.name.Split('_')[0]; ItemIndex val = ItemCatalog.FindItemIndex(text2); ItemDef itemDef = ItemCatalog.GetItemDef(val); string text3 = text2; if ((Object)(object)itemDef != (Object)null) { string @string = Language.GetString(itemDef.nameToken); string text4 = "#FFFFFF"; ItemTier tier = itemDef.tier; ItemTier val2 = tier; text4 = (int)val2 switch { 0 => "#FFFFFF", 1 => "#72ff13", 2 => "#e65541", 4 => "#E4C415", 3 => "#4AE2F7", 6 => "#e95fae", 7 => "#e95fae", 8 => "#e95fae", 9 => "#e95fae", _ => "#FFFFFF", }; text3 = "" + @string + ""; } if (def.name.Contains("_Printer")) { return Language.GetStringFormatted("PRINTER_ITEMS_MODIFIER_DESCRIPTION", new object[1] { text3 }); } if (def.name.Contains("_EnemyItem")) { if ((Object)(object)itemDef != (Object)null) { int itemStack = EnemyItemsModifier.GetItemStack(itemDef, mod.stack); return Language.GetStringFormatted("ENEMY_ITEMS_MODIFIER_DESCRIPTION", new object[2] { text3, itemStack }); } return Language.GetStringFormatted("ENEMY_ITEMS_MODIFIER_DESCRIPTION", new object[2] { text3, mod.stack }); } if (def.name.Contains("_LunarItem")) { if (StageModifierDirector.instance.purifyLunarItemModifier) { return Language.GetStringFormatted("LUNAR_ITEMS_MODIFIER_DESCRIPTION_PURIFY", new object[1] { text3 }); } return Language.GetStringFormatted("LUNAR_ITEMS_MODIFIER_DESCRIPTION_DEFAULT", new object[1] { text3 }); } } else { if (def.isArtifact) { return "" + Language.GetStringFormatted(def.descriptionToken, Array.Empty()) + ""; } if (def.name == "Doppelganger") { string cooldownString = DoppelgangerModifier.GetCooldownString(mod.stack); return Language.GetStringFormatted("MODIFIER_DOPPELGANGER_DESCRIPTION", new object[1] { cooldownString }); } } return Language.GetString(def.descriptionToken) + text; } } } namespace RiskOfRoutes.StageModifiers.SceneModifiers { public class SoulCostController { [CompilerGenerated] private static class <>O { public static hook_BuildCostStringStyled <0>__AppendSoulCost; public static StatHookEventHandler <1>__AppendHPBarCurse; } public static void Initialize() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: 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_003d: Expected O, but got Unknown object obj = <>O.<0>__AppendSoulCost; if (obj == null) { hook_BuildCostStringStyled val = AppendSoulCost; <>O.<0>__AppendSoulCost = val; obj = (object)val; } CostTypeDef.BuildCostStringStyled += (hook_BuildCostStringStyled)obj; object obj2 = <>O.<1>__AppendHPBarCurse; if (obj2 == null) { StatHookEventHandler val2 = AppendHPBarCurse; <>O.<1>__AppendHPBarCurse = val2; obj2 = (object)val2; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj2; } private static void AppendSoulCost(orig_BuildCostStringStyled orig, CostTypeDef self, int cost, StringBuilder stringBuilder, bool forWorldDisplay, bool includeColor) { orig.Invoke(self, cost, stringBuilder, forWorldDisplay, includeColor); if (Object.op_Implicit((Object)(object)StageModifierDirector.instance) && StageModifierDirector.instance.IsModifierActive("SoulCost")) { int soulCostStack = StageModifierDirector.instance.soulCostStack; if (self == CostTypeCatalog.GetCostTypeDef((CostTypeIndex)1)) { stringBuilder.AppendLine($" + {3 + (soulCostStack - 1)}% Soul"); } } } private static void AppendHPBarCurse(CharacterBody sender, StatHookEventArgs args) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)StageModifierDirector.instance) && StageModifierDirector.instance.IsModifierActive("SoulCost") && Object.op_Implicit((Object)(object)sender.teamComponent) && (int)sender.teamComponent.teamIndex == 1) { float syncedBaseCurse = StageModifierDirector.instance.syncedBaseCurse; float num = Mathf.Min(0.99f, syncedBaseCurse); float num2 = 1f - num; float num3 = 1f / num2 - 1f; args.baseCurseAdd += num3; } } } public class SoulCostModifier : StageModifier { public float curseAdd = 0f; public SoulCostModifier(int stack) { base.stack = stack; } public override void OnEnd() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown PurchaseInteraction.Awake -= new hook_Awake(PurchaseInteraction_Awake); } public override void OnStart() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown curseAdd = 0.03f + (float)(stack - 1) * Mathf.Max((float)(RiskOfRoutes.soulCostStackPercent.Value / 100), 0.25f); if (NetworkServer.active && Object.op_Implicit((Object)(object)StageModifierDirector.instance)) { StageModifierDirector.instance.NetworksoulCostStack = stack; StageModifierDirector.instance.NetworksyncedBaseCurse = 0f; } Log.Info($"SoulCost stack - {stack}"); Log.Info($"CurseAdd - {curseAdd}"); PurchaseInteraction.Awake += new hook_Awake(PurchaseInteraction_Awake); } private void PurchaseInteraction_Awake(orig_Awake orig, PurchaseInteraction self) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 orig.Invoke(self); if ((int)self.costType == 1) { ((UnityEvent)(object)self.onPurchase).AddListener((UnityAction)PlayerPurchase); } } private void PlayerPurchase(Interactor interactor) { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)StageModifierDirector.instance)) { return; } StageModifierDirector instance = StageModifierDirector.instance; instance.NetworksyncedBaseCurse = instance.syncedBaseCurse + curseAdd; foreach (PlayerCharacterMasterController instance2 in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance2.master) && Object.op_Implicit((Object)(object)instance2.master.GetBody())) { instance2.master.GetBody().RecalculateStats(); } } } } } namespace RiskOfRoutes.StageModifiers.OtherModifiers { public class LunarItemsModifier : StageModifier { private ItemDef lunarItem; public LunarItemsModifier(string internalName) { lunarItem = PrinterItemModifier.stringToItemDef(internalName); } public LunarItemsModifier(ItemDef item) { lunarItem = item; } public override void OnEnd() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown if ((Object)(object)lunarItem == (Object)null || (Object)(object)Run.instance == (Object)null || PlayerCharacterMasterController.instances == null || CharacterMaster.readOnlyInstancesList.Count == 0) { Log.Error("Lunar item is null"); return; } ItemIcon.SetItemIndex_ItemIndex_int_float -= new hook_SetItemIndex_ItemIndex_int_float(ItemIcon_SetItemIndex_ItemIndex_int_float); ReadOnlyCollection instances = PlayerCharacterMasterController.instances; foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (!((Object)(object)readOnlyInstances.playerCharacterMasterController != (Object)null) || !((Object)(object)readOnlyInstances.inventory != (Object)null)) { continue; } ItemDef val = ((Run.instance.stageRng.nextNormalizedFloat > 0.2f) ? Items.Pearl : Items.ShinyPearl); if (readOnlyInstances.inventory.GetItemCountEffective(lunarItem) > 0) { readOnlyInstances.inventory.RemoveItemPermanent(lunarItem, 1); if (StageModifierDirector.instance.purifyLunarItemModifier) { readOnlyInstances.inventory.GiveItemPermanent(val, 1); Log.Info("LunarItemModifier Gave player " + readOnlyInstances.playerCharacterMasterController.GetDisplayName() + " a " + ((Object)val).name); } } } } public override void OnStart() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if ((Object)(object)lunarItem == (Object)null) { Log.Error("Lunar item is null"); return; } ItemIcon.SetItemIndex_ItemIndex_int_float += new hook_SetItemIndex_ItemIndex_int_float(ItemIcon_SetItemIndex_ItemIndex_int_float); foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances.playerCharacterMasterController != (Object)null && (Object)(object)readOnlyInstances.inventory != (Object)null) { readOnlyInstances.inventory.GiveItemPermanent(lunarItem, 1); } } } private void ItemIcon_SetItemIndex_ItemIndex_int_float(orig_SetItemIndex_ItemIndex_int_float orig, ItemIcon self, ItemIndex newItemIndex, int newItemCount, float newDurationPercent) { //IL_0003: 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_0015: 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) orig.Invoke(self, newItemIndex, newItemCount, newDurationPercent); if (newItemIndex == lunarItem.itemIndex) { ((Graphic)self.image).color = new Color(0.3f, 0.3f, 0.3f, 1f); } } } public class SaveMountainEffectModifier : StageModifier { public SaveMountainEffectModifier(int stack) { base.stack = stack; } public override void OnEnd() { Log.Info("SaveMountain on end"); Stage.onServerStageBegin -= Stage_onServerStageBegin; } public override void OnStart() { Log.Info("SaveMountain on start"); Stage.onServerStageBegin += Stage_onServerStageBegin; } private void Stage_onServerStageBegin(Stage obj) { TeleporterInteraction.instance.SetShrineStack(stack); } } public class UpgradeDronesModifier : StageModifier { public UpgradeDronesModifier(int stack) { base.stack = stack; } public override void OnEnd() { Log.Info("Droen upgrade end"); } public override void OnStart() { Log.Info("UpgradeDrones on start"); for (int i = 0; i < stack; i++) { UpgradePlayerDrones(); } } private void UpgradePlayerDrones() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances == (Object)null) { continue; } CharacterBody body = readOnlyInstances.GetBody(); MinionGroup val = MinionGroup.FindGroup(((NetworkBehaviour)readOnlyInstances).netId); if (val == null) { continue; } MinionOwnership[] members = val.members; if (members == null || members.Length == 0) { continue; } MinionOwnership[] array = members; foreach (MinionOwnership val2 in array) { if (Object.op_Implicit((Object)(object)val2)) { CharacterMaster component = ((Component)val2).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.inventory)) { component.inventory.GiveItemPermanent(Items.DroneUpgradeHidden, stack); } } } } } } } namespace RiskOfRoutes.StageModifiers.CombatModifiers { public class DoppelgangerModifier : StageModifier { private float coolDown = 0f; private static float defaultTime = 240f; public DoppelgangerModifier(int stack) { base.stack = stack; } public override void OnEnd() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Run.FixedUpdate -= new hook_FixedUpdate(Run_FixedUpdate); } public override void OnStart() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown coolDown = Run.instance.GetRunStopwatch() + defaultTime; Run.FixedUpdate += new hook_FixedUpdate(Run_FixedUpdate); } private void Run_FixedUpdate(orig_FixedUpdate orig, Run self) { orig.Invoke(self); if (NetworkServer.active && !self.isGameOverServer && self.fixedTime > coolDown) { Log.Info("Here doppel"); PerformInvasion(); coolDown = self.fixedTime + Mathf.Max(defaultTime - (float)(RiskOfRoutes.doppelStackTime.Value * (stack - 1)), 60f); } } public static string GetCooldownString(int stack) { float num = Mathf.Max(defaultTime - (float)(StageModifierDirector.instance.doppelStackTime * (stack - 1)), 60f); int num2 = Mathf.RoundToInt(num); int num3 = num2 / 60; int num4 = num2 % 60; if (num4 > 0) { return Language.GetStringFormatted("DOPPELGANGER_TIME", new object[2] { num3, num4 }); } return Language.GetStringFormatted("DOPPELGANGER_TIME_MINUTE", new object[1] { num3 }); } private void PerformInvasion() { ReadOnlyCollection instances = PlayerCharacterMasterController.instances; Log.Info(instances.Count); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.master) && !instance.master.IsDeadAndOutOfLivesServer()) { CreateDoppelganger(instance.master, Run.instance.stageRng); } } } private static void CreateDoppelganger(CharacterMaster srcCharacterMaster, Xoroshiro128Plus rng) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_007f: 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_009f: Expected O, but got Unknown Log.Info("Doppel"); SpawnCard val = (SpawnCard)(object)FromMaster(srcCharacterMaster); if (!Object.op_Implicit((Object)(object)val)) { Log.Error("No spawn card"); return; } Transform spawnOnTarget; MonsterSpawnDistance val2; if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance)) { spawnOnTarget = ((Component)TeleporterInteraction.instance).transform; val2 = (MonsterSpawnDistance)1; } else { spawnOnTarget = srcCharacterMaster.GetBody().coreTransform; val2 = (MonsterSpawnDistance)1; } DirectorPlacementRule val3 = new DirectorPlacementRule { spawnOnTarget = spawnOnTarget, placementMode = (PlacementMode)3 }; DirectorCore.GetMonsterSpawnDistance(val2, ref val3.minDistance, ref val3.maxDistance); DirectorSpawnRequest val4 = new DirectorSpawnRequest(val, val3, rng); val4.teamIndexOverride = (TeamIndex)2; val4.ignoreTeamMemberLimit = true; CombatSquad combatSquad = null; val4.onSpawnedServer = (Action)Delegate.Combine(val4.onSpawnedServer, (Action)delegate(SpawnResult result) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)combatSquad)) { combatSquad = Object.Instantiate(LegacyResourcesAPI.Load("Prefabs/NetworkedObjects/Encounters/ShadowCloneEncounter")).GetComponent(); } combatSquad.AddMember(result.spawnedInstance.GetComponent()); }); DirectorCore.instance.TrySpawnObject(val4); Object.Destroy((Object)(object)val); } public static DoppelgangerSpawnCard FromMaster(CharacterMaster srcCharacterMaster) { if (!Object.op_Implicit((Object)(object)srcCharacterMaster) || !Object.op_Implicit((Object)(object)srcCharacterMaster.GetBody())) { Log.Error("Here"); return null; } DoppelgangerSpawnCard val = ScriptableObject.CreateInstance(); MasterCopySpawnCard.CopyDataFromMaster((MasterCopySpawnCard)(object)val, srcCharacterMaster, true, true); ((MasterCopySpawnCard)val).GiveItem(Items.InvadingDoppelganger, 1); ((MasterCopySpawnCard)val).onPreSpawnSetup = OnPreSpawnSetup; return val; void OnPreSpawnSetup(CharacterMaster spawnedMaster) { BaseAI ai = ((Component)spawnedMaster).GetComponent(); CharacterBody srcBody = srcCharacterMaster.GetBody(); ai.onBodyDiscovered += SetEnemyToOriginator; void SetEnemyToOriginator(CharacterBody body) { ai.currentEnemy.gameObject = ((Component)srcBody).gameObject; ai.onBodyDiscovered -= SetEnemyToOriginator; } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace Unity { [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] public class GeneratedNetworkCode { public static void _ReadStructSyncListModifier_None(NetworkReader reader, SyncListModifier instance) { ushort num = reader.ReadUInt16(); ((SyncList)(object)instance).Clear(); for (ushort num2 = 0; num2 < num; num2++) { ((SyncListStruct)instance).AddInternal(instance.DeserializeItem(reader)); } } public static void _WriteStructSyncListModifier_None(NetworkWriter writer, SyncListModifier value) { ushort count = ((SyncListStruct)value).Count; writer.Write(count); for (ushort num = 0; num < count; num++) { value.SerializeItem(writer, ((SyncListStruct)value).GetItem((int)num)); } } public static void _ReadStructSyncListRouteNode_None(NetworkReader reader, SyncListRouteNode instance) { ushort num = reader.ReadUInt16(); ((SyncList)(object)instance).Clear(); for (ushort num2 = 0; num2 < num; num2++) { ((SyncListStruct)instance).AddInternal(instance.DeserializeItem(reader)); } } public static void _WriteStructSyncListRouteNode_None(NetworkWriter writer, SyncListRouteNode value) { ushort count = ((SyncListStruct)value).Count; writer.Write(count); for (ushort num = 0; num < count; num++) { value.SerializeItem(writer, ((SyncListStruct)value).GetItem((int)num)); } } public static RouteNodeSync _ReadRouteNodeSync_None(NetworkReader reader) { RouteNodeSync result = default(RouteNodeSync); result.portalType = (RoutePortalType)reader.ReadInt32(); result.x = (int)reader.ReadPackedUInt32(); result.y = (int)reader.ReadPackedUInt32(); result.frontX = (int)reader.ReadPackedUInt32(); result.frontY = (int)reader.ReadPackedUInt32(); result.leftX = (int)reader.ReadPackedUInt32(); result.leftY = (int)reader.ReadPackedUInt32(); result.rightX = (int)reader.ReadPackedUInt32(); result.rightY = (int)reader.ReadPackedUInt32(); result.bonusX = (int)reader.ReadPackedUInt32(); result.bonusY = (int)reader.ReadPackedUInt32(); result.visited = reader.ReadBoolean(); result.shopVisited = reader.ReadBoolean(); result.goldshoresVisited = reader.ReadBoolean(); result.voidFieldsVisited = reader.ReadBoolean(); return result; } public static RouteNodeSync[] _ReadArrayRouteNodeSync_None(NetworkReader reader) { int num = reader.ReadUInt16(); if (num == 0) { return new RouteNodeSync[0]; } RouteNodeSync[] array = new RouteNodeSync[num]; for (int i = 0; i < num; i++) { ref RouteNodeSync reference = ref array[i]; reference = _ReadRouteNodeSync_None(reader); } return array; } public static void _WriteRouteNodeSync_None(NetworkWriter writer, RouteNodeSync value) { writer.Write((int)value.portalType); writer.WritePackedUInt32((uint)value.x); writer.WritePackedUInt32((uint)value.y); writer.WritePackedUInt32((uint)value.frontX); writer.WritePackedUInt32((uint)value.frontY); writer.WritePackedUInt32((uint)value.leftX); writer.WritePackedUInt32((uint)value.leftY); writer.WritePackedUInt32((uint)value.rightX); writer.WritePackedUInt32((uint)value.rightY); writer.WritePackedUInt32((uint)value.bonusX); writer.WritePackedUInt32((uint)value.bonusY); writer.Write(value.visited); writer.Write(value.shopVisited); writer.Write(value.goldshoresVisited); writer.Write(value.voidFieldsVisited); } public static void _WriteArrayRouteNodeSync_None(NetworkWriter writer, RouteNodeSync[] value) { if (value == null) { writer.Write((ushort)0); return; } ushort num = (ushort)value.Length; writer.Write(num); for (ushort num2 = 0; num2 < value.Length; num2++) { _WriteRouteNodeSync_None(writer, value[num2]); } } } }