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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[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("FasterNPC")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("FasterNPC")]
[assembly: AssemblyTitle("FasterNPC")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace FasterNPC
{
[BepInPlugin("xuthics.fasterNPC", "FasterNPC", "0.0.1")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(CheckoutEmployee), "UpdateEmployee")]
private class CheckoutEmployeeUpdateEmployeePatch
{
private static void Prefix(CheckoutEmployee __instance)
{
EmployeeSO employeeById = GameManager.Instance.GetEmployeeById(__instance.employeeId.Value);
if (!((Object)(object)employeeById != (Object)null))
{
return;
}
for (int i = 0; i < __instance.meshes.transform.childCount; i++)
{
Transform child = __instance.meshes.transform.GetChild(i);
if (employeeById.meshIndex == i && employeeById.animationSpeed != CheckoutEmployeeSpeed.Value)
{
employeeById.animationSpeed = CheckoutEmployeeSpeed.Value;
}
}
}
}
[HarmonyPatch(typeof(CleanerController), "Awake")]
private class CleanerControllerAwakePatch
{
private static void Postfix(CleanerController __instance)
{
__instance.agent.speed = CleanerEmployeeWalkSpeed.Value;
}
}
[HarmonyPatch(typeof(RestockerController), "Awake")]
private class RestockerControllerAwakePatch
{
private static void Postfix(CleanerController __instance)
{
__instance.agent.speed = CleanerEmployeeWalkSpeed.Value;
}
}
private static ConfigEntry<int> ConfigVersion;
private static ConfigEntry<float> CheckoutEmployeeSpeed;
private static ConfigEntry<float> CellarEmployeeWalkSpeed;
private static ConfigEntry<float> CleanerEmployeeWalkSpeed;
internal static ManualLogSource Logger;
private Harmony m_harmony = new Harmony("xuthics.fasterNPC");
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin FasterNPC v0.0.1 is loaded!");
m_harmony.PatchAll();
ConfigVersion = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ConfigVersion", 1, "Config version. Do not change this value.");
if (ConfigVersion.Value == 1)
{
CheckoutEmployeeSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("EmployeeSpeeds", "CheckoutEmployeeSpeed", 5f, "Speed of Checkout Employee.");
CellarEmployeeWalkSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("EmployeeSpeeds", "CellarEmployeeWalkSpeed", 5f, "Speed of Cellar Employee.");
CleanerEmployeeWalkSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("EmployeeSpeeds", "CleanerEmployeeWalkSpeed", 5f, "Speed of Cleaner Employee.");
}
else
{
Logger.LogWarning((object)"Config version is outdated. Resetting config.");
ConfigVersion.Value = 1;
CheckoutEmployeeSpeed.Value = 5f;
CellarEmployeeWalkSpeed.Value = 5f;
CleanerEmployeeWalkSpeed.Value = 5f;
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "FasterNPC";
public const string PLUGIN_NAME = "FasterNPC";
public const string PLUGIN_VERSION = "0.0.1";
}
}