using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPORace.LevelGeneration;
using RepoRace.MainMenu;
using RepoRace.Utility;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("danos")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+735e981f814c5b61a6c310b41813196ad5b6b25c")]
[assembly: AssemblyProduct("RepoRace")]
[assembly: AssemblyTitle("RepoRace")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace REPORace.Patches
{
[HarmonyPatch]
public class CompletePatch
{
[HarmonyPatch(typeof(TruckScreenText), "GotoNextLevel")]
[HarmonyPrefix]
public static bool GoToNextLevelPrefix()
{
RepoRaceGameManager instance = RepoRaceGameManager.Instance;
if ((Object)(object)instance == (Object)null)
{
return true;
}
instance.CompletedRound();
return true;
}
}
[HarmonyPatch]
internal class MainMenuButtonPatch
{
[HarmonyPatch(typeof(MenuPageEsc), "ButtonEventQuitToMenu")]
[HarmonyPrefix]
public static bool Prefix()
{
ForfitMatch();
return true;
}
[HarmonyPatch(typeof(MenuPageEsc), "ButtonEventQuit")]
[HarmonyPrefix]
public static bool OtherPrefix()
{
ForfitMatch();
return true;
}
private static void ForfitMatch()
{
RepoRaceGameManager instance = RepoRaceGameManager.Instance;
if (!((Object)(object)instance == (Object)null))
{
instance.CompleteMatch("forfeit");
}
}
}
public class ShopItemManagerPatch
{
[HarmonyPatch(typeof(ShopManager), "GetAllItemsFromStatsManager")]
[HarmonyPrefix]
private static bool Prefix(ShopManager __instance)
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Invalid comparison between Unknown and I4
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Invalid comparison between Unknown and I4
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Invalid comparison between Unknown and I4
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Invalid comparison between Unknown and I4
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Invalid comparison between Unknown and I4
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Invalid comparison between Unknown and I4
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Invalid comparison between Unknown and I4
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
Random rng = new Random(DanosLevelGenerator.Seed);
if (SemiFunc.IsNotMasterClient())
{
return false;
}
__instance.potentialItems.Clear();
__instance.potentialItemConsumables.Clear();
__instance.potentialItemUpgrades.Clear();
__instance.potentialItemHealthPacks.Clear();
__instance.potentialSecretItems.Clear();
foreach (Item value in StatsManager.instance.itemDictionary.Values)
{
int num = SemiFunc.StatGetItemsPurchased(value.itemAssetName);
float num2 = value.value.valueMax / 1000f * __instance.itemValueMultiplier;
if ((int)value.itemType == 3)
{
num2 -= num2 * 0.05f * (float)(GameDirector.instance.PlayerList.Count - 1);
int itemsUpgradesPurchased = StatsManager.instance.GetItemsUpgradesPurchased(value.itemAssetName);
num2 += num2 * __instance.upgradeValueIncrease * (float)itemsUpgradesPurchased;
num2 = Mathf.Ceil(num2);
}
if ((int)value.itemType == 8)
{
num2 += num2 * __instance.healthPackValueIncrease * (float)RunManager.instance.levelsCompleted;
num2 = Mathf.Ceil(num2);
}
if ((int)value.itemType == 5)
{
num2 += num2 * __instance.crystalValueIncrease * (float)RunManager.instance.levelsCompleted;
num2 = Mathf.Ceil(num2);
}
float num3 = Mathf.Clamp(num2, 1f, num2);
bool flag = (int)value.itemType == 5;
bool flag2 = (int)value.itemType == 3;
bool flag3 = (int)value.itemType == 8;
int maxAmountInShop = value.maxAmountInShop;
if (num >= maxAmountInShop || (value.maxPurchase && StatsManager.instance.GetItemsUpgradesPurchasedTotal(value.itemAssetName) >= value.maxPurchaseAmount))
{
continue;
}
for (int i = 0; i < maxAmountInShop - num; i++)
{
if (flag2)
{
__instance.potentialItemUpgrades.Add(value);
continue;
}
if (flag3)
{
__instance.potentialItemHealthPacks.Add(value);
continue;
}
if (flag)
{
__instance.potentialItemConsumables.Add(value);
continue;
}
if ((int)value.itemSecretShopType == 0)
{
__instance.potentialItems.Add(value);
continue;
}
if (!__instance.potentialSecretItems.ContainsKey(value.itemSecretShopType))
{
__instance.potentialSecretItems.Add(value.itemSecretShopType, new List<Item>());
}
__instance.potentialSecretItems[value.itemSecretShopType].Add(value);
}
}
__instance.potentialItems.ShuffleWithRng(rng);
__instance.potentialItemConsumables.ShuffleWithRng(rng);
__instance.potentialItemUpgrades.ShuffleWithRng(rng);
__instance.potentialItemHealthPacks.ShuffleWithRng(rng);
foreach (List<Item> value2 in __instance.potentialSecretItems.Values)
{
value2.ShuffleWithRng(rng);
}
return false;
}
[HarmonyPatch(typeof(ShopManager), "GetAllItemVolumesInScene")]
[HarmonyPrefix]
private static bool GetAllItemVolumesInScenePrefix(ShopManager __instance)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Invalid comparison between Unknown and I4
//IL_0069: 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_0085: Unknown result type (might be due to invalid IL or missing references)
Random rng = new Random(DanosLevelGenerator.Seed);
if (SemiFunc.IsNotMasterClient())
{
return false;
}
__instance.itemVolumes.Clear();
ItemVolume[] array = Object.FindObjectsOfType<ItemVolume>();
ItemVolume[] array2 = array;
foreach (ItemVolume val in array2)
{
if ((int)val.itemSecretShopType == 0)
{
__instance.itemVolumes.Add(val);
continue;
}
if (!__instance.secretItemVolumes.ContainsKey(val.itemSecretShopType))
{
__instance.secretItemVolumes.Add(val.itemSecretShopType, new List<ItemVolume>());
}
__instance.secretItemVolumes[val.itemSecretShopType].Add(val);
}
foreach (List<ItemVolume> value in __instance.secretItemVolumes.Values)
{
value.ShuffleWithRng(rng);
}
__instance.itemVolumes.ShuffleWithRng(rng);
return false;
}
}
[HarmonyPatch]
internal class StallingPatch
{
[HarmonyPatch(typeof(TruckScreenText), "NextLine")]
[HarmonyPrefix]
private static bool Prefix(TruckScreenText __instance, int _currentLineIndex)
{
Random random = new Random(DanosLevelGenerator.Seed);
List<TextPages> pages = __instance.pages;
int currentPageIndex = __instance.currentPageIndex;
int currentLineIndex = __instance.currentLineIndex;
if (pages[currentPageIndex].textLines.Count != 0)
{
int maxValue = pages[currentPageIndex].textLines[currentLineIndex].textLines.Count();
if (GameManager.instance.gameMode == 0)
{
int num = random.Next(0, maxValue);
__instance.NextLineLogic(_currentLineIndex, num);
}
else if (PhotonNetwork.IsMasterClient)
{
int num2 = random.Next(0, maxValue);
__instance.photonView.RPC("NextLineRPC", (RpcTarget)0, new object[2] { num2, _currentLineIndex });
}
}
return false;
}
}
[HarmonyPatch]
public class ValuableObjectPatch
{
[HarmonyPatch(typeof(ValuableObject), "DollarValueSetLogic")]
[HarmonyPrefix]
public static bool DollarValueSetLogicPrefix(ValuableObject __instance)
{
if (DanosValuableGeneration.Instance == null)
{
Debug.LogError((object)"DanosValuableGeneration instance is null. Please ensure it is initialized before calling DollarValueSetLogic.");
return true;
}
DanosValuableGeneration.Instance.DollarValueSetLogic(__instance);
return false;
}
[HarmonyPatch(typeof(ValuableObject), "Start")]
[HarmonyPrefix]
private static bool QueueObjectPrefix(ValuableObject __instance)
{
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Invalid comparison between Unknown and I4
__instance.physGrabObject = ((Component)__instance).GetComponent<PhysGrabObject>();
__instance.roomVolumeCheck = ((Component)__instance).GetComponent<RoomVolumeCheck>();
__instance.navMeshObstacle = ((Component)__instance).GetComponent<NavMeshObstacle>();
if (Object.op_Implicit((Object)(object)__instance.navMeshObstacle))
{
Debug.LogError((object)(((Object)((Component)__instance).gameObject).name + " has a NavMeshObstacle component. Please remove it."));
}
if (!SemiFunc.IsMultiplayer())
{
DanosValuableGeneration.Instance.DollarValueSetLogic(__instance);
}
else if (SemiFunc.IsMasterClient())
{
DanosValuableGeneration.Instance.DollarValueSetLogic(__instance);
__instance.photonView.RPC("DollarValueSetRPC", (RpcTarget)1, new object[1] { __instance.dollarValueCurrent });
}
((MonoBehaviour)__instance).StartCoroutine(DanosValuableGeneration.CustomDollarValueSet(__instance));
__instance.rigidBodyMass = __instance.physAttributePreset.mass;
__instance.rb = ((Component)__instance).GetComponent<Rigidbody>();
if (Object.op_Implicit((Object)(object)__instance.rb))
{
__instance.rb.mass = __instance.rigidBodyMass;
}
__instance.physGrabObject.massOriginal = __instance.rigidBodyMass;
if (!LevelGenerator.Instance.Generated)
{
ValuableDirector instance = ValuableDirector.instance;
instance.valuableSpawnAmount++;
ValuableDirector.instance.valuableList.Add(__instance);
}
if ((int)__instance.volumeType <= 1)
{
__instance.physGrabObject.clientNonKinematic = true;
}
return false;
}
}
}
namespace REPORace.Patches.LevelGeneration
{
[HarmonyPatch(typeof(LevelGenerator), "Start")]
public class Patch_LevelManager_Generate
{
private static bool Prefix(LevelGenerator __instance)
{
if (StatsManager.instance.teamName != RepoRaceGameManagerUtils.SaveName)
{
return true;
}
if ((Object)(object)RepoRaceGameManager.Instance == (Object)null)
{
return true;
}
string text = null;
FTTDMapData currentMapData = RepoRaceGameManager.Instance.GetCurrentMapData();
text = currentMapData.seed.ToString();
if (string.IsNullOrEmpty(text))
{
Debug.LogWarning((object)"Seed is null or empty. Using default seed 0.");
return true;
}
if (!int.TryParse(text, out var result))
{
Debug.LogError((object)("Failed to parse seed '" + text + "' to an integer. Using default seed 0."));
return true;
}
Debug.Log((object)result);
DollarValueGenerationQueue.Reset();
DanosEnemyGeneration.Create(result);
DanosLevelGenerator.Create(result);
DanosValuableGeneration.Create(result);
Random.InitState(result);
((MonoBehaviour)__instance).StartCoroutine(DanosLevelGenerator.GenerateWithSeed(__instance, result));
return false;
}
}
[HarmonyPatch(typeof(LevelGenerator), "PickModule")]
internal class PickModulePatch
{
private static bool Prefix(ref GameObject __result, List<GameObject> _list1, List<GameObject> _list2, List<GameObject> _list3, ref int _index1, ref int _index2, ref int _index3, ref int _loops1, ref int _loops2, ref int _loops3)
{
DanosLevelGenerator instance = DanosLevelGenerator.Instance;
if (instance == null)
{
return true;
}
LevelGenerator instance2 = LevelGenerator.Instance;
if ((Object)(object)instance2 == (Object)null)
{
return true;
}
__result = DanosLevelGenerator.PickModule(_list1, _list2, _list3, ref _index1, ref _index2, ref _index3, ref _loops1, ref _loops2, ref _loops3, instance2, instance.rng);
if ((Object)(object)__result == (Object)null)
{
return true;
}
return false;
}
}
[HarmonyPatch(typeof(RunManager), "SetRunLevel")]
public class RunManagerPatch_SetRunLevel
{
private static void Postfix(RunManager __instance)
{
MonthlyLogic(__instance);
}
private static void MonthlyLogic(RunManager instance)
{
List<Level> levels = instance.levels;
if (levels == null || levels.Count == 0 || (Object)(object)RepoRaceGameManager.Instance == (Object)null || RepoRaceGameManager.Instance.FirstToTenData == null)
{
return;
}
FTTDMapData currentMapData = RepoRaceGameManager.Instance.GetCurrentMapData();
if (currentMapData == null)
{
return;
}
string map = currentMapData.map;
if (string.IsNullOrEmpty(map))
{
return;
}
foreach (Level item in levels)
{
if ((Object)(object)item != (Object)null && item.ResourcePath.Contains(map))
{
instance.levelCurrent = item;
break;
}
}
}
}
}
namespace REPORace.Patches.EnemyDirectorP
{
[HarmonyPatch]
public class EnemyPatches
{
[HarmonyPatch(typeof(EnemyDirector), "PickEnemies")]
[HarmonyPrefix]
public static bool PickEnemiesPrefix(EnemyDirector __instance, List<EnemySetup> _enemiesList)
{
if (DanosEnemyGeneration.Instance == null)
{
return true;
}
DanosEnemyGeneration.Instance?.PickEnemies(__instance, _enemiesList);
return false;
}
}
}
namespace REPORace.LevelGeneration
{
public class DanosEnemyGeneration
{
private Random rng;
public static DanosEnemyGeneration? Instance { get; private set; }
private DanosEnemyGeneration(int seed)
{
Debug.Log((object)("resetting enemy rng with: " + seed));
rng = new Random(seed);
}
public static void Create(int seed)
{
Instance = new DanosEnemyGeneration(seed);
}
public static void Delete()
{
Instance = null;
}
public int Range(int min, int max)
{
return rng.Next(min, max);
}
public float Range(float min, float max)
{
if (min == max)
{
return min;
}
return (float)rng.NextDouble() * (max - min) + min;
}
public void PickEnemies(EnemyDirector edinstance, List<EnemySetup> _enemiesList)
{
int num = DataDirector.instance.SettingValueFetch((Setting)31);
_enemiesList.ShuffleWithRng(rng);
EnemySetup item = null;
float num2 = -1f;
foreach (EnemySetup _enemies in _enemiesList)
{
if ((_enemies.levelsCompletedCondition && (RunManager.instance.levelsCompleted < _enemies.levelsCompletedMin || RunManager.instance.levelsCompleted > _enemies.levelsCompletedMax)) || num < _enemies.runsPlayed)
{
continue;
}
int num3 = 0;
foreach (EnemySetup item2 in RunManager.instance.enemiesSpawned)
{
if ((Object)(object)item2 == (Object)(object)_enemies)
{
num3++;
}
}
int num4 = 0;
foreach (EnemySetup enemy in edinstance.enemyList)
{
if ((Object)(object)enemy == (Object)(object)_enemies)
{
num4++;
}
}
float num5 = 100f;
if (Object.op_Implicit((Object)(object)_enemies.rarityPreset))
{
num5 = _enemies.rarityPreset.chance;
}
float max = Mathf.Max(1f, num5 - 30f * (float)num3 - 10f * (float)num4);
float num6 = Range(0f, max);
if (num6 > num2)
{
item = _enemies;
num2 = num6;
}
}
edinstance.enemyListCurrent.Add(item);
edinstance.enemyList.Add(item);
foreach (EnemySetup enemy2 in edinstance.enemyList)
{
Debug.Log((object)$"Chosen Enemy: {((Object)enemy2).name} - Levels Completed: {RunManager.instance.levelsCompleted}, Runs Played: {num}");
}
}
}
public class DanosLevelGenerator
{
[CompilerGenerated]
private sealed class <GenerateBlockObjects>d__14 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LevelGenerator instance;
private float <moduleWidth>5__1;
private int <x>5__2;
private int <y>5__3;
private float <num>5__4;
private float <num2>5__5;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GenerateBlockObjects>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0036: 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_00ab: Invalid comparison between Unknown and I4
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
goto IL_0347;
}
<>1__state = -1;
instance.waitingForSubCoroutine = true;
instance.State = (LevelState)6;
<moduleWidth>5__1 = LevelGenerator.ModuleWidth * LevelGenerator.TileSize;
<x>5__2 = 0;
goto IL_0389;
IL_0389:
if (<x>5__2 < instance.LevelWidth)
{
<y>5__3 = 0;
goto IL_035a;
}
instance.waitingForSubCoroutine = false;
return false;
IL_035a:
if (<y>5__3 < instance.LevelHeight)
{
if (instance.LevelGrid[<x>5__2, <y>5__3].active && (int)instance.LevelGrid[<x>5__2, <y>5__3].type == 0)
{
<num>5__4 = (float)<x>5__2 * <moduleWidth>5__1 - (float)(instance.LevelWidth / 2) * <moduleWidth>5__1;
<num2>5__5 = (float)<y>5__3 * <moduleWidth>5__1 + <moduleWidth>5__1 / 2f;
if (<y>5__3 + 1 >= instance.LevelHeight || !instance.LevelGrid[<x>5__2, <y>5__3 + 1].active)
{
instance.SpawnBlockObject(new Vector3(<num>5__4, 0f, <num2>5__5 + <moduleWidth>5__1 / 2f), new Vector3(0f, 180f, 0f));
}
if (<x>5__2 + 1 >= instance.LevelWidth || !instance.LevelGrid[<x>5__2 + 1, <y>5__3].active)
{
instance.SpawnBlockObject(new Vector3(<num>5__4 + <moduleWidth>5__1 / 2f, 0f, <num2>5__5), new Vector3(0f, -90f, 0f));
}
if ((<y>5__3 - 1 < 0 || !instance.LevelGrid[<x>5__2, <y>5__3 - 1].active) && (<x>5__2 != instance.LevelWidth / 2 || <y>5__3 != 0))
{
instance.SpawnBlockObject(new Vector3(<num>5__4, 0f, <num2>5__5 - <moduleWidth>5__1 / 2f), new Vector3(0f, 0f, 0f));
}
if (<x>5__2 - 1 < 0 || !instance.LevelGrid[<x>5__2 - 1, <y>5__3].active)
{
instance.SpawnBlockObject(new Vector3(<num>5__4 - <moduleWidth>5__1 / 2f, 0f, <num2>5__5), new Vector3(0f, 90f, 0f));
}
<>2__current = null;
<>1__state = 1;
return true;
}
goto IL_0347;
}
<x>5__2++;
goto IL_0389;
IL_0347:
<y>5__3++;
goto IL_035a;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <GenerateConnectObjects>d__13 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LevelGenerator instance;
private float <moduleWidth>5__1;
private int <x>5__2;
private int <y>5__3;
private float <num>5__4;
private float <num2>5__5;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GenerateConnectObjects>d__13(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_0433: Unknown result type (might be due to invalid IL or missing references)
//IL_0438: Unknown result type (might be due to invalid IL or missing references)
//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
goto IL_0535;
}
<>1__state = -1;
instance.waitingForSubCoroutine = true;
instance.State = (LevelState)4;
<moduleWidth>5__1 = LevelGenerator.ModuleWidth * LevelGenerator.TileSize;
<x>5__2 = 0;
goto IL_0577;
IL_0577:
if (<x>5__2 < instance.LevelWidth)
{
<y>5__3 = 0;
goto IL_0548;
}
instance.waitingForSubCoroutine = false;
return false;
IL_0548:
if (<y>5__3 < instance.LevelHeight)
{
if (instance.LevelGrid[<x>5__2, <y>5__3].active)
{
if (instance.GridCheckActive(<x>5__2, <y>5__3 + 1))
{
Tile obj = instance.LevelGrid[<x>5__2, <y>5__3];
obj.connections++;
}
if (instance.GridCheckActive(<x>5__2, <y>5__3 - 1))
{
Tile obj2 = instance.LevelGrid[<x>5__2, <y>5__3];
obj2.connections++;
}
if (instance.GridCheckActive(<x>5__2 + 1, <y>5__3))
{
Tile obj3 = instance.LevelGrid[<x>5__2, <y>5__3];
obj3.connections++;
}
if (instance.GridCheckActive(<x>5__2 - 1, <y>5__3))
{
Tile obj4 = instance.LevelGrid[<x>5__2, <y>5__3];
obj4.connections++;
}
<num>5__4 = (float)<x>5__2 * <moduleWidth>5__1 - (float)(instance.LevelWidth / 2) * <moduleWidth>5__1;
<num2>5__5 = (float)<y>5__3 * <moduleWidth>5__1 + <moduleWidth>5__1 / 2f;
if (<y>5__3 + 1 < instance.LevelHeight && instance.LevelGrid[<x>5__2, <y>5__3 + 1].active && !instance.LevelGrid[<x>5__2, <y>5__3 + 1].connectedBot)
{
instance.SpawnConnectObject(new Vector3(<num>5__4, 0f, <num2>5__5 + <moduleWidth>5__1 / 2f), Vector3.zero);
instance.LevelGrid[<x>5__2, <y>5__3].connectedTop = true;
}
if (<x>5__2 + 1 < instance.LevelWidth && instance.LevelGrid[<x>5__2 + 1, <y>5__3].active && !instance.LevelGrid[<x>5__2 + 1, <y>5__3].connectedLeft)
{
instance.SpawnConnectObject(new Vector3(<num>5__4 + <moduleWidth>5__1 / 2f, 0f, <num2>5__5), new Vector3(0f, 90f, 0f));
instance.LevelGrid[<x>5__2, <y>5__3].connectedRight = true;
}
if ((<y>5__3 - 1 >= 0 && instance.LevelGrid[<x>5__2, <y>5__3 - 1].active && !instance.LevelGrid[<x>5__2, <y>5__3 - 1].connectedTop) || (<x>5__2 == instance.LevelWidth / 2 && <y>5__3 == 0))
{
instance.SpawnConnectObject(new Vector3(<num>5__4, 0f, <num2>5__5 - <moduleWidth>5__1 / 2f), Vector3.zero);
instance.LevelGrid[<x>5__2, <y>5__3].connectedBot = true;
}
if (<x>5__2 - 1 >= 0 && instance.LevelGrid[<x>5__2 - 1, <y>5__3].active && !instance.LevelGrid[<x>5__2 - 1, <y>5__3].connectedRight)
{
instance.SpawnConnectObject(new Vector3(<num>5__4 - <moduleWidth>5__1 / 2f, 0f, <num2>5__5), Vector3.zero);
instance.LevelGrid[<x>5__2, <y>5__3].connectedLeft = true;
}
<>2__current = null;
<>1__state = 1;
return true;
}
goto IL_0535;
}
<x>5__2++;
goto IL_0577;
IL_0535:
<y>5__3++;
goto IL_0548;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <GenerateWithSeed>d__10 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LevelGenerator instance;
public int seedBase;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GenerateWithSeed>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Expected O, but got Unknown
//IL_0119: 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_012e: Expected O, but got Unknown
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Expected O, but got Unknown
//IL_0387: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Expected O, but got Unknown
//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
//IL_04c3: Expected O, but got Unknown
//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
//IL_057f: Unknown result type (might be due to invalid IL or missing references)
//IL_058a: Unknown result type (might be due to invalid IL or missing references)
//IL_0594: Expected O, but got Unknown
//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
//IL_05fd: Expected O, but got Unknown
//IL_0656: Unknown result type (might be due to invalid IL or missing references)
//IL_0661: Unknown result type (might be due to invalid IL or missing references)
//IL_066b: Expected O, but got Unknown
//IL_0719: Unknown result type (might be due to invalid IL or missing references)
//IL_07bf: Unknown result type (might be due to invalid IL or missing references)
//IL_07c9: Expected O, but got Unknown
//IL_0866: Unknown result type (might be due to invalid IL or missing references)
//IL_0870: Expected O, but got Unknown
//IL_051e: Unknown result type (might be due to invalid IL or missing references)
//IL_0524: Unknown result type (might be due to invalid IL or missing references)
//IL_0408: Unknown result type (might be due to invalid IL or missing references)
//IL_0413: Unknown result type (might be due to invalid IL or missing references)
//IL_041d: Expected O, but got Unknown
//IL_0803: Unknown result type (might be due to invalid IL or missing references)
//IL_077f: Unknown result type (might be due to invalid IL or missing references)
//IL_0789: Expected O, but got Unknown
//IL_081f: Unknown result type (might be due to invalid IL or missing references)
//IL_0825: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Seed = seedBase;
<>2__current = (object)new WaitForSeconds(0.2f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (!SemiFunc.IsMultiplayer())
{
instance.AllPlayersReady = true;
}
goto IL_013f;
case 2:
<>1__state = -1;
goto IL_013f;
case 3:
<>1__state = -1;
instance.Level = RunManager.instance.levelCurrent;
RunManager.instance.levelPrevious = instance.Level;
if (SemiFunc.IsMasterClientOrSingleplayer())
{
instance.ModuleAmount = instance.Level.ModuleAmount;
if (instance.DebugAmount > 0)
{
instance.ModuleAmount = instance.DebugAmount;
}
Random.InitState(seedBase);
((MonoBehaviour)instance).StartCoroutine(TileGeneration(instance));
goto IL_022d;
}
goto IL_03ad;
case 4:
<>1__state = -1;
goto IL_022d;
case 5:
<>1__state = -1;
goto IL_027c;
case 6:
<>1__state = -1;
goto IL_02cb;
case 7:
<>1__state = -1;
goto IL_0326;
case 8:
<>1__state = -1;
goto IL_03ad;
case 9:
<>1__state = -1;
goto IL_042f;
case 10:
<>1__state = -1;
goto IL_04d5;
case 11:
<>1__state = -1;
goto IL_05a6;
case 12:
<>1__state = -1;
goto IL_060f;
case 13:
<>1__state = -1;
goto IL_060f;
case 14:
<>1__state = -1;
goto IL_067d;
case 15:
<>1__state = -1;
goto IL_067d;
case 16:
<>1__state = -1;
if (GameManager.Multiplayer())
{
goto IL_079b;
}
goto IL_07db;
case 17:
<>1__state = -1;
goto IL_079b;
case 18:
<>1__state = -1;
goto IL_07db;
case 19:
{
<>1__state = -1;
goto IL_0882;
}
IL_079b:
if (!instance.EnemyReady)
{
instance.State = (LevelState)14;
if (instance.EnemyReadyPlayers >= PhotonNetwork.CurrentRoom.PlayerCount || instance.EnemiesSpawnTarget <= 0)
{
instance.PhotonView.RPC("EnemyReadyAllRPC", (RpcTarget)3, Array.Empty<object>());
instance.EnemyReady = true;
}
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 17;
return true;
}
goto IL_07fb;
IL_013f:
if (!instance.AllPlayersReady)
{
instance.State = (LevelState)1;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 2;
return true;
}
<>2__current = (object)new WaitForSeconds(0.2f);
<>1__state = 3;
return true;
IL_022d:
if (instance.waitingForSubCoroutine)
{
<>2__current = null;
<>1__state = 4;
return true;
}
Random.InitState(seedBase);
((MonoBehaviour)instance).StartCoroutine(StartRoomGeneration(instance));
goto IL_027c;
IL_05a6:
if (!ValuableDirector.instance.setupComplete)
{
instance.State = (LevelState)11;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 11;
return true;
}
instance.NavMeshSetup();
<>2__current = null;
<>1__state = 12;
return true;
IL_03ad:
if (instance.ModulesSpawned < instance.ModuleAmount - 1)
{
instance.State = (LevelState)7;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 8;
return true;
}
if (GameManager.instance.gameMode == 1)
{
instance.PhotonView.RPC("ModulesReadyRPC", (RpcTarget)3, Array.Empty<object>());
}
goto IL_042f;
IL_07db:
if (instance.EnemiesSpawned < instance.EnemiesSpawnTarget)
{
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 18;
return true;
}
goto IL_07fb;
IL_067d:
if (instance.playerSpawned < GameDirector.instance.PlayerList.Count)
{
instance.State = (LevelState)13;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 15;
return true;
}
if (instance.Level.HasEnemies && !instance.DebugNoEnemy)
{
Random.InitState(seedBase);
instance.EnemySetup();
<>2__current = null;
<>1__state = 16;
return true;
}
goto IL_07fb;
IL_027c:
if (instance.waitingForSubCoroutine)
{
<>2__current = null;
<>1__state = 5;
return true;
}
Random.InitState(seedBase);
((MonoBehaviour)instance).StartCoroutine(GenerateConnectObjects(instance));
goto IL_02cb;
IL_02cb:
if (instance.waitingForSubCoroutine)
{
<>2__current = null;
<>1__state = 6;
return true;
}
Random.InitState(seedBase);
ModuleGeneration(instance);
((MonoBehaviour)instance).StartCoroutine(GenerateBlockObjects(instance));
goto IL_0326;
IL_07fb:
instance.State = (LevelState)15;
if (!SemiFunc.IsMultiplayer())
{
instance.GenerateDone(default(PhotonMessageInfo));
}
else
{
instance.PhotonView.RPC("GenerateDone", (RpcTarget)3, Array.Empty<object>());
}
SessionManager.instance.CrownPlayer();
break;
IL_04d5:
if (instance.LevelPathPoints.Count == 0)
{
instance.State = (LevelState)9;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 10;
return true;
}
instance.State = (LevelState)10;
if (!SemiFunc.IsMultiplayer())
{
Random.InitState(seedBase);
instance.ItemSetup(default(PhotonMessageInfo));
}
else
{
instance.PhotonView.RPC("ItemSetup", (RpcTarget)3, Array.Empty<object>());
}
Random.InitState(seedBase);
((MonoBehaviour)instance).StartCoroutine(DanosValuableGeneration.Instance.SetupHost(ValuableDirector.instance));
goto IL_05a6;
IL_0326:
if (instance.waitingForSubCoroutine)
{
<>2__current = null;
<>1__state = 7;
return true;
}
if (GameManager.instance.gameMode == 1)
{
instance.PhotonView.RPC("ModuleAmountRPC", (RpcTarget)3, new object[1] { instance.ModuleAmount });
}
goto IL_03ad;
IL_042f:
if (GameManager.instance.gameMode == 1 && instance.ModulesReadyPlayers < PhotonNetwork.CurrentRoom.PlayerCount)
{
instance.State = (LevelState)8;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 9;
return true;
}
Random.InitState(seedBase);
EnvironmentDirector.Instance.Setup();
PostProcessing.Instance.Setup();
LevelMusic.instance.Setup();
ConstantMusic.instance.Setup();
if (SemiFunc.IsMasterClientOrSingleplayer())
{
goto IL_04d5;
}
goto IL_0882;
IL_060f:
if (GameDirector.instance.PlayerList.Count == 0)
{
instance.State = (LevelState)12;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 13;
return true;
}
instance.PlayerSpawn();
<>2__current = null;
<>1__state = 14;
return true;
IL_0882:
if (!instance.Generated)
{
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 19;
return true;
}
break;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <StartRoomGeneration>d__12 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LevelGenerator instance;
private List<GameObject> <list>5__1;
private GameObject <gameObject>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <StartRoomGeneration>d__12(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<list>5__1 = null;
<gameObject>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
instance.waitingForSubCoroutine = true;
instance.State = (LevelState)3;
<list>5__1 = new List<GameObject>();
<list>5__1.AddRange(instance.Level.StartRooms);
if (Object.op_Implicit((Object)(object)instance.DebugStartRoom))
{
<list>5__1[0] = instance.DebugStartRoom;
}
<gameObject>5__2 = ((GameManager.instance.gameMode != 0) ? PhotonNetwork.InstantiateRoomObject(instance.ResourceParent + "/" + instance.Level.ResourcePath + "/" + instance.ResourceStart + "/" + ((Object)<list>5__1[0]).name, Vector3.zero, Quaternion.identity, (byte)0, (object[])null) : Object.Instantiate<GameObject>(<list>5__1[0], Vector3.zero, Quaternion.identity));
<gameObject>5__2.transform.parent = instance.LevelParent.transform;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
instance.waitingForSubCoroutine = false;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <TileGeneration>d__11 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LevelGenerator instance;
private int <moduleAmount>5__1;
private int <num>5__2;
private int <num2>5__3;
private List<Tile> <possibleExtractionTiles>5__4;
private int <num7>5__5;
private Tile <tile5>5__6;
private List<Tile> <_extractionTiles>5__7;
private int <num11>5__8;
private int <i>5__9;
private int <j>5__10;
private int <num3>5__11;
private int <num4>5__12;
private int <num5>5__13;
private int <>s__14;
private int <k>5__15;
private int <l>5__16;
private int <num6>5__17;
private Tile <tile>5__18;
private Tile <tile2>5__19;
private Tile <tile3>5__20;
private Tile <tile4>5__21;
private Tile <tile6>5__22;
private float <num8>5__23;
private List<Tile>.Enumerator <>s__24;
private Tile <item>5__25;
private float <num9>5__26;
private List<Tile>.Enumerator <>s__27;
private Tile <item2>5__28;
private float <num10>5__29;
private Tile <tile7>5__30;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TileGeneration>d__11(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<possibleExtractionTiles>5__4 = null;
<tile5>5__6 = null;
<_extractionTiles>5__7 = null;
<tile>5__18 = null;
<tile2>5__19 = null;
<tile3>5__20 = null;
<tile4>5__21 = null;
<tile6>5__22 = null;
<>s__24 = default(List<Tile>.Enumerator);
<item>5__25 = null;
<>s__27 = default(List<Tile>.Enumerator);
<item2>5__28 = null;
<tile7>5__30 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_087b: Unknown result type (might be due to invalid IL or missing references)
//IL_0885: Expected O, but got Unknown
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Expected O, but got Unknown
//IL_094f: Unknown result type (might be due to invalid IL or missing references)
//IL_096c: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
instance.waitingForSubCoroutine = true;
instance.State = (LevelState)2;
instance.LevelWidth = Mathf.Max(2, Mathf.CeilToInt((float)instance.LevelWidth * instance.DebugLevelSize));
instance.LevelHeight = Mathf.Max(2, Mathf.CeilToInt((float)instance.LevelHeight * instance.DebugLevelSize));
instance.LevelGrid = new Tile[instance.LevelWidth, instance.LevelHeight];
<i>5__9 = 0;
while (<i>5__9 < instance.LevelWidth)
{
<j>5__10 = 0;
while (<j>5__10 < instance.LevelHeight)
{
instance.LevelGrid[<i>5__9, <j>5__10] = new Tile
{
x = <i>5__9,
y = <j>5__10,
active = false
};
<j>5__10++;
}
<i>5__9++;
}
instance.ExtractionAmount = 0;
if (instance.ModuleAmount > 4)
{
instance.ModuleAmount = Mathf.Min(5 + RunManager.instance.levelsCompleted, 10);
if (RunManager.instance.levelsCompleted >= 10)
{
LevelGenerator obj = instance;
obj.ModuleAmount += Mathf.Min(RunManager.instance.levelsCompleted - 9, 5);
}
instance.ModuleAmount = Mathf.CeilToInt((float)instance.ModuleAmount * instance.DebugLevelSize);
if (!Object.op_Implicit((Object)(object)instance.DebugModule))
{
instance.DeadEndAmount = Mathf.CeilToInt((float)(instance.ModuleAmount / 3));
if (instance.ModuleAmount >= 15)
{
instance.ExtractionAmount = 4;
}
else if (instance.ModuleAmount >= 10)
{
instance.ExtractionAmount = 3;
}
else if (instance.ModuleAmount >= 8)
{
instance.ExtractionAmount = 2;
}
else if (instance.ModuleAmount >= 6)
{
instance.ExtractionAmount = 1;
}
else
{
instance.ExtractionAmount = 0;
}
}
}
if ((Object)(object)instance.Level == (Object)(object)RunManager.instance.levelShop)
{
instance.DeadEndAmount = 1;
}
<moduleAmount>5__1 = instance.ModuleAmount;
instance.LevelGrid[instance.LevelWidth / 2, 0].active = true;
instance.LevelGrid[instance.LevelWidth / 2, 0].first = true;
<moduleAmount>5__1--;
<num>5__2 = instance.LevelWidth / 2;
<num2>5__3 = 0;
while (<moduleAmount>5__1 > 0)
{
<num3>5__11 = -999;
<num4>5__12 = -999;
while (<num>5__2 + <num3>5__11 < 0 || <num>5__2 + <num3>5__11 >= instance.LevelWidth || <num2>5__3 + <num4>5__12 < 0 || <num2>5__3 + <num4>5__12 >= instance.LevelHeight)
{
<num3>5__11 = 0;
<num4>5__12 = 0;
<num5>5__13 = Instance.rng.Next(0, 4);
if (<num2>5__3 == 1)
{
<num5>5__13 = Instance.rng.Next(0, 3);
}
if (instance.DebugPassage)
{
<num5>5__13 = 2;
}
int num = <num5>5__13;
<>s__14 = num;
switch (<>s__14)
{
case 0:
<num3>5__11--;
break;
case 1:
<num3>5__11++;
break;
case 2:
<num4>5__12++;
break;
case 3:
<num4>5__12--;
break;
}
}
<num>5__2 += <num3>5__11;
<num2>5__3 += <num4>5__12;
if (!instance.LevelGrid[<num>5__2, <num2>5__3].active)
{
instance.LevelGrid[<num>5__2, <num2>5__3].active = true;
<moduleAmount>5__1--;
}
}
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<possibleExtractionTiles>5__4 = new List<Tile>();
if (!instance.DebugNormal && !instance.DebugPassage && !instance.DebugDeadEnd)
{
<k>5__15 = 0;
while (<k>5__15 < instance.LevelWidth)
{
<l>5__16 = 0;
while (<l>5__16 < instance.LevelHeight)
{
if (!instance.LevelGrid[<k>5__15, <l>5__16].active)
{
<num6>5__17 = 0;
<tile>5__18 = instance.GridGetTile(<k>5__15, <l>5__16 + 1);
if (<tile>5__18 != null && <tile>5__18.active)
{
<num6>5__17++;
}
<tile2>5__19 = instance.GridGetTile(<k>5__15 + 1, <l>5__16);
if (<tile2>5__19 != null && <tile2>5__19.active)
{
<num6>5__17++;
}
<tile3>5__20 = instance.GridGetTile(<k>5__15, <l>5__16 - 1);
if (<tile3>5__20 != null && <tile3>5__20.active)
{
<num6>5__17++;
}
<tile4>5__21 = instance.GridGetTile(<k>5__15 - 1, <l>5__16);
if (<tile4>5__21 != null && <tile4>5__21.active)
{
<num6>5__17++;
}
if (<num6>5__17 == 1)
{
<possibleExtractionTiles>5__4.Add(instance.LevelGrid[<k>5__15, <l>5__16]);
}
<tile>5__18 = null;
<tile2>5__19 = null;
<tile3>5__20 = null;
<tile4>5__21 = null;
}
<l>5__16++;
}
<k>5__15++;
}
}
<>2__current = null;
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<num7>5__5 = instance.ExtractionAmount;
<tile5>5__6 = new Tile();
<tile5>5__6.x = instance.LevelWidth / 2;
<tile5>5__6.y = -1;
<_extractionTiles>5__7 = new List<Tile> { <tile5>5__6 };
while (<num7>5__5 > 0 && <possibleExtractionTiles>5__4.Count > 0)
{
<tile6>5__22 = null;
<num8>5__23 = 0f;
<>s__24 = <possibleExtractionTiles>5__4.GetEnumerator();
try
{
while (<>s__24.MoveNext())
{
<item>5__25 = <>s__24.Current;
<num9>5__26 = 9999999f;
<>s__27 = <_extractionTiles>5__7.GetEnumerator();
try
{
while (<>s__27.MoveNext())
{
<item2>5__28 = <>s__27.Current;
<num10>5__29 = Vector2.Distance(new Vector2((float)<item2>5__28.x, (float)<item2>5__28.y), new Vector2((float)<item>5__25.x, (float)<item>5__25.y));
if (<num10>5__29 < <num9>5__26)
{
<num9>5__26 = <num10>5__29;
}
<item2>5__28 = null;
}
}
finally
{
((IDisposable)<>s__27).Dispose();
}
<>s__27 = default(List<Tile>.Enumerator);
if (<num9>5__26 > <num8>5__23)
{
<num8>5__23 = <num9>5__26;
<tile6>5__22 = <item>5__25;
}
<item>5__25 = null;
}
}
finally
{
((IDisposable)<>s__24).Dispose();
}
<>s__24 = default(List<Tile>.Enumerator);
instance.SetExtractionTile((Type)3, <tile6>5__22, ref <_extractionTiles>5__7, ref <possibleExtractionTiles>5__4);
<num7>5__5--;
<tile6>5__22 = null;
}
<>2__current = null;
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<num11>5__8 = instance.DeadEndAmount;
while (<num11>5__8 > 0 && <possibleExtractionTiles>5__4.Count > 0)
{
<tile7>5__30 = <possibleExtractionTiles>5__4[Instance.rng.Next(0, <possibleExtractionTiles>5__4.Count)];
instance.SetExtractionTile((Type)2, <tile7>5__30, ref <_extractionTiles>5__7, ref <possibleExtractionTiles>5__4);
<num11>5__8--;
<tile7>5__30 = null;
}
<>2__current = null;
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
instance.waitingForSubCoroutine = false;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public Random rng;
public static int Seed;
public static DanosLevelGenerator? Instance { get; private set; }
private DanosLevelGenerator(int seed)
{
rng = new Random(seed);
Seed = seed;
}
public static void Create(int seed)
{
Instance = new DanosLevelGenerator(seed);
}
public static void Delete()
{
Instance = null;
}
public int Range(int min, int max)
{
return rng.Next(min, max);
}
[IteratorStateMachine(typeof(<GenerateWithSeed>d__10))]
public static IEnumerator GenerateWithSeed(LevelGenerator instance, int seedBase)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GenerateWithSeed>d__10(0)
{
instance = instance,
seedBase = seedBase
};
}
[IteratorStateMachine(typeof(<TileGeneration>d__11))]
public static IEnumerator TileGeneration(LevelGenerator instance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TileGeneration>d__11(0)
{
instance = instance
};
}
[IteratorStateMachine(typeof(<StartRoomGeneration>d__12))]
public static IEnumerator StartRoomGeneration(LevelGenerator instance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <StartRoomGeneration>d__12(0)
{
instance = instance
};
}
[IteratorStateMachine(typeof(<GenerateConnectObjects>d__13))]
private static IEnumerator GenerateConnectObjects(LevelGenerator instance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GenerateConnectObjects>d__13(0)
{
instance = instance
};
}
[IteratorStateMachine(typeof(<GenerateBlockObjects>d__14))]
private static IEnumerator GenerateBlockObjects(LevelGenerator instance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GenerateBlockObjects>d__14(0)
{
instance = instance
};
}
private static void ModuleGeneration(LevelGenerator instance)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0420: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Invalid comparison between Unknown and I4
//IL_0446: Unknown result type (might be due to invalid IL or missing references)
//IL_044b: Unknown result type (might be due to invalid IL or missing references)
//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0504: Invalid comparison between Unknown and I4
//IL_0527: Unknown result type (might be due to invalid IL or missing references)
//IL_052c: Unknown result type (might be due to invalid IL or missing references)
//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0772: Unknown result type (might be due to invalid IL or missing references)
//IL_0777: Unknown result type (might be due to invalid IL or missing references)
//IL_077c: Unknown result type (might be due to invalid IL or missing references)
//IL_077e: Unknown result type (might be due to invalid IL or missing references)
//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
//IL_067e: Unknown result type (might be due to invalid IL or missing references)
//IL_0680: Unknown result type (might be due to invalid IL or missing references)
//IL_0738: Unknown result type (might be due to invalid IL or missing references)
//IL_073a: Unknown result type (might be due to invalid IL or missing references)
instance.waitingForSubCoroutine = true;
instance.State = (LevelState)5;
instance.ModulesNormalShuffled_1 = new List<GameObject>();
instance.ModulesNormalShuffled_2 = new List<GameObject>();
instance.ModulesNormalShuffled_3 = new List<GameObject>();
instance.ModulesPassageShuffled_1 = new List<GameObject>();
instance.ModulesPassageShuffled_2 = new List<GameObject>();
instance.ModulesPassageShuffled_3 = new List<GameObject>();
instance.ModulesDeadEndShuffled_1 = new List<GameObject>();
instance.ModulesDeadEndShuffled_2 = new List<GameObject>();
instance.ModulesDeadEndShuffled_3 = new List<GameObject>();
instance.ModulesExtractionShuffled_1 = new List<GameObject>();
instance.ModulesExtractionShuffled_2 = new List<GameObject>();
instance.ModulesExtractionShuffled_3 = new List<GameObject>();
instance.ModuleRarity1 = instance.DifficultyCurve1.Evaluate(SemiFunc.RunGetDifficultyMultiplier1());
instance.ModuleRarity2 = instance.DifficultyCurve2.Evaluate(SemiFunc.RunGetDifficultyMultiplier1());
instance.ModuleRarity3 = instance.DifficultyCurve3.Evaluate(SemiFunc.RunGetDifficultyMultiplier1());
if (!Object.op_Implicit((Object)(object)instance.DebugModule))
{
instance.ModulesNormalShuffled_1.AddRange(instance.Level.ModulesNormal1);
instance.ModulesNormalShuffled_1.ShuffleWithRng(Instance.rng);
instance.ModulesNormalShuffled_2.AddRange(instance.Level.ModulesNormal2);
instance.ModulesNormalShuffled_2.ShuffleWithRng(Instance.rng);
instance.ModulesNormalShuffled_3.AddRange(instance.Level.ModulesNormal3);
instance.ModulesNormalShuffled_3.ShuffleWithRng(Instance.rng);
instance.ModulesPassageShuffled_1.AddRange(instance.Level.ModulesPassage1);
instance.ModulesPassageShuffled_1.ShuffleWithRng(Instance.rng);
instance.ModulesPassageShuffled_2.AddRange(instance.Level.ModulesPassage2);
instance.ModulesPassageShuffled_2.ShuffleWithRng(Instance.rng);
instance.ModulesPassageShuffled_3.AddRange(instance.Level.ModulesPassage3);
instance.ModulesPassageShuffled_3.ShuffleWithRng(Instance.rng);
instance.ModulesDeadEndShuffled_1.AddRange(instance.Level.ModulesDeadEnd1);
instance.ModulesDeadEndShuffled_1.ShuffleWithRng(Instance.rng);
instance.ModulesDeadEndShuffled_2.AddRange(instance.Level.ModulesDeadEnd2);
instance.ModulesDeadEndShuffled_2.ShuffleWithRng(Instance.rng);
instance.ModulesDeadEndShuffled_3.AddRange(instance.Level.ModulesDeadEnd3);
instance.ModulesDeadEndShuffled_3.ShuffleWithRng(Instance.rng);
instance.ModulesExtractionShuffled_1.AddRange(instance.Level.ModulesExtraction1);
instance.ModulesExtractionShuffled_1.ShuffleWithRng(Instance.rng);
instance.ModulesExtractionShuffled_2.AddRange(instance.Level.ModulesExtraction2);
instance.ModulesExtractionShuffled_2.ShuffleWithRng(Instance.rng);
instance.ModulesExtractionShuffled_3.AddRange(instance.Level.ModulesExtraction3);
instance.ModulesExtractionShuffled_3.ShuffleWithRng(Instance.rng);
}
else
{
instance.ModulesNormalShuffled_1.Add(instance.DebugModule);
instance.ModulesPassageShuffled_1.Add(instance.DebugModule);
instance.ModulesDeadEndShuffled_1.Add(instance.DebugModule);
instance.ModulesExtractionShuffled_1.Add(instance.DebugModule);
}
if (instance.ModulesNormalShuffled_1.Count == 0)
{
instance.waitingForSubCoroutine = false;
return;
}
Vector3 val2 = default(Vector3);
for (int i = 0; i < instance.LevelWidth; i++)
{
for (int j = 0; j < instance.LevelHeight; j++)
{
if (!instance.LevelGrid[i, j].active)
{
continue;
}
Vector3 val = Vector3.zero;
((Vector3)(ref val2))..ctor((float)i * LevelGenerator.ModuleWidth * LevelGenerator.TileSize - (float)(instance.LevelWidth / 2) * LevelGenerator.ModuleWidth * LevelGenerator.TileSize, 0f, (float)j * LevelGenerator.ModuleWidth * LevelGenerator.TileSize + LevelGenerator.ModuleWidth * LevelGenerator.TileSize / 2f);
if (!instance.DebugNormal && !instance.DebugPassage && !instance.DebugDeadEnd && (int)instance.LevelGrid[i, j].type == 3)
{
if (instance.GridCheckActive(i, j - 1))
{
val = Vector3.zero;
}
if (instance.GridCheckActive(i - 1, j))
{
((Vector3)(ref val))..ctor(0f, 90f, 0f);
}
if (instance.GridCheckActive(i, j + 1))
{
((Vector3)(ref val))..ctor(0f, 180f, 0f);
}
if (instance.GridCheckActive(i + 1, j))
{
((Vector3)(ref val))..ctor(0f, -90f, 0f);
}
instance.SpawnModule(i, j, val2, val, (Type)3);
continue;
}
if (instance.DebugDeadEnd || (!instance.DebugNormal && !instance.DebugPassage && (int)instance.LevelGrid[i, j].type == 2))
{
if (instance.GridCheckActive(i, j - 1))
{
val = Vector3.zero;
}
if (instance.GridCheckActive(i - 1, j))
{
((Vector3)(ref val))..ctor(0f, 90f, 0f);
}
if (instance.GridCheckActive(i, j + 1))
{
((Vector3)(ref val))..ctor(0f, 180f, 0f);
}
if (instance.GridCheckActive(i + 1, j))
{
((Vector3)(ref val))..ctor(0f, -90f, 0f);
}
instance.SpawnModule(i, j, val2, val, (Type)2);
continue;
}
if (!instance.DebugNormal && (instance.DebugPassage || instance.PassageAmount < instance.Level.PassageMaxAmount))
{
if (instance.DebugPassage || (instance.GridCheckActive(i, j + 1) && (instance.GridCheckActive(i, j - 1) || instance.LevelGrid[i, j].first) && !instance.GridCheckActive(i + 1, j) && !instance.GridCheckActive(i - 1, j)))
{
if (Instance.rng.Next(0, 100) < 50)
{
((Vector3)(ref val))..ctor(0f, 180f, 0f);
}
instance.SpawnModule(i, j, val2, val, (Type)1);
instance.PassageAmount++;
continue;
}
if (!instance.LevelGrid[i, j].first && instance.GridCheckActive(i + 1, j) && instance.GridCheckActive(i - 1, j) && !instance.GridCheckActive(i, j + 1) && !instance.GridCheckActive(i, j - 1))
{
((Vector3)(ref val))..ctor(0f, 90f, 0f);
if (Instance.rng.Next(0, 100) < 50)
{
((Vector3)(ref val))..ctor(0f, -90f, 0f);
}
instance.SpawnModule(i, j, val2, val, (Type)1);
instance.PassageAmount++;
continue;
}
}
val = instance.ModuleRotations[Instance.rng.Next(0, instance.ModuleRotations.Length)];
instance.SpawnModule(i, j, val2, val, (Type)0);
}
}
instance.waitingForSubCoroutine = false;
}
public static GameObject PickModule(List<GameObject> _list1, List<GameObject> _list2, List<GameObject> _list3, ref int _index1, ref int _index2, ref int _index3, ref int _loops1, ref int _loops2, ref int _loops3, LevelGenerator instance, Random rng)
{
GameObject result = null;
float[] array = new float[3] { instance.ModuleRarity1, instance.ModuleRarity2, instance.ModuleRarity3 };
if (_list2.Count <= 0)
{
array[1] = 0f;
}
if (_list3.Count <= 0)
{
array[2] = 0f;
}
int num = Mathf.Max(new int[3] { _loops1, _loops2, _loops3 });
int num2 = Mathf.Min(new int[3] { _loops1, _loops2, _loops3 });
if (num != num2)
{
if (_loops1 == num2 && array[0] > 0f)
{
if (_loops1 != _loops2)
{
array[1] = 0f;
}
if (_loops1 != _loops3)
{
array[2] = 0f;
}
}
else if (_loops2 == num2 && array[1] > 0f)
{
if (_loops2 != _loops1)
{
array[0] = 0f;
}
if (_loops2 != _loops3)
{
array[2] = 0f;
}
}
else if (_loops3 == num2 && array[2] > 0f)
{
if (_loops3 != _loops1)
{
array[0] = 0f;
}
if (_loops3 != _loops2)
{
array[1] = 0f;
}
}
}
float num3 = -1f;
int num4 = -1;
for (int i = 0; i < array.Length; i++)
{
if (array[i] > 0f)
{
float num5 = (float)rng.NextDouble() * array[i];
if (num5 > num3)
{
num3 = num5;
num4 = i;
}
}
}
switch (num4)
{
case 0:
result = _list1[_index1];
_index1++;
if (_index1 >= _list1.Count)
{
_list1.ShuffleWithRng(rng);
_index1 = 0;
_loops1++;
}
break;
case 1:
result = _list2[_index2];
_index2++;
if (_index2 >= _list2.Count)
{
_list2.ShuffleWithRng(rng);
_index2 = 0;
_loops2++;
}
break;
case 2:
result = _list3[_index3];
_index3++;
if (_index3 >= _list3.Count)
{
_list3.ShuffleWithRng(rng);
_index3 = 0;
_loops3++;
}
break;
}
return result;
}
}
public static class ListExtensions
{
public static void ShuffleWithRng<T>(this List<T> list, Random rng)
{
int num = list.Count;
while (num > 1)
{
num--;
int num2 = rng.Next(num + 1);
int index = num2;
int index2 = num;
T value = list[num];
T value2 = list[num2];
list[index] = value;
list[index2] = value2;
}
}
}
public class DanosValuableGeneration
{
[CompilerGenerated]
private sealed class <CustomDollarValueSet>d__13 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ValuableObject instance;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <CustomDollarValueSet>d__13(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Invalid comparison between Unknown and I4
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if ((int)LevelGenerator.Instance.State <= 11)
{
<>2__current = null;
<>1__state = 1;
return true;
}
if (SemiFunc.IsMasterClientOrSingleplayer())
{
RoundDirector obj = RoundDirector.instance;
obj.haulGoalMax += (int)instance.dollarValueCurrent;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SetupHost>d__11 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ValuableDirector instance;
public DanosValuableGeneration <>4__this;
private List<ValuableVolume> <list>5__1;
private string[] <_names>5__2;
private int[] <_maxAmount>5__3;
private List<ValuableVolume>[] <_volumes>5__4;
private string[] <_path>5__5;
private int[] <_chance>5__6;
private List<GameObject>[] <_valuables>5__7;
private int[] <_volumeIndex>5__8;
private float <time>5__9;
private float <time2>5__10;
private List<LevelValuables>.Enumerator <>s__11;
private LevelValuables <valuablePreset>5__12;
private int <_i>5__13;
private float <num>5__14;
private int <num2>5__15;
private ValuableVolume <volume>5__16;
private GameObject <valuable>5__17;
private int <i>5__18;
private int <num3>5__19;
private int <j>5__20;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetupHost>d__11(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<list>5__1 = null;
<_names>5__2 = null;
<_maxAmount>5__3 = null;
<_volumes>5__4 = null;
<_path>5__5 = null;
<_chance>5__6 = null;
<_valuables>5__7 = null;
<_volumeIndex>5__8 = null;
<>s__11 = default(List<LevelValuables>.Enumerator);
<valuablePreset>5__12 = null;
<volume>5__16 = null;
<valuable>5__17 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0e98: Unknown result type (might be due to invalid IL or missing references)
//IL_0ea2: Expected O, but got Unknown
//IL_0ef5: Unknown result type (might be due to invalid IL or missing references)
//IL_0eff: Expected O, but got Unknown
//IL_0774: Unknown result type (might be due to invalid IL or missing references)
//IL_077a: Invalid comparison between Unknown and I4
//IL_0870: Unknown result type (might be due to invalid IL or missing references)
//IL_0876: Invalid comparison between Unknown and I4
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
if (SemiFunc.RunGetDifficultyMultiplier2() > 0f && !SemiFunc.RunIsArena())
{
<time>5__9 = SemiFunc.RunGetDifficultyMultiplier2();
instance.totalMaxValue = Mathf.RoundToInt(instance.totalMaxValueCurve2.Evaluate(<time>5__9));
instance.tinyMaxAmount = Mathf.RoundToInt(instance.tinyMaxAmountCurve2.Evaluate(<time>5__9));
instance.smallMaxAmount = Mathf.RoundToInt(instance.smallMaxAmountCurve2.Evaluate(<time>5__9));
instance.mediumMaxAmount = Mathf.RoundToInt(instance.mediumMaxAmountCurve2.Evaluate(<time>5__9));
instance.bigMaxAmount = Mathf.RoundToInt(instance.bigMaxAmountCurve2.Evaluate(<time>5__9));
instance.wideMaxAmount = Mathf.RoundToInt(instance.wideMaxAmountCurve2.Evaluate(<time>5__9));
instance.tallMaxAmount = Mathf.RoundToInt(instance.tallMaxAmountCurve2.Evaluate(<time>5__9));
instance.veryTallMaxAmount = Mathf.RoundToInt(instance.veryTallMaxAmountCurve2.Evaluate(<time>5__9));
}
else
{
<time2>5__10 = SemiFunc.RunGetDifficultyMultiplier1();
if (SemiFunc.RunIsArena())
{
<time2>5__10 = 0.75f;
}
instance.totalMaxValue = Mathf.RoundToInt(instance.totalMaxValueCurve1.Evaluate(<time2>5__10));
instance.tinyMaxAmount = Mathf.RoundToInt(instance.tinyMaxAmountCurve1.Evaluate(<time2>5__10));
instance.smallMaxAmount = Mathf.RoundToInt(instance.smallMaxAmountCurve1.Evaluate(<time2>5__10));
instance.mediumMaxAmount = Mathf.RoundToInt(instance.mediumMaxAmountCurve1.Evaluate(<time2>5__10));
instance.bigMaxAmount = Mathf.RoundToInt(instance.bigMaxAmountCurve1.Evaluate(<time2>5__10));
instance.wideMaxAmount = Mathf.RoundToInt(instance.wideMaxAmountCurve1.Evaluate(<time2>5__10));
instance.tallMaxAmount = Mathf.RoundToInt(instance.tallMaxAmountCurve1.Evaluate(<time2>5__10));
instance.veryTallMaxAmount = Mathf.RoundToInt(instance.veryTallMaxAmountCurve1.Evaluate(<time2>5__10));
}
if (SemiFunc.RunIsArena())
{
ValuableDirector obj = instance;
obj.totalMaxAmount /= 2;
ValuableDirector obj2 = instance;
obj2.tinyMaxAmount /= 3;
ValuableDirector obj3 = instance;
obj3.smallMaxAmount /= 3;
ValuableDirector obj4 = instance;
obj4.mediumMaxAmount /= 3;
ValuableDirector obj5 = instance;
obj5.bigMaxAmount /= 3;
ValuableDirector obj6 = instance;
obj6.wideMaxAmount /= 2;
ValuableDirector obj7 = instance;
obj7.tallMaxAmount /= 2;
ValuableDirector obj8 = instance;
obj8.veryTallMaxAmount /= 2;
}
<>s__11 = LevelGenerator.Instance.Level.ValuablePresets.GetEnumerator();
try
{
while (<>s__11.MoveNext())
{
<valuablePreset>5__12 = <>s__11.Current;
instance.tinyValuables.AddRange(<valuablePreset>5__12.tiny);
instance.smallValuables.AddRange(<valuablePreset>5__12.small);
instance.mediumValuables.AddRange(<valuablePreset>5__12.medium);
instance.bigValuables.AddRange(<valuablePreset>5__12.big);
instance.wideValuables.AddRange(<valuablePreset>5__12.wide);
instance.tallValuables.AddRange(<valuablePreset>5__12.tall);
instance.veryTallValuables.AddRange(<valuablePreset>5__12.veryTall);
<valuablePreset>5__12 = null;
}
}
finally
{
((IDisposable)<>s__11).Dispose();
}
<>s__11 = default(List<LevelValuables>.Enumerator);
<list>5__1 = Object.FindObjectsOfType<ValuableVolume>(false).ToList();
Debug.Log((object)$"Found {<list>5__1.Count} valuable volumes in the scene.");
<list>5__1.RemoveAll((ValuableVolume volume) => !((Component)volume).gameObject.activeInHierarchy);
Debug.Log((object)$"After removing inactive volumes, {<list>5__1.Count} valuable volumes remain.");
instance.tinyVolumes = <list>5__1.FindAll((ValuableVolume x) => (int)x.VolumeType == 0);
instance.tinyVolumes.ShuffleWithRng(<>4__this.rng);
instance.smallVolumes = <list>5__1.FindAll((ValuableVolume x) => (int)x.VolumeType == 1);
instance.smallVolumes.ShuffleWithRng(<>4__this.rng);
instance.mediumVolumes = <list>5__1.FindAll((ValuableVolume x) => (int)x.VolumeType == 2);
instance.mediumVolumes.ShuffleWithRng(<>4__this.rng);
instance.bigVolumes = <list>5__1.FindAll((ValuableVolume x) => (int)x.VolumeType == 3);
instance.bigVolumes.ShuffleWithRng(<>4__this.rng);
instance.wideVolumes = <list>5__1.FindAll((ValuableVolume x) => (int)x.VolumeType == 4);
instance.wideVolumes.ShuffleWithRng(<>4__this.rng);
instance.tallVolumes = <list>5__1.FindAll((ValuableVolume x) => (int)x.VolumeType == 5);
instance.tallVolumes.ShuffleWithRng(<>4__this.rng);
instance.veryTallVolumes = <list>5__1.FindAll((ValuableVolume x) => (int)x.VolumeType == 6);
instance.veryTallVolumes.ShuffleWithRng(<>4__this.rng);
if ((int)instance.valuableDebug == 1)
{
instance.totalMaxAmount = <list>5__1.Count;
instance.totalMaxValue = 99999f;
instance.tinyMaxAmount = instance.tinyVolumes.Count;
instance.smallMaxAmount = instance.smallVolumes.Count;
instance.mediumMaxAmount = instance.mediumVolumes.Count;
instance.bigMaxAmount = instance.bigVolumes.Count;
instance.wideMaxAmount = instance.wideVolumes.Count;
instance.tallMaxAmount = instance.tallVolumes.Count;
instance.veryTallMaxAmount = instance.veryTallVolumes.Count;
}
if ((int)instance.valuableDebug == 2 || LevelGenerator.Instance.Level.ValuablePresets.Count <= 0)
{
instance.totalMaxAmount = 0;
instance.tinyMaxAmount = 0;
instance.smallMaxAmount = 0;
instance.mediumMaxAmount = 0;
instance.bigMaxAmount = 0;
instance.wideMaxAmount = 0;
instance.tallMaxAmount = 0;
instance.veryTallMaxAmount = 0;
}
instance.valuableTargetAmount = 0;
<_names>5__2 = new string[7] { "Tiny", "Small", "Medium", "Big", "Wide", "Tall", "Very Tall" };
<_maxAmount>5__3 = new int[7] { instance.tinyMaxAmount, instance.smallMaxAmount, instance.mediumMaxAmount, instance.bigMaxAmount, instance.wideMaxAmount, instance.tallMaxAmount, instance.veryTallMaxAmount };
<_volumes>5__4 = new List<ValuableVolume>[7] { instance.tinyVolumes, instance.smallVolumes, instance.mediumVolumes, instance.bigVolumes, instance.wideVolumes, instance.tallVolumes, instance.veryTallVolumes };
<_path>5__5 = new string[7] { instance.tinyPath, instance.smallPath, instance.mediumPath, instance.bigPath, instance.widePath, instance.tallPath, instance.veryTallPath };
<_chance>5__6 = new int[7] { instance.tinyChance, instance.smallChance, instance.mediumChance, instance.bigChance, instance.wideChance, instance.tallChance, instance.veryTallChance };
<_valuables>5__7 = new List<GameObject>[7] { instance.tinyValuables, instance.smallValuables, instance.mediumValuables, instance.bigValuables, instance.wideValuables, instance.tallValuables, instance.veryTallValuables };
<_volumeIndex>5__8 = new int[7];
<_i>5__13 = 0;
while (<_i>5__13 < instance.totalMaxAmount)
{
<num>5__14 = -1f;
<num2>5__15 = -1;
<i>5__18 = 0;
while (<i>5__18 < <_names>5__2.Length)
{
if (<_volumeIndex>5__8[<i>5__18] < <_maxAmount>5__3[<i>5__18] && <_volumeIndex>5__8[<i>5__18] < <_volumes>5__4[<i>5__18].Count)
{
<num3>5__19 = <>4__this.Range(0, <_chance>5__6[<i>5__18]);
if ((float)<num3>5__19 > <num>5__14)
{
<num>5__14 = <num3>5__19;
<num2>5__15 = <i>5__18;
}
}
<i>5__18++;
}
if (<num2>5__15 == -1)
{
break;
}
<volume>5__16 = <_volumes>5__4[<num2>5__15][<_volumeIndex>5__8[<num2>5__15]];
<valuable>5__17 = <_valuables>5__7[<num2>5__15][<>4__this.Range(0, <_valuables>5__7[<num2>5__15].Count)];
instance.Spawn(<valuable>5__17, <volume>5__16, <_path>5__5[<num2>5__15]);
<_volumeIndex>5__8[<num2>5__15]++;
<volume>5__16 = null;
<valuable>5__17 = null;
<_i>5__13++;
}
if (instance.valuableTargetAmount < instance.totalMaxAmount && Object.op_Implicit((Object)(object)DebugComputerCheck.instance) && (!((Behaviour)DebugComputerCheck.instance).enabled || !DebugComputerCheck.instance.LevelDebug || !DebugComputerCheck.instance.ModuleOverrideActive || !Object.op_Implicit((Object)(object)DebugComputerCheck.instance.ModuleOverride)))
{
<j>5__20 = 0;
while (<j>5__20 < <_names>5__2.Length)
{
if (<_volumeIndex>5__8[<j>5__20] < <_maxAmount>5__3[<j>5__20])
{
Debug.LogError((object)("Could not spawn enough ''" + <_names>5__2[<j>5__20] + "'' valuables!"));
}
<j>5__20++;
}
}
if (GameManager.instance.gameMode == 1)
{
instance.PhotonView.RPC("ValuablesTargetSetRPC", (RpcTarget)0, new object[1] { instance.valuableTargetAmount });
}
ValuableDirector obj9 = instance;
obj9.valuableSpawnPlayerReady++;
goto IL_0eb3;
}
case 1:
<>1__state = -1;
goto IL_0eb3;
case 2:
{
<>1__state = -1;
break;
}
IL_0eb3:
if (GameManager.instance.gameMode == 1 && instance.valuableSpawnPlayerReady < PhotonNetwork.CurrentRoom.PlayerCount)
{
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
}
instance.VolumesAndSwitchSetup();
break;
}
if (GameManager.instance.gameMode == 1 && instance.switchSetupPlayerReady < PhotonNetwork.CurrentRoom.PlayerCount)
{
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 2;
return true;
}
instance.setupComplete = true;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private Random rng;
private Random rng2;
public static DanosValuableGeneration? Instance { get; private set; }
private DanosValuableGeneration(int seed)
{
rng = new Random(seed);
rng2 = new Random(seed);
}
public static void Create(int seed)
{
Instance = new DanosValuableGeneration(seed);
}
public static void Delete()
{
Instance = null;
}
public int Range(int min, int max)
{
return rng.Next(min, max);
}
public int Range2(int min, int max)
{
return rng2.Next(min, max);
}
[IteratorStateMachine(typeof(<SetupHost>d__11))]
public IEnumerator SetupHost(ValuableDirector instance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SetupHost>d__11(0)
{
<>4__this = this,
instance = instance
};
}
public void DollarValueSetLogic(ValuableObject valuableInstance)
{
if (!valuableInstance.dollarValueSet)
{
if (valuableInstance.dollarValueOverride != 0)
{
valuableInstance.dollarValueOriginal = valuableInstance.dollarValueOverride;
valuableInstance.dollarValueCurrent = valuableInstance.dollarValueOverride;
}
else
{
valuableInstance.dollarValueOriginal = Mathf.Round((float)rng2.Next((int)valuableInstance.valuePreset.valueMin, (int)valuableInstance.valuePreset.valueMax));
valuableInstance.dollarValueOriginal = Mathf.Round(valuableInstance.dollarValueOriginal / 100f) * 100f;
valuableInstance.dollarValueCurrent = valuableInstance.dollarValueOriginal;
}
valuableInstance.dollarValueSet = true;
Debug.Log((object)$"Dollar value set for {((Object)((Component)valuableInstance).gameObject).name}: {valuableInstance.dollarValueCurrent}");
}
else
{
Debug.LogWarning((object)$"Dollar value for {((Object)((Component)valuableInstance).gameObject).name} is already set. Current value: {valuableInstance.dollarValueCurrent}");
}
}
[IteratorStateMachine(typeof(<CustomDollarValueSet>d__13))]
public static IEnumerator CustomDollarValueSet(ValuableObject instance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CustomDollarValueSet>d__13(0)
{
instance = instance
};
}
}
public static class DollarValueGenerationQueue
{
private static readonly Queue<ValuableObject> queue = new Queue<ValuableObject>();
private static ValuableObject? current = null;
public static void Enqueue(ValuableObject obj)
{
lock (queue)
{
queue.Enqueue(obj);
}
}
public static bool IsMyTurn(ValuableObject obj)
{
lock (queue)
{
if ((Object)(object)current == (Object)null && (Object)(object)queue.Peek() == (Object)(object)obj)
{
current = obj;
return true;
}
return (Object)(object)current == (Object)(object)obj;
}
}
public static void Done(ValuableObject obj)
{
lock (queue)
{
if ((Object)(object)current == (Object)(object)obj)
{
queue.Dequeue();
current = null;
}
}
}
public static void Reset()
{
lock (queue)
{
queue.Clear();
current = null;
}
}
}
}
namespace RepoRace
{
[HarmonyPatch(typeof(PlayerController))]
internal static class ExamplePlayerControllerPatch
{
[HarmonyPrefix]
[HarmonyPatch("Start")]
private static void Start_Prefix(PlayerController __instance)
{
RepoRace.Logger.LogDebug((object)$"{__instance} Start Prefix");
}
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void Start_Postfix(PlayerController __instance)
{
RepoRace.Logger.LogDebug((object)$"{__instance} Start Postfix");
}
}
[BepInPlugin("danos.RepoRace", "RepoRace", "1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class RepoRace : BaseUnityPlugin
{
internal static RepoRace Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
DanosMainMenuManager.Create();
DanosMainMenuManager.Instance.Init();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//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_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}
namespace RepoRace.Utility
{
public class FirstToTenData
{
public List<FTTDMapData> maps { get; set; } = new List<FTTDMapData>();
}
public class FTTDMapData
{
public int level { get; set; } = 0;
public int seed { get; set; } = 0;
public string map { get; set; } = string.Empty;
public bool isShop { get; set; } = false;
public Dictionary<string, int> Enemies { get; set; } = new Dictionary<string, int>();
}
public static class GenerateFirstToTenData
{
private static Random _random;
private static List<string> MapNames = new List<string> { "Manor", "Arctic", "Wizard", "Museum" };
public static FirstToTenData GeneratedData { get; private set; } = null;
public static int SeedBase { get; set; } = 69420;
public static int Levels { get; set; } = 101;
public static async Task<FirstToTenData> GenerateDataAsync()
{
if (GeneratedData != null)
{
return GeneratedData;
}
GeneratedData = GenerateData(SeedBase);
return GeneratedData;
}
public static FirstToTenData GenerateData(int SeedBase)
{
List<FTTDMapData> list = new List<FTTDMapData>();
List<int> list2 = GenerateSeedChain(Levels, SeedBase);
int num = 0;
string lastMap = null;
for (int i = 0; i < Levels; i++)
{
int seed = list2[i];
bool flag = i % 2 != 0;
FTTDMapData fTTDMapData = GenerateMap(i, seed, lastMap, num, flag);
list.Add(fTTDMapData);
if (!flag)
{
num++;
lastMap = fTTDMapData.map;
}
}
return new FirstToTenData
{
maps = list
};
}
private static List<int> GenerateSeedChain(int amount, int seedBase)
{
_random = new Random(seedBase);
List<int> list = new List<int>();
for (int i = 0; i < amount; i++)
{
int item = _random.Next(0, int.MaxValue);
list.Add(item);
}
return list;
}
public static FTTDMapData GenerateMap(int levelIndex, int seed, string? lastMap, int actualLevel, bool isShop)
{
string lastMap2 = lastMap;
FTTDMapData fTTDMapData = new FTTDMapData();
_random = new Random(seed);
fTTDMapData.level = actualLevel;
fTTDMapData.seed = seed;
fTTDMapData.isShop = isShop;
if (isShop)
{
fTTDMapData.map = "Shop";
}
else
{
List<string> list = MapNames.Where((string m) => m != lastMap2).ToList();
fTTDMapData.map = list[_random.Next(list.Count)];
}
return fTTDMapData;
}
}
public class RepoRaceGameManager : MonoBehaviour
{
public int CurrentLevelIndex = 0;
public int m_seed = 0;
public static RepoRaceGameManager Instance { get; private set; }
public FirstToTenData FirstToTenData { get; private set; } = null;
public static void StartMatch(int Seed)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
if ((Object)(object)Instance != (Object)null)
{
Debug.LogWarning((object)"RankedGameManager already running.");
return;
}
GameObject val = new GameObject("RankedGameManager");
Object.DontDestroyOnLoad((Object)(object)val);
Instance = val.AddComponent<RepoRaceGameManager>();
Instance.BeginMatch(Seed);
}
private void BeginMatch(int Seed)
{
CurrentLevelIndex = 0;
if ((Object)(object)RunManager.instance != (Object)null)
{
RunManager.instance.enemiesSpawned = new List<EnemySetup>();
RunManager.instance.ResetProgress();
}
if ((Object)(object)LevelGenerator.Instance != (Object)null)
{
}
m_seed = Seed;
FirstToTenData = GenerateFirstToTenData.GenerateData(Seed);
RepoRaceGameManagerUtils.CreateSave();
SemiFunc.MenuActionSingleplayerGame(RepoRaceGameManagerUtils.SaveName);
}
public void CompleteMatch(string reason)
{
long num = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
EndMatch();
}
private void EndMatch()
{
//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)
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
player.OutroStartRPC(default(PhotonMessageInfo));
}
NetworkManager.instance.leavePhotonRoom = true;
Object.Destroy((Object)(object)((Component)this).gameObject);
Instance = null;
}
public FTTDMapData GetCurrentMapData()
{
if (FirstToTenData != null && CurrentLevelIndex < FirstToTenData.maps.Count)
{
return FirstToTenData.maps[CurrentLevelIndex];
}
return null;
}
public bool IsLastShop()
{
return false;
}
public void CompletedRound()
{
CurrentLevelIndex++;
if (IsLastShop())
{
Debug.Log((object)"[REPORanked] Last shop reached, completing match.");
CompleteMatch("finished");
return;
}
FTTDMapData currentMapData = GetCurrentMapData();
if (currentMapData == null)
{
Debug.LogWarning((object)"[REPORanked] Current map data is null.");
}
}
}
public static class RepoRaceGameManagerUtils
{
public static string SaveName { get; private set; } = "REPORace";
public static void CreateSave()
{
//IL_0001: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
SteamId steamId = SteamClient.SteamId;
string text = ((object)(SteamId)(ref steamId)).ToString();
string path = Path.Combine(Application.persistentDataPath, "saves");
string text2 = Path.Combine(path, SaveName);
string path2 = Path.Combine(text2, SaveName + ".es3");
if (Directory.Exists(text2))
{
if (File.Exists(path2))
{
File.Delete(path2);
}
Directory.Delete(text2, recursive: true);
}
Directory.CreateDirectory(text2);
string text3 = Path.Combine(text2, SaveName + ".es3");
string text4 = DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
string saveName = SaveName;
float num = 0f;
Dictionary<string, string> dictionary = new Dictionary<string, string>();
Dictionary<string, Dictionary<string, int>> dictionary2 = new Dictionary<string, Dictionary<string, int>>();
ES3Settings val = new ES3Settings(text3, (ES3Settings)null)
{
encryptionType = (EncryptionType)1,
encryptionPassword = "Why would you want to cheat?... :o It's no fun. :') :'D"
};
ES3.Save<string>("teamName", saveName, val);
ES3.Save<string>("dateAndTime", text4, val);
ES3.Save<float>("timePlayed", num, val);
ES3.Save<Dictionary<string, string>>("playerNames", dictionary, val);
ES3.Save<Dictionary<string, Dictionary<string, int>>>("dictionaryOfDictionaries", dictionary2, val);
}
}
}
namespace RepoRace.Patches
{
[HarmonyPatch]
internal class ValuableDirectorPatches
{
[HarmonyPatch(typeof(ValuableDirector), "Spawn")]
[HarmonyPrefix]
private static bool SpawnPrefix(ValuableDirector __instance, GameObject _valuable, ValuableVolume _volume, string _path)
{
//IL_0051: 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_001a: 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)
if (GameManager.instance.gameMode == 0)
{
Object.Instantiate<GameObject>(_valuable, ((Component)_volume).transform.position, ((Component)_volume).transform.rotation);
}
else
{
PhotonNetwork.InstantiateRoomObject(__instance.resourcePath + _path + "/" + ((Object)_valuable).name, ((Component)_volume).transform.position, ((Component)_volume).transform.rotation, (byte)0, (object[])null);
}
ValuableObject component = _valuable.GetComponent<ValuableObject>();
component.dollarValueSet = false;
DanosValuableGeneration.Instance.DollarValueSetLogic(component);
__instance.valuableTargetAmount++;
__instance.totalCurrentValue += component.dollarValueCurrent * 0.001f;
if (__instance.totalCurrentValue > __instance.totalMaxValue)
{
__instance.totalMaxAmount = __instance.valuableTargetAmount;
}
return false;
}
}
}
namespace RepoRace.MainMenu
{
public class DanosMainMenuManager : MonoBehaviour
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Action <>9__10_0;
public static Action <>9__11_0;
public static Action<string> <>9__20_4;
public static BuilderDelegate <>9__20_0;
public static Func<FTTDMapData, bool> <>9__23_0;
public static Func<FTTDMapData, string> <>9__23_1;
internal void <GetRankedDiscordButton>b__10_0()
{
Application.OpenURL("https://discord.gg/y7WBzTT9jF");
}
internal void <GetSpeedrunDiscordButton>b__11_0()
{
Application.OpenURL("https://discord.gg/y7WBzTT9jF");
}
internal void <ShowPopup>b__20_0(Transform parent)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOInputField("Seed", (Action<string>)delegate(string value)
{
if (int.TryParse(value, out var result))
{
Seed = result;
}
else
{
Debug.LogError((object)"Invalid seed value entered.");
}
}, parent, new Vector2(400f, 260f), false, "Enter seed...", Seed.ToString());
}
internal void <ShowPopup>b__20_4(string value)
{
if (int.TryParse(value, out var result))
{
Seed = result;
}
else
{
Debug.LogError((object)"Invalid seed value entered.");
}
}
internal bool <GeneratePreview>b__23_0(FTTDMapData b)
{
return !b.isShop;
}
internal string <GeneratePreview>b__23_1(FTTDMapData m)
{
return m.map;
}
}
private Vector2 hostPosition = Vector2.zero;
private Vector2 joinPosition = Vector2.zero;
private const string REPORANKEDDiscordInviteUrl = "https://discord.gg/y7WBzTT9jF";
private const string SpeedrunDiscordInviteUrl = "https://discord.gg/9bH3G9jEGs";
private REPOLabel labelRef = null;
private REPOPopupPage? queueSelectorPopup;
public static DanosMainMenuManager Instance { get; private set; } = null;
public static int Seed { get; set; } = 69420;
public static void Create()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
if (!((Object)(object)Instance != (Object)null))
{
GameObject val = new GameObject("DanosMainMenuManager");
Object.DontDestroyOnLoad((Object)(object)val);
Instance = val.AddComponent<DanosMainMenuManager>();
}
}
public void Init()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
MenuAPI.AddElementToMainMenu((BuilderDelegate)delegate(Transform parent)
{
MenuPage component = ((Component)parent).GetComponent<MenuPage>();
if ((Object)(object)component == (Object)null)
{
Debug.Log((object)"MenuPage component not found in the parent object.");
}
else
{
RemoveMainButtons(((Component)component).transform);
REPOButton rankedDiscordButton = GetRankedDiscordButton(((Component)component).transform);
REPOButton speedrunDiscordButton = GetSpeedrunDiscordButton(((Component)component).transform);
REPOButton popupButton = GetPopupButton(((Component)component).transform);
}
});
}
public REPOButton GetRankedDiscordButton(Transform parent)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
return MenuAPI.CreateREPOButton("REPORanked Discord", (Action)delegate
{
Application.OpenURL("https://discord.gg/y7WBzTT9jF");
}, parent, hostPosition + new Vector2(200f, -40f));
}
public REPOButton GetSpeedrunDiscordButton(Transform parent)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
return MenuAPI.CreateREPOButton("Speedrun Discord", (Action)delegate
{
Application.OpenURL("https://discord.gg/y7WBzTT9jF");
}, parent, hostPosition + new Vector2(200f, -80f));
}
public void RemoveMainButtons(Transform parent)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//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_0049: 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_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)
foreach (Transform item in parent)
{
Transform val = item;
string name = ((Object)val).name;
string text = name;
if (!(text == "Menu Button - Private Game"))
{
if (text == "Menu Button - Public Game")
{
joinPosition = Vector2.op_Implicit(val.localPosition);
}
}
else
{
hostPosition = Vector2.op_Implicit(val.localPosition);
}
}
}
public REPOButton GetPopupButton(Transform parent)
{
//IL_0014: 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)
return MenuAPI.CreateREPOButton("REPORace", (Action)delegate
{
ShowPopup();
}, parent, hostPosition + new Vector2(200f, 0f));
}
public void ShowPopup()
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
if ((Object)(object)queueSelectorPopup == (Object)null)
{
queueSelectorPopup = MenuAPI.CreateREPOPopupPage("Start Match", (PresetSide)1, false, true, 1.5f);
REPOPopupPage? obj = queueSelectorPopup;
object obj2 = <>c.<>9__20_0;
if (obj2 == null)
{
BuilderDelegate val = delegate(Transform parent)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOInputField("Seed", (Action<string>)delegate(string value)
{
if (int.TryParse(value, out var result))
{
Seed = result;
}
else
{
Debug.LogError((object)"Invalid seed value entered.");
}
}, parent, new Vector2(400f, 260f), false, "Enter seed...", Seed.ToString());
};
<>c.<>9__20_0 = val;
obj2 = (object)val;
}
obj.AddElement((BuilderDelegate)obj2);
queueSelectorPopup.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_001d: 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)
REPOButton val3 = MenuAPI.CreateREPOButton("Set Seed", (Action)delegate
{
Reload();
}, parent, new Vector2(400f, 200f));
REPOButton val4 = MenuAPI.CreateREPOButton("Generate Random Seed", (Action)delegate
{
Seed = Random.Range(0, int.MaxValue);
Debug.Log((object)$"Generated random seed: {Seed}");
Reload();
}, parent, new Vector2(400f, 160f));
});
queueSelectorPopup.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_0018: 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)
labelRef = MenuAPI.CreateREPOLabel(GeneratePreview(Seed), parent, new Vector2(400f, 60f));
((Graphic)labelRef.labelTMP).color = Color.white;
((TMP_Text)labelRef.labelTMP).fontSize = 6f;
});
queueSelectorPopup.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
REPOButton val2 = MenuAPI.CreateREPOButton("Go", (Action)delegate
{
destroy();
RepoRaceGameManager.StartMatch(Seed);
}, parent, new Vector2(500f, 40f));
});
}
REPOPopupPage? obj3 = queueSelectorPopup;
if (obj3 != null)
{
obj3.OpenPage(false);
}
}
public void Reload()
{
REPOPopupPage? obj = queueSelectorPopup;
if (obj != null)
{
obj.ClosePage(true);
}
Object.Destroy((Object)(object)queueSelectorPopup);
queueSelectorPopup = null;
ShowPopup();
}
public void destroy()
{
if ((Object)(object)queueSelectorPopup != (Object)null)
{
queueSelectorPopup.ClosePage(true);
Object.Destroy((Object)(object)queueSelectorPopup);
queueSelectorPopup = null;
}
if ((Object)(object)labelRef != (Object)null)
{
Object.Destroy((Object)(object)((Component)labelRef).gameObject);
labelRef = null;
}
}
public string GeneratePreview(int seed)
{
FirstToTenData firstToTenData = GenerateFirstToTenData.GenerateData(seed);
firstToTenData.maps = firstToTenData.maps.Where((FTTDMapData b) => !b.isShop).ToList();
StringBuilder stringBuilder = new StringBuilder();
string text = string.Join("\n", from m in firstToTenData.maps.Take(10)
select m.map);
stringBuilder.AppendLine($"Seed: {seed}");
stringBuilder.AppendLine("Maps: " + text);
return stringBuilder.ToString();
}
}
}