using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Larsielol")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RepoSeeded")]
[assembly: AssemblyTitle("RepoSeeded")]
[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 RepoSeeded
{
[HarmonyPatch(typeof(EnemyDirector))]
internal static class EnemyRNGPatch
{
[HarmonyPrefix]
[HarmonyPatch("PickEnemies")]
private static bool EnemyTypeRNGSeeder(List<EnemySetup> _enemiesList)
{
Random.InitState(RepoSeeded.EnemyTypeRandom.Next());
int num = DataDirector.instance.SettingValueFetch((Setting)31);
ListExtension.Shuffle<EnemySetup>((IList<EnemySetup>)_enemiesList);
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++;
}
}
float num4 = 100f;
if (Object.op_Implicit((Object)(object)_enemies.rarityPreset))
{
num4 = _enemies.rarityPreset.chance;
}
float num5 = Mathf.Max(0f, num4 - 30f * (float)num3);
float num6 = Random.Range(0f, num5);
if (num6 > num2)
{
item = _enemies;
num2 = num6;
}
}
EnemyDirector.instance.enemyList.Add(item);
return false;
}
}
[HarmonyPatch(typeof(RunManager))]
internal static class LevelAreaRNGPatch
{
[HarmonyPrefix]
[HarmonyPatch("SetRunLevel")]
private static void LevelAreaRNGSeeder(Level ___previousRunLevel, int ___levelsCompleted)
{
if (___levelsCompleted == 0)
{
___previousRunLevel = null;
}
Random.InitState(RepoSeeded.LevelRandom.Next());
}
}
[HarmonyPatch(typeof(LevelGenerator))]
internal static class LevelLayoutRNGPatch
{
[HarmonyPrefix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static void LevelGenerationRNGSeederTiles()
{
Random.InitState(RepoSeeded.LevelRandom.Next());
}
[HarmonyPrefix]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static void LevelGenerationRNGSeederModules()
{
Random.InitState(RepoSeeded.LevelRandom.Next());
}
}
[BepInPlugin("Larsielol.RepoSeeded", "RepoSeeded", "1.0")]
public class RepoSeeded : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Action<string> <>9__20_3;
public static ScrollViewBuilderDelegate <>9__20_2;
public static Action <>9__20_1;
public static BuilderDelegate <>9__20_0;
internal void <Awake>b__20_0(Transform parent)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
REPOButton val = MenuAPI.CreateREPOButton("Input Seed", (Action)delegate
{
//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_0033: Expected O, but got Unknown
REPOPopupPage val3 = MenuAPI.CreateREPOPopupPage("Seed Menu", (PresetSide)0, false, true, 1.5f);
object obj = <>9__20_2;
if (obj == null)
{
ScrollViewBuilderDelegate val4 = delegate(Transform scrollView)
{
//IL_002d: 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)
Action<string> obj2 = delegate(string newSeed)
{
setSeed(newSeed);
};
string currentSeed = RepoSeeded.currentSeed;
REPOInputField val5 = MenuAPI.CreateREPOInputField("Seed", obj2, scrollView, default(Vector2), false, "", currentSeed);
return ((REPOElement)val5).rectTransform;
};
<>9__20_2 = val4;
obj = (object)val4;
}
val3.AddElementToScrollView((ScrollViewBuilderDelegate)obj, 0f, 0f);
val3.OpenPage(false);
}, parent, new Vector2(50f, 100f));
Transform val2 = parent.Find("Menu Button - Tutorial");
((Component)val2).gameObject.SetActive(false);
}
internal void <Awake>b__20_1()
{
//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_0033: Expected O, but got Unknown
REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Seed Menu", (PresetSide)0, false, true, 1.5f);
object obj = <>9__20_2;
if (obj == null)
{
ScrollViewBuilderDelegate val2 = delegate(Transform scrollView)
{
//IL_002d: 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)
Action<string> obj2 = delegate(string newSeed)
{
setSeed(newSeed);
};
string currentSeed = RepoSeeded.currentSeed;
REPOInputField val3 = MenuAPI.CreateREPOInputField("Seed", obj2, scrollView, default(Vector2), false, "", currentSeed);
return ((REPOElement)val3).rectTransform;
};
<>9__20_2 = val2;
obj = (object)val2;
}
val.AddElementToScrollView((ScrollViewBuilderDelegate)obj, 0f, 0f);
val.OpenPage(false);
}
internal RectTransform <Awake>b__20_2(Transform scrollView)
{
//IL_002d: 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)
Action<string> obj = delegate(string newSeed)
{
setSeed(newSeed);
};
string currentSeed = RepoSeeded.currentSeed;
REPOInputField val = MenuAPI.CreateREPOInputField("Seed", obj, scrollView, default(Vector2), false, "", currentSeed);
return ((REPOElement)val).rectTransform;
}
internal void <Awake>b__20_3(string newSeed)
{
setSeed(newSeed);
}
}
internal static Random ValuableTypeRandom = new Random(1);
internal static Random ValuableCostRandom = new Random(1);
internal static Random LevelRandom = new Random(1);
internal static Random ShopRandom = new Random(1);
internal static Random EnemyTypeRandom = new Random(1);
internal static Random EnemyOrbRandom = new Random(1);
public static string currentSeed = "1";
internal static RepoSeeded Instance { get; private set; } = null;
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
public static void setSeed(string seed)
{
SHA256 sHA = SHA256.Create();
seed = seed.Replace(" ", "");
int num = 1;
try
{
num = int.Parse(seed);
}
catch (FormatException)
{
byte[] array = sHA.ComputeHash(Encoding.UTF8.GetBytes(seed));
num = BitConverter.ToInt32(array);
}
ValuableTypeRandom = new Random(num);
ValuableCostRandom = new Random(num);
LevelRandom = new Random(num);
ShopRandom = new Random(num);
EnemyTypeRandom = new Random(num);
EnemyOrbRandom = new Random(num);
RunManager.instance.enemiesSpawned = new List<EnemySetup>();
currentSeed = seed;
}
private void Awake()
{
//IL_003e: 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_0049: Expected O, but got Unknown
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
object obj = <>c.<>9__20_0;
if (obj == null)
{
BuilderDelegate val = delegate(Transform parent)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
REPOButton val2 = MenuAPI.CreateREPOButton("Input Seed", (Action)delegate
{
//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_0033: Expected O, but got Unknown
REPOPopupPage val4 = MenuAPI.CreateREPOPopupPage("Seed Menu", (PresetSide)0, false, true, 1.5f);
object obj2 = <>c.<>9__20_2;
if (obj2 == null)
{
ScrollViewBuilderDelegate val5 = delegate(Transform scrollView)
{
//IL_002d: 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)
Action<string> obj3 = delegate(string newSeed)
{
setSeed(newSeed);
};
string text = currentSeed;
REPOInputField val6 = MenuAPI.CreateREPOInputField("Seed", obj3, scrollView, default(Vector2), false, "", text);
return ((REPOElement)val6).rectTransform;
};
<>c.<>9__20_2 = val5;
obj2 = (object)val5;
}
val4.AddElementToScrollView((ScrollViewBuilderDelegate)obj2, 0f, 0f);
val4.OpenPage(false);
}, parent, new Vector2(50f, 100f));
Transform val3 = parent.Find("Menu Button - Tutorial");
((Component)val3).gameObject.SetActive(false);
};
<>c.<>9__20_0 = val;
obj = (object)val;
}
MenuAPI.AddElementToMainMenu((BuilderDelegate)obj);
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0025: 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()
{
}
}
[HarmonyPatch(typeof(MenuPageSaves))]
internal static class RNGSetterOnGameStart
{
[HarmonyPrefix]
[HarmonyPatch("OnNewGame")]
private static void setSeedOnNewGame()
{
RepoSeeded.setSeed(RepoSeeded.currentSeed);
}
[HarmonyPrefix]
[HarmonyPatch("OnLoadGame")]
private static void setSeedOnLoadGame()
{
RepoSeeded.setSeed(RepoSeeded.currentSeed);
}
}
[HarmonyPatch(typeof(MenuPageLobby))]
internal static class RNGSetterOnGameHost
{
[HarmonyPrefix]
[HarmonyPatch("ButtonStart")]
private static void setSeedOnHostGame()
{
RepoSeeded.setSeed(RepoSeeded.currentSeed);
}
}
[HarmonyPatch(typeof(ShopManager))]
internal static class ShopRNGPatch
{
private static ShopManager sm = ShopManager.instance;
[HarmonyPatch("GetAllItemsFromStatsManager")]
[HarmonyPrefix]
private static bool GetAlllItemsPrefix()
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Invalid comparison between Unknown and I4
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Invalid comparison between Unknown and I4
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Invalid comparison between Unknown and I4
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: 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_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Invalid comparison between Unknown and I4
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: 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_0272: Unknown result type (might be due to invalid IL or missing references)
Random.InitState(RepoSeeded.ShopRandom.Next());
if (SemiFunc.IsNotMasterClient())
{
return false;
}
sm.potentialItems.Clear();
sm.potentialItemConsumables.Clear();
sm.potentialItemUpgrades.Clear();
sm.potentialItemHealthPacks.Clear();
sm.potentialSecretItems.Clear();
Item[] array = sortItemsOnName(StatsManager.instance.itemDictionary.Values);
foreach (Item val in array)
{
int num = SemiFunc.StatGetItemsPurchased(val.itemAssetName);
float num2 = val.value.valueMax / 1000f * sm.itemValueMultiplier;
if ((int)val.itemType == 3)
{
num2 -= num2 * 0.05f * (float)(GameDirector.instance.PlayerList.Count - 1);
int itemsUpgradesPurchased = StatsManager.instance.GetItemsUpgradesPurchased(val.itemAssetName);
num2 += num2 * sm.upgradeValueIncrease * (float)itemsUpgradesPurchased;
num2 = Mathf.Ceil(num2);
}
if ((int)val.itemType == 8)
{
num2 += num2 * sm.healthPackValueIncrease * (float)RunManager.instance.levelsCompleted;
num2 = Mathf.Ceil(num2);
}
if ((int)val.itemType == 5)
{
num2 += num2 * sm.crystalValueIncrease * (float)RunManager.instance.levelsCompleted;
num2 = Mathf.Ceil(num2);
}
float num3 = Mathf.Clamp(num2, 1f, num2);
bool flag = (int)val.itemType == 5;
bool flag2 = (int)val.itemType == 3;
bool flag3 = (int)val.itemType == 8;
int maxAmountInShop = val.maxAmountInShop;
if (num >= maxAmountInShop || (val.maxPurchase && StatsManager.instance.GetItemsUpgradesPurchasedTotal(val.itemAssetName) >= val.maxPurchaseAmount) || (!(num3 <= (float)sm.totalCurrency) && Random.Range(0, 100) >= 25))
{
continue;
}
for (int j = 0; j < maxAmountInShop - num; j++)
{
if (flag2)
{
sm.potentialItemUpgrades.Add(val);
continue;
}
if (flag3)
{
sm.potentialItemHealthPacks.Add(val);
continue;
}
if (flag)
{
sm.potentialItemConsumables.Add(val);
continue;
}
if ((int)val.itemSecretShopType == 0)
{
sm.potentialItems.Add(val);
continue;
}
if (!sm.potentialSecretItems.ContainsKey(val.itemSecretShopType))
{
sm.potentialSecretItems.Add(val.itemSecretShopType, new List<Item>());
}
sm.potentialSecretItems[val.itemSecretShopType].Add(val);
}
}
ListExtension.Shuffle<Item>((IList<Item>)sm.potentialItems);
ListExtension.Shuffle<Item>((IList<Item>)sm.potentialItemConsumables);
ListExtension.Shuffle<Item>((IList<Item>)sm.potentialItemUpgrades);
ListExtension.Shuffle<Item>((IList<Item>)sm.potentialItemHealthPacks);
foreach (List<Item> value in sm.potentialSecretItems.Values)
{
ListExtension.Shuffle<Item>((IList<Item>)value);
}
return false;
}
[HarmonyPatch("GetAllItemVolumesInScene")]
[HarmonyPrefix]
private static bool GetAllVolumesPrefix()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: 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_0089: Unknown result type (might be due to invalid IL or missing references)
Random.InitState(RepoSeeded.ShopRandom.Next());
if (SemiFunc.IsNotMasterClient())
{
return false;
}
sm.itemVolumes.Clear();
sm.secretItemVolumes.Clear();
ItemVolume[] array = Object.FindObjectsByType<ItemVolume>((FindObjectsSortMode)0);
sortVolumesOnLocation(array);
ItemVolume[] array2 = array;
foreach (ItemVolume val in array2)
{
if ((int)val.itemSecretShopType == 0)
{
sm.itemVolumes.Add(val);
continue;
}
if (!sm.secretItemVolumes.ContainsKey(val.itemSecretShopType))
{
sm.secretItemVolumes.Add(val.itemSecretShopType, new List<ItemVolume>());
}
sm.secretItemVolumes[val.itemSecretShopType].Add(val);
}
foreach (List<ItemVolume> value in sm.secretItemVolumes.Values)
{
ListExtension.Shuffle<ItemVolume>((IList<ItemVolume>)value);
}
ListExtension.Shuffle<ItemVolume>((IList<ItemVolume>)sm.itemVolumes);
return false;
}
public static void sortVolumesOnLocation(ItemVolume[] volumes)
{
Array.Sort(volumes, delegate(ItemVolume a, ItemVolume b)
{
//IL_000f: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = new Vector3(0f, 0f, 0f) - ((Component)a).transform.position;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
val = new Vector3(0f, 0f, 0f) - ((Component)b).transform.position;
return sqrMagnitude.CompareTo(((Vector3)(ref val)).sqrMagnitude);
});
}
public static Item[] sortItemsOnName(IEnumerable<Item> items)
{
Item[] array = items.ToArray();
Array.Sort(array, (Item a, Item b) => a.itemName.CompareTo(b.itemName));
return array;
}
}
internal static class ValuableCostsRNGPatch
{
[HarmonyPatch("DollarValueSetLogic")]
[HarmonyPrefix]
private static void RemoveValueRNG(ref Rigidbody ___rb)
{
Random.InitState(RepoSeeded.ValuableCostRandom.Next());
RepoSeeded.Logger.LogWarning((object)((Object)((Component)___rb).gameObject).name);
}
}
[HarmonyPatch(typeof(ValuableDirector))]
internal static class ValuableTypesRNGPatch
{
[CompilerGenerated]
private sealed class <newSetupHost>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
private ValuableDirector <vd>5__2;
private string[] <_names>5__3;
private int[] <_maxAmount>5__4;
private List<ValuableVolume>[] <_volumes>5__5;
private string[] <_path>5__6;
private int[] <_chance>5__7;
private List<GameObject>[] <_valuables>5__8;
private int[] <_volumeIndex>5__9;
private int <_i>5__10;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <newSetupHost>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<vd>5__2 = null;
<_names>5__3 = null;
<_maxAmount>5__4 = null;
<_volumes>5__5 = null;
<_path>5__6 = null;
<_chance>5__7 = null;
<_valuables>5__8 = null;
<_volumeIndex>5__9 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0ac9: Unknown result type (might be due to invalid IL or missing references)
//IL_0ad3: Expected O, but got Unknown
//IL_0b1a: Unknown result type (might be due to invalid IL or missing references)
//IL_0b24: Expected O, but got Unknown
//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
//IL_04bc: Invalid comparison between Unknown and I4
//IL_0595: Unknown result type (might be due to invalid IL or missing references)
//IL_059b: Invalid comparison between Unknown and I4
ValuableDirector obj9;
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
<vd>5__2 = ValuableDirector.instance;
float num = SemiFunc.RunGetDifficultyMultiplier();
if (SemiFunc.RunIsArena())
{
num = 0.75f;
}
<vd>5__2.totalMaxAmount = Mathf.RoundToInt(<vd>5__2.totalMaxAmountCurve.Evaluate(num));
<vd>5__2.tinyMaxAmount = Mathf.RoundToInt(<vd>5__2.tinyMaxAmountCurve.Evaluate(num));
<vd>5__2.smallMaxAmount = Mathf.RoundToInt(<vd>5__2.smallMaxAmountCurve.Evaluate(num));
<vd>5__2.mediumMaxAmount = Mathf.RoundToInt(<vd>5__2.mediumMaxAmountCurve.Evaluate(num));
<vd>5__2.bigMaxAmount = Mathf.RoundToInt(<vd>5__2.bigMaxAmountCurve.Evaluate(num));
<vd>5__2.wideMaxAmount = Mathf.RoundToInt(<vd>5__2.wideMaxAmountCurve.Evaluate(num));
<vd>5__2.tallMaxAmount = Mathf.RoundToInt(<vd>5__2.tallMaxAmountCurve.Evaluate(num));
<vd>5__2.veryTallMaxAmount = Mathf.RoundToInt(<vd>5__2.veryTallMaxAmountCurve.Evaluate(num));
if (SemiFunc.RunIsArena())
{
ValuableDirector obj = <vd>5__2;
obj.totalMaxAmount /= 2;
ValuableDirector obj2 = <vd>5__2;
obj2.tinyMaxAmount /= 3;
ValuableDirector obj3 = <vd>5__2;
obj3.smallMaxAmount /= 3;
ValuableDirector obj4 = <vd>5__2;
obj4.mediumMaxAmount /= 3;
ValuableDirector obj5 = <vd>5__2;
obj5.bigMaxAmount /= 3;
ValuableDirector obj6 = <vd>5__2;
obj6.wideMaxAmount /= 2;
ValuableDirector obj7 = <vd>5__2;
obj7.tallMaxAmount /= 2;
ValuableDirector obj8 = <vd>5__2;
obj8.veryTallMaxAmount /= 2;
}
foreach (LevelValuables valuablePreset in LevelGenerator.Instance.Level.ValuablePresets)
{
<vd>5__2.tinyValuables.AddRange(valuablePreset.tiny);
<vd>5__2.smallValuables.AddRange(valuablePreset.small);
<vd>5__2.mediumValuables.AddRange(valuablePreset.medium);
<vd>5__2.bigValuables.AddRange(valuablePreset.big);
<vd>5__2.wideValuables.AddRange(valuablePreset.wide);
<vd>5__2.tallValuables.AddRange(valuablePreset.tall);
<vd>5__2.veryTallValuables.AddRange(valuablePreset.veryTall);
}
List<ValuableVolume> list = Object.FindObjectsByType<ValuableVolume>((FindObjectsInactive)0, (FindObjectsSortMode)0).ToList();
sortVolumesOnLocation(list);
Random.InitState(RepoSeeded.ValuableTypeRandom.Next());
<vd>5__2.tinyVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 0);
ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)<vd>5__2.tinyVolumes);
<vd>5__2.smallVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 1);
ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)<vd>5__2.smallVolumes);
<vd>5__2.mediumVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 2);
ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)<vd>5__2.mediumVolumes);
<vd>5__2.bigVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 3);
ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)<vd>5__2.bigVolumes);
<vd>5__2.wideVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 4);
ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)<vd>5__2.wideVolumes);
<vd>5__2.tallVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 5);
ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)<vd>5__2.tallVolumes);
<vd>5__2.veryTallVolumes = list.FindAll((ValuableVolume x) => (int)x.VolumeType == 6);
ListExtension.Shuffle<ValuableVolume>((IList<ValuableVolume>)<vd>5__2.veryTallVolumes);
if ((int)<vd>5__2.valuableDebug == 1)
{
<vd>5__2.totalMaxAmount = list.Count;
<vd>5__2.tinyMaxAmount = <vd>5__2.tinyVolumes.Count;
<vd>5__2.smallMaxAmount = <vd>5__2.smallVolumes.Count;
<vd>5__2.mediumMaxAmount = <vd>5__2.mediumVolumes.Count;
<vd>5__2.bigMaxAmount = <vd>5__2.bigVolumes.Count;
<vd>5__2.wideMaxAmount = <vd>5__2.wideVolumes.Count;
<vd>5__2.tallMaxAmount = <vd>5__2.tallVolumes.Count;
<vd>5__2.veryTallMaxAmount = <vd>5__2.veryTallVolumes.Count;
}
if ((int)<vd>5__2.valuableDebug == 2 || LevelGenerator.Instance.Level.ValuablePresets.Count <= 0)
{
<vd>5__2.totalMaxAmount = 0;
<vd>5__2.tinyMaxAmount = 0;
<vd>5__2.smallMaxAmount = 0;
<vd>5__2.mediumMaxAmount = 0;
<vd>5__2.bigMaxAmount = 0;
<vd>5__2.wideMaxAmount = 0;
<vd>5__2.tallMaxAmount = 0;
<vd>5__2.veryTallMaxAmount = 0;
}
<vd>5__2.valuableTargetAmount = 0;
<_names>5__3 = new string[7] { "Tiny", "Small", "Medium", "Big", "Wide", "Tall", "Very Tall" };
<_maxAmount>5__4 = new int[7] { <vd>5__2.tinyMaxAmount, <vd>5__2.smallMaxAmount, <vd>5__2.mediumMaxAmount, <vd>5__2.bigMaxAmount, <vd>5__2.wideMaxAmount, <vd>5__2.tallMaxAmount, <vd>5__2.veryTallMaxAmount };
<_volumes>5__5 = new List<ValuableVolume>[7] { <vd>5__2.tinyVolumes, <vd>5__2.smallVolumes, <vd>5__2.mediumVolumes, <vd>5__2.bigVolumes, <vd>5__2.wideVolumes, <vd>5__2.tallVolumes, <vd>5__2.veryTallVolumes };
<_path>5__6 = new string[7] { <vd>5__2.tinyPath, <vd>5__2.smallPath, <vd>5__2.mediumPath, <vd>5__2.bigPath, <vd>5__2.widePath, <vd>5__2.tallPath, <vd>5__2.veryTallPath };
<_chance>5__7 = new int[7] { <vd>5__2.tinyChance, <vd>5__2.smallChance, <vd>5__2.mediumChance, <vd>5__2.bigChance, <vd>5__2.wideChance, <vd>5__2.tallChance, <vd>5__2.veryTallChance };
<_valuables>5__8 = new List<GameObject>[7] { <vd>5__2.tinyValuables, <vd>5__2.smallValuables, <vd>5__2.mediumValuables, <vd>5__2.bigValuables, <vd>5__2.wideValuables, <vd>5__2.tallValuables, <vd>5__2.veryTallValuables };
<_volumeIndex>5__9 = new int[7];
<_i>5__10 = 0;
goto IL_09b8;
}
case 1:
<>1__state = -1;
<_i>5__10++;
goto IL_09b8;
case 2:
<>1__state = -1;
goto IL_0ae3;
case 3:
{
<>1__state = -1;
break;
}
IL_09b8:
if (<_i>5__10 < <vd>5__2.totalMaxAmount)
{
Random.InitState(RepoSeeded.ValuableTypeRandom.Next());
float num2 = -1f;
int num3 = -1;
for (int i = 0; i < <_names>5__3.Length; i++)
{
if (<_volumeIndex>5__9[i] < <_maxAmount>5__4[i] && <_volumeIndex>5__9[i] < <_volumes>5__5[i].Count)
{
int num4 = Random.Range(0, <_chance>5__7[i]);
if ((float)num4 > num2)
{
num2 = num4;
num3 = i;
}
}
}
if (num3 != -1)
{
ValuableVolume val = <_volumes>5__5[num3][<_volumeIndex>5__9[num3]];
GameObject val2 = <_valuables>5__8[num3][Random.Range(0, <_valuables>5__8[num3].Count)];
<vd>5__2.Spawn(val2, val, <_path>5__6[num3]);
<_volumeIndex>5__9[num3]++;
<>2__current = null;
<>1__state = 1;
return true;
}
}
if (<vd>5__2.valuableTargetAmount < <vd>5__2.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)))
{
for (int j = 0; j < <_names>5__3.Length; j++)
{
if (<_volumeIndex>5__9[j] < <_maxAmount>5__4[j])
{
Debug.LogError((object)("Could not spawn enough ''" + <_names>5__3[j] + "'' valuables!"));
}
}
}
if (GameManager.instance.gameMode == 1)
{
<vd>5__2.PhotonView.RPC("ValuablesTargetSetRPC", (RpcTarget)0, new object[1] { <vd>5__2.valuableTargetAmount });
}
obj9 = <vd>5__2;
obj9.valuableSpawnPlayerReady++;
goto IL_0ae3;
IL_0ae3:
if (GameManager.instance.gameMode == 1 && <vd>5__2.valuableSpawnPlayerReady < PhotonNetwork.CurrentRoom.PlayerCount)
{
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 2;
return true;
}
<vd>5__2.VolumesAndSwitchSetup();
break;
}
if (GameManager.instance.gameMode == 1 && <vd>5__2.switchSetupPlayerReady < PhotonNetwork.CurrentRoom.PlayerCount)
{
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 3;
return true;
}
<vd>5__2.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();
}
}
[HarmonyPrefix]
[HarmonyPatch("SetupHost")]
private static bool ValuablesRNGSeeder(ref IEnumerator __result)
{
__result = newSetupHost();
return false;
}
[IteratorStateMachine(typeof(<newSetupHost>d__1))]
private static IEnumerator newSetupHost()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <newSetupHost>d__1(0);
}
[HarmonyPatch("Spawn")]
[HarmonyPrefix]
private static bool RemoveStartRandomizing(ref GameObject _valuable, ref ValuableVolume _volume, ref string _path)
{
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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)
ValuableDirector instance = ValuableDirector.instance;
if (GameManager.instance.gameMode == 0)
{
GameObject val = Object.Instantiate<GameObject>(_valuable, ((Component)_volume).transform.position, ((Component)_volume).transform.rotation);
ValuableObject component = val.GetComponent<ValuableObject>();
Random.InitState(RepoSeeded.ValuableCostRandom.Next());
component.dollarValueOverride = (int)Mathf.Round(Random.Range(component.valuePreset.valueMin, component.valuePreset.valueMax));
component.dollarValueOverride = (int)(Mathf.Round((float)component.dollarValueOverride / 100f) * 100f);
}
else
{
PhotonNetwork.InstantiateRoomObject(instance.resourcePath + _path + "/" + ((Object)_valuable).name, ((Component)_volume).transform.position, ((Component)_volume).transform.rotation, (byte)0, (object[])null);
}
instance.valuableTargetAmount++;
return false;
}
public static void sortVolumesOnLocation(List<ValuableVolume> volumes)
{
volumes.Sort(delegate(ValuableVolume a, ValuableVolume b)
{
//IL_000f: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = new Vector3(0f, 0f, 0f) - ((Component)a).transform.position;
float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
val = new Vector3(0f, 0f, 0f) - ((Component)b).transform.position;
return sqrMagnitude.CompareTo(((Vector3)(ref val)).sqrMagnitude);
});
}
}
}