using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Antro.FairPayout")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Antro.FairPayout")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0.0")] [assembly: AssemblyProduct("Antro.FairPayout")] [assembly: AssemblyTitle("Antro.FairPayout")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 FairPayoutMod { [BepInPlugin("FairPayout", "FairPayout", "1.0.0")] public class FairPayoutPlugin : BaseUnityPlugin { public static ConfigEntry UseLogicalRecalculation; private void Awake() { UseLogicalRecalculation = ((BaseUnityPlugin)this).Config.Bind("General", "UseLogicalRecalculation", false, "If true: death penalty is linear (fair for large lobbies, disables vanilla geometric progression).\nIf false: no death penalty at all (always 0)."); Harmony.CreateAndPatchAll(typeof(PayoutPatch), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod FairPayout is loaded! Host-only logic is now active."); } } public class PayoutPatch { [HarmonyPatch(typeof(GameProgressionManager), "GetCurrentRespawningCost")] [HarmonyPrefix] public static bool Prefix(GameProgressionManager __instance, ref int __result, AnimationCurve ___respawnCostPerPlayer) { if (FairPayoutPlugin.UseLogicalRecalculation.Value) { float num = ___respawnCostPerPlayer.Evaluate(__instance.NormalizedGameTime); __result = Mathf.CeilToInt(num * (float)__instance.DeadPlayerCount); } else { __result = 0; } return false; } } }