using System;
using System.Collections.Generic;
using System.Diagnostics;
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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using RebalancedMoons.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.SceneManagement;
using WeatherRegistry;
[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-CSharp")]
[assembly: IgnoresAccessChecksTo("Chameleon")]
[assembly: IgnoresAccessChecksTo("LethalLevelLoader")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: AssemblyCompany("RebalancedMoons")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Rebalances/reworks some of the vanilla moons.")]
[assembly: AssemblyFileVersion("1.6.10.0")]
[assembly: AssemblyInformationalVersion("1.6.10+d65c0e1cda78f685decb57fcca334dcab1411bf6")]
[assembly: AssemblyProduct("RebalancedMoons")]
[assembly: AssemblyTitle("RebalancedMoons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.6.10.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace RebalancedMoons
{
[CreateAssetMenu(menuName = "ScriptableObjects/BundledCurve", order = 2)]
public class BundledCurve : ScriptableObject
{
public AnimationCurve curve;
}
public class ModConfig
{
internal static ConfigEntry<bool> configTitanLighting;
internal static ConfigEntry<bool> configExperimentationScene;
internal static ConfigEntry<bool> configVowScene;
internal static ConfigEntry<bool> configAssuranceScene;
internal static ConfigEntry<bool> configOffenseScene;
internal static ConfigEntry<bool> configAdamanceScene;
internal static ConfigEntry<bool> configMarchScene;
internal static ConfigEntry<bool> configRendScene;
internal static ConfigEntry<bool> configDineScene;
internal static ConfigEntry<bool> configTitanScene;
internal static ConfigEntry<bool> configEmbrionScene;
internal static ConfigEntry<bool> configArtificeScene;
internal static ConfigEntry<bool> configMarchBridge;
internal static ConfigEntry<bool> configTitanThirdFireExit;
internal static ConfigEntry<bool> configMarchDungeons;
internal static ConfigEntry<bool> configDineDungeons;
internal static ConfigEntry<bool> configTitanDungeons;
internal static ConfigEntry<bool> configWeatherOverrides;
internal static ConfigEntry<bool> configMoonPriceOverrides;
internal static ConfigEntry<bool> configEmbrionBoulders;
internal static ConfigEntry<bool> configEmbrionGambling;
internal static void Init(ConfigFile cfg)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Expected O, but got Unknown
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Expected O, but got Unknown
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Expected O, but got Unknown
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Expected O, but got Unknown
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Expected O, but got Unknown
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Expected O, but got Unknown
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Expected O, but got Unknown
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Expected O, but got Unknown
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Expected O, but got Unknown
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Expected O, but got Unknown
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Expected O, but got Unknown
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Expected O, but got Unknown
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Expected O, but got Unknown
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0319: Expected O, but got Unknown
configTitanLighting = cfg.Bind<bool>("Client", "Titan Lighting", true, new ConfigDescription("Adds colder interior lighting to Titan.", (AcceptableValueBase)null, Array.Empty<object>()));
configMarchBridge = cfg.Bind<bool>("Server", "March Rickety Bridge", true, new ConfigDescription("Adds a rickety bridge to March. Stats are inbetween Adamance and Vow.", (AcceptableValueBase)null, Array.Empty<object>()));
configTitanThirdFireExit = cfg.Bind<bool>("Server", "Titan Third Fire Exit", false, new ConfigDescription("Adds a 3rd fire exit to Titan under the first one. Off by default as it's a bit overpowered.", (AcceptableValueBase)null, Array.Empty<object>()));
configExperimentationScene = cfg.Bind<bool>("Server", "Experimentation Scene Overrides", true, new ConfigDescription("Replaces Experimentation's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configAssuranceScene = cfg.Bind<bool>("Server", "Assurance Scene Overrides", true, new ConfigDescription("Replaces Assurance's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configOffenseScene = cfg.Bind<bool>("Server", "Offense Scene Overrides", true, new ConfigDescription("Replaces Offense's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configVowScene = cfg.Bind<bool>("Server", "Vow Scene Overrides", true, new ConfigDescription("Replaces Vow's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configMarchScene = cfg.Bind<bool>("Server", "March Scene Overrides", true, new ConfigDescription("Replaces March's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configAdamanceScene = cfg.Bind<bool>("Server", "Adamance Scene Overrides", true, new ConfigDescription("Replaces Adamance's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configRendScene = cfg.Bind<bool>("Server", "Rend Scene Overrides", true, new ConfigDescription("Replaces Rend's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configDineScene = cfg.Bind<bool>("Server", "Dine Scene Overrides", true, new ConfigDescription("Replaces Dine's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configTitanScene = cfg.Bind<bool>("Server", "Titan Scene Overrides", true, new ConfigDescription("Replaces Titan's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configEmbrionScene = cfg.Bind<bool>("Server", "Embrion Scene Overrides", true, new ConfigDescription("Replaces Embrion's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configArtificeScene = cfg.Bind<bool>("Server", "Artifice Scene Overrides", true, new ConfigDescription("Replaces Artifice's scene with a new one using LLL.", (AcceptableValueBase)null, Array.Empty<object>()));
configEmbrionBoulders = cfg.Bind<bool>("Server", "Embrion Boulders", true, new ConfigDescription("Adds randomly spawning boulders to Embrion.", (AcceptableValueBase)null, Array.Empty<object>()));
configEmbrionGambling = cfg.Bind<bool>("Server", "Embrion Gambling", true, new ConfigDescription("Randomizes Embrion's scrap pool equally with every one handed item in the game.", (AcceptableValueBase)null, Array.Empty<object>()));
configMarchDungeons = cfg.Bind<bool>("Server", "March Interior Overrides", true, new ConfigDescription("REQUIRES RESTART WHEN DISABLING INGAME - Overrides the interior selections on March to include all vanilla interiors.", (AcceptableValueBase)null, Array.Empty<object>()));
configDineDungeons = cfg.Bind<bool>("Server", "Dine Interior Overrides", true, new ConfigDescription("REQUIRES RESTART WHEN DISABLING INGAME - Overrides the interior selections on Dine to make Mineshaft less common.", (AcceptableValueBase)null, Array.Empty<object>()));
configTitanDungeons = cfg.Bind<bool>("Server", "Titan Interior Overrides", true, new ConfigDescription("REQUIRES RESTART WHEN DISABLING INGAME - Overrides the interior selections on Titan to make Mineshaft significantly more common.", (AcceptableValueBase)null, Array.Empty<object>()));
configWeatherOverrides = cfg.Bind<bool>("Server", "Weather Overrides", true, new ConfigDescription("Enables weather overrides on rebalanced moons (Replaces Rainy w/ Foggy on Dine)", (AcceptableValueBase)null, Array.Empty<object>()));
configMoonPriceOverrides = cfg.Bind<bool>("Server", "Price Overrides", true, new ConfigDescription("Enables price overrides on rebalanced moons", (AcceptableValueBase)null, Array.Empty<object>()));
}
}
public class ModNetworkHandler : NetworkBehaviour
{
public static ModNetworkHandler Instance { get; private set; }
public static event Action<int, string, string> SendLevelEvent;
public override void OnNetworkSpawn()
{
ModNetworkHandler.SendLevelEvent = null;
if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && (Object)(object)Instance != (Object)null)
{
ModNetworkHandler instance = Instance;
if (instance != null)
{
((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
}
}
Instance = this;
((NetworkBehaviour)this).OnNetworkSpawn();
}
[ServerRpc(RequireOwnership = false)]
public void InteriorServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3535556583u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3535556583u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
if (ModConfig.configMarchDungeons.Value)
{
InteriorClientRpc("March");
}
if (ModConfig.configDineDungeons.Value)
{
InteriorClientRpc("Dine");
}
if (ModConfig.configTitanDungeons.Value)
{
InteriorClientRpc("Titan");
}
}
}
[ServerRpc(RequireOwnership = false)]
public void WeatherServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(275949116u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 275949116u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ModConfig.configWeatherOverrides.Value)
{
WeatherClientRpc();
}
}
}
[ServerRpc(RequireOwnership = false)]
public void MoonPriceServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3503754077u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3503754077u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ModConfig.configMoonPriceOverrides.Value)
{
MoonPriceClientRpc();
}
}
}
[ServerRpc(RequireOwnership = false)]
public void MoonPropertiesServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(21799551u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 21799551u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
if (ModConfig.configEmbrionBoulders.Value)
{
MoonPropertiesClientRpc("EmbrionBoulders");
}
if (ModConfig.configEmbrionGambling.Value)
{
MoonPropertiesClientRpc("EmbrionGambling");
}
}
}
[ClientRpc]
public void MoonPriceClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(157177165u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 157177165u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
foreach (ExtendedLevel vanillaExtendedLevel in PatchedContent.VanillaExtendedLevels)
{
if (vanillaExtendedLevel.NumberlessPlanetName == "Dine")
{
vanillaExtendedLevel.RoutePrice = 650;
}
}
}
[ClientRpc]
public void WeatherClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2505610390u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2505610390u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
foreach (ExtendedLevel vanillaExtendedLevel in PatchedContent.VanillaExtendedLevels)
{
string numberlessPlanetName = vanillaExtendedLevel.NumberlessPlanetName;
if (!(numberlessPlanetName == "Dine"))
{
if (numberlessPlanetName == "March")
{
vanillaExtendedLevel.SelectableLevel.overrideWeather = true;
vanillaExtendedLevel.SelectableLevel.overrideWeatherType = (LevelWeatherType)1;
}
continue;
}
RandomWeatherWithVariables val3 = ((IEnumerable<RandomWeatherWithVariables>)vanillaExtendedLevel.SelectableLevel.randomWeathers).FirstOrDefault((Func<RandomWeatherWithVariables, bool>)((RandomWeatherWithVariables weather) => (int)weather.weatherType == 1));
if (val3 != null)
{
val3.weatherType = (LevelWeatherType)3;
val3.weatherVariable = 4;
val3.weatherVariable2 = 12;
}
}
}
[ClientRpc]
public void MoonPropertiesClientRpc(string configProperty)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Expected O, but got Unknown
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Expected O, but got Unknown
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3612463388u, val, (RpcDelivery)0);
bool flag = configProperty != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(configProperty, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3612463388u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
foreach (ExtendedLevel vanillaExtendedLevel in PatchedContent.VanillaExtendedLevels)
{
if (!(vanillaExtendedLevel.NumberlessPlanetName == "Embrion"))
{
continue;
}
if (!(configProperty == "EmbrionBoulders"))
{
if (!(configProperty == "EmbrionGambling"))
{
continue;
}
vanillaExtendedLevel.SelectableLevel.spawnableScrap.Clear();
foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
{
if (!items.twoHanded && items.isScrap && (!items.isDefensiveWeapon || !(items.itemName != "Stop sign") || !(items.itemName != "Yield sign")))
{
SpawnableItemWithRarity val3 = new SpawnableItemWithRarity();
val3.spawnableItem = items;
val3.rarity = 300;
vanillaExtendedLevel.SelectableLevel.spawnableScrap.Add(val3);
}
}
continue;
}
BundledCurve bundledCurve = LoadCurve(ref Plugin.embyBoulderCurve, "EmbrionRockCurve");
if ((Object)(object)bundledCurve == (Object)null || bundledCurve.curve == null)
{
Debug.LogError((object)"Failed to load EmbrionRockCurve!");
break;
}
AnimationCurve curve = bundledCurve.curve;
string[] array = new string[4] { "LargeRock1Embrion", "LargeRock2Embrion", "LargeRock3Embrion", "LargeRock4Embrion" };
SpawnableOutsideObject[] array2 = (SpawnableOutsideObject[])(object)new SpawnableOutsideObject[4]
{
Plugin.embrionBoulder1,
Plugin.embrionBoulder2,
Plugin.embrionBoulder3,
Plugin.embrionBoulder4
};
List<SpawnableOutsideObjectWithRarity> list = new List<SpawnableOutsideObjectWithRarity>();
for (int i = 0; i < array.Length; i++)
{
SpawnableOutsideObject val4 = LoadOutsideObject(ref array2[i], array[i]);
if ((Object)(object)val4 == (Object)null)
{
Debug.LogError((object)("Failed to load object: " + array[i]));
continue;
}
SpawnableOutsideObjectWithRarity item = new SpawnableOutsideObjectWithRarity
{
spawnableObject = val4,
randomAmount = curve
};
list.Add(item);
}
vanillaExtendedLevel.SelectableLevel.spawnableOutsideObjects = list.ToArray();
}
}
public SpawnableOutsideObject LoadOutsideObject(ref SpawnableOutsideObject mapObject, string assetName)
{
if ((Object)(object)mapObject == (Object)null)
{
try
{
mapObject = Plugin.Instance.EmbrionBundle.LoadAsset<SpawnableOutsideObject>(assetName);
}
catch (Exception ex)
{
Plugin.Logger.LogError((object)("Failed to load asset '" + assetName + "' from bundle 'embrionboulders': " + ex.Message));
}
}
return mapObject;
}
public BundledCurve LoadCurve(ref BundledCurve curveObject, string assetName)
{
if ((Object)(object)curveObject == (Object)null)
{
try
{
curveObject = Plugin.Instance.EmbrionBundle.LoadAsset<BundledCurve>(assetName);
}
catch (Exception ex)
{
Plugin.Logger.LogError((object)("Failed to load asset '" + assetName + "' from bundle 'embrionboulders': " + ex.Message));
}
}
return curveObject;
}
[ClientRpc]
public void InteriorClientRpc(string name)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1063301947u, val, (RpcDelivery)0);
bool flag = name != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1063301947u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
string name2 = name;
if ((Object)(object)Plugin.rebalancedMoonsMod == (Object)null)
{
return;
}
foreach (ExtendedDungeonFlow extendedDungeonFlow in PatchedContent.ExtendedDungeonFlows)
{
List<StringWithRarity> planetNames2 = extendedDungeonFlow.LevelMatchingProperties.planetNames;
switch (((Object)extendedDungeonFlow.DungeonFlow).name)
{
case "Level1Flow3Exits":
planetNames2.RemoveAll((StringWithRarity p) => p.Name.Equals("March") && name2.Equals("March"));
break;
case "Level1Flow":
UpdateMoonInList(planetNames2, "Titan", 140, name2);
AddMoonIfNotInList(planetNames2, "March", 300, name2);
break;
case "Level2Flow":
UpdateMoonInList(planetNames2, "Titan", 40, name2);
AddMoonIfNotInList(planetNames2, "March", 5, name2);
break;
case "Level3Flow":
UpdateMoonInList(planetNames2, "Dine", 50, name2);
UpdateMoonInList(planetNames2, "Titan", 300, name2);
AddMoonIfNotInList(planetNames2, "March", 190, name2);
break;
}
}
static void AddMoonIfNotInList(List<StringWithRarity> planetNames, string planetName, int rarity, string configEvent)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
if (!planetNames.Any((StringWithRarity p) => p.Name.Equals(planetName) && p.Name.Equals(configEvent)))
{
planetNames.Add(new StringWithRarity(planetName, rarity));
}
}
static void UpdateMoonInList(List<StringWithRarity> planetNames, string planetName, int newRarity, string configEvent)
{
foreach (StringWithRarity planetName in planetNames)
{
if (planetName.Name.Equals(planetName) && planetName.Name.Equals(configEvent))
{
planetName.Rarity = newRarity;
}
}
}
}
[ClientRpc]
public void DeactivateObjectClientRpc(string name)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1937315323u, val, (RpcDelivery)0);
bool flag = name != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1937315323u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
GameObject val3 = GameObject.Find(name);
if ((Object)(object)val3 != (Object)null && val3.activeSelf)
{
val3.SetActive(false);
}
}
}
[ClientRpc]
public void LevelClientRpc(int extendedLevel, string eventName, string sceneName)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1937144637u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, extendedLevel);
bool flag = eventName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(eventName, false);
}
bool flag2 = sceneName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
if (flag2)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(sceneName, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1937144637u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
ModNetworkHandler.SendLevelEvent?.Invoke(extendedLevel, eventName, sceneName);
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_ModNetworkHandler()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(3535556583u, new RpcReceiveHandler(__rpc_handler_3535556583));
NetworkManager.__rpc_func_table.Add(275949116u, new RpcReceiveHandler(__rpc_handler_275949116));
NetworkManager.__rpc_func_table.Add(3503754077u, new RpcReceiveHandler(__rpc_handler_3503754077));
NetworkManager.__rpc_func_table.Add(21799551u, new RpcReceiveHandler(__rpc_handler_21799551));
NetworkManager.__rpc_func_table.Add(157177165u, new RpcReceiveHandler(__rpc_handler_157177165));
NetworkManager.__rpc_func_table.Add(2505610390u, new RpcReceiveHandler(__rpc_handler_2505610390));
NetworkManager.__rpc_func_table.Add(3612463388u, new RpcReceiveHandler(__rpc_handler_3612463388));
NetworkManager.__rpc_func_table.Add(1063301947u, new RpcReceiveHandler(__rpc_handler_1063301947));
NetworkManager.__rpc_func_table.Add(1937315323u, new RpcReceiveHandler(__rpc_handler_1937315323));
NetworkManager.__rpc_func_table.Add(1937144637u, new RpcReceiveHandler(__rpc_handler_1937144637));
}
private static void __rpc_handler_3535556583(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((ModNetworkHandler)(object)target).InteriorServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_275949116(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((ModNetworkHandler)(object)target).WeatherServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3503754077(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((ModNetworkHandler)(object)target).MoonPriceServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_21799551(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((ModNetworkHandler)(object)target).MoonPropertiesServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_157177165(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((ModNetworkHandler)(object)target).MoonPriceClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2505610390(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((ModNetworkHandler)(object)target).WeatherClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3612463388(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string configProperty = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref configProperty, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((ModNetworkHandler)(object)target).MoonPropertiesClientRpc(configProperty);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1063301947(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string name = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((ModNetworkHandler)(object)target).InteriorClientRpc(name);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1937315323(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string name = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((ModNetworkHandler)(object)target).DeactivateObjectClientRpc(name);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1937144637(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int extendedLevel = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref extendedLevel);
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string eventName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false);
}
bool flag2 = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
string sceneName = null;
if (flag2)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref sceneName, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((ModNetworkHandler)(object)target).LevelClientRpc(extendedLevel, eventName, sceneName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "ModNetworkHandler";
}
}
internal class ModUtil
{
public static List<T> SearchInLatestScene<T>() where T : Object
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
List<T> list = new List<T>();
Scene sceneAt = SceneManager.GetSceneAt(SceneManager.sceneCount - 1);
GameObject[] rootGameObjects = ((Scene)(ref sceneAt)).GetRootGameObjects();
for (int i = 0; i < rootGameObjects.Length; i++)
{
T[] componentsInChildren = rootGameObjects[i].GetComponentsInChildren<T>();
foreach (T item in componentsInChildren)
{
list.Add(item);
}
}
return list;
}
}
internal class NetworkObjectManager
{
private static GameObject networkPrefab;
[HarmonyPatch(typeof(GameNetworkManager), "Start")]
[HarmonyPostfix]
public static void Init()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
if (!((Object)(object)networkPrefab != (Object)null))
{
networkPrefab = (GameObject)Plugin.Instance.NetworkBundle.LoadAsset("RBMNetworkHandler");
networkPrefab.AddComponent<ModNetworkHandler>();
NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
}
}
[HarmonyPatch(typeof(StartOfRound), "Awake")]
[HarmonyPostfix]
private static void SpawnNetworkHandler()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity);
Plugin.Logger.LogDebug((object)("Network handler instantiated at " + (object)val));
val.GetComponent<NetworkObject>().Spawn(false);
}
}
}
[BepInPlugin("dopadream.lethalcompany.rebalancedmoons", "RebalancedMoons", "1.6.10")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal class RebalancedMoonsPatches
{
private static void InitMoons()
{
if (!Plugin.IsSetupComplete)
{
return;
}
foreach (ExtendedLevel vanillaExtendedLevel in PatchedContent.VanillaExtendedLevels)
{
SwapScene(vanillaExtendedLevel);
}
}
private static void SwapScene(ExtendedLevel extendedLevel)
{
if (new Dictionary<string, Action<ExtendedLevel>>
{
{
"Experimentation",
delegate(ExtendedLevel level)
{
SetScene(level, "ReExperimentationScene");
}
},
{
"Assurance",
delegate(ExtendedLevel level)
{
SetScene(level, "ReAssuranceScene");
}
},
{
"Offense",
delegate(ExtendedLevel level)
{
SetScene(level, "ReOffenseScene");
}
},
{
"Vow",
delegate(ExtendedLevel level)
{
SetScene(level, "ReVowScene");
}
},
{
"March",
delegate(ExtendedLevel level)
{
SetScene(level, "ReMarchScene");
}
},
{
"Adamance",
delegate(ExtendedLevel level)
{
SetScene(level, "ReAdamanceScene");
}
},
{
"Rend",
delegate(ExtendedLevel level)
{
SetScene(level, "ReRendScene");
}
},
{
"Dine",
delegate(ExtendedLevel level)
{
SetScene(level, "ReDineScene");
}
},
{
"Titan",
delegate(ExtendedLevel level)
{
SetScene(level, "ReTitanScene");
}
},
{
"Artifice",
delegate(ExtendedLevel level)
{
SetScene(level, "ReArtificeScene");
}
},
{
"Embrion",
delegate(ExtendedLevel level)
{
SetScene(level, "ReEmbrionScene");
}
}
}.TryGetValue(extendedLevel.NumberlessPlanetName, out var value))
{
value(extendedLevel);
}
}
private static void SetScene(ExtendedLevel extendedLevel, string sceneName)
{
if ((NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) && new Dictionary<string, bool>
{
{
"Experimentation",
ModConfig.configExperimentationScene.Value
},
{
"Assurance",
ModConfig.configAssuranceScene.Value
},
{
"Offense",
ModConfig.configOffenseScene.Value
},
{
"Vow",
ModConfig.configVowScene.Value
},
{
"March",
ModConfig.configMarchScene.Value
},
{
"Adamance",
ModConfig.configAdamanceScene.Value
},
{
"Rend",
ModConfig.configRendScene.Value
},
{
"Dine",
ModConfig.configDineScene.Value
},
{
"Titan",
ModConfig.configTitanScene.Value
},
{
"Embrion",
ModConfig.configEmbrionScene.Value
},
{
"Artifice",
ModConfig.configArtificeScene.Value
}
}.TryGetValue(extendedLevel.NumberlessPlanetName, out var value) && value)
{
SendLevelToClients(extendedLevel.SelectableLevel.levelID, "RBMSceneEvent", sceneName);
}
}
[HarmonyPatch(typeof(QuickMenuManager), "Start")]
[HarmonyPostfix]
private static void SubscribeToHandler()
{
ModNetworkHandler.SendLevelEvent += ReceivedLevelFromServer;
SetupLobby(StartOfRound.Instance);
ModNetworkHandler.Instance.InteriorServerRpc();
ModNetworkHandler.Instance.MoonPriceServerRpc();
ModNetworkHandler.Instance.WeatherServerRpc();
ModNetworkHandler.Instance.MoonPropertiesServerRpc();
}
[HarmonyPatch(typeof(QuickMenuManager), "LeaveGameConfirm")]
[HarmonyPostfix]
private static void UnsubscribeFromHandler()
{
ModNetworkHandler.SendLevelEvent -= ReceivedLevelFromServer;
}
[HarmonyPatch(typeof(StartOfRound), "OnClientConnect")]
[HarmonyPostfix]
private static void ClientConnectPostFix(StartOfRound __instance)
{
SetupLobby(__instance);
}
private static void SetupLobby(StartOfRound __instance)
{
InitMoons();
}
public static void SendLevelToClients(int extendedLevel, string eventName, string sceneName)
{
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
ModNetworkHandler.Instance.LevelClientRpc(extendedLevel, eventName, sceneName);
}
}
public static void ReceivedLevelFromServer(int extendedLevel, string eventName, string sceneName)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
foreach (ExtendedLevel vanillaExtendedLevel in PatchedContent.VanillaExtendedLevels)
{
if (!vanillaExtendedLevel.SelectableLevel.levelID.Equals(extendedLevel))
{
continue;
}
if (!(eventName == "RBMSceneEvent"))
{
if (eventName == "VanillaSceneEvent" && new Dictionary<string, string>
{
{ "ReExperimentationScene", "Level1Experimentation" },
{ "ReAssuranceScene", "Level2Assurance" },
{ "ReVowScene", "Level3Vow" },
{ "ReMarchScene", "Level4March" },
{ "ReRendScene", "Level5Rend" },
{ "ReDineScene", "Level6Dine" },
{ "ReOffenseScene", "Level7Offense" },
{ "ReTitanScene", "Level8Titan" },
{ "ReArtificeScene", "Level9Artifice" },
{ "ReAdamanceScene", "Level10Adamance" }
}.TryGetValue(vanillaExtendedLevel.SelectableLevel.sceneName, out var value))
{
vanillaExtendedLevel.SelectableLevel.sceneName = sceneName;
vanillaExtendedLevel.SceneSelections.Clear();
vanillaExtendedLevel.SceneSelections.Add(new StringWithRarity(value, 100));
}
}
else
{
vanillaExtendedLevel.SelectableLevel.sceneName = sceneName;
vanillaExtendedLevel.SceneSelections.Clear();
vanillaExtendedLevel.SceneSelections.Add(new StringWithRarity(sceneName, 100));
}
}
}
[HarmonyPatch(typeof(RoundManager), "SetChallengeFileRandomModifiers")]
[HarmonyPriority(800)]
[HarmonyPrefix]
private static void OnGenerateNewFloorPrefix(RoundManager __instance)
{
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
if (!ModConfig.configTitanThirdFireExit.Value && (Object)(object)StartOfRound.Instance.currentLevel != (Object)null && ((Object)StartOfRound.Instance.currentLevel).name.Equals("TitanLevel") && ModConfig.configTitanScene.Value)
{
Logger.LogDebug((object)"Rebalanced Titan loaded, destroying 3rd fire exit...");
ModNetworkHandler.Instance.DeactivateObjectClientRpc("Environment/Teleports/FireExitDoorContainerD");
}
if (!ModConfig.configMarchBridge.Value && (Object)(object)StartOfRound.Instance.currentLevel != (Object)null && ((Object)StartOfRound.Instance.currentLevel).name.Equals("MarchLevel") && ModConfig.configMarchScene.Value)
{
Logger.LogDebug((object)"Rebalanced March loaded, destroying rickety bridge...");
ModNetworkHandler.Instance.DeactivateObjectClientRpc("Environment/DangerousBridge");
}
}
}
[HarmonyPatch(typeof(RoundManager), "RefreshLightsList")]
[HarmonyPostfix]
private static void RefreshLightsPostFix(ref List<Light> ___allPoweredLights)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
if (!ModConfig.configTitanLighting.Value || !((Object)StartOfRound.Instance.currentLevel).name.Equals("TitanLevel"))
{
return;
}
foreach (Light ___allPoweredLight in ___allPoweredLights)
{
if ((Object)(object)___allPoweredLight != (Object)null)
{
___allPoweredLight.useColorTemperature = true;
___allPoweredLight.color = new Color(0.7f, 0.735f, 0.76f, 1f);
___allPoweredLight.colorTemperature = 6500f;
}
}
}
[HarmonyPatch(typeof(PlayerControllerB), "KillPlayerClientRpc")]
[HarmonyPostfix]
private static void OnKillPlayerClientRpcPostfix(PlayerControllerB __instance)
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
if (!ModConfig.configTitanLighting.Value || !((Object)StartOfRound.Instance.currentLevel).name.Equals("TitanLevel") || RoundManager.Instance.LevelRandom.Next(0, 2) == 0 || __instance.playersManager.connectedPlayersAmount < 1 || __instance.playersManager.livingPlayers != 1)
{
return;
}
RoundManager.Instance.FlickerLights(false, false);
foreach (Light allPoweredLight in RoundManager.Instance.allPoweredLights)
{
if ((Object)(object)allPoweredLight != (Object)null)
{
allPoweredLight.color = new Color(0.4f, 0.425f, 0.45f, 1f);
}
}
}
}
public const string PLUGIN_GUID = "dopadream.lethalcompany.rebalancedmoons";
public const string PLUGIN_NAME = "RebalancedMoons";
public const string PLUGIN_VERSION = "1.6.10";
public const string WEATHER_REGISTRY = "mrov.WeatherRegistry";
internal static ManualLogSource Logger;
internal static ExtendedMod rebalancedMoonsMod;
internal static SpawnableOutsideObject embrionBoulder1;
internal static SpawnableOutsideObject embrionBoulder2;
internal static SpawnableOutsideObject embrionBoulder3;
internal static SpawnableOutsideObject embrionBoulder4;
internal static BundledCurve embyBoulderCurve;
public AssetBundle NetworkBundle;
public AssetBundle EmbrionBundle;
public static Plugin Instance { get; set; }
public Plugin()
{
Instance = this;
}
private void Awake()
{
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
ModConfig.Init(((BaseUnityPlugin)this).Config);
string? directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
string text = Path.Combine(directoryName, "networkprefab");
NetworkBundle = AssetBundle.LoadFromFile(text);
string text2 = Path.Combine(directoryName, "embrionboulders");
EmbrionBundle = AssetBundle.LoadFromFile(text2);
NetcodePatcher();
AssetBundleLoader.AddOnExtendedModLoadedListener((Action<ExtendedMod>)OnExtendedModRegistered, "dopadream", "RebalancedMoons");
Harmony val = new Harmony("dopadream.lethalcompany.rebalancedmoons");
val.PatchAll(typeof(NetworkObjectManager));
val.PatchAll(typeof(RebalancedMoonsPatches));
if (Chainloader.PluginInfos.ContainsKey("mrov.WeatherRegistry"))
{
val.PatchAll(typeof(WeatherRegistryCompat));
}
Logger.LogInfo((object)"RebalancedMoons v1.6.10 loaded");
}
private static void NetcodePatcher()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
for (int i = 0; i < types.Length; i++)
{
MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
foreach (MethodInfo methodInfo in methods)
{
if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
internal static void OnExtendedModRegistered(ExtendedMod extendedMod)
{
if (!((Object)(object)extendedMod == (Object)null))
{
rebalancedMoonsMod = extendedMod;
}
}
}
internal class WeatherRegistryCompat
{
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
[HarmonyPostfix]
private static void startGamePostfix(RoundManager __instance)
{
initWeatherTweaksCompat(__instance);
}
private static void initWeatherTweaksCompat(RoundManager instance)
{
if (!((Object)instance.currentLevel).name.Equals("TitanLevel") || !WeatherManager.GetCurrentLevelWeather().Name.Equals("Blackout"))
{
return;
}
Plugin.Logger.LogDebug((object)"Titan Blackout detected, turning the evil fire exit off...");
foreach (AudioSource item in from aud in ModUtil.SearchInLatestScene<AudioSource>()
where ((Object)((Component)aud).gameObject).name == "BrokenLight"
select aud)
{
item.mute = true;
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "RebalancedMoons";
public const string PLUGIN_NAME = "RebalancedMoons";
public const string PLUGIN_VERSION = "1.6.10";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace RebalancedMoons.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}