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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using Photon.Pun;
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("RandomizeEveryRound")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.7")]
[assembly: AssemblyInformationalVersion("1.2.1+fe8afd5d548e5df12c02b3500342ba36d9db56ea")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("RandomizeEveryRound")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.7.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace RandomizeEveryRound
{
[HarmonyPatch(typeof(StatsUI), "Update")]
public static class StatsUIPatch
{
private static void Prefix(ref float ___showStatsTimer)
{
if (UpgradeMenu.isOpen)
{
___showStatsTimer = 5f;
}
}
}
[HarmonyPatch(typeof(StatsManager))]
[HarmonyPatch("Start")]
public static class StatsManagerPatch
{
private static void Prefix(StatsManager __instance)
{
__instance.dictionaryOfDictionaries.Add("playerUpgradesUsed", new Dictionary<string, int>());
__instance.dictionaryOfDictionaries.Add("UERDataSync", new Dictionary<string, int> {
{
"HostConfig",
Plugin.configData
} });
}
}
[HarmonyPatch(typeof(RunManager))]
[HarmonyPatch("ChangeLevel")]
public static class RunManagerChangeLevelPatch
{
private static void Prefix()
{
UpgradeMenu.isOpen = false;
if (SemiFunc.IsMasterClientOrSingleplayer())
{
Plugin.CurrentRound = -1;
}
}
}
[HarmonyPatch(typeof(RunManager))]
[HarmonyPatch("LeaveToMainMenu")]
public static class RunManagerMainMenuPatch
{
private static void Prefix()
{
UpgradeMenu.isOpen = false;
Plugin.RandomizedUpgrades.Clear();
Plugin.CurrentRound = -1;
}
}
[HarmonyPatch(typeof(PlayerAvatar))]
[HarmonyPatch("SpawnRPC")]
public static class PlayerSpawnPatch
{
private static void Prefix(PhotonView ___photonView)
{
Level[] source = (Level[])(object)new Level[3]
{
RunManager.instance.levelMainMenu,
RunManager.instance.levelLobbyMenu,
RunManager.instance.levelTutorial
};
if (source.Contains(RunManager.instance.levelCurrent))
{
return;
}
string steamID = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarGetFromPhotonID(SemiFunc.PhotonViewIDPlayerAvatarLocal()));
int num = RunManager.instance.levelsCompleted * Plugin.UpgradesPerRound;
num++;
if (Plugin.NumUpgradesUsed(steamID) >= num || (GameManager.Multiplayer() && !___photonView.IsMine))
{
return;
}
if (SemiFunc.IsMasterClientOrSingleplayer())
{
Plugin.RandomizeUpgrades(RunManager.instance.levelsCompleted);
if (GameManager.Multiplayer())
{
PhotonView component = ((Component)PunManager.instance).GetComponent<PhotonView>();
component.RPC("SyncRandomizedUpgradesRPC", (RpcTarget)1, new object[2]
{
RunManager.instance.levelsCompleted,
Plugin.RandomizedUpgrades.ToArray()
});
}
}
Plugin.ApplyRandomizedUpgrades(steamID);
UpgradeMenu.isOpen = false;
}
}
[BepInPlugin("le_pepe.randomizeeveryround", "Randomize Every Round", "1.0.2")]
[BepInDependency("nickklmao.menulib", "2.1.3")]
public class Plugin : BaseUnityPlugin
{
public const string modGUID = "le_pepe.randomizeeveryround";
public const string modName = "Randomize Every Round";
public const string modVersion = "1.0.2";
private static ConfigEntry<int> upgradesPerRound;
private static ConfigEntry<bool> limitedChoices;
private static ConfigEntry<int> numChoices;
private static ConfigEntry<bool> allowMapCount;
private static ConfigEntry<bool> allowEnergy;
private static ConfigEntry<bool> allowExtraJump;
private static ConfigEntry<bool> allowRange;
private static ConfigEntry<bool> allowStrength;
private static ConfigEntry<bool> allowHealth;
private static ConfigEntry<bool> allowSpeed;
private static ConfigEntry<bool> allowTumbleLaunch;
public static List<int> RandomizedUpgrades = new List<int>();
public static int CurrentRound = -1;
public static int configData = 0;
internal static ManualLogSource Logger;
private readonly Harmony harmony = new Harmony("le_pepe.randomizeeveryround");
public static int UpgradesPerRound => SemiFunc.IsMasterClientOrSingleplayer() ? upgradesPerRound.Value : (StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 7);
public static bool LimitedChoices => SemiFunc.IsMasterClientOrSingleplayer() ? limitedChoices.Value : ((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x40) == 1);
public static int NumChoices => SemiFunc.IsMasterClientOrSingleplayer() ? numChoices.Value : (((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x38) >> 3) + 1);
public static bool AllowMapCount => SemiFunc.IsMasterClientOrSingleplayer() ? allowMapCount.Value : ((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x80) == 1);
public static bool AllowEnergy => SemiFunc.IsMasterClientOrSingleplayer() ? allowEnergy.Value : ((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x100) == 1);
public static bool AllowExtraJump => SemiFunc.IsMasterClientOrSingleplayer() ? allowExtraJump.Value : ((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x200) == 1);
public static bool AllowRange => SemiFunc.IsMasterClientOrSingleplayer() ? allowRange.Value : ((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x400) == 1);
public static bool AllowStrength => SemiFunc.IsMasterClientOrSingleplayer() ? allowStrength.Value : ((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x800) == 1);
public static bool AllowHealth => SemiFunc.IsMasterClientOrSingleplayer() ? allowHealth.Value : ((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x1000) == 1);
public static bool AllowSpeed => SemiFunc.IsMasterClientOrSingleplayer() ? allowSpeed.Value : ((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x2000) == 1);
public static bool AllowTumbleLaunch => SemiFunc.IsMasterClientOrSingleplayer() ? allowTumbleLaunch.Value : ((StatsManager.instance.dictionaryOfDictionaries["UERDataSync"]["HostConfig"] & 0x4000) == 1);
private void Awake()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Expected O, but got Unknown
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Expected O, but got Unknown
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Expected O, but got Unknown
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Expected O, but got Unknown
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Expected O, but got Unknown
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
upgradesPerRound = ((BaseUnityPlugin)this).Config.Bind<int>("Upgrades", "Upgrades Per Round", 1, new ConfigDescription("Number of upgrades per round", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 7), Array.Empty<object>()));
limitedChoices = ((BaseUnityPlugin)this).Config.Bind<bool>("Upgrades", "Limited random choices", false, new ConfigDescription("Only presents a fixed number of random options", (AcceptableValueBase)null, Array.Empty<object>()));
numChoices = ((BaseUnityPlugin)this).Config.Bind<int>("Upgrades", "Number of choices", 3, new ConfigDescription("Number of options to choose from per upgrade", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 8), Array.Empty<object>()));
allowMapCount = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Map Player Count", true, new ConfigDescription("Allows Map Player Count Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
allowEnergy = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Stamina", true, new ConfigDescription("Allows Stamina Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
allowExtraJump = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Extra Jump", true, new ConfigDescription("Allows Extra Jump Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
allowRange = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Range", true, new ConfigDescription("Allows Range Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
allowStrength = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Strength", true, new ConfigDescription("Allows Strength Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
allowHealth = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Health", true, new ConfigDescription("Allows Health Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
allowSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Speed", true, new ConfigDescription("Allows Speed Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
allowTumbleLaunch = ((BaseUnityPlugin)this).Config.Bind<bool>("Enabled upgrades", "Enable Tumble Launch", true, new ConfigDescription("Allows Tumble Launch Upgrade to be chosen", (AcceptableValueBase)null, Array.Empty<object>()));
upgradesPerRound.SettingChanged += ConfigUpdated;
limitedChoices.SettingChanged += ConfigUpdated;
numChoices.SettingChanged += ConfigUpdated;
allowMapCount.SettingChanged += ConfigUpdated;
allowEnergy.SettingChanged += ConfigUpdated;
allowExtraJump.SettingChanged += ConfigUpdated;
allowRange.SettingChanged += ConfigUpdated;
allowStrength.SettingChanged += ConfigUpdated;
allowHealth.SettingChanged += ConfigUpdated;
allowSpeed.SettingChanged += ConfigUpdated;
allowTumbleLaunch.SettingChanged += ConfigUpdated;
UpdateConfigData();
harmony.PatchAll(typeof(PlayerSpawnPatch));
harmony.PatchAll(typeof(RunManagerChangeLevelPatch));
harmony.PatchAll(typeof(RunManagerMainMenuPatch));
harmony.PatchAll(typeof(StatsManagerPatch));
harmony.PatchAll(typeof(StatsUIPatch));
harmony.PatchAll(typeof(UpgradeMapPlayerCountPatch));
harmony.PatchAll(typeof(UpgradePlayerEnergyPatch));
harmony.PatchAll(typeof(UpgradePlayerExtraJumpPatch));
harmony.PatchAll(typeof(UpgradePlayerGrabRangePatch));
harmony.PatchAll(typeof(UpgradePlayerGrabStrengthPatch));
harmony.PatchAll(typeof(UpgradePlayerHealthPatch));
harmony.PatchAll(typeof(UpgradePlayerSprintSpeedPatch));
harmony.PatchAll(typeof(UpgradePlayerTumbleLaunchPatch));
Logger.LogInfo((object)"Plugin RandomizeEveryRound is loaded!");
}
private void ConfigUpdated(object sender, EventArgs args)
{
UpdateConfigData();
if (SemiFunc.IsMultiplayer() && PhotonNetwork.IsMasterClient)
{
PhotonView component = ((Component)PunManager.instance).GetComponent<PhotonView>();
component.RPC("UpdateStatRPC", (RpcTarget)1, new object[3] { "UERDataSync", "HostConfig", configData });
}
}
private void UpdateConfigData()
{
configData = upgradesPerRound.Value & 7;
configData |= (numChoices.Value - 1 << 3) & 0x38;
configData |= (limitedChoices.Value ? 64 : 0);
configData |= (allowMapCount.Value ? 128 : 0);
configData |= (allowEnergy.Value ? 256 : 0);
configData |= (allowExtraJump.Value ? 512 : 0);
configData |= (allowRange.Value ? 1024 : 0);
configData |= (allowStrength.Value ? 2048 : 0);
configData |= (allowHealth.Value ? 4096 : 0);
configData |= (allowSpeed.Value ? 8192 : 0);
configData |= (allowTumbleLaunch.Value ? 16384 : 0);
Logger.LogInfo((object)("upgradeData updated to " + configData));
}
public static void RandomizeUpgrades(int currentRound)
{
if (currentRound == CurrentRound)
{
return;
}
RandomizedUpgrades.Clear();
List<int> list = new List<int>();
if (AllowEnergy)
{
list.Add(0);
}
if (AllowExtraJump)
{
list.Add(1);
}
if (AllowRange)
{
list.Add(2);
}
if (AllowStrength)
{
list.Add(3);
}
if (AllowHealth)
{
list.Add(4);
}
if (AllowSpeed)
{
list.Add(5);
}
if (AllowTumbleLaunch)
{
list.Add(6);
}
if (AllowMapCount)
{
list.Add(7);
}
for (int i = 0; i < UpgradesPerRound; i++)
{
if (list.Count > 0)
{
int index = Random.Range(0, list.Count);
RandomizedUpgrades.Add(list[index]);
}
}
CurrentRound = currentRound;
Logger.LogInfo((object)$"Randomized {RandomizedUpgrades.Count} upgrades for round {currentRound}");
}
public static void ApplyRandomizedUpgrades(string _steamID)
{
Logger.LogInfo((object)$"Applying {RandomizedUpgrades.Count} randomized upgrades for player {_steamID}");
StatsUI.instance.Fetch();
StatsUI.instance.ShowStats();
foreach (int randomizedUpgrade in RandomizedUpgrades)
{
ApplyUpgradeById(randomizedUpgrade, _steamID);
CameraGlitch.Instance.PlayUpgrade();
}
int num = RunManager.instance.levelsCompleted * UpgradesPerRound;
int num2 = NumUpgradesUsed(_steamID);
int num3 = num;
StatsManager.instance.dictionaryOfDictionaries["playerUpgradesUsed"][_steamID] = num3;
if (GameManager.Multiplayer())
{
PhotonView component = ((Component)PunManager.instance).GetComponent<PhotonView>();
component.RPC("UpdateStatRPC", (RpcTarget)1, new object[3] { "playerUpgradesUsed", _steamID, num3 });
}
}
private static void ApplyUpgradeById(int upgradeType, string _steamID)
{
switch (upgradeType)
{
case 0:
PunManager.instance.UpgradePlayerEnergy(_steamID);
break;
case 1:
PunManager.instance.UpgradePlayerExtraJump(_steamID);
break;
case 2:
PunManager.instance.UpgradePlayerGrabRange(_steamID);
break;
case 3:
PunManager.instance.UpgradePlayerGrabStrength(_steamID);
break;
case 4:
PunManager.instance.UpgradePlayerHealth(_steamID);
break;
case 5:
PunManager.instance.UpgradePlayerSprintSpeed(_steamID);
break;
case 6:
PunManager.instance.UpgradePlayerTumbleLaunch(_steamID);
break;
case 7:
PunManager.instance.UpgradeMapPlayerCount(_steamID);
break;
}
}
public static void ApplyUpgrade(string _steamID, REPOPopupPage popupPage)
{
StatsUI.instance.Fetch();
StatsUI.instance.ShowStats();
CameraGlitch.Instance.PlayUpgrade();
int num = ++StatsManager.instance.dictionaryOfDictionaries["playerUpgradesUsed"][_steamID];
if (GameManager.Multiplayer())
{
PhotonView component = ((Component)PunManager.instance).GetComponent<PhotonView>();
component.RPC("UpdateStatRPC", (RpcTarget)1, new object[3] { "playerUpgradesUsed", _steamID, num });
}
UpgradeMenu.isOpen = false;
popupPage.ClosePage(true);
int num2 = RunManager.instance.levelsCompleted * UpgradesPerRound;
if (num2 > num)
{
REPOPopupPage val = UpgradeMenu.createMenu(_steamID);
val.OpenPage(false);
UpgradeMenu.isOpen = true;
}
}
public static int NumUpgradesUsed(string _steamID)
{
return StatsManager.instance.dictionaryOfDictionaries["playerUpgradesUsed"][_steamID];
}
}
[HarmonyPatch(typeof(PunManager))]
[HarmonyPatch("Start")]
public static class PunManagerRPCPatch
{
private static void Postfix(PunManager __instance)
{
((Component)__instance).gameObject.AddComponent<PhotonView>().RPC("SyncRandomizedUpgradesRPC", (RpcTarget)0, new object[2]
{
-1,
new int[0]
});
}
}
[HarmonyPatch]
public static class SyncRandomizedUpgradesRPCMethod
{
[HarmonyPatch(typeof(PunManager), "SyncRandomizedUpgradesRPC")]
[HarmonyPrefix]
private static bool Prefix(int roundNumber, int[] upgrades)
{
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
Plugin.CurrentRound = roundNumber;
Plugin.RandomizedUpgrades.Clear();
foreach (int item in upgrades)
{
Plugin.RandomizedUpgrades.Add(item);
}
Plugin.Logger.LogInfo((object)$"Received {upgrades.Length} randomized upgrades from host for round {roundNumber}");
}
return false;
}
}
[HarmonyPatch(typeof(PunManager))]
[HarmonyPatch("UpgradeMapPlayerCount")]
public static class UpgradeMapPlayerCountPatch
{
private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
{
if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
{
___photonView.RPC("UpgradeMapPlayerCountRPC", (RpcTarget)1, new object[2]
{
_steamID,
___statsManager.playerUpgradeMapPlayerCount[_steamID]
});
}
}
}
[HarmonyPatch(typeof(PunManager))]
[HarmonyPatch("UpgradePlayerEnergy")]
public static class UpgradePlayerEnergyPatch
{
private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
{
if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
{
___photonView.RPC("UpgradePlayerEnergyCountRPC", (RpcTarget)1, new object[2]
{
_steamID,
___statsManager.playerUpgradeStamina[_steamID]
});
}
}
}
[HarmonyPatch(typeof(PunManager))]
[HarmonyPatch("UpgradePlayerExtraJump")]
public static class UpgradePlayerExtraJumpPatch
{
private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
{
if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
{
___photonView.RPC("UpgradePlayerExtraJumpRPC", (RpcTarget)1, new object[2]
{
_steamID,
___statsManager.playerUpgradeExtraJump[_steamID]
});
}
}
}
[HarmonyPatch(typeof(PunManager))]
[HarmonyPatch("UpgradePlayerGrabRange")]
public static class UpgradePlayerGrabRangePatch
{
private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
{
if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
{
___photonView.RPC("UpgradePlayerGrabRangeRPC", (RpcTarget)1, new object[2]
{
_steamID,
___statsManager.playerUpgradeRange[_steamID]
});
}
}
}
[HarmonyPatch(typeof(PunManager))]
[HarmonyPatch("UpgradePlayerGrabStrength")]
public static class UpgradePlayerGrabStrengthPatch
{
private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
{
if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
{
___photonView.RPC("UpgradePlayerGrabStrengthRPC", (RpcTarget)1, new object[2]
{
_steamID,
___statsManager.playerUpgradeStrength[_steamID]
});
}
}
}
[HarmonyPatch(typeof(PunManager))]
[HarmonyPatch("UpgradePlayerHealth")]
public static class UpgradePlayerHealthPatch
{
private static void Postfix(string playerName, PhotonView ___photonView, StatsManager ___statsManager)
{
if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
{
___photonView.RPC("UpgradePlayerHealthRPC", (RpcTarget)1, new object[2]
{
playerName,
___statsManager.playerUpgradeHealth[playerName]
});
}
}
}
[HarmonyPatch(typeof(PunManager))]
[HarmonyPatch("UpgradePlayerSprintSpeed")]
public static class UpgradePlayerSprintSpeedPatch
{
private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
{
if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
{
___photonView.RPC("UpgradePlayerSprintSpeedRPC", (RpcTarget)1, new object[2]
{
_steamID,
___statsManager.playerUpgradeSpeed[_steamID]
});
}
}
}
[HarmonyPatch(typeof(PunManager))]
[HarmonyPatch("UpgradePlayerTumbleLaunch")]
public static class UpgradePlayerTumbleLaunchPatch
{
private static void Postfix(string _steamID, PhotonView ___photonView, StatsManager ___statsManager)
{
if (!SemiFunc.IsMasterClient() && GameManager.Multiplayer() && UpgradeMenu.isOpen)
{
___photonView.RPC("UpgradePlayerTumbleLaunchRPC", (RpcTarget)1, new object[2]
{
_steamID,
___statsManager.playerUpgradeLaunch[_steamID]
});
}
}
}
public static class UpgradeMenu
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static BuilderDelegate <>9__1_0;
internal void <createInfoPopup>b__1_0(Transform parent)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOLabel("Random upgrades have been applied to all players", parent, new Vector2(500f, 25f));
}
}
public static bool isOpen;
public static REPOPopupPage createInfoPopup(string _steamID)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Expected O, but got Unknown
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Expected O, but got Unknown
StatsUI.instance.Fetch();
StatsUI.instance.ShowStats();
REPOPopupPage repoPopupPage = MenuAPI.CreateREPOPopupPage("Randomized Upgrades Applied", (PresetSide)1, false, true, 1.5f);
REPOPopupPage obj = repoPopupPage;
object obj2 = <>c.<>9__1_0;
if (obj2 == null)
{
BuilderDelegate val = delegate(Transform parent)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOLabel("Random upgrades have been applied to all players", parent, new Vector2(500f, 25f));
};
<>c.<>9__1_0 = val;
obj2 = (object)val;
}
obj.AddElement((BuilderDelegate)obj2);
float yPos = 60f;
foreach (int randomizedUpgrade in Plugin.RandomizedUpgrades)
{
string upgradeName = GetUpgradeName(randomizedUpgrade);
repoPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOLabel("• " + upgradeName, parent, new Vector2(500f, yPos));
});
yPos += 25f;
}
repoPopupPage.AddElement((BuilderDelegate)delegate(Transform parent)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOButton("Close", (Action)delegate
{
repoPopupPage.ClosePage(true);
isOpen = false;
}, parent, new Vector2(500f, yPos + 25f));
});
return repoPopupPage;
}
private static string GetUpgradeName(int upgradeType)
{
if (1 == 0)
{
}
string result = upgradeType switch
{
0 => "Stamina",
1 => "Extra Jump",
2 => "Range",
3 => "Strength",
4 => "Health",
5 => "Sprint Speed",
6 => "Tumble Launch",
7 => "Map Player Count",
_ => "Unknown Upgrade",
};
if (1 == 0)
{
}
return result;
}
public static REPOPopupPage createMenu(string _steamID)
{
return createInfoPopup(_steamID);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "RandomizeEveryRound";
public const string PLUGIN_NAME = "My first plugin";
public const string PLUGIN_VERSION = "1.2.1";
}
}