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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using LethalLib.Extras;
using LethalLib.Modules;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using MonoMod.Utils;
using TestAccountCore.Dependencies;
using TestAccountCore.Dependencies.Compatibility;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Serialization;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TestAccount666.TestAccountCore")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A mod with some common methods I use in my mods")]
[assembly: AssemblyFileVersion("1.9.1.0")]
[assembly: AssemblyInformationalVersion("1.9.1+17c52cc3794aba852f262ad9fe23e8706023f75a")]
[assembly: AssemblyProduct("TestAccountCore")]
[assembly: AssemblyTitle("TestAccount666.TestAccountCore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.9.1.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 TestAccountCore
{
public static class AssetLoader
{
private static AssetBundle? _assets;
public static void LoadBundle(Assembly assembly, string assetBundleName)
{
string directoryName = Path.GetDirectoryName(assembly.Location);
if (directoryName == null)
{
TestAccountCore.Logger.LogError((object)("Failed to determine assembly '" + assembly.FullName + "' location."));
return;
}
string text = Path.Combine(directoryName, assetBundleName);
if (!File.Exists(text))
{
TestAccountCore.Logger.LogFatal((object)new StringBuilder("Asset bundle '" + assetBundleName + "' not found at " + text + ".").Append(" ").Append("Check if the asset bundle is in the same directory as the plugin.").ToString());
return;
}
try
{
_assets = AssetBundle.LoadFromFile(text);
}
catch (Exception ex)
{
TestAccountCore.Logger.LogError((object)("Failed to load asset bundle '" + assetBundleName + "' for assembly " + assembly.FullName + ": " + ex.Message));
}
}
public static void LoadCustomScripts(ConfigFile? configFile)
{
if (_assets == null || configFile == null)
{
return;
}
CustomScript[] source = _assets.LoadAllAssets<CustomScript>();
IEnumerable<CustomScript> enumerable = source.OfType<CustomScript>();
foreach (CustomScript item in enumerable)
{
item.Initialize(configFile);
}
}
public static void LoadItems(ConfigFile? configFile)
{
if (_assets != null && configFile != null)
{
ItemWithDefaultWeight[] source = _assets.LoadAllAssets<ItemWithDefaultWeight>();
IEnumerable<ItemWithDefaultWeight> source2 = source.OfType<ItemWithDefaultWeight>();
List<ItemWithDefaultWeight> itemsWithDefaultWeight = source2.ToList();
RegisterAllScrap(itemsWithDefaultWeight, configFile);
}
}
private static void RegisterAllScrap(List<ItemWithDefaultWeight> itemsWithDefaultWeight, ConfigFile? configFile)
{
ConfigFile configFile2 = configFile;
if (configFile2 != null)
{
itemsWithDefaultWeight.ForEach(delegate(ItemWithDefaultWeight item)
{
RegisterScrap(item, configFile2);
});
}
}
private static void RegisterScrap(ItemWithDefaultWeight item, ConfigFile? configFile)
{
if (configFile == null)
{
return;
}
if (item.item == null)
{
throw new NullReferenceException("ItemProperties cannot be null!");
}
ConfigEntry<bool> val = configFile.Bind<bool>(item.item.itemName ?? "", "1. Enabled", true, "If false, " + item.item.itemName + " will not be registered. This is different from a spawn weight of 0!");
if (!val.Value)
{
return;
}
ConfigEntry<int> val2 = configFile.Bind<int>(item.item.itemName ?? "", "2. Maximum Value", item.item.maxValue, "Defines the maximum scrap value for " + item.item.itemName + ".");
ConfigEntry<int> val3 = configFile.Bind<int>(item.item.itemName ?? "", "3. Minimum Value", item.item.minValue, "Defines the minimum scrap value for " + item.item.itemName + ".");
ConfigEntry<string> val4 = configFile.Bind<string>(item.item.itemName ?? "", "4. Moon Spawn Weight", $"Vanilla:{item.defaultWeight}, Modded:{item.defaultWeight}", $"Defines the spawn weight per moon. e.g. Assurance:{item.defaultWeight}");
item.item.maxValue = val2.Value;
item.item.minValue = val3.Value;
ConfigEntry<bool> val5 = configFile.Bind<bool>(item.item.itemName ?? "", "5. Is Conductive", item.item.isConductiveMetal, "If set to true, will make the item conductive. Conductive defines, if the item attracts lightning");
item.item.isConductiveMetal = val5.Value;
(Dictionary<LevelTypes, int>, Dictionary<string, int>) tuple = val4.Value.ParseConfig(item.item.itemName);
foreach (GameObject connectedNetworkPrefab in item.connectedNetworkPrefabs)
{
NetworkPrefabs.RegisterNetworkPrefab(connectedNetworkPrefab);
}
NetworkPrefabs.RegisterNetworkPrefab(item.item.spawnPrefab);
Items.RegisterScrap(item.item, tuple.Item1, tuple.Item2);
TestAccountCore.Logger.LogInfo((object)("Fully registered item " + item.item.itemName + "!"));
}
public static void LoadHazards(ConfigFile? configFile)
{
if (_assets != null && configFile != null)
{
MapHazardWithDefaultWeight[] source = _assets.LoadAllAssets<MapHazardWithDefaultWeight>();
IEnumerable<MapHazardWithDefaultWeight> source2 = source.OfType<MapHazardWithDefaultWeight>();
List<MapHazardWithDefaultWeight> hazardsWithDefaultWeight = source2.ToList();
RegisterAllHazards(hazardsWithDefaultWeight, configFile);
}
}
private static void RegisterAllHazards(List<MapHazardWithDefaultWeight> hazardsWithDefaultWeight, ConfigFile? configFile)
{
ConfigFile configFile2 = configFile;
if (configFile2 != null)
{
hazardsWithDefaultWeight.ForEach(delegate(MapHazardWithDefaultWeight hazard)
{
RegisterHazard(hazard, configFile2);
});
}
}
private static void RegisterHazard(MapHazardWithDefaultWeight hazard, ConfigFile? configFile)
{
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Expected O, but got Unknown
//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
//IL_03fc: 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_0414: 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_043e: Expected O, but got Unknown
//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
//IL_03d2: Expected O, but got Unknown
//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
if (configFile == null)
{
return;
}
if (hazard.hazardName == null)
{
throw new NullReferenceException("Map Hazard name cannot be null!");
}
TestAccountCore.Logger.LogInfo((object)("Registering hazard " + hazard.hazardName + "..."));
if (hazard.spawnableMapObject == null)
{
throw new NullReferenceException("(" + hazard.hazardName + ") Map Hazard cannot be null!");
}
ConfigEntry<bool> val = configFile.Bind<bool>(hazard.hazardName ?? "", "1. Enabled", true, "If false, " + hazard.hazardName + " will not be registered.");
if (!val.Value)
{
return;
}
AnimationCurve animationCurve;
if (string.IsNullOrWhiteSpace(hazard.spawnCurve))
{
int value = configFile.Bind<int>(hazard.hazardName ?? "", "2. Max Spawn Amount", hazard.amount, "The max spawn amount for " + hazard.hazardName + ".").Value;
animationCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 0f),
new Keyframe(1f, (float)value)
});
}
else
{
string spawnCurve = hazard.spawnCurve;
string value2 = configFile.Bind<string>(hazard.hazardName ?? "", "2. Spawn Curve", spawnCurve, "The spawn curve for " + hazard.hazardName + ". First number is between 0 and 1. The second one is the max amount.").Value;
value2 = value2.Replace(" ", "");
if (value2.StartsWith(","))
{
string text = value2;
value2 = text.Substring(1, text.Length - 1);
}
if (value2.EndsWith(","))
{
string text = value2;
value2 = text.Substring(0, text.Length - 1);
}
List<Keyframe> list = new List<Keyframe>();
string[] array = value2.Split(",");
foreach (string text2 in array)
{
string[] array2 = text2.Split(':');
if (array2.Length <= 1)
{
try
{
throw new InvalidDataException("'" + value2 + "' is invalid! Point: " + text2);
}
catch (Exception ex)
{
TestAccountCore.Logger.LogError((object)("Map Hazard spawn curve is not correctly configured: " + ex.Message));
Extensions.LogDetailed(ex, (string)null);
return;
}
}
if (!float.TryParse(array2[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
{
try
{
throw new InvalidDataException("'" + value2 + "' is invalid! Point: " + text2 + " (Could not parse time '" + array2[0] + "' as float)");
}
catch (Exception ex2)
{
TestAccountCore.Logger.LogError((object)("Map Hazard spawn curve is not correctly configured: " + ex2.Message));
Extensions.LogDetailed(ex2, (string)null);
return;
}
}
if (!int.TryParse(array2[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2))
{
try
{
throw new InvalidDataException("'" + value2 + "' is invalid! Point: " + text2 + " (Could not parse amount '" + array2[1] + "' as int)");
}
catch (Exception ex3)
{
TestAccountCore.Logger.LogError((object)("Map Hazard spawn curve is not correctly configured: " + ex3.Message));
Extensions.LogDetailed(ex3, (string)null);
return;
}
}
list.Add(new Keyframe(result, (float)result2));
}
animationCurve = new AnimationCurve(list.ToArray());
}
MapObjects.RegisterMapObject(new SpawnableMapObject
{
prefabToSpawn = hazard.spawnableMapObject,
spawnFacingWall = hazard.spawnFacingWall,
spawnWithBackToWall = hazard.spawnWithBackToWall,
spawnFacingAwayFromWall = hazard.spawnFacingAwayFromWall,
spawnWithBackFlushAgainstWall = hazard.spawnWithBackFlushAgainstWall,
disallowSpawningNearEntrances = hazard.disallowSpawningNearEntrances,
requireDistanceBetweenSpawns = hazard.requireDistanceBetweenSpawns
}, (LevelTypes)(-1), (Func<SelectableLevel, AnimationCurve>)((SelectableLevel _) => animationCurve));
NetworkPrefabs.RegisterNetworkPrefab(hazard.spawnableMapObject);
TestAccountCore.Logger.LogInfo((object)("Fully registered hazard " + hazard.hazardName + "!"));
}
private static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ParseConfig(this string configMoonRarity, string itemName)
{
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
foreach (string item in from configEntry in configMoonRarity.Split(',')
select configEntry.Trim())
{
if (string.IsNullOrWhiteSpace(item))
{
continue;
}
string[] array = item.Split(':');
if (array.Length != 2)
{
continue;
}
string text = array[0];
if (int.TryParse(array[1], out var result))
{
if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
{
dictionary[result2] = result;
TestAccountCore.Logger.LogInfo((object)$"Registered {itemName}'s weight for level type {result2} to {result}");
}
else
{
dictionary2[text] = result;
TestAccountCore.Logger.LogInfo((object)$"Registered {itemName}'s weight for custom level type {text} to {result}");
}
}
}
return (dictionary, dictionary2);
}
public static void LoadUnlockables(ConfigFile? configFile)
{
if (_assets != null && configFile != null)
{
UnlockableWithPrice[] source = _assets.LoadAllAssets<UnlockableWithPrice>();
IEnumerable<UnlockableWithPrice> source2 = source.OfType<UnlockableWithPrice>();
List<UnlockableWithPrice> unlockablesWithPrice = source2.ToList();
RegisterAllUnlockables(unlockablesWithPrice, configFile);
}
}
private static void RegisterAllUnlockables(List<UnlockableWithPrice> unlockablesWithPrice, ConfigFile? configFile)
{
ConfigFile configFile2 = configFile;
if (configFile2 != null)
{
unlockablesWithPrice.ForEach(delegate(UnlockableWithPrice unlockable)
{
RegisterUnlockable(unlockable, configFile2);
});
}
}
private static void RegisterUnlockable(UnlockableWithPrice unlockable, ConfigFile? configFile)
{
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Expected O, but got Unknown
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Expected O, but got Unknown
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
if (configFile == null)
{
return;
}
if (unlockable.unlockableName == null)
{
throw new NullReferenceException("Unlockable unlockableName cannot be null!");
}
TestAccountCore.Logger.LogInfo((object)("Registering unlockable " + unlockable.unlockableName + "..."));
if (unlockable.spawnPrefab == null)
{
throw new NullReferenceException("(" + unlockable.unlockableName + ") Spawn Prefab cannot be null!");
}
ConfigEntry<bool> val = configFile.Bind<bool>(unlockable.unlockableName ?? "", "1. Enabled", true, "If false, " + unlockable.unlockableName + " will not be registered.");
if (val.Value)
{
ConfigEntry<bool> val2 = configFile.Bind<bool>(unlockable.unlockableName ?? "", "2. Always unlocked", false, "If true, " + unlockable.unlockableName + " will always be unlocked. Otherwise you need to unlock it.");
ConfigEntry<int> val3 = configFile.Bind<int>(unlockable.unlockableName ?? "", "3. Price", unlockable.price, new ConfigDescription("Price to unlock " + unlockable.unlockableName + ". Obviously doesn't matter, if 'Always Unlocked' is true.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100000), Array.Empty<object>()));
ScriptableObject obj = ScriptableObject.CreateInstance(typeof(UnlockableItemDef));
UnlockableItemDef val4 = (UnlockableItemDef)(object)((obj is UnlockableItemDef) ? obj : null);
if (val4 == null)
{
throw new NullReferenceException("(" + unlockable.unlockableName + ") Could not create unlockable item!");
}
val4.storeType = unlockable.storeType;
val4.unlockable = new UnlockableItem
{
unlockableName = unlockable.unlockableName,
alreadyUnlocked = val2.Value,
inStorage = false,
alwaysInStock = true,
canBeStored = true,
maxNumber = 1,
unlockableType = 1,
hasBeenUnlockedByPlayer = val2.Value,
spawnPrefab = true,
prefabObject = unlockable.spawnPrefab
};
Unlockables.RegisterUnlockable(val4, val3.Value, unlockable.storeType);
NetworkPrefabs.RegisterNetworkPrefab(unlockable.spawnPrefab);
TestAccountCore.Logger.LogInfo((object)("Fully registered unlockable " + unlockable.unlockableName + "!"));
}
}
}
public abstract class CustomScript : ScriptableObject
{
public abstract void Initialize(ConfigFile? configFile);
}
[CreateAssetMenu(menuName = "ScriptableObjects/ItemWithDefaultWeight", order = 1)]
public class ItemWithDefaultWeight : ScriptableObject
{
[SerializeField]
[Tooltip("The item properties.")]
[Space(10f)]
public Item? item;
[SerializeField]
[Tooltip("The default spawn weight of this item.")]
[Space(5f)]
public int defaultWeight;
[SerializeField]
[Tooltip("All network prefabs that are connected to this item.")]
[Space(5f)]
public List<GameObject> connectedNetworkPrefabs = new List<GameObject>();
}
public static class LinqExtensions
{
public static bool None<TSource>(this IEnumerable<TSource> source)
{
return !source.Any();
}
}
[CreateAssetMenu(menuName = "ScriptableObjects/MapHazardWithDefaultWeight", order = 1)]
public class MapHazardWithDefaultWeight : ScriptableObject
{
[SerializeField]
[Tooltip("The hazard to spawn.")]
[Space(10f)]
public GameObject? spawnableMapObject;
[SerializeField]
[Tooltip("The amount to spawn.")]
[Space(10f)]
public int amount;
[SerializeField]
[Tooltip("The amount to spawn.")]
[Space(10f)]
public string? spawnCurve;
[SerializeField]
[Tooltip("The hazard name.")]
[Space(10f)]
public string? hazardName;
[SerializeField]
[Space(10f)]
public bool spawnFacingAwayFromWall;
[SerializeField]
[Space(10f)]
public bool spawnFacingWall;
[SerializeField]
[Space(10f)]
public bool spawnWithBackToWall;
[SerializeField]
[Space(10f)]
public bool spawnWithBackFlushAgainstWall;
[SerializeField]
[Space(10f)]
public bool requireDistanceBetweenSpawns;
[SerializeField]
[Space(10f)]
public bool disallowSpawningNearEntrances;
}
[AddComponentMenu("TestAccount666/TestAccountCore/Material Variants")]
public class MaterialVariants : NetworkBehaviour
{
[Tooltip("The variants of the scrap.")]
public Material[] materialVariants;
[Space(5f)]
[Tooltip("The mesh renderers to change the material of. This will use the first material in the array.")]
public MeshRenderer[] meshRenderers;
[FormerlySerializedAs("ChangeScanNodeText")]
[Space(5f)]
public bool changeScanNodeText;
[Tooltip("The text to change to when the material is changed.")]
public string[] scanNodeText;
[Space(5f)]
[Tooltip("The scan node properties to change the text of.")]
public ScanNodeProperties scanNodeProperties;
[Space(5f)]
[Tooltip("The currently saved material variant.")]
public int savedMaterialVariant = -1;
public bool synced;
public override void OnNetworkSpawn()
{
((MonoBehaviour)this).StartCoroutine(WaitAndSync());
}
[ServerRpc(RequireOwnership = false)]
private void SetRendererServerRpc()
{
savedMaterialVariant = ((savedMaterialVariant != -1) ? Math.Clamp(savedMaterialVariant, 0, materialVariants.Length - 1) : Random.Range(0, materialVariants.Length));
SetRendererClientRpc(savedMaterialVariant);
}
[ClientRpc]
private void SetRendererClientRpc(int materialVariant)
{
synced = true;
MeshRenderer[] array = meshRenderers;
foreach (MeshRenderer val in array)
{
((Renderer)val).material = materialVariants[materialVariant];
if (changeScanNodeText)
{
scanNodeProperties.headerText = scanNodeText[materialVariant];
}
}
}
private IEnumerator WaitAndSync()
{
TestAccountCore.Logger.LogDebug((object)"Starting WaitAndSync");
yield return (object)new WaitForSeconds(1f);
TestAccountCore.Logger.LogDebug((object)"After wait");
SetRendererServerRpc();
TestAccountCore.Logger.LogDebug((object)"RPC called");
yield return (object)new WaitForEndOfFrame();
TestAccountCore.Logger.LogDebug((object)"End of frame");
if (synced)
{
TestAccountCore.Logger.LogDebug((object)"Already synced, breaking out.");
yield break;
}
TestAccountCore.Logger.LogDebug((object)"Not yet synced, retrying...");
yield return WaitAndSync();
}
}
public static class Netcode
{
public static void ExecuteNetcodePatcher(Assembly assembly)
{
Type[] types = assembly.GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("TestAccount666.TestAccountCore", "TestAccountCore", "1.9.1")]
public class TestAccountCore : BaseUnityPlugin
{
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
if (DependencyChecker.IsLobbyCompatibilityInstalled())
{
Logger.LogInfo((object)"Found LobbyCompatibility Mod, initializing support :)");
LobbyCompatibilitySupport.Initialize();
}
Logger.LogInfo((object)"TestAccount666.TestAccountCore v1.9.1 has loaded!");
}
}
public static class UnixTime
{
public static long GetCurrentTime()
{
return (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds;
}
}
[CreateAssetMenu(menuName = "ScriptableObjects/UnlockableWithPrice", order = 1)]
public class UnlockableWithPrice : ScriptableObject
{
[SerializeField]
[Tooltip("The unlockable type.")]
[Space(10f)]
public StoreType storeType;
[SerializeField]
[Tooltip("The unlockable name.")]
[Space(10f)]
public string? unlockableName;
[SerializeField]
[Tooltip("The unlockable price.")]
[Space(10f)]
public int price;
[SerializeField]
[Tooltip("The unlockable prefab.")]
[Space(10f)]
public GameObject? spawnPrefab;
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "TestAccount666.TestAccountCore";
public const string PLUGIN_NAME = "TestAccountCore";
public const string PLUGIN_VERSION = "1.9.1";
}
}
namespace TestAccountCore.Dependencies
{
public static class DependencyChecker
{
public static bool IsLobbyCompatibilityInstalled()
{
return Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains("LobbyCompatibility"));
}
}
public static class LobbyCompatibilitySupport
{
internal static void Initialize()
{
Initialize("TestAccount666.TestAccountCore", new string("1.9.1"), CompatibilityLevel.ClientOnly, VersionStrictness.Minor);
}
public static void Initialize(string pluginGuid, string pluginVersion, CompatibilityLevel compatibilityLevel, VersionStrictness versionStrictness)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
PluginHelper.RegisterPlugin(pluginGuid, new Version(pluginVersion), compatibilityLevel.Convert(), versionStrictness.Convert());
}
}
}
namespace TestAccountCore.Dependencies.Compatibility
{
public enum CompatibilityLevel
{
ClientOnly,
ServerOnly,
Everyone,
ClientOptional
}
internal static class Converter
{
internal static VersionStrictness Convert(this VersionStrictness versionStrictness)
{
return (VersionStrictness)versionStrictness;
}
internal static CompatibilityLevel Convert(this CompatibilityLevel versionStrictness)
{
return (CompatibilityLevel)versionStrictness;
}
}
public enum VersionStrictness
{
None,
Major,
Minor,
Patch
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}