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 Unity.Netcode;
[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("clearershotguntip")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("clearershotguntip")]
[assembly: AssemblyTitle("clearershotguntip")]
[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;
}
}
}
[BepInPlugin("com.atomic.shotgunsafety", "Shotgun Safety", "1.1.0")]
public class ShotgunPatch : BaseUnityPlugin
{
internal ConfigEntry<bool> colorizeTextConfig;
internal ConfigEntry<bool> colorizeFullTextConfig;
internal ConfigEntry<string> colorOnConfig;
internal ConfigEntry<string> colorOffConfig;
public static ShotgunPatch Instance { get; private set; }
private void Awake()
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Expected O, but got Unknown
Instance = this;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Clearer Shotgun Tooltip is loaded!");
string text = "Text & Text Color";
colorizeTextConfig = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Colorize Text", false, "Enable or disable colorized text for shotgun safety.");
colorizeFullTextConfig = ((BaseUnityPlugin)this).Config.Bind<bool>(text, "Colorize Full-Text", false, "Enable or disable coloring the entire text instead of just the 'on' or 'off' word.");
colorOnConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text, "On-Text Color", "green", "The color for the 'on' text. Accepted colors: black, blue, green, red, white, yellow, any other colors you think may work. NOTE: Spell it exactly, it also does NOT need a restart when changed!");
colorOffConfig = ((BaseUnityPlugin)this).Config.Bind<string>(text, "Off-Text Color", "red", "The color for the 'off' text. Accepted colors: black, blue, green, red, white, yellow, any other colors you think may work. NOTE: Spell it exactly, it also does NOT need a restart when changed!");
Harmony val = new Harmony("com.atomic.shotgunsafety");
val.PatchAll();
}
}
[HarmonyPatch(typeof(ShotgunItem), "SetControlTipsForItem")]
public class ShotgunItem_SetControlTipsForItem_Patch
{
private static void Postfix(ShotgunItem __instance)
{
string[] toolTips = ((GrabbableObject)__instance).itemProperties.toolTips;
if (__instance.safetyOn)
{
toolTips[2] = ((!ShotgunPatch.Instance.colorizeTextConfig.Value) ? "The safety is on: [Q]" : (ShotgunPatch.Instance.colorizeFullTextConfig.Value ? ("<color=" + ShotgunPatch.Instance.colorOnConfig.Value + ">The safety is on: [Q]</color>") : ("The safety is<color=white></color> <color=" + ShotgunPatch.Instance.colorOnConfig.Value + ">on:</color> <color=white>[Q]</color>")));
}
else
{
toolTips[2] = ((!ShotgunPatch.Instance.colorizeTextConfig.Value) ? "The safety is off: [Q]" : (ShotgunPatch.Instance.colorizeFullTextConfig.Value ? ("<color=" + ShotgunPatch.Instance.colorOffConfig.Value + ">The safety is off: [Q]</color>") : ("The safety is<color=white></color> <color=" + ShotgunPatch.Instance.colorOffConfig.Value + ">off:</color> <color=white>[Q]</color>")));
}
HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, ((GrabbableObject)__instance).itemProperties);
}
}
[HarmonyPatch(typeof(ShotgunItem), "SetSafetyControlTip")]
public class ShotgunItem_SetSafetyControlTip_Patch
{
private static void Postfix(ShotgunItem __instance)
{
string text = (__instance.safetyOn ? ((!ShotgunPatch.Instance.colorizeTextConfig.Value) ? "The safety is on: [Q]" : (ShotgunPatch.Instance.colorizeFullTextConfig.Value ? ("<color=" + ShotgunPatch.Instance.colorOnConfig.Value + ">The safety is on: [Q]</color>") : ("The safety is<color=white></color> <color=" + ShotgunPatch.Instance.colorOnConfig.Value + ">on:</color> <color=white>[Q]</color>"))) : ((!ShotgunPatch.Instance.colorizeTextConfig.Value) ? "The safety is off: [Q]" : (ShotgunPatch.Instance.colorizeFullTextConfig.Value ? ("<color=" + ShotgunPatch.Instance.colorOffConfig.Value + ">The safety is off: [Q]</color>") : ("The safety is<color=white></color> <color=" + ShotgunPatch.Instance.colorOffConfig.Value + ">off:</color> <color=white>[Q]</color>"))));
if (((NetworkBehaviour)__instance).IsOwner)
{
HUDManager.Instance.ChangeControlTip(3, text, false);
}
}
}