Decompiled source of FasterDealers v3.0.0

FasterDealers.dll

Decompiled 2 months ago
using System;
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 FasterDealers;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using S1API.Entities;
using S1API.Entities.NPCs.Docks;
using S1API.Entities.NPCs.Downtown;
using S1API.Entities.NPCs.Northtown;
using S1API.Entities.NPCs.Suburbia;
using S1API.Entities.NPCs.Uptown;
using S1API.Entities.NPCs.Westville;
using S1API.Lifecycle;
using S1API.Logging;

[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), "FasterDealers", "3.0.0", "Riccaforte", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: MelonAuthorColor(1, 68, 2, 152)]
[assembly: MelonColor(1, 68, 2, 152)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FasterDealers")]
[assembly: AssemblyConfiguration("CrossCompat")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+04bc930fb413788adc98b54953e94b43e9552fd1")]
[assembly: AssemblyProduct("FasterDealers")]
[assembly: AssemblyTitle("FasterDealers")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 FasterDealers
{
	public class Core : MelonMod
	{
		private static MelonPreferences_Category? _fasterDealersCategory;

		private static MelonPreferences_Entry<bool>? _modEnabled;

		private static MelonPreferences_Entry<float>? _speedMultiplier;

		private Log _logger = new Log("FasterDealers");

		public static Core? Instance { get; private set; }

		public override void OnInitializeMelon()
		{
			Instance = this;
			LoadConfig();
			if (!_modEnabled.Value)
			{
				_logger.Msg("FasterDealers is disabled, skipping.");
				return;
			}
			GameLifecycle.OnLoadComplete += ApplyDealerSpeedMultiplier;
			_logger.Msg("FasterDealers initialized and config loaded. Waiting for Main scene to load.");
		}

		private void ApplyDealerSpeedMultiplier()
		{
			NPC[] array = (NPC[])(object)new NPC[6]
			{
				NPC.Get<BenjiColeman>(),
				NPC.Get<MollyPresley>(),
				NPC.Get<BradCrosby>(),
				NPC.Get<JaneLucero>(),
				NPC.Get<WeiLong>(),
				NPC.Get<LeoRivers>()
			};
			try
			{
				NPC[] array2 = array;
				foreach (NPC val in array2)
				{
					if (val != null)
					{
						val.Movement.SpeedMultiplier = _speedMultiplier.Value;
					}
				}
				_logger.Msg("Dealer speed multiplier applied successfully.");
			}
			catch
			{
				_logger.Msg("Failed to apply dealer speed multiplier.");
			}
		}

		private void LoadConfig()
		{
			_fasterDealersCategory = MelonPreferences.CreateCategory("FasterDealers");
			_modEnabled = _fasterDealersCategory.CreateEntry<bool>("Enabled", true, "Enable Faster Dealers", "Enables or disables Faster Dealers mod.", false, false, (ValueValidator)null, (string)null);
			_speedMultiplier = _fasterDealersCategory.CreateEntry<float>("SpeedMultiplier", 3f, "Dealer Speed Multiplier", "Speed multiplier for all dealers as a float value. Default is 3.0f. Multiplies base dealer speed by this amount.", false, false, (ValueValidator)null, (string)null);
			_fasterDealersCategory.SaveToFile(false);
		}
	}
}
namespace FasterDealers.Utils
{
	public static class Constants
	{
		public static class Game
		{
			public const string GAME_STUDIO = "TVGS";

			public const string GAME_NAME = "Schedule I";
		}

		public const string MOD_NAME = "FasterDealers";

		public const string MOD_VERSION = "3.0.0";

		public const string MOD_AUTHOR = "Riccaforte";

		public const string MOD_DESCRIPTION = "A simple mod to make all drug dealer NPCs faster! Speed multiplier can be configured to your desired speed.";

		public const string PREFERENCES_CATEGORY = "FasterDealers";
	}
}