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 System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using LethalLib.Modules;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using TestAccountCore.Dependencies;
using UnityEngine;
[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.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+385717dd6f32acb5386fe8d2ab03e1eef9bb68ec")]
[assembly: AssemblyProduct("TestAccountCore")]
[assembly: AssemblyTitle("TestAccount666.TestAccountCore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 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 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)
{
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)
{
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);
Items.RegisterScrap(item.item, tuple.Item1, tuple.Item2);
NetworkPrefabs.RegisterNetworkPrefab(item.item.spawnPrefab);
TestAccountCore.Logger.LogInfo((object)("Fully registered item " + item.item.itemName + "!"));
}
}
}
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);
}
}
[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;
}
public static class LinqExtensions
{
public static bool None<TSource>(this IEnumerable<TSource> source)
{
return !source.Any();
}
}
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.1.0")]
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.1.0 has loaded!");
}
}
public static class UnixTime
{
public static long GetCurrentTime()
{
return (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "TestAccount666.TestAccountCore";
public const string PLUGIN_NAME = "TestAccountCore";
public const string PLUGIN_VERSION = "1.1.0";
}
}
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.1.0"), (CompatibilityLevel)0, (VersionStrictness)2);
}
public static void Initialize(string pluginGuid, string pluginVersion, CompatibilityLevel compatibilityLevel, VersionStrictness versionStrictness)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
PluginHelper.RegisterPlugin(pluginGuid, new Version(pluginVersion), compatibilityLevel, versionStrictness);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}