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 BepInEx.Logging;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("REPO_SharedUpgradesChancePerPlayer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("REPO_SharedUpgradesChancePerPlayer")]
[assembly: AssemblyTitle("REPO_SharedUpgradesChancePerPlayer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 SharedUpgrades
{
[BepInPlugin("iridescentblaze_ConfigurableSharedUpgrades", "Configurable_shared_upgrades", "1.0.0")]
public class SharedUpgrades : BaseUnityPlugin
{
public const string GUID = "iridescentblaze_ConfigurableSharedUpgrades";
public const string Name = "Configurable_shared_upgrades";
public const string Version = "1.0.0";
public static ConfigEntry<bool>? DoChancePerPlayer;
public static ConfigEntry<float>? ChancePerPlayer;
public static ConfigEntry<float>? ChancePerMapPlayerCount;
public static ConfigEntry<float>? ChancePerPlayerEnergy;
public static ConfigEntry<float>? ChancePerPlayerExtraJump;
public static ConfigEntry<float>? ChancePerPlayerGrabRange;
public static ConfigEntry<float>? ChancePerPlayerStrength;
public static ConfigEntry<float>? ChancePerPlayerHealth;
public static ConfigEntry<float>? ChancePerPlayerTumbleLaunch;
public static ConfigEntry<float>? ChancePerPlayerSprintSpeed;
internal static SharedUpgrades? Instance { get; private set; }
internal static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger;
internal Harmony? HarmonyInstance { get; set; }
private void Awake()
{
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Expected O, but got Unknown
Instance = this;
DoChancePerPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("All upgrades", "Per player chance", false, "Makes it so every item has the same chance per player.");
ChancePerPlayer = ((BaseUnityPlugin)this).Config.Bind<float>("All upgrades", "Per player chance", 50f, "Chance (in %) that each player gets an upgrade when one player upgrades.");
ChancePerMapPlayerCount = ((BaseUnityPlugin)this).Config.Bind<float>("Specific upgrades", "Map Player Count Upgrade", 100f, "Chance (in %) that each player gets the Map Player Count upgrade when one player upgrades.");
ChancePerPlayerEnergy = ((BaseUnityPlugin)this).Config.Bind<float>("Specific upgrades", "Stamina Capacity Upgrade", 25f, "Chance (in %) that each player gets the Stamina Capacity upgrade when one player upgrades.");
ChancePerPlayerExtraJump = ((BaseUnityPlugin)this).Config.Bind<float>("Specific upgrades", "Extra Jump Upgrade", 50f, "Chance (in %) that each player gets the Extra Jump upgrade when one player upgrades.");
ChancePerPlayerGrabRange = ((BaseUnityPlugin)this).Config.Bind<float>("Specific upgrades", "Range Upgrade", 33f, "Chance (in %) that each player gets the Range upgrade when one player upgrades.");
ChancePerPlayerStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Specific upgrades", "Strength Upgrade", 10f, "Chance (in %) that each player gets the Strength upgrade when one player upgrades.");
ChancePerPlayerHealth = ((BaseUnityPlugin)this).Config.Bind<float>("Specific upgrades", "Health Upgrade", 25f, "Chance (in %) that each player gets the Health upgrade when one player upgrades.");
ChancePerPlayerSprintSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Specific upgrades", "Sprint Speed Upgrade", 15f, "Chance (in %) that each player gets the Sprint Speed upgrade when one player upgrades.");
ChancePerPlayerTumbleLaunch = ((BaseUnityPlugin)this).Config.Bind<float>("Specific upgrades", "Tumble Launch Upgrade", 15f, "Chance (in %) that each player gets the Tumble Launch upgrade when one player upgrades.");
Log.LogInfo((object)"[INFO] Configurable_shared_upgrades v1.0.0 loaded!");
HarmonyInstance = new Harmony("iridescentblaze_ConfigurableSharedUpgrades");
HarmonyInstance.PatchAll(Assembly.GetExecutingAssembly());
}
private void OnDestroy()
{
Harmony? harmonyInstance = HarmonyInstance;
if (harmonyInstance != null)
{
harmonyInstance.UnpatchSelf();
}
}
}
}
namespace SharedUpgrades.Patches
{
internal class ItemUpgradeMapPlayerCount
{
[HarmonyPatch(typeof(ItemUpgradeMapPlayerCount), "Upgrade")]
[HarmonyPrefix]
private static bool Prefix(ItemUpgradeMapPlayerCount __instance)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
if (SharedUpgrades.DoChancePerPlayer.Value)
{
if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayer.Value)
{
SharedUpgrades.Log.LogInfo((object)"[INFO] Map Player Count upgrade applied to everyone!");
PunManager.instance.UpgradeMapPlayerCount(SemiFunc.PlayerGetSteamID(item));
}
}
else if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerMapPlayerCount.Value)
{
PunManager.instance.UpgradeMapPlayerCount(SemiFunc.PlayerGetSteamID(item));
}
}
return false;
}
}
internal class ItemUpgradePlayerEnergyPatch
{
[HarmonyPatch(typeof(ItemUpgradePlayerEnergy), "Upgrade")]
[HarmonyPrefix]
private static bool Prefix(ItemUpgradePlayerEnergy __instance)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
if (SharedUpgrades.DoChancePerPlayer.Value)
{
if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayer.Value)
{
SharedUpgrades.Log.LogInfo((object)"[INFO] Energy upgrade applied to everyone!");
PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item));
}
}
else if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayerEnergy.Value)
{
PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item));
}
}
return false;
}
}
internal class ItemUpgradePlayerExtraJumpPatch
{
[HarmonyPatch(typeof(ItemUpgradePlayerExtraJump), "Upgrade")]
[HarmonyPrefix]
private static bool Prefix(ItemUpgradePlayerExtraJump __instance)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
if (SharedUpgrades.DoChancePerPlayer.Value)
{
if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayer.Value)
{
SharedUpgrades.Log.LogInfo((object)"[INFO] Extra Jump upgrade applied to everyone!");
PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item));
}
}
else if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayerExtraJump.Value)
{
PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item));
}
}
return false;
}
}
internal class ItemUpgradePlayerGrabRangePatch
{
[HarmonyPatch(typeof(ItemUpgradePlayerGrabRange), "Upgrade")]
[HarmonyPrefix]
private static bool Prefix(ItemUpgradePlayerGrabRange __instance)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
if (SharedUpgrades.DoChancePerPlayer.Value)
{
if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayer.Value)
{
SharedUpgrades.Log.LogInfo((object)"[INFO] Grab Range upgrade applied to everyone!");
PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item));
}
}
else if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayerGrabRange.Value)
{
PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item));
}
}
return false;
}
}
internal class ItemUpgradePlayerGrabStrengthPatch
{
[HarmonyPatch(typeof(ItemUpgradePlayerGrabStrength), "Upgrade")]
[HarmonyPrefix]
private static bool Prefix(ItemUpgradePlayerGrabStrength __instance)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
if (SharedUpgrades.DoChancePerPlayer.Value)
{
if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayer.Value)
{
SharedUpgrades.Log.LogInfo((object)"[INFO] Grab Strength upgrade applied to everyone!");
PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item));
}
}
else if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayerStrength.Value)
{
PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item));
}
}
return false;
}
}
internal class ItemUpgradePlayerGrabThrowPatch
{
[HarmonyPatch(typeof(ItemUpgradePlayerGrabThrow), "Upgrade")]
[HarmonyPrefix]
private static bool Prefix(ItemUpgradePlayerGrabThrow __instance)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
if (SharedUpgrades.DoChancePerPlayer.Value)
{
if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayer.Value)
{
SharedUpgrades.Log.LogInfo((object)"[INFO] Grab Throw Strength upgrade applied to everyone!");
PunManager.instance.UpgradePlayerThrowStrength(SemiFunc.PlayerGetSteamID(item));
}
}
else if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayerStrength.Value)
{
PunManager.instance.UpgradePlayerThrowStrength(SemiFunc.PlayerGetSteamID(item));
}
}
return false;
}
}
internal class ItemUpgradePlayerHealthPatch
{
[HarmonyPatch(typeof(ItemUpgradePlayerHealth), "Upgrade")]
[HarmonyPrefix]
private static bool Prefix(ItemUpgradePlayerHealth __instance)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
if (SharedUpgrades.DoChancePerPlayer.Value)
{
if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayer.Value)
{
SharedUpgrades.Log.LogInfo((object)"[INFO] Health upgrade applied to everyone!");
PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
}
}
else if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayerHealth.Value)
{
PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
}
}
return false;
}
}
internal class ItemUpgradePlayerSprintSpeedPatch
{
[HarmonyPatch(typeof(ItemUpgradePlayerSprintSpeed), "Upgrade")]
[HarmonyPrefix]
private static bool Prefix(ItemUpgradePlayerSprintSpeed __instance)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
if (SharedUpgrades.DoChancePerPlayer.Value)
{
if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayer.Value)
{
SharedUpgrades.Log.LogInfo((object)"[INFO] Sprint Speed upgrade applied to everyone!");
PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item));
}
}
else if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayerSprintSpeed.Value)
{
PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item));
}
}
return false;
}
}
internal class ItemUpgradePlayerTumbleLaunch
{
[HarmonyPatch(typeof(ItemUpgradePlayerTumbleLaunch), "Upgrade")]
[HarmonyPrefix]
private static bool Prefix(ItemUpgradePlayerTumbleLaunch __instance)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
if (SharedUpgrades.DoChancePerPlayer.Value)
{
if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayer.Value)
{
SharedUpgrades.Log.LogInfo((object)"[INFO] Tumble Launch upgrade applied to everyone!");
PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item));
}
}
else if (Random.Range(0f, 100f) <= SharedUpgrades.ChancePerPlayerTumbleLaunch.Value)
{
PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item));
}
}
return false;
}
}
}