using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using StrafTatViewModels.Config;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("StrafTatViewModels")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("StrafTatViewModels")]
[assembly: AssemblyTitle("StrafTatViewModels")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
}
}
}
namespace StrafTatViewModels
{
[BepInPlugin("malco.MinimalViewModels", "MinimalViewModels", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("malco.strafMusicPack");
public static Plugin instance;
public PluginConfig cfg { get; private set; }
private void Awake()
{
instance = this;
cfg = new PluginConfig(((BaseUnityPlugin)this).Config);
cfg.InitBindings();
harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Patched minimal view models");
}
}
}
namespace StrafTatViewModels.Patches
{
[HarmonyPatch(typeof(FirstPersonController))]
internal class FirstPersonControllerPatcher
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void StartPatcher(FirstPersonController __instance)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)((Component)__instance.playerCamera).transform.GetChild(2)).gameObject;
if (Plugin.instance.cfg.INVISIBLE_VIEWMODELS)
{
gameObject.SetActive(false);
return;
}
Transform transform = gameObject.transform;
transform.localPosition += new Vector3(Plugin.instance.cfg.VIEWMODEL_OFFSET_X, Plugin.instance.cfg.VIEWMODEL_OFFSET_Y, Plugin.instance.cfg.VIEWMODEL_OFFSET_Z);
gameObject.GetComponent<Camera>().fieldOfView = Plugin.instance.cfg.VIEWMODEL_FOV;
}
}
}
namespace StrafTatViewModels.Config
{
public class PluginConfig
{
private readonly ConfigFile configFile;
public float VIEWMODEL_OFFSET_X { get; set; }
public float VIEWMODEL_OFFSET_Y { get; set; }
public float VIEWMODEL_OFFSET_Z { get; set; }
public bool INVISIBLE_VIEWMODELS { get; set; }
public float VIEWMODEL_FOV { get; set; }
public PluginConfig(ConfigFile cfg)
{
configFile = cfg;
}
private T ConfigEntry<T>(string section, string key, T defaultVal, string description)
{
return configFile.Bind<T>(section, key, defaultVal, description).Value;
}
public void InitBindings()
{
VIEWMODEL_OFFSET_X = ConfigEntry("Viewmodel X Offset", "Offset", 0f, "Positive values will shift your held weapon left. Negative values will shift it right.");
VIEWMODEL_OFFSET_Y = ConfigEntry("Viewmodel Y Offset", "Offset", 0.4f, "Positive values will shift your held weapon down. Negative values will shift it up.");
VIEWMODEL_OFFSET_Z = ConfigEntry("Viewmodel Z Offset", "Offset", 0f, "Positive values will shift your held weapon back. Negative values will shift it forward.");
INVISIBLE_VIEWMODELS = ConfigEntry("Invisible Viewmodels", "Visibility", defaultVal: false, "Set this to true if you do not want to see your weapon at all.");
VIEWMODEL_FOV = ConfigEntry("Viewmodel FOV", "Visibility", 75f, "Set the FOV of your viewmodel. A higher value will result in a smaller weapon.");
}
}
}