using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 Sirenix.Utilities;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Discord.Sdk")]
[assembly: IgnoresAccessChecksTo("Domain_Reload")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.MemoryProfiler")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Splines")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Einhornyordle")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.3.1.0")]
[assembly: AssemblyInformationalVersion("0.3.1+ee81725ee0ef0629f29cbff80098000f2fa45beb")]
[assembly: AssemblyProduct("RepoLeveling")]
[assembly: AssemblyTitle("RepoLeveling")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.3.1.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;
}
}
internal static class IsExternalInit
{
}
}
namespace RepoLeveling
{
internal static class ManagerConfig
{
internal static ConfigEntry<float> TotalHaulRequirementMultiplier;
internal static ConfigEntry<bool> EnableThrowSkill;
internal static void Initialize()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
TotalHaulRequirementMultiplier = ((BaseUnityPlugin)RepoLeveling.Instance).Config.Bind<float>("General", "TotalHaulRequirementMultiplier", 1f, new ConfigDescription("The multiplier applied to the total haul requirement for skill point gains. Increase it to slow skill point gain, decrease it to gain skill points faster. Note that this value is limited to 2 decimal places to prevent floating point precision errors and the upper and lower range is limited for better compatibility with the REPO Config mod.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 10f), Array.Empty<object>()));
EnableThrowSkill = ((BaseUnityPlugin)RepoLeveling.Instance).Config.Bind<bool>("General", "EnableThrowSkill", true, new ConfigDescription("The game contains references to a currently unused throw upgrade. With this option, you can choose if you want the related skill to be available or not. This setting will NOT make the upgrade available in-game!.", (AcceptableValueBase)null, Array.Empty<object>()));
}
internal static void Reload()
{
((BaseUnityPlugin)RepoLeveling.Instance).Config.Reload();
TotalHaulRequirementMultiplier.Value = (float)Math.Round(TotalHaulRequirementMultiplier.Value, 2);
}
}
internal static class ManagerSaveData
{
internal record SkillDefinition(string ConfigKey, string DictionaryName, string ReadableName, int MaxValue = int.MaxValue);
internal static List<SkillDefinition> SkillDefinitions = new List<SkillDefinition>(12)
{
new SkillDefinition("DeathHeadBattery", "playerUpgradeDeathHeadBattery", "death head battery"),
new SkillDefinition("MapPlayerCount", "playerUpgradeMapPlayerCount", "map player count", 1),
new SkillDefinition("CrouchRest", "playerUpgradeCrouchRest", "crouch rest"),
new SkillDefinition("Energy", "playerUpgradeStamina", "stamina"),
new SkillDefinition("ExtraJump", "playerUpgradeExtraJump", "double jump"),
new SkillDefinition("GrabRange", "playerUpgradeRange", "range"),
new SkillDefinition("GrabStrength", "playerUpgradeStrength", "strength"),
new SkillDefinition("Health", "playerUpgradeHealth", "health"),
new SkillDefinition("SprintSpeed", "playerUpgradeSpeed", "sprint speed"),
new SkillDefinition("TumbleClimb", "playerUpgradeTumbleClimb", "tumble climb"),
new SkillDefinition("TumbleLaunch", "playerUpgradeLaunch", "tumble launch"),
new SkillDefinition("TumbleWings", "playerUpgradeTumbleWings", "tumble wings")
};
internal static ConfigEntry<int> SaveCumulativeHaul = null;
internal static Dictionary<string, ConfigEntry<int>> SkillEntries = new Dictionary<string, ConfigEntry<int>>();
internal static void Initialize()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Expected O, but got Unknown
ConfigFile val = new ConfigFile(Path.Combine(Application.persistentDataPath, "REPOModData/RepoLeveling/save.cfg"), false);
SaveCumulativeHaul = val.Bind<int>("General", "CumulativeHaul", 0, new ConfigDescription("The total value of all hauls you've ever completed. Increase this to cheat skill points. Set to 0 to reset progress.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
if (ManagerConfig.EnableThrowSkill.Value)
{
SkillDefinitions.Add(new SkillDefinition("GrabThrow", "playerUpgradeThrow", "throw"));
}
foreach (SkillDefinition skillDefinition in SkillDefinitions)
{
SkillEntries[skillDefinition.ConfigKey] = val.Bind<int>("Skills", skillDefinition.ConfigKey, 0, new ConfigDescription("The amount of " + skillDefinition.ReadableName + " upgrades you've skilled. Set to 0 to regain spent skill points.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, int.MaxValue), Array.Empty<object>()));
}
}
internal static void ResetProgress()
{
SaveCumulativeHaul.Value = 0;
ResetSpentSkillPoints();
RepoLeveling.Logger.LogDebug((object)"Progress reset.");
}
internal static void ResetSpentSkillPoints()
{
foreach (ConfigEntry<int> value in SkillEntries.Values)
{
value.Value = 0;
}
RepoLeveling.Logger.LogDebug((object)"Skill points reset.");
}
internal static int SkillPointsFromCumulativeHaul()
{
int num = (int)Math.Round((-1.0 + Math.Sqrt(1f + (float)(4 * SaveCumulativeHaul.Value) / (75f * ManagerConfig.TotalHaulRequirementMultiplier.Value))) / 2.0);
RepoLeveling.Logger.LogDebug((object)$"Total skill points: {num}");
return num;
}
internal static int TotalSpentSkillPoints()
{
int num = SkillEntries.Values.Sum((ConfigEntry<int> e) => e.Value);
RepoLeveling.Logger.LogDebug((object)$"Spent skill points: {num}");
return num;
}
internal static int AvailableSkillPoints()
{
int num = SkillPointsFromCumulativeHaul() - TotalSpentSkillPoints();
RepoLeveling.Logger.LogDebug((object)$"Available skill points: {num}");
return num;
}
internal static int TotalCumulativeHaulNeededForNextSkillPoint()
{
int num = SkillPointsFromCumulativeHaul() + 1;
int num2 = (int)Math.Round((float)(75 * num * (num + 1)) * ManagerConfig.TotalHaulRequirementMultiplier.Value);
RepoLeveling.Logger.LogDebug((object)$"Total haul needed for next skill point: {num2}");
return num2;
}
internal static int NeededCumulativeHaulForNextSkillPoint()
{
int num = TotalCumulativeHaulNeededForNextSkillPoint() - SaveCumulativeHaul.Value;
RepoLeveling.Logger.LogDebug((object)$"Haul still needed for next skill point: {num}");
return num;
}
}
internal static class MenuPageMain
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static BuilderDelegate <>9__0_0;
public static BuilderDelegate <>9__0_1;
public static ShouldCloseMenuDelegate <>9__1_1;
internal void <Initialize>b__0_0(Transform parent)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOButton("Repo Leveling", (Action)Open, parent, new Vector2(50f, 360f));
}
internal void <Initialize>b__0_1(Transform parent)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOButton("Repo Leveling", (Action)Open, parent, new Vector2(30f, 295f));
}
internal bool <Open>b__1_1()
{
PatchPunManager.SyncSkills();
return true;
}
}
internal static void Initialize()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
object obj = <>c.<>9__0_0;
if (obj == null)
{
BuilderDelegate val = delegate(Transform parent)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOButton("Repo Leveling", (Action)Open, parent, new Vector2(50f, 360f));
};
<>c.<>9__0_0 = val;
obj = (object)val;
}
BuilderDelegate val2 = (BuilderDelegate)obj;
MenuAPI.AddElementToMainMenu(val2);
MenuAPI.AddElementToEscapeMenu(val2);
object obj2 = <>c.<>9__0_1;
if (obj2 == null)
{
BuilderDelegate val3 = delegate(Transform parent)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.CreateREPOButton("Repo Leveling", (Action)Open, parent, new Vector2(30f, 295f));
};
<>c.<>9__0_1 = val3;
obj2 = (object)val3;
}
MenuAPI.AddElementToLobbyMenu((BuilderDelegate)obj2);
}
internal static void Open()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
ManagerConfig.Reload();
REPOPopupPage page = MenuAPI.CreateREPOPopupPage("Repo Leveling", (PresetSide)0, false, true, 0f);
REPOElement[] array = (REPOElement[])(object)new REPOElement[3]
{
(REPOElement)MenuAPI.CreateREPOButton("Skills", (Action)MenuPageSkills.Open, ((Component)page).transform, default(Vector2)),
(REPOElement)MenuAPI.CreateREPOButton("Statistics", (Action)MenuPageStatistics.Open, ((Component)page).transform, default(Vector2)),
(REPOElement)MenuAPI.CreateREPOButton("Settings", (Action)MenuPageSettings.Open, ((Component)page).transform, default(Vector2))
};
REPOElement[] array2 = array;
foreach (REPOElement val in array2)
{
page.AddElementToScrollView(val.rectTransform, default(Vector2), 0f, 0f);
}
REPOButton val2 = MenuAPI.CreateREPOButton("Close", (Action)delegate
{
page.ClosePage(true);
PatchPunManager.SyncSkills();
}, ((Component)page).transform, new Vector2(66f, 20f));
page.AddElement(((REPOElement)val2).rectTransform, Vector2.op_Implicit(((Transform)((REPOElement)val2).rectTransform).localPosition));
REPOPopupPage obj = page;
ShouldCloseMenuDelegate onEscapePressed = obj.onEscapePressed;
object obj2 = <>c.<>9__1_1;
if (obj2 == null)
{
ShouldCloseMenuDelegate val3 = delegate
{
PatchPunManager.SyncSkills();
return true;
};
<>c.<>9__1_1 = val3;
obj2 = (object)val3;
}
obj.onEscapePressed = (ShouldCloseMenuDelegate)Delegate.Combine((Delegate?)(object)onEscapePressed, (Delegate?)obj2);
page.OpenPage(false);
}
}
internal static class MenuPageSettings
{
internal static void Open()
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
if (MenuManager.instance.addedPagesOnTop.Count > 0)
{
if (((Object)MenuManager.instance.addedPagesOnTop[0]).name == "Menu Page Settings")
{
return;
}
MenuAPI.CloseAllPagesAddedOnTop();
}
REPOPopupPage page = MenuAPI.CreateREPOPopupPage("Settings", (PresetSide)1, false, false, 0f);
page.AddElementToScrollView(((REPOElement)MenuAPI.CreateREPOButton("Reset spent skill points", (Action)delegate
{
ManagerSaveData.ResetSpentSkillPoints();
MenuAPI.CloseAllPagesAddedOnTop();
PatchPunManager.SyncSkills();
}, ((Component)page).transform, default(Vector2))).rectTransform, default(Vector2), 0f, 0f);
page.AddElementToScrollView(((REPOElement)MenuAPI.CreateREPOButton("Reset progress", (Action)delegate
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
MenuAPI.OpenPopup("Reset Progress", Color.red, "Are you sure that you want to reset your progress? This cannot be undone!", (Action)delegate
{
ManagerSaveData.ResetProgress();
page.ClosePage(true);
PatchPunManager.SyncSkills();
}, (Action)null);
}, ((Component)page).transform, default(Vector2))).rectTransform, default(Vector2), 0f, 0f);
page.OpenPage(true);
}
}
internal static class MenuPageSkills
{
private static Dictionary<REPOSlider, ManagerSaveData.SkillDefinition> _skillSliders;
private static REPOLabel _skillPointsLabel;
private static string SkillPointsLabelText(int available, int total)
{
return $"Skill points: {available} / {total}";
}
internal static void Open()
{
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
if (MenuManager.instance.addedPagesOnTop.Count > 0)
{
if (((Object)MenuManager.instance.addedPagesOnTop[0]).name == "Menu Page Skills")
{
return;
}
MenuAPI.CloseAllPagesAddedOnTop();
}
REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Skills", (PresetSide)1, false, false, 0f);
_skillSliders = new Dictionary<REPOSlider, ManagerSaveData.SkillDefinition>();
int num = ManagerSaveData.AvailableSkillPoints();
foreach (ManagerSaveData.SkillDefinition skill in ManagerSaveData.SkillDefinitions)
{
int value2 = ManagerSaveData.SkillEntries[skill.ConfigKey].Value;
REPOSlider val2 = MenuAPI.CreateREPOSlider(StringExtensions.ToTitleCase(skill.ReadableName), string.Empty, (Action<int>)delegate(int value)
{
OnSkillPointAssignmentChanged(skill, value);
}, ((Component)val).transform, default(Vector2), 0, Math.Clamp(value2 + num, 0, skill.MaxValue), value2, "", "", (BarBehavior)0);
_skillSliders[val2] = skill;
val.AddElementToScrollView(((REPOElement)val2).rectTransform, default(Vector2), 0f, 0f);
}
if (_skillSliders.Count > 0)
{
((REPOElement)_skillSliders.Keys.First()).repoScrollViewElement.topPadding = 5f;
}
val.scrollView.spacing = 5f;
_skillPointsLabel = MenuAPI.CreateREPOLabel(SkillPointsLabelText(num, ManagerSaveData.SkillPointsFromCumulativeHaul()), ((Component)val).transform, new Vector2(420f, 20f));
val.AddElement(((REPOElement)_skillPointsLabel).rectTransform, Vector2.op_Implicit(((Transform)((REPOElement)_skillPointsLabel).rectTransform).localPosition));
val.OpenPage(true);
}
private static void OnSkillPointAssignmentChanged(ManagerSaveData.SkillDefinition changedSkill, int value)
{
ManagerSaveData.SkillEntries[changedSkill.ConfigKey].Value = value;
int num = ManagerSaveData.AvailableSkillPoints();
foreach (var (val2, skillDefinition2) in _skillSliders)
{
val2.max = Math.Min(((skillDefinition2 == changedSkill) ? ((float)value) : val2.value) + (float)num, skillDefinition2.MaxValue);
val2.SetValue(val2.value, false);
}
((TMP_Text)_skillPointsLabel.labelTMP).text = SkillPointsLabelText(num, ManagerSaveData.SkillPointsFromCumulativeHaul());
}
}
internal static class MenuPageStatistics
{
internal static void Open()
{
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
if (MenuManager.instance.addedPagesOnTop.Count > 0)
{
if (((Object)MenuManager.instance.addedPagesOnTop[0]).name == "Menu Page Statistics")
{
return;
}
MenuAPI.CloseAllPagesAddedOnTop();
}
REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Statistics", (PresetSide)1, false, false, 0f);
string[] array = new string[5]
{
$"Total Hauled: {ManagerSaveData.SaveCumulativeHaul.Value}k",
$"Current Haul: {StatsManager.instance.GetRunStatTotalHaul()}k",
$"Next SP in: {ManagerSaveData.NeededCumulativeHaulForNextSkillPoint()}k",
$"Total SP earned: {ManagerSaveData.SkillPointsFromCumulativeHaul()}",
$"Available SP: {ManagerSaveData.AvailableSkillPoints()}"
};
string[] array2 = array;
foreach (string text in array2)
{
val.AddElementToScrollView(((REPOElement)MenuAPI.CreateREPOLabel(text, ((Component)val).transform, default(Vector2))).rectTransform, default(Vector2), 0f, 0f);
}
val.OpenPage(true);
}
}
[HarmonyPatch(typeof(PlayerAvatar))]
internal static class PatchPlayerAvatar
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void Start_Postfix()
{
PatchPunManager.SyncSkills();
}
}
[HarmonyPatch(typeof(PunManager))]
internal static class PatchPunManager
{
[HarmonyPrefix]
[HarmonyPatch("SyncAllDictionaries")]
private static void SyncAllDictionaries_Prefix()
{
if (!SemiFunc.IsMasterClientOrSingleplayer() || !SemiFunc.RunIsLevel())
{
return;
}
RepoLeveling.Logger.LogDebug((object)"Skill distribution started");
foreach (PlayerAvatar item in GameDirector.instance.PlayerList.Where((PlayerAvatar player) => StatsManager.instance.FetchPlayerUpgrades(player.steamID).Values.All((int v) => v == 0)))
{
RepoLeveling.Logger.LogDebug((object)("Applying skills for " + item.playerName + "..."));
if (RepoLeveling.Instance.PlayerSkills.TryGetValue(item.steamID, out Dictionary<string, int> value))
{
foreach (ManagerSaveData.SkillDefinition skillDefinition in ManagerSaveData.SkillDefinitions)
{
if (value.TryGetValue(skillDefinition.ConfigKey, out var value2))
{
StatsManager.instance.DictionaryUpdateValue(skillDefinition.DictionaryName, item.steamID, value2);
RepoLeveling.Logger.LogDebug((object)$"{skillDefinition.ReadableName} is now {value2}.");
}
}
}
RepoLeveling.Logger.LogDebug((object)("Skills applied for " + item.playerName + "."));
}
RepoLeveling.Logger.LogDebug((object)"Skill distribution finished");
}
[HarmonyPostfix]
[HarmonyPatch("Awake")]
private static void Awake_Postfix(PunManager __instance)
{
((Component)__instance).gameObject.AddComponent<NetworkingReceiver>();
}
internal static void SyncSkills()
{
string[] array = new string[ManagerSaveData.SkillDefinitions.Count];
int[] array2 = new int[ManagerSaveData.SkillDefinitions.Count];
for (int i = 0; i < ManagerSaveData.SkillDefinitions.Count; i++)
{
ManagerSaveData.SkillDefinition skillDefinition = ManagerSaveData.SkillDefinitions[i];
array[i] = skillDefinition.ConfigKey;
array2[i] = ManagerSaveData.SkillEntries[skillDefinition.ConfigKey].Value;
}
if (SemiFunc.IsMasterClientOrSingleplayer())
{
((Component)PunManager.instance).GetComponent<NetworkingReceiver>().SyncSkillsRPC(PlayerAvatar.instance.steamID, array, array2);
return;
}
PunManager.instance.photonView.RPC("SyncSkillsRPC", (RpcTarget)2, new object[3]
{
PlayerAvatar.instance.steamID,
array,
array2
});
RepoLeveling.Logger.LogDebug((object)"Sent skills to host.");
}
}
internal class NetworkingReceiver : MonoBehaviour
{
[PunRPC]
internal void SyncSkillsRPC(string steamID, string[] keys, int[] values)
{
Dictionary<string, int> dictionary = new Dictionary<string, int>();
for (int i = 0; i < keys.Length; i++)
{
dictionary[keys[i]] = values[i];
}
RepoLeveling.Instance.PlayerSkills[steamID] = dictionary;
RepoLeveling.Logger.LogDebug((object)("Updated skills for " + steamID + "."));
}
}
[HarmonyPatch(typeof(SemiFunc))]
internal static class PatchSemiFunc
{
[HarmonyPostfix]
[HarmonyPatch("OnSceneSwitch")]
private static void OnSceneSwitch_Postfix(bool _gameOver, bool _leaveGame)
{
if (_leaveGame)
{
RepoLeveling.Logger.LogDebug((object)"Clearing skill cache.");
RepoLeveling.Instance.PlayerSkills.Clear();
}
if (SemiFunc.RunIsArena())
{
RepoLeveling.Logger.LogDebug((object)$"Level failed, saving haul of {StatsManager.instance.GetRunStatTotalHaul()}");
ConfigEntry<int> saveCumulativeHaul = ManagerSaveData.SaveCumulativeHaul;
saveCumulativeHaul.Value += StatsManager.instance.GetRunStatTotalHaul();
RepoLeveling.Logger.LogDebug((object)$"New total: {ManagerSaveData.SaveCumulativeHaul.Value}");
}
}
}
[BepInPlugin("Einhornyordle.RepoLeveling", "RepoLeveling", "0.3.1")]
internal class RepoLeveling : BaseUnityPlugin
{
internal Dictionary<string, Dictionary<string, int>> PlayerSkills;
internal static RepoLeveling Instance { get; set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
private Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
PlayerSkills = new Dictionary<string, Dictionary<string, int>>();
ManagerConfig.Initialize();
ManagerSaveData.Initialize();
MenuPageMain.Initialize();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
private void OnDestroy()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Patch()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0025: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
}
}