Decompiled source of Reset Progress v1.1.0

ResetProgress.dll

Decompiled 2 months ago
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.Logging;
using CG.Client.Player.Input;
using CG.Cloud;
using CG.Profile;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;

[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("ResetProgress")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+b9676dd5465b914f45105c8b184cfcbbe74dc119")]
[assembly: AssemblyProduct("ResetProgress")]
[assembly: AssemblyTitle("Allows user to reset their experience or entire player profile (levels, cosmetics, acheivements, etc) via the F5 menu.")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ResetProgress
{
	[BepInPlugin("Dragon.ResetProgress", "Reset Progress", "1.1.0")]
	[BepInProcess("Void Crew.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BepinPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource log;

		private void Awake()
		{
			log = ((BaseUnityPlugin)this).Logger;
			log.LogInfo((object)"Plugin Dragon.ResetProgress is loaded!");
		}
	}
	public class VoidManagerPlugin : VoidPlugin
	{
		public override MultiplayerType MPType => (MultiplayerType)8;

		public override string Author => "Dragon, Mest";

		public override string Description => "Allows user to reset their experience or entire player profile (levels, cosmetics, acheivements, etc) via the F5 menu.";

		public override string ThunderstoreID => "VoidCrewModdingTeam/Reset_Progress";
	}
	internal class GUI : ModSettingsMenu
	{
		private bool FirstAsk;

		private bool SecondAsk;

		private bool ThirdAsk;

		public override string Name()
		{
			return "Reset Progress";
		}

		public override void OnOpen()
		{
			FirstAsk = false;
			SecondAsk = false;
			ThirdAsk = false;
		}

		public override void Draw()
		{
			GUILayout.Label("Reset xp Menu", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Current xp: {PlayerProfile.Instance.Profile.Xp}", Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Reset XP", Array.Empty<GUILayoutOption>()))
			{
				IPlayerProfileData profile = PlayerProfile.Instance.Profile;
				CloudPlayerProfileDataSync val = (CloudPlayerProfileDataSync)(object)((profile is CloudPlayerProfileDataSync) ? profile : null);
				if (val != null)
				{
					IPlayerProfileData source = ((ChainOfResponsibility<IPlayerProfileData>)(object)val).source;
					PhotonPlayerDataSync val2 = (PhotonPlayerDataSync)(object)((source is PhotonPlayerDataSync) ? source : null);
					if (val2 != null)
					{
						IPlayerProfileData source2 = ((ChainOfResponsibility<IPlayerProfileData>)(object)val2).source;
						PlayerProfileData val3 = (PlayerProfileData)(object)((source2 is PlayerProfileData) ? source2 : null);
						if (val3 != null)
						{
							val3.Xp = 0L;
							val.AddXp(0L);
							goto IL_00bd;
						}
					}
				}
				BepinPlugin.log.LogError((object)"Could not reset player XP");
			}
			goto IL_00bd;
			IL_00bd:
			GUILayout.EndHorizontal();
			GUILayout.HorizontalSlider(0f, 100f, 100f, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Reset Profile Menu", Array.Empty<GUILayoutOption>());
			GUILayout.Label("Levels, cosmetics, and achievements will all be reset. There will be no going back.", Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Reset Account?", Array.Empty<GUILayoutOption>()))
			{
				FirstAsk = true;
			}
			if (FirstAsk && GUILayout.Button("Are you sure?", Array.Empty<GUILayoutOption>()))
			{
				SecondAsk = true;
			}
			if (SecondAsk && GUILayout.Button("Are you REALLY sure?!?", Array.Empty<GUILayoutOption>()))
			{
				ThirdAsk = true;
			}
			if (ThirdAsk && GUILayout.Button("This is the final button. There is no going back.", Array.Empty<GUILayoutOption>()))
			{
				DebugInput.CloudProfileReset();
				DebugInput.AchievementsReset();
				((ModSettingsMenu)this).OnOpen();
			}
		}
	}
	public class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Dragon.ResetProgress";

		public const string PLUGIN_NAME = "ResetProgress";

		public const string USERS_PLUGIN_NAME = "Reset Progress";

		public const string PLUGIN_VERSION = "1.1.0";

		public const string PLUGIN_DESCRIPTION = "Allows user to reset their experience or entire player profile (levels, cosmetics, acheivements, etc) via the F5 menu.";

		public const string PLUGIN_ORIGINAL_AUTHOR = "Dragon";

		public const string PLUGIN_AUTHORS = "Dragon, Mest";

		public const string PLUGIN_THUNDERSTORE_ID = "VoidCrewModdingTeam/Reset_Progress";
	}
}