using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Extensions;
using CSync.Lib;
using HarmonyLib;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CustomDeathPenalty")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomDeathPenalty")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5bb0c4cb-6367-4acd-a5f1-d488ab3dd9b3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace CustomDeathPenalty;
public static class GlobalVariables
{
public static int RemainingScrapInLevel;
}
[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
public class ShipleaveCalc
{
[HarmonyPostfix]
public static void Postfix()
{
GlobalVariables.RemainingScrapInLevel = CalculateRemainingScrapInLevel();
}
public static int CalculateRemainingScrapInLevel()
{
GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
int num = 0;
for (int i = 0; i < array.Length; i++)
{
if (array[i].itemProperties.isScrap && !array[i].isInShipRoom && !array[i].isInElevator && !array[i].scrapPersistedThroughRounds)
{
num += array[i].scrapValue;
}
}
return num;
}
}
[HarmonyPatch(typeof(HUDManager), "FillEndGameStats")]
public class HUDManagerPatch
{
[HarmonyPostfix]
public static void FillEndGameStatsPostfix(HUDManager __instance, int scrapCollected)
{
float num = scrapCollected + GlobalVariables.RemainingScrapInLevel;
((TMP_Text)__instance.statsUIElements.quotaDenominator).text = num.ToString();
}
}
[HarmonyPatch(typeof(StartOfRound), "ArriveAtLevel")]
public class ArrivalSwitch
{
public static SelectableLevel myReferenceToGordionLevel;
public static float CurrentFineAmount { get; set; }
public static float CurrentInsuranceReduction { get; set; }
private static void Postfix(StartOfRound __instance)
{
CurrentFineAmount = SyncedInstance<SyncConfigCDP>.Instance.FineAmount.Value;
CurrentInsuranceReduction = SyncedInstance<SyncConfigCDP>.Instance.InsuranceReduction.Value;
if ((Object)(object)__instance.currentLevel == (Object)(object)myReferenceToGordionLevel)
{
CurrentFineAmount = SyncedInstance<SyncConfigCDP>.Instance.CompanyFineAmount.Value;
CurrentInsuranceReduction = SyncedInstance<SyncConfigCDP>.Instance.CompanyInsuranceReduction.Value;
}
else
{
CurrentFineAmount = SyncedInstance<SyncConfigCDP>.Instance.FineAmount.Value;
CurrentInsuranceReduction = SyncedInstance<SyncConfigCDP>.Instance.InsuranceReduction.Value;
}
}
}
public static class CustomDeathPenalty
{
public static float GetCurrentFineAmount()
{
if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)ArrivalSwitch.myReferenceToGordionLevel != (Object)null && (Object)(object)ArrivalSwitch.myReferenceToGordionLevel == (Object)(object)StartOfRound.Instance.currentLevel)
{
return SyncedInstance<SyncConfigCDP>.Instance.CompanyFineAmount.Value / 100f;
}
return SyncedInstance<SyncConfigCDP>.Instance.FineAmount.Value / 100f;
}
public static float GetCurrentInsuranceReduction()
{
if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)ArrivalSwitch.myReferenceToGordionLevel != (Object)null && (Object)(object)ArrivalSwitch.myReferenceToGordionLevel == (Object)(object)StartOfRound.Instance.currentLevel)
{
return 1f / (SyncedInstance<SyncConfigCDP>.Instance.CompanyInsuranceReduction.Value / 100f);
}
return 1f / (SyncedInstance<SyncConfigCDP>.Instance.InsuranceReduction.Value / 100f);
}
}
[HarmonyPatch(typeof(HUDManager), "ApplyPenalty")]
public class ChangeFineAmount
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
foreach (CodeInstruction instruction in instructions)
{
if (instruction.opcode == OpCodes.Ldc_R4)
{
if ((float)instruction.operand == 0.2f)
{
instruction.opcode = OpCodes.Call;
instruction.operand = typeof(CustomDeathPenalty).GetMethod("GetCurrentFineAmount");
}
else if ((float)instruction.operand == 2.5f)
{
instruction.opcode = OpCodes.Call;
instruction.operand = typeof(CustomDeathPenalty).GetMethod("GetCurrentInsuranceReduction");
}
}
yield return instruction;
}
}
}
[HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")]
public class ChangeQuota
{
public static int unrecoveredBodies;
public static int oldQuota;
public static int newQuota;
private static void Postfix(StartOfRound __instance)
{
int num = StartOfRound.Instance.connectedPlayersAmount + 1 - __instance.livingPlayers;
int bodiesInShip = GetBodiesInShip();
unrecoveredBodies = num - bodiesInShip;
if (unrecoveredBodies != 0 && (Object)(object)ArrivalSwitch.myReferenceToGordionLevel != (Object)(object)StartOfRound.Instance.currentLevel)
{
oldQuota = TimeOfDay.Instance.profitQuota;
if (!SyncedInstance<SyncConfigCDP>.Instance.PlayerCountBasedPenalty.Value)
{
int num2 = (100 + SyncedInstance<SyncConfigCDP>.Instance.QuotaIncreasePercent.Value * unrecoveredBodies) * TimeOfDay.Instance.profitQuota;
TimeOfDay.Instance.profitQuota = num2 / 100;
}
else
{
int num3 = (int)(((float)(unrecoveredBodies / (StartOfRound.Instance.connectedPlayersAmount + 1)) * (float)(SyncedInstance<SyncConfigCDP>.Instance.DynamicQuotaPercent.Value / 100) + 1f) * 100f);
TimeOfDay instance = TimeOfDay.Instance;
instance.profitQuota *= num3 / 100;
}
newQuota = TimeOfDay.Instance.profitQuota;
CustomDeathPenaltyMain.instance.mls.LogInfo((object)("Old Quota: " + oldQuota));
CustomDeathPenaltyMain.instance.mls.LogInfo((object)("New Quota: " + newQuota));
}
else
{
CustomDeathPenaltyMain.instance.mls.LogInfo((object)"On Company moon, no quota multiplier applied");
}
}
private static int GetBodiesInShip()
{
int num = 0;
DeadBodyInfo[] array = Object.FindObjectsOfType<DeadBodyInfo>();
for (int i = 0; i < array.Length; i++)
{
if (array[i].isInShip)
{
num++;
}
}
return num;
}
}
[HarmonyPatch(typeof(HUDManager), "ApplyPenalty")]
public class ChangePenaltyText
{
private static void Postfix(HUDManager __instance, int playersDead, int bodiesInsured)
{
if (SyncedInstance<SyncConfigCDP>.Instance.QuotaIncreasePercent.Value != 0)
{
TextMeshProUGUI penaltyAddition = __instance.statsUIElements.penaltyAddition;
((TMP_Text)penaltyAddition).text = ((TMP_Text)penaltyAddition).text + $"\nUnrecovered bodies: {ChangeQuota.unrecoveredBodies}\nQuota has increased from {ChangeQuota.oldQuota} to {ChangeQuota.newQuota}";
}
}
}
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
public static class DynamicScrapSpawn
{
[HarmonyPrefix]
public static void Postfix(RoundManager __instance)
{
SelectableLevel currentLevel = __instance.currentLevel;
float num = (float)(currentLevel.maxEnemyPowerCount / SyncedInstance<SyncConfigCDP>.Instance.EnemyThreshold.Value) / (1f / (SyncedInstance<SyncConfigCDP>.Instance.EnemyThresholdWeight.Value / 100f)) + 1f;
CustomDeathPenaltyMain.instance.mls.LogInfo((object)$"EnemyFactor: {num}");
if (SyncedInstance<SyncConfigCDP>.Instance.DynamicScrapBool.Value && (Object)(object)ArrivalSwitch.myReferenceToGordionLevel != (Object)(object)StartOfRound.Instance.currentLevel)
{
currentLevel.minTotalScrapValue = (int)((float)TimeOfDay.Instance.profitQuota * (SyncedInstance<SyncConfigCDP>.Instance.MinDiff.Value / 100f) * num) + SyncedInstance<SyncConfigCDP>.Instance.ScrapValueOffset.Value;
currentLevel.maxTotalScrapValue = (int)((float)TimeOfDay.Instance.profitQuota * (SyncedInstance<SyncConfigCDP>.Instance.MaxDiff.Value / 100f) * num) + SyncedInstance<SyncConfigCDP>.Instance.ScrapValueOffset.Value;
currentLevel.maxScrap = currentLevel.minTotalScrapValue / 25;
if ((float)currentLevel.minTotalScrapValue / 333f < 1f)
{
currentLevel.minScrap = (int)Math.Round((float)currentLevel.maxScrap * 4f / 5f);
}
else if ((float)currentLevel.minTotalScrapValue / 333f < 2f)
{
currentLevel.minScrap = (int)Math.Round((float)currentLevel.maxScrap * 3f / 5f);
}
else if ((float)currentLevel.minTotalScrapValue / 333f < 3f)
{
currentLevel.minScrap = (int)Math.Round((float)currentLevel.maxScrap * 2f / 5f);
}
else
{
currentLevel.minScrap = (int)Math.Round((float)currentLevel.maxScrap * 1f / 5f);
}
CustomDeathPenaltyMain.instance.mls.LogInfo((object)$"minScrap: {currentLevel.minScrap}");
CustomDeathPenaltyMain.instance.mls.LogInfo((object)$"maxScrap: {currentLevel.maxScrap}");
CustomDeathPenaltyMain.instance.mls.LogInfo((object)$"minTotalScrapValue: {currentLevel.minTotalScrapValue}");
CustomDeathPenaltyMain.instance.mls.LogInfo((object)$"maxTotalScrapValue: {currentLevel.maxTotalScrapValue}");
}
else
{
CustomDeathPenaltyMain.instance.mls.LogInfo((object)"Dynamic Scrap is either disabled or you are on the Company Moon.");
}
}
}
[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
public static class DynamicInteriorSize
{
[HarmonyPrefix]
public static void Postfix(RoundManager __instance)
{
SelectableLevel currentLevel = __instance.currentLevel;
if (SyncedInstance<SyncConfigCDP>.Instance.DynamicSizeBool.Value && (Object)(object)ArrivalSwitch.myReferenceToGordionLevel != (Object)(object)StartOfRound.Instance.currentLevel)
{
int num = (int)((float)TimeOfDay.Instance.profitQuota * (SyncedInstance<SyncConfigCDP>.Instance.MinDiff.Value / 100f) * (float)(currentLevel.maxEnemyPowerCount / SyncedInstance<SyncConfigCDP>.Instance.EnemyThreshold.Value + 1)) + SyncedInstance<SyncConfigCDP>.Instance.ScrapValueOffset.Value;
currentLevel.factorySizeMultiplier = (float)(int)((float)num / SyncedInstance<SyncConfigCDP>.Instance.SizeScrapThreshold.Value) / 100f + SyncedInstance<SyncConfigCDP>.Instance.SizeOffset.Value;
currentLevel.factorySizeMultiplier = (float)(int)Math.Round((float)num / SyncedInstance<SyncConfigCDP>.Instance.SizeScrapThreshold.Value) / 100f + SyncedInstance<SyncConfigCDP>.Instance.SizeOffset.Value;
CustomDeathPenaltyMain.instance.mls.LogInfo((object)$"factorySizeMultiplier: {currentLevel.factorySizeMultiplier}");
}
else
{
CustomDeathPenaltyMain.instance.mls.LogInfo((object)"Dynamic Size is disabled.");
}
}
}
[BepInPlugin("impulse.CustomDeathPenalty", "CustomDeathPenalty", "1.9.5")]
public class CustomDeathPenaltyMain : BaseUnityPlugin
{
private const string modGUID = "impulse.CustomDeathPenalty";
private const string modName = "CustomDeathPenalty";
private const string modVersion = "1.9.5";
private readonly Harmony harmony = new Harmony("impulse.CustomDeathPenalty");
public ManualLogSource mls;
public static CustomDeathPenaltyMain instance;
public static SyncConfigCDP Config;
private void Awake()
{
instance = this;
Config = new SyncConfigCDP(((BaseUnityPlugin)this).Config);
harmony.PatchAll(typeof(StartOfRound_Awake_Patch));
harmony.PatchAll(typeof(CustomDeathPenalty));
harmony.PatchAll(typeof(ArrivalSwitch));
harmony.PatchAll(typeof(ChangeFineAmount));
harmony.PatchAll(typeof(ChangeQuota));
harmony.PatchAll(typeof(ChangePenaltyText));
harmony.PatchAll(typeof(HUDManagerPatch));
harmony.PatchAll(typeof(ShipleaveCalc));
harmony.PatchAll(typeof(DynamicScrapSpawn));
harmony.PatchAll(typeof(DynamicInteriorSize));
mls = Logger.CreateLogSource("impulse.CustomDeathPenalty");
}
}
[DataContract]
public class SyncConfigCDP : SyncedConfig<SyncConfigCDP>
{
[DataMember]
public SyncedEntry<float> FineAmount { get; private set; }
[DataMember]
public SyncedEntry<float> InsuranceReduction { get; private set; }
[DataMember]
public SyncedEntry<float> CompanyFineAmount { get; private set; }
[DataMember]
public SyncedEntry<float> CompanyInsuranceReduction { get; private set; }
[DataMember]
public SyncedEntry<int> QuotaIncreasePercent { get; private set; }
[DataMember]
public SyncedEntry<bool> DynamicScrapBool { get; private set; }
[DataMember]
public SyncedEntry<int> ScrapValueOffset { get; private set; }
[DataMember]
public SyncedEntry<int> EnemyThreshold { get; private set; }
[DataMember]
public SyncedEntry<float> MinDiff { get; private set; }
[DataMember]
public SyncedEntry<float> MaxDiff { get; private set; }
[DataMember]
public SyncedEntry<bool> DynamicSizeBool { get; private set; }
[DataMember]
public SyncedEntry<float> SizeScrapThreshold { get; private set; }
[DataMember]
public SyncedEntry<float> SizeOffset { get; private set; }
[DataMember]
public SyncedEntry<float> MinSizeClamp { get; private set; }
[DataMember]
public SyncedEntry<float> MaxSizeClamp { get; private set; }
[DataMember]
public SyncedEntry<bool> PlayerCountBasedPenalty { get; private set; }
[DataMember]
public SyncedEntry<int> DynamicQuotaPercent { get; private set; }
[DataMember]
public SyncedEntry<float> EnemyThresholdWeight { get; private set; }
public SyncConfigCDP(ConfigFile cfg)
: base("CustomDeathPenalty")
{
ConfigManager.Register<SyncConfigCDP>(this);
FineAmount = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "2. Fines", "Fine for each dead player", 20f, "What percent of current credits should be taken for each dead player. Range 0 to 100");
InsuranceReduction = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "2. Fines", "Fine reduction for retrieving the players body", 40f, "This value decides how much the penalty should be reduced if the dead player's body is retrieved. For example: 0 results in no fine for recovered bodies, 50 results in being fined half for retriving the body, and 100 results in no difference whether the body is recovered or not. Range 0 to 100");
CompanyFineAmount = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "2. Fines", "Fine for each dead player (on Gordion)", 0f, "What percent of current credits should be taken for each dead player. Range 0 to 100");
CompanyInsuranceReduction = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "2. Fines", "Fine reduction for retrieving the players body (on Gordion)", 0f, "This value decides how much the penalty should be reduced if the dead player's body is retrieved. For example: 0 results in no fine for recovered bodies, 50 results in being fined half for retriving the body, and 100 results in no difference whether the body is recovered or not. Range 0 to 100");
QuotaIncreasePercent = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "1. Quota", "Quota Increase Percent", 10, "This value determines how much the quota should increase per dead player that is not retrived. 0 will not increase the quota, 10 increases the quota by 10% per missing player, 50 by 50%, 100 by 100% and so on. Range 0 to ∞");
PlayerCountBasedPenalty = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "1. Quota", "Dynamic Quota Increase", false, "If set to true, the quota increase will instead be a set value times the ratio of unrecovered bodies over the total players.");
DynamicQuotaPercent = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "1. Quota", "Dynamic Quota Percent", 100, "If all players are dead, the quota will increase by this amount. If only some of the players are unrecovered then the quota will increase based on the fraction of the lobby that is dead and unrecovered. Range 0 to ∞");
DynamicScrapBool = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "3. Dynamic Scrap", "Dynamic Scrap Calculation", false, "Set to true to enable. This setting makes the scrap value scale based on the current quota and the enemy power level of the moon. This generally makes the game harder but can allow for reaching higher quotas than typically possible.");
ScrapValueOffset = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "3. Dynamic Scrap", "Scrap Value Offset", 100, "This value determines how much extra scrap value should be added to each moon. This value takes the apparatus into account and therefore must be equal to or higher than its value. (80 is the vanilla apparatus value, if you use FacilityMeltdown to make the apparatus worth 300 for instance. You MUST set this value to 300 or higher.) Range 0 to ∞");
EnemyThreshold = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "3. Dynamic Scrap", "Enemy Power Threshold", 5, "Every time the Interior Enemy Power Count of a moon exceeds this value, 0.XX (see next setting) will be added to 1, this multiplier is then applied to the scrap value calculation. With the value at 3, a moon with an interior power of 14 will have a difficulty adjustment of 4 * 0.XX + 1. if the value is 5, then the moon will only have a difficulty adjustment of 2 * 0.XX + 1. Etc. Range 1 to ∞");
EnemyThresholdWeight = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "3. Dynamic Scrap", "Enemy Power Threshold Weight", 25f, "This setting controls the % increase of the enemy factor in the dynamic scrap calculation. 25% will make it so that each time that the current moons interior enemy power count exceeds the setting able, 0.25 will be added to the 1 in the multipler. If it is exceeded 3 times for instance then the scrap will be multiplied by 1.75. Range 0 to ∞");
MinDiff = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "3. Dynamic Scrap", "Multiplier for Min Scrap Value", 50f, "The percent of the quota the min scrap on a planet should be. Min < Max. The difficulty multiplier and Offset are applied after. Range 1 to ∞");
MaxDiff = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "3. Dynamic Scrap", "Multiplier for Max Scrap Value", 100f, "The percent of the quota the max scrap on a planet should be. Max > Min. The difficulty multiplier and Offset are applied after. Range 1 to ∞");
DynamicSizeBool = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "4. Dynamic Interior Size", "Dynamic Interior Size Calculation", false, "Set to true to enable. This setting makes the interior size be based on the scrap value. IE every x worth of scrap increases the interior size.");
SizeScrapThreshold = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "4. Dynamic Interior Size", "Size Increase Threshold", 5f, "Everytime the minimum scrap on a moon exceeds this value, 0.01 will be added to the size multiplier. At 5, the multiplier increases by 0.01x every 500 scrap on the moon. Range 0.01 to ∞");
SizeOffset = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "4. Dynamic Interior Size", "Size Offset", 1f, "This controls the intial multiplier the threshold adds onto. Keep in mind that if it is below or above the clamps, it will be corrected as such until it enters an acceptable range.");
MinSizeClamp = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "4. Dynamic Interior Size", "Min Size Clamp", 1f, "If the calculated value of the interior is below this, it will correct to this value. I cannot verify how low this can safely get. It varies by interior.");
MaxSizeClamp = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "4. Dynamic Interior Size", "Max Size Clamp", 3f, "If the calculated value of the interior is above this, it will correct to this value. I cannot verify how high this can safely get. It varies by interior.");
AcceptableRanges();
}
public void AcceptableRanges()
{
float num = FineAmount.Value;
if (num < 0f)
{
num = 0f;
}
if (num > 100f)
{
num = 100f;
}
FineAmount.LocalValue = num;
float num2 = InsuranceReduction.Value;
if (num2 < 0f)
{
num2 = 0f;
}
if (num2 > 100f)
{
num2 = 100f;
}
InsuranceReduction.LocalValue = num2;
float num3 = CompanyFineAmount.Value;
if (num3 < 0f)
{
num3 = 0f;
}
if (num3 > 100f)
{
num3 = 100f;
}
CompanyFineAmount.LocalValue = num3;
float num4 = CompanyInsuranceReduction.Value;
if (num4 < 0f)
{
num4 = 0f;
}
if (num4 > 100f)
{
num4 = 100f;
}
CompanyInsuranceReduction.LocalValue = num4;
int num5 = QuotaIncreasePercent.Value;
if (num5 < 0)
{
num5 = 0;
}
QuotaIncreasePercent.LocalValue = num5;
int num6 = ScrapValueOffset.Value;
if (num6 < 0)
{
num6 = 0;
}
ScrapValueOffset.LocalValue = num6;
int num7 = EnemyThreshold.Value;
if (num7 < 1)
{
num7 = 1;
}
EnemyThreshold.LocalValue = num7;
float num8 = MinDiff.Value;
if (num8 < 1f)
{
num8 = 1f;
}
MinDiff.LocalValue = num8;
float num9 = MaxDiff.Value;
if (num9 < 1f)
{
num9 = 1f;
}
MaxDiff.LocalValue = num9;
float num10 = SizeScrapThreshold.Value;
if (num10 < 0.01f)
{
num10 = 0.01f;
}
SizeScrapThreshold.LocalValue = num10;
float num11 = SizeOffset.Value;
if (num11 < 0f)
{
num11 = 0f;
}
SizeOffset.LocalValue = num11;
float num12 = MinSizeClamp.Value;
if (num12 < 0f)
{
num12 = 0f;
}
MinSizeClamp.LocalValue = num12;
float num13 = MaxSizeClamp.Value;
if (num13 < 0f)
{
num13 = 0f;
}
MaxSizeClamp.LocalValue = num13;
int num14 = DynamicQuotaPercent.Value;
if (num14 < 0)
{
num14 = 0;
}
DynamicQuotaPercent.LocalValue = num14;
float num15 = EnemyThresholdWeight.Value;
if (num15 < 0f)
{
num15 = 0f;
}
EnemyThresholdWeight.LocalValue = num15;
}
}
[HarmonyPatch(typeof(StartOfRound), "Awake")]
public class StartOfRound_Awake_Patch
{
private static void Prefix(StartOfRound __instance)
{
SelectableLevel[] levels = __instance.levels;
foreach (SelectableLevel val in levels)
{
if (val.sceneName.Contains("CompanyBuilding") || val.PlanetName.Contains("Gordion"))
{
ArrivalSwitch.myReferenceToGordionLevel = val;
break;
}
}
}
}