using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AppreciatingReturns.Patches;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dawn;
using Dawn.Utils;
using Microsoft.CodeAnalysis;
using On;
using Unity.Netcode;
using UnityEngine;
using com.github.xuuxiaolan.appreciatingreturns.NetcodePatcher;
[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("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[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.Components")]
[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: AssemblyCompany("com.github.xuuxiaolan.appreciatingreturns")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AppreciatingReturns")]
[assembly: AssemblyTitle("com.github.xuuxiaolan.appreciatingreturns")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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 AppreciatingReturns
{
[BepInPlugin("com.github.xuuxiaolan.appreciatingreturns", "AppreciatingReturns", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class AppreciatingReturns : BaseUnityPlugin
{
internal static ManualLogSource Logger { get; private set; }
public static ConfigFile configFile { get; private set; }
public static AppreciatingReturnsConfig ModConfig { get; private set; }
internal static PersistentDataContainer PersistentData { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
configFile = ((BaseUnityPlugin)this).Config;
ModConfig = new AppreciatingReturnsConfig(configFile);
((BaseUnityPlugin)this).Config.Save();
RoundManagerPatches.Init();
Logger.LogInfo((object)"com.github.xuuxiaolan.appreciatingreturns v1.0.0 has loaded!");
}
}
public class AppreciatingReturnsConfig
{
public ConfigEntry<string> MoonsWhitelist { get; private set; }
public ConfigEntry<string> HazardLevelWhitelist { get; private set; }
public AppreciatingReturnsConfig(ConfigFile configFile)
{
MoonsWhitelist = ConfigFileExtensions.CleanedBind<string>(configFile, "General", "Appreciating Returns | MoonsWhitelist", "", "Comma separated list of moons (or tags of moons) to scale up based on current quota (Based on DawnLib keys, i.e. experimentation, NOT lethal_company:experimentation).");
HazardLevelWhitelist = ConfigFileExtensions.CleanedBind<string>(configFile, "General", "Appreciating Returns | HazardLevelWhitelist", "", "Comma separated list of hazard levels on moons to scale up based on current quota.");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.github.xuuxiaolan.appreciatingreturns";
public const string PLUGIN_NAME = "AppreciatingReturns";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace AppreciatingReturns.Patches
{
internal static class RoundManagerPatches
{
[CompilerGenerated]
private static class <>O
{
public static hook_SyncScrapValuesClientRpc <0>__RoundManager_SyncScrapValuesClientRpc;
}
public static void Init()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
object obj = <>O.<0>__RoundManager_SyncScrapValuesClientRpc;
if (obj == null)
{
hook_SyncScrapValuesClientRpc val = RoundManager_SyncScrapValuesClientRpc;
<>O.<0>__RoundManager_SyncScrapValuesClientRpc = val;
obj = (object)val;
}
RoundManager.SyncScrapValuesClientRpc += (hook_SyncScrapValuesClientRpc)obj;
}
private static void RoundManager_SyncScrapValuesClientRpc(orig_SyncScrapValuesClientRpc orig, RoundManager self, NetworkObjectReference[] spawnedScrap, int[] allScrapValue)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)self).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
orig.Invoke(self, spawnedScrap, allScrapValue);
return;
}
if ((int)((NetworkBehaviour)self).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
orig.Invoke(self, spawnedScrap, allScrapValue);
return;
}
orig.Invoke(self, spawnedScrap, allScrapValue);
NetworkObject val2 = default(NetworkObject);
GrabbableObject val3 = default(GrabbableObject);
for (int i = 0; i < spawnedScrap.Length; i++)
{
NetworkObjectReference val = spawnedScrap[i];
if (((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null) && ((Component)val2).TryGetComponent<GrabbableObject>(ref val3))
{
val3.SetScrapValue(val3.scrapValue + GetExtraScrapAmount(self.currentLevel, spawnedScrap.Length));
}
}
}
private static int GetExtraScrapAmount(SelectableLevel currentLevel, int totalScrapAmount)
{
bool flag = false;
List<string> list = (from x in ((DawnBaseInfo<DawnMoonInfo>)(object)SelectableLevelExtensions.GetDawnInfo(currentLevel)).AllTags()
select x.Key).ToList();
list.Add(((NamespacedKey)((DawnBaseInfo<DawnMoonInfo>)(object)SelectableLevelExtensions.GetDawnInfo(currentLevel)).TypedKey).Key);
if (!string.IsNullOrEmpty(AppreciatingReturns.ModConfig.MoonsWhitelist.Value))
{
foreach (string item in list)
{
string[] array = AppreciatingReturns.ModConfig.MoonsWhitelist.Value.Split(',', StringSplitOptions.RemoveEmptyEntries);
foreach (string text in array)
{
if (item.Trim().Equals(text.Trim(), StringComparison.OrdinalIgnoreCase))
{
flag = true;
break;
}
}
}
}
if (!flag && !string.IsNullOrEmpty(AppreciatingReturns.ModConfig.HazardLevelWhitelist.Value))
{
string riskLevel = currentLevel.riskLevel;
string[] array2 = AppreciatingReturns.ModConfig.HazardLevelWhitelist.Value.Split(',', StringSplitOptions.RemoveEmptyEntries);
foreach (string text2 in array2)
{
if (riskLevel.Trim().Equals(text2.Trim(), StringComparison.OrdinalIgnoreCase))
{
flag = true;
break;
}
}
}
AppreciatingReturns.Logger.LogInfo((object)$"Moon is valid: {flag}");
if (!flag)
{
return 0;
}
return Mathf.CeilToInt(100f * (1f + (float)(TimeOfDay.Instance.timesFulfilledQuota * TimeOfDay.Instance.timesFulfilledQuota) / 16f)) / totalScrapAmount;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace com.github.xuuxiaolan.appreciatingreturns.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}