Decompiled source of Reset Progress v1.2.1

ResetProgress.dll

Decompiled 2 weeks 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.Game;
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.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+e24203752e2b48349e5e4813fff9c1a1ea305c78")]
[assembly: AssemblyProduct("ResetProgress")]
[assembly: AssemblyTitle("Allows user to reset their experience, levels, or entire player profile (levels, cosmetics, acheivements, etc) via the F5 menu.")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.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.2.1")]
	[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, levels, or entire player profile (levels, cosmetics, acheivements, etc) via the F5 menu.";

		public override string ThunderstoreID => "NihilityShift/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);
							if (GameSessionManager.ActiveSession != null)
							{
								ClientGame.Current.ModelEventBus.OnRankChanged.Publish();
							}
							goto IL_00e5;
						}
					}
				}
				BepinPlugin.log.LogError((object)"Could not reset player XP");
			}
			goto IL_00e5;
			IL_0211:
			if (GUILayout.Button("Reset Favor Level only", Array.Empty<GUILayoutOption>()))
			{
				IPlayerProfileData profile2 = PlayerProfile.Instance.Profile;
				CloudPlayerProfileDataSync val4 = (CloudPlayerProfileDataSync)(object)((profile2 is CloudPlayerProfileDataSync) ? profile2 : null);
				if (val4 != null)
				{
					IPlayerProfileData source3 = ((ChainOfResponsibility<IPlayerProfileData>)(object)val4).source;
					PhotonPlayerDataSync val5 = (PhotonPlayerDataSync)(object)((source3 is PhotonPlayerDataSync) ? source3 : null);
					if (val5 != null)
					{
						IPlayerProfileData source4 = ((ChainOfResponsibility<IPlayerProfileData>)(object)val5).source;
						PlayerProfileData val6 = (PlayerProfileData)(object)((source4 is PlayerProfileData) ? source4 : null);
						if (val6 != null)
						{
							val6.FavorRank = 0;
							val4.AddXp(0L);
							if (GameSessionManager.ActiveSession != null)
							{
								ClientGame.Current.ModelEventBus.OnRankChanged.Publish();
							}
							goto IL_02bc;
						}
					}
				}
				BepinPlugin.log.LogError((object)"Could not reset player Level");
			}
			goto IL_02bc;
			IL_00e5:
			GUILayout.EndHorizontal();
			GUILayout.HorizontalSlider(0f, 100f, 100f, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Reset Level Menu", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Current Level: {PlayerProfile.Instance.Profile.Rank} : {PlayerProfile.Instance.Profile.FavorRank}", Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Reset Level", Array.Empty<GUILayoutOption>()))
			{
				IPlayerProfileData profile3 = PlayerProfile.Instance.Profile;
				CloudPlayerProfileDataSync val7 = (CloudPlayerProfileDataSync)(object)((profile3 is CloudPlayerProfileDataSync) ? profile3 : null);
				if (val7 != null)
				{
					IPlayerProfileData source5 = ((ChainOfResponsibility<IPlayerProfileData>)(object)val7).source;
					PhotonPlayerDataSync val8 = (PhotonPlayerDataSync)(object)((source5 is PhotonPlayerDataSync) ? source5 : null);
					if (val8 != null)
					{
						IPlayerProfileData source6 = ((ChainOfResponsibility<IPlayerProfileData>)(object)val8).source;
						PlayerProfileData val9 = (PlayerProfileData)(object)((source6 is PlayerProfileData) ? source6 : null);
						if (val9 != null)
						{
							val9.Rank = 0;
							val9.FavorRank = 0;
							val7.AddXp(0L);
							if (GameSessionManager.ActiveSession != null)
							{
								ClientGame.Current.ModelEventBus.OnRankChanged.Publish();
							}
							goto IL_0211;
						}
					}
				}
				BepinPlugin.log.LogError((object)"Could not reset player Level");
			}
			goto IL_0211;
			IL_02bc:
			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>()))
			{
				return;
			}
			IPlayerProfileData profile4 = PlayerProfile.Instance.Profile;
			CloudPlayerProfileDataSync val10 = (CloudPlayerProfileDataSync)(object)((profile4 is CloudPlayerProfileDataSync) ? profile4 : null);
			if (val10 != null)
			{
				IPlayerProfileData source7 = ((ChainOfResponsibility<IPlayerProfileData>)(object)val10).source;
				PhotonPlayerDataSync val11 = (PhotonPlayerDataSync)(object)((source7 is PhotonPlayerDataSync) ? source7 : null);
				if (val11 != null)
				{
					IPlayerProfileData source8 = ((ChainOfResponsibility<IPlayerProfileData>)(object)val11).source;
					PlayerProfileData val12 = (PlayerProfileData)(object)((source8 is PlayerProfileData) ? source8 : null);
					if (val12 != null)
					{
						val12.Xp = 0L;
						val12.Rank = 0;
						val12.FavorRank = 0;
						val10.AddXp(0L);
						goto IL_040f;
					}
				}
			}
			BepinPlugin.log.LogError((object)"Could not reset player Level/xp in total reset");
			goto IL_040f;
			IL_040f:
			DebugInput.AchievementsReset();
			DebugInput.CloudProfileReset();
			if (GameSessionManager.ActiveSession != null)
			{
				ClientGame.Current.ModelEventBus.OnRankChanged.Publish();
			}
			((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.2.1";

		public const string PLUGIN_DESCRIPTION = "Allows user to reset their experience, levels, 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 = "NihilityShift/Reset_Progress";
	}
}