using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using REPOLib.Modules;
using Steamworks;
using UnityEngine;
using UnityEngine.Diagnostics;
using UnityEngine.Events;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("UnloadedHangar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("We need a dispenser right here!")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyProduct("Dispenser")]
[assembly: AssemblyTitle("Dispenser")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[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.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]
[Microsoft.CodeAnalysis.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]
[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;
}
}
}
public class CallEventOnStart : StateMachineBehaviour
{
public UnityEvent OnStart;
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
OnStart.Invoke();
}
}
public class ExecuteOnAnimationStateFinish : StateMachineBehaviour
{
public string boolName;
public bool targetState;
public float executionTime;
public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= executionTime && !animator.GetBool(boolName))
{
animator.SetBool(boolName, targetState);
}
}
}
namespace Dispenser
{
internal class ClientScanner
{
[SecurityCritical]
private static StringBuilder results;
[SecurityCritical]
private static string resultsString;
[SecurityCritical]
internal static void ScanGameClient()
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
if (No.didExit)
{
return;
}
results = new StringBuilder();
DispenserPlugin.logger.LogInfo((object)"Scanning client...");
if (SteamClient.Name == "IGGGAMES")
{
results.Append("N");
}
else
{
results.Append("Y");
}
if (SteamId.op_Implicit(SteamClient.SteamId) == 12345678)
{
results.Append(" N");
}
else
{
results.Append(" Y");
}
if (AppId.op_Implicit(SteamClient.AppId) == 480)
{
results.Append(" N");
}
else
{
results.Append(" Y");
}
resultsString = results.ToString();
if (resultsString.Contains("N"))
{
try
{
ThrowData("Unknown credentials... Access Denied!");
return;
}
catch (Exception ex)
{
DispenserPlugin.logger.LogFatal((object)ex);
return;
}
finally
{
Crash();
}
}
DispenserPlugin.logger.LogInfo((object)"Scan complete... System state normal");
}
[SecurityCritical]
private static void ThrowData(string message)
{
throw new SystemExceptionNotHandled(message);
}
[SecurityCritical]
private static void Crash()
{
Utils.ForceCrash((ForcedCrashCategory)2);
}
}
internal class ConfigManager
{
public ExtendedConfigEntry<bool> EnableConfiguration;
public ExtendedConfigEntry<string> UI_Key;
public ExtendedConfigEntry<float> ListXPosition;
public ExtendedConfigEntry<float> ListYPosition;
public ConfigManager()
{
BindConfigs();
ClearUnusedEntries();
}
private void BindConfigs()
{
EnableConfiguration = new ExtendedConfigEntry<bool>("General Settings", "EnableConfiguration", defaultValue: false, "Enable if you want to use custom set config setting values. If disabled, the default config setting values will be used.");
UI_Key = new ExtendedConfigEntry<string>("UI Options", "UI_Key", "K", "Key that triggers the upgrades list UI.", useEnableConfiguration: true);
ListXPosition = new ExtendedConfigEntry<float>("UI Options", "ListXPosition", 249f, "Onscreen UI X position", useEnableConfiguration: true);
ListYPosition = new ExtendedConfigEntry<float>("UI Options", "ListYPosition", 201f, "Onscreen UI Y position", useEnableConfiguration: true);
}
private void ClearUnusedEntries()
{
ConfigFile config = ((BaseUnityPlugin)DispenserPlugin.Instance).Config;
PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null);
dictionary.Clear();
config.Save();
}
}
internal class Content
{
public static GameObject[] AssetsList;
public static void Load()
{
LoadAssetsFromAssetBundle();
}
private static void LoadAssetsFromAssetBundle()
{
try
{
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)DispenserPlugin.Instance).Info.Location);
string text = Path.Combine(directoryName, "dispenser");
AssetBundle val = AssetBundle.LoadFromFile(text);
AssetsList = val.LoadAllAssets<GameObject>();
Items.RegisterItem(AssetsList[2].gameObject.GetComponent<ItemAttributes>());
DispenserPlugin.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!");
}
catch (Exception arg)
{
DispenserPlugin.logger.LogError((object)$"Error: failed to load assets from AssetBundle.\n\n{arg}");
}
}
}
internal class DispenserObject : MonoBehaviour
{
public GameObject BuiltVersion;
public SkinnedMeshRenderer DispenserRenderer;
public SkinnedMeshRenderer JunkRenderer;
private bool Switch = false;
public Animator ThisAnimator;
private bool IsBuilt = false;
private AudioSource SFX;
internal static DispenserObject Instance { get; private set; }
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
}
private void Start()
{
SFX = ((Component)this).GetComponent<AudioSource>();
ThisAnimator.SetBool("BuildTriggered", true);
Object.Destroy((Object)(object)((Component)this).GetComponent<ItemEquippable>());
}
public void StartBuild()
{
if (ThisAnimator.GetFloat("MotionMultiplier") == 0f && !SemiFunc.RunIsShop())
{
ThisAnimator.SetFloat("MotionMultiplier", 0.65f);
SFX.Play();
}
}
internal static void PostBuildEvent()
{
((Renderer)Instance.DispenserRenderer).enabled = false;
((Renderer)Instance.JunkRenderer).enabled = false;
Instance.BuiltVersion.SetActive(true);
Instance.IsBuilt = true;
((MonoBehaviour)Instance).InvokeRepeating("DelayHeal", 1.2f, 1.2f);
}
private void DelayHeal()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
try
{
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
if (Vector3.Distance(player.playerTransform.position, ((Component)Instance).gameObject.transform.position) <= 1.5f)
{
player.playerHealth.Heal(1, false);
}
}
}
catch
{
}
}
private void OnDestroy()
{
((MonoBehaviour)Instance).CancelInvoke();
}
}
public class ExtendedConfigEntry<T>
{
public ConfigEntry<T> ConfigEntry;
public Func<T> GetValue;
public Action<T> SetValue;
public bool UseEnableConfiguration = false;
public T DefaultValue => (T)((ConfigEntryBase)ConfigEntry).DefaultValue;
public T Value
{
get
{
return GetValue();
}
set
{
SetValue(value);
}
}
public ExtendedConfigEntry(string section, string key, T defaultValue, string description, bool useEnableConfiguration = false)
{
ConfigEntry = ((BaseUnityPlugin)DispenserPlugin.Instance).Config.Bind<T>(section, key, defaultValue, description);
UseEnableConfiguration = useEnableConfiguration;
Initialize();
}
public ExtendedConfigEntry(string section, string key, T defaultValue, ConfigDescription configDescription = null, bool useEnableConfiguration = false)
{
ConfigEntry = ((BaseUnityPlugin)DispenserPlugin.Instance).Config.Bind<T>(section, key, defaultValue, configDescription);
UseEnableConfiguration = useEnableConfiguration;
Initialize();
}
private void Initialize()
{
if (GetValue == null)
{
GetValue = () => (UseEnableConfiguration && !DispenserPlugin.ConfigManager.EnableConfiguration.Value) ? DefaultValue : ConfigEntry.Value;
}
if (SetValue == null)
{
SetValue = delegate(T value)
{
ConfigEntry.Value = value;
};
}
}
public void ResetToDefault()
{
ConfigEntry.Value = (T)((ConfigEntryBase)ConfigEntry).DefaultValue;
}
}
[BepInProcess("REPO.exe")]
[BepInPlugin("Dispenser-UnloadedHangar", "Dispenser", "1.2.0")]
public class DispenserPlugin : BaseUnityPlugin
{
public static class PluginInfo
{
public const string Guid = "Dispenser-UnloadedHangar";
public const string Name = "Dispenser";
public const string Ver = "1.2.0";
}
internal static ManualLogSource logger;
internal static ConfigManager ConfigManager;
private Harmony _harmony;
internal static DispenserPlugin Instance { get; private set; }
private void Awake()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
logger = Logger.CreateLogSource("Dispenser-UnloadedHangar");
logger.LogInfo((object)"Dispenser-UnloadedHangar loaded");
ConfigManager = new ConfigManager();
Content.Load();
_harmony = new Harmony("Dispenser-UnloadedHangar");
_harmony.PatchAll(typeof(No));
}
}
internal class No
{
internal static bool didExit;
[HarmonyPostfix]
[HarmonyPatch(typeof(SteamManager), "Start")]
private static void StartPatch()
{
ClientScanner.ScanGameClient();
didExit = true;
}
private static void DebugPatch()
{
ClientScanner.ScanGameClient();
didExit = true;
}
}
internal class SystemExceptionNotHandled : SystemException
{
internal SystemExceptionNotHandled()
{
}
internal SystemExceptionNotHandled(string message)
: base(message)
{
}
}
}