Decompiled source of Server Modifier v0.6.1

plugins/ServerModifier/ServerModifier.dll

Decompiled 9 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
[assembly: AssemblyCompany("ServerModifier")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ServerModifier")]
[assembly: AssemblyTitle("ServerModifier")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : System.Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class NullableAttribute : System.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]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class NullableContextAttribute : System.Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class RefSafetyRulesAttribute : System.Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ServerModifier
{
	internal enum FunctionType
	{
		Default,
		Linear,
		Exponential
	}
	[BepInPlugin("TriBlades.ServerModifier", "Server Modifier", "0.6.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ServerModifier : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static CanModifyDelegate <0>__IsWaitingMatch;
		}

		private const string modGUID = "TriBlades.ServerModifier";

		private const string modName = "Server Modifier";

		private const string modVersion = "0.6.0";

		private readonly Harmony harmony = new Harmony("TriBlades.ServerModifier");

		private static ServerModifier Instance;

		private static ManualLogSource mls;

		internal static bool isHost;

		internal static ConfigFile ConfigR;

		private static ConfigEntry<FunctionType> quotaFunction;

		private static ConfigEntry<float> quotaStart;

		private static ConfigEntry<float> quotaRate;

		private static ConfigEntry<float> quotaRandomScale;

		private static ConfigEntry<float> overtimeExcess;

		private static ConfigEntry<float> overtimeEarly;

		private static ConfigEntry<int> daysLeft;

		private static ConfigEntry<FunctionType> sellingFunction;

		private static ConfigEntry<float> sellingStart;

		private static ConfigEntry<float> sellingRate;

		private static ConfigEntry<float> sellingRandomness;

		private void Awake()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Expected O, but got Unknown
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Expected O, but got Unknown
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Expected O, but got Unknown
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Expected O, but got Unknown
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Expected O, but got Unknown
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Expected O, but got Unknown
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Expected O, but got Unknown
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Expected O, but got Unknown
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Expected O, but got Unknown
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Expected O, but got Unknown
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Expected O, but got Unknown
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Expected O, but got Unknown
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Expected O, but got Unknown
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Expected O, but got Unknown
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Expected O, but got Unknown
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Expected O, but got Unknown
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Expected O, but got Unknown
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Expected O, but got Unknown
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Expected O, but got Unknown
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Expected O, but got Unknown
			//IL_0535: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: Expected O, but got Unknown
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d5: Expected O, but got Unknown
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			ConfigR = ((BaseUnityPlugin)this).Config;
			mls = Logger.CreateLogSource("TriBlades.ServerModifier");
			mls.LogInfo((object)"Server Modifier has Awoken");
			harmony.PatchAll(typeof(ServerModifier));
			mls.LogInfo((object)"Setup configs");
			quotaFunction = ConfigR.Bind<FunctionType>("Quota", "Function", FunctionType.Default, "The function to determine quota.");
			ConfigEntry<FunctionType> obj = quotaFunction;
			EnumDropDownOptions val = new EnumDropDownOptions();
			((BaseOptions)val).RequiresRestart = false;
			EnumDropDownOptions obj2 = val;
			object obj3 = <>O.<0>__IsWaitingMatch;
			if (obj3 == null)
			{
				CanModifyDelegate val2 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val2;
				obj3 = (object)val2;
			}
			((BaseOptions)obj2).CanModifyCallback = (CanModifyDelegate)obj3;
			EnumDropDownConfigItem<FunctionType> val3 = new EnumDropDownConfigItem<FunctionType>(obj, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3);
			quotaStart = ConfigR.Bind<float>("Quota", "Start Value", 130f, "The starting quota amount.");
			ConfigEntry<float> obj4 = quotaStart;
			FloatSliderOptions val4 = new FloatSliderOptions();
			((BaseOptions)val4).RequiresRestart = false;
			((BaseRangeOptions<float>)(object)val4).Min = 0f;
			((BaseRangeOptions<float>)(object)val4).Max = 500f;
			FloatSliderOptions obj5 = val4;
			object obj6 = <>O.<0>__IsWaitingMatch;
			if (obj6 == null)
			{
				CanModifyDelegate val5 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val5;
				obj6 = (object)val5;
			}
			((BaseOptions)obj5).CanModifyCallback = (CanModifyDelegate)obj6;
			FloatSliderConfigItem val6 = new FloatSliderConfigItem(obj4, val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6);
			quotaRate = ConfigR.Bind<float>("Quota", "Rate Value", 150f, "The amount to scale by based on the function.");
			ConfigEntry<float> obj7 = quotaRate;
			val4 = new FloatSliderOptions();
			((BaseOptions)val4).RequiresRestart = false;
			((BaseRangeOptions<float>)(object)val4).Min = 0f;
			((BaseRangeOptions<float>)(object)val4).Max = 500f;
			FloatSliderOptions obj8 = val4;
			object obj9 = <>O.<0>__IsWaitingMatch;
			if (obj9 == null)
			{
				CanModifyDelegate val7 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val7;
				obj9 = (object)val7;
			}
			((BaseOptions)obj8).CanModifyCallback = (CanModifyDelegate)obj9;
			FloatSliderConfigItem val8 = new FloatSliderConfigItem(obj7, val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8);
			quotaRandomScale = ConfigR.Bind<float>("Quota", "Randomness", 50f, "The amount of random noise to add.");
			ConfigEntry<float> obj10 = quotaRandomScale;
			val4 = new FloatSliderOptions();
			((BaseOptions)val4).RequiresRestart = false;
			((BaseRangeOptions<float>)(object)val4).Min = 0f;
			((BaseRangeOptions<float>)(object)val4).Max = 500f;
			FloatSliderOptions obj11 = val4;
			object obj12 = <>O.<0>__IsWaitingMatch;
			if (obj12 == null)
			{
				CanModifyDelegate val9 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val9;
				obj12 = (object)val9;
			}
			((BaseOptions)obj11).CanModifyCallback = (CanModifyDelegate)obj12;
			FloatSliderConfigItem val10 = new FloatSliderConfigItem(obj10, val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val10);
			overtimeExcess = ConfigR.Bind<float>("Overtime", "Excess Scalar", 0.2f, "The amount to scale the excess profit to add onto overtime.");
			ConfigEntry<float> obj13 = overtimeExcess;
			val4 = new FloatSliderOptions();
			((BaseOptions)val4).RequiresRestart = false;
			((BaseRangeOptions<float>)(object)val4).Min = 0f;
			((BaseRangeOptions<float>)(object)val4).Max = 10f;
			FloatSliderOptions obj14 = val4;
			object obj15 = <>O.<0>__IsWaitingMatch;
			if (obj15 == null)
			{
				CanModifyDelegate val11 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val11;
				obj15 = (object)val11;
			}
			((BaseOptions)obj14).CanModifyCallback = (CanModifyDelegate)obj15;
			FloatSliderConfigItem val12 = new FloatSliderConfigItem(obj13, val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val12);
			overtimeEarly = ConfigR.Bind<float>("Overtime", "Early Scalar", 15f, "The amount to scale the amount of days early the quota has been achieved.");
			ConfigEntry<float> obj16 = overtimeEarly;
			val4 = new FloatSliderOptions();
			((BaseOptions)val4).RequiresRestart = false;
			((BaseRangeOptions<float>)(object)val4).Min = 0f;
			((BaseRangeOptions<float>)(object)val4).Max = 500f;
			FloatSliderOptions obj17 = val4;
			object obj18 = <>O.<0>__IsWaitingMatch;
			if (obj18 == null)
			{
				CanModifyDelegate val13 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val13;
				obj18 = (object)val13;
			}
			((BaseOptions)obj17).CanModifyCallback = (CanModifyDelegate)obj18;
			FloatSliderConfigItem val14 = new FloatSliderConfigItem(obj16, val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val14);
			daysLeft = ConfigR.Bind<int>("Day", "Days Remaining", 3, "The number of days to explore and collect strap.\n\nValues 10 and above are reportedly glitchy.");
			ConfigEntry<int> obj19 = daysLeft;
			IntSliderOptions val15 = new IntSliderOptions();
			((BaseOptions)val15).RequiresRestart = false;
			((BaseRangeOptions<int>)(object)val15).Min = 1;
			((BaseRangeOptions<int>)(object)val15).Max = 9;
			object obj20 = <>O.<0>__IsWaitingMatch;
			if (obj20 == null)
			{
				CanModifyDelegate val16 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val16;
				obj20 = (object)val16;
			}
			((BaseOptions)val15).CanModifyCallback = (CanModifyDelegate)obj20;
			IntSliderConfigItem val17 = new IntSliderConfigItem(obj19, val15);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val17);
			sellingFunction = ConfigR.Bind<FunctionType>("Company Buying Rate", "Function", FunctionType.Default, "The Function to determine buy back rate at the company.");
			ConfigEntry<FunctionType> obj21 = sellingFunction;
			val = new EnumDropDownOptions();
			((BaseOptions)val).RequiresRestart = false;
			EnumDropDownOptions obj22 = val;
			object obj23 = <>O.<0>__IsWaitingMatch;
			if (obj23 == null)
			{
				CanModifyDelegate val18 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val18;
				obj23 = (object)val18;
			}
			((BaseOptions)obj22).CanModifyCallback = (CanModifyDelegate)obj23;
			EnumDropDownConfigItem<FunctionType> val19 = new EnumDropDownConfigItem<FunctionType>(obj21, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val19);
			sellingStart = ConfigR.Bind<float>("Company Buying Rate", "Final Rate", 100f, "The final percentage for buy back rates at `remaining_day = 0`.");
			ConfigEntry<float> obj24 = sellingStart;
			val4 = new FloatSliderOptions();
			((BaseOptions)val4).RequiresRestart = false;
			((BaseRangeOptions<float>)(object)val4).Min = 1f;
			((BaseRangeOptions<float>)(object)val4).Max = 500f;
			FloatSliderOptions obj25 = val4;
			object obj26 = <>O.<0>__IsWaitingMatch;
			if (obj26 == null)
			{
				CanModifyDelegate val20 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val20;
				obj26 = (object)val20;
			}
			((BaseOptions)obj25).CanModifyCallback = (CanModifyDelegate)obj26;
			FloatSliderConfigItem val21 = new FloatSliderConfigItem(obj24, val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val21);
			sellingRate = ConfigR.Bind<float>("Company Buying Rate", "Rate Decrease", -30f, "The rate to decrease the percentage by.");
			ConfigEntry<float> obj27 = sellingRate;
			val4 = new FloatSliderOptions();
			((BaseOptions)val4).RequiresRestart = false;
			((BaseRangeOptions<float>)(object)val4).Min = -200f;
			((BaseRangeOptions<float>)(object)val4).Max = 200f;
			FloatSliderOptions obj28 = val4;
			object obj29 = <>O.<0>__IsWaitingMatch;
			if (obj29 == null)
			{
				CanModifyDelegate val22 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val22;
				obj29 = (object)val22;
			}
			((BaseOptions)obj28).CanModifyCallback = (CanModifyDelegate)obj29;
			FloatSliderConfigItem val23 = new FloatSliderConfigItem(obj27, val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val23);
			sellingRandomness = ConfigR.Bind<float>("Company Buying Rate", "Randomness", 0f, "Randomness to add when calculating buy back percentage");
			ConfigEntry<float> obj30 = sellingRandomness;
			val4 = new FloatSliderOptions();
			((BaseOptions)val4).RequiresRestart = false;
			((BaseRangeOptions<float>)(object)val4).Min = 0f;
			((BaseRangeOptions<float>)(object)val4).Max = 500f;
			FloatSliderOptions obj31 = val4;
			object obj32 = <>O.<0>__IsWaitingMatch;
			if (obj32 == null)
			{
				CanModifyDelegate val24 = IsWaitingMatch;
				<>O.<0>__IsWaitingMatch = val24;
				obj32 = (object)val24;
			}
			((BaseOptions)obj31).CanModifyCallback = (CanModifyDelegate)obj32;
			FloatSliderConfigItem val25 = new FloatSliderConfigItem(obj30, val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val25);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TimeOfDay), "SetBuyingRateForDay")]
		private static bool PatchSellUpdate(TimeOfDay __instance)
		{
			mls.LogInfo((object)"Company buy back rate is being updated");
			if (sellingFunction.Value == FunctionType.Default)
			{
				mls.LogInfo((object)"Reverting to default rates.");
				return true;
			}
			mls.LogInfo((object)"Manually updating rates.");
			int num = __instance.quotaVariables.deadlineDaysAmount - __instance.daysUntilDeadline;
			StartOfRound.Instance.companyBuyingRate = FunctionEval(sellingFunction.Value, sellingStart.Value, 0f - sellingRate.Value, sellingRandomness.Value, __instance.quotaVariables.randomizerCurve, num);
			StartOfRound.Instance.companyBuyingRate = ((StartOfRound.Instance.companyBuyingRate <= 0f) ? 0f : (StartOfRound.Instance.companyBuyingRate / 100f));
			return false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TimeOfDay), "SetNewProfitQuota")]
		private static bool PatchQuotaUpdate(TimeOfDay __instance)
		{
			mls.LogInfo((object)"Quota is being updated");
			if (((NetworkBehaviour)__instance).IsServer)
			{
				mls.LogInfo((object)"Manually updating the quota");
				__instance.timesFulfilledQuota++;
				int num = __instance.quotaFulfilled - __instance.profitQuota;
				float num2 = Mathf.Clamp(1f + (float)__instance.timesFulfilledQuota * ((float)__instance.timesFulfilledQuota / __instance.quotaVariables.increaseSteepness), 0f, 10000f);
				num2 = __instance.quotaVariables.baseIncrease * num2 * (__instance.quotaVariables.randomizerCurve.Evaluate(Random.Range(0f, 1f)) * __instance.quotaVariables.randomizerMultiplier + 1f);
				if (quotaFunction.Value == FunctionType.Default)
				{
					__instance.profitQuota = (int)Mathf.Clamp((float)__instance.profitQuota + num2, 0f, 1E+09f);
				}
				else
				{
					__instance.profitQuota = (int)FunctionEval(quotaFunction.Value, quotaStart.Value, quotaRate.Value, quotaRandomScale.Value, __instance.quotaVariables.randomizerCurve, __instance.timesFulfilledQuota);
				}
				__instance.quotaFulfilled = 0;
				float num3 = (float)num * overtimeExcess.Value + overtimeEarly.Value * (float)__instance.daysUntilDeadline;
				mls.LogInfo((object)("New Quota: " + __instance.profitQuota));
				mls.LogInfo((object)("OverTime: " + num3));
				mls.LogInfo((object)("Total Time: " + __instance.totalTime));
				mls.LogInfo((object)string.Concat(new string[6]
				{
					"Had excess of ",
					num.ToString(),
					". Saving ",
					__instance.quotaFulfilled.ToString(),
					"for current quota fulfillment of ",
					__instance.quotaFulfilled.ToString()
				}));
				mls.LogInfo((object)("Deadline Day Amount currently is " + __instance.quotaVariables.deadlineDaysAmount));
				mls.LogInfo((object)("Length of a day is currently " + __instance.totalTime));
				__instance.SyncNewProfitQuotaClientRpc(__instance.profitQuota, (int)num3, __instance.timesFulfilledQuota);
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "SetTimeAndPlanetToSavedSettings")]
		private static void EasierStart()
		{
			mls.LogInfo((object)"StartofRound Injection was Successful!");
			if (TimeOfDay.Instance.timesFulfilledQuota < 1)
			{
				TimeOfDay.Instance.profitQuota = (int)quotaStart.Value;
				TimeOfDay.Instance.UpdateProfitQuotaCurrentTime();
				mls.LogInfo((object)("New Quota: " + TimeOfDay.Instance.profitQuota));
			}
			mls.LogInfo((object)("Current profit quota for game on launch: " + TimeOfDay.Instance.profitQuota));
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TimeOfDay), "Start")]
		private static void EasierTime()
		{
			TimeOfDay.Instance.timeUntilDeadline = TimeOfDay.Instance.totalTime * (float)daysLeft.Value;
			TimeOfDay.Instance.quotaVariables.deadlineDaysAmount = daysLeft.Value;
			TimeOfDay.Instance.UpdateProfitQuotaCurrentTime();
			mls.LogInfo((object)"Changed length of hours during TimeOfDay start.");
			mls.LogInfo((object)("Deadline Days Amount: " + TimeOfDay.Instance.quotaVariables.deadlineDaysAmount));
			mls.LogInfo((object)("New Time: " + TimeOfDay.Instance.timeUntilDeadline));
			mls.LogInfo((object)("Total Time: " + TimeOfDay.Instance.totalTime));
		}

		private static float FunctionEval(FunctionType ft, float startingVal, float rate, float randomness, AnimationCurve rc, float x)
		{
			float num = x * rate;
			float num2 = rc.Evaluate(Random.Range(-1f, 1f)) * randomness;
			mls.LogInfo((object)string.Concat(new string[6]
			{
				"Recieved the following q values:\n",
				startingVal.ToString(),
				"\n",
				num.ToString(),
				"\n",
				num2.ToString()
			}));
			return ft switch
			{
				FunctionType.Linear => Mathf.Clamp(startingVal + num + num2, 0f, 1E+09f), 
				FunctionType.Exponential => Mathf.Clamp(startingVal * Mathf.Exp(num) + num2, 0f, 1E+09f), 
				_ => 0f, 
			};
		}

		private static CanModifyResult IsWaitingMatch()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (GameNetworkManager.Instance.gameHasStarted)
				{
					return CanModifyResult.False("The game has currently started. Do not allow for further modifications.");
				}
				return CanModifyResult.True();
			}
			catch (System.Exception ex)
			{
				mls.LogInfo((object)"Ran into error determining if game started. Assuming in menu and game has not started.");
				mls.LogDebug((object)ex);
				return CanModifyResult.True();
			}
		}
	}
}