Decompiled source of CrazyFox v1.0.2

CrazyFox.MelonLoaderMod.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using CrazyFox.MelonLoaderMod;
using Il2Cpp;
using Il2CppAssets.Scripts.Saves___Serialization.Progression.Achievements;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "CrazyFox", "1.0.2", "Slimaeus", null)]
[assembly: MelonGame("Ved", "Megabonk")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CrazyFox.MelonLoaderMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: AssemblyInformationalVersion("1.0.0+9e2823162fdbb07c401ab7bb32c03ce3d1a931b5")]
[assembly: AssemblyProduct("CrazyFox.MelonLoaderMod")]
[assembly: AssemblyTitle("CrazyFox.MelonLoaderMod")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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 CrazyFox.MelonLoaderMod
{
	public class Core : MelonMod
	{
		private const string _mainMenuSceneName = "MainMenu";

		public override void OnSceneWasInitialized(int buildIndex, string sceneName)
		{
			if (sceneName != "MainMenu")
			{
				return;
			}
			GameObject val = GameObject.Find("B_Play");
			if (val != null)
			{
				Button component = val.GetComponent<Button>();
				if (component != null)
				{
					((UnityEvent)component.onClick).AddListener(UnityAction.op_Implicit((Action)UpdateFox));
				}
			}
		}

		private void UpdateFox()
		{
			List<WeaponData> list = new List<WeaponData>();
			List<PassiveData> list2 = new List<PassiveData>();
			Enumerator<CharacterData> enumerator = DataManager.Instance.unsortedCharacterData.GetEnumerator();
			MyAchievement val = default(MyAchievement);
			while (enumerator.MoveNext())
			{
				CharacterData current = enumerator.Current;
				list2.Add(current.passive);
				WeaponData weapon = current.weapon;
				MyAchievement unlockRequirement = ((UnlockableBase)weapon).GetUnlockRequirement();
				string text = ((unlockRequirement != null) ? ((Object)unlockRequirement).name : null);
				if (text == null || string.IsNullOrEmpty(text))
				{
					list.Add(current.weapon);
				}
				else if (!DataManager.Instance.achievementsData.TryGetValue(text, ref val))
				{
					list.Add(current.weapon);
				}
				else if (val.IsUnlocked())
				{
					list.Add(current.weapon);
				}
			}
			CharacterData val2 = DataManager.Instance.characterData[(ECharacter)0];
			val2.weapon = list[Random.Shared.Next(0, list.Count)];
			val2.passive = list2[Random.Shared.Next(0, list2.Count)];
		}
	}
}