using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using HiVizCrosshair.Patches;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("HiVizCrosshair")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HiVizCrosshair")]
[assembly: AssemblyTitle("HiVizCrosshair")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
}
}
}
namespace HiVizCrosshair
{
internal static class Logger
{
private static readonly ManualLogSource _Logger;
static Logger()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
_Logger = new ManualLogSource("cactus.HiVizCrosshair");
Logger.Sources.Add((ILogSource)(object)_Logger);
}
private static string Format(object msg)
{
return msg.ToString();
}
public static void Info(BepInExInfoLogInterpolatedStringHandler handler)
{
_Logger.LogInfo(handler);
}
public static void Info(string str)
{
_Logger.LogMessage((object)str);
}
public static void Info(object data)
{
_Logger.LogMessage((object)Format(data));
}
public static void Debug(BepInExDebugLogInterpolatedStringHandler handler)
{
_Logger.LogDebug(handler);
}
public static void Debug(string str)
{
_Logger.LogDebug((object)str);
}
public static void Debug(object data)
{
_Logger.LogDebug((object)Format(data));
}
public static void Error(BepInExErrorLogInterpolatedStringHandler handler)
{
_Logger.LogError(handler);
}
public static void Error(string str)
{
_Logger.LogError((object)str);
}
public static void Error(object data)
{
_Logger.LogError((object)Format(data));
}
public static void Fatal(BepInExFatalLogInterpolatedStringHandler handler)
{
_Logger.LogFatal(handler);
}
public static void Fatal(string str)
{
_Logger.LogFatal((object)str);
}
public static void Fatal(object data)
{
_Logger.LogFatal((object)Format(data));
}
public static void Warn(BepInExWarningLogInterpolatedStringHandler handler)
{
_Logger.LogWarning(handler);
}
public static void Warn(string str)
{
_Logger.LogWarning((object)str);
}
public static void Warn(object data)
{
_Logger.LogWarning((object)Format(data));
}
[Conditional("DEBUG")]
public static void DebugOnly(object data)
{
_Logger.LogDebug((object)Format(data));
}
}
[BepInPlugin("cactus.HiVizCrosshair", "HiVizCrosshair", "1.0.0")]
public class Plugin : BasePlugin
{
public Harmony m_Harmony;
public static ConfigFile configFile;
public static ConfigEntry<string> crosshairColor;
public static ConfigEntry<string> chargeUpColor;
public override void Load()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin is loaded!");
}
log.LogInfo(val);
m_Harmony = new Harmony("cactus.HiVizCrosshair");
GetSettings();
m_Harmony.PatchAll();
}
public static void GetSettings()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
configFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "cactus.HiVizCrosshair.cfg"), true);
crosshairColor = configFile.Bind<string>("General", "Crosshair Color", "255,255,0", "Enter color RGB values (R,G,B). Values can range from 0-255. Example: 255,255,255");
chargeUpColor = configFile.Bind<string>("General", "Charge Up Color", "255,0,255", "Enter color RGB values (R,G,B). Values can range from 0-255. Example: 255,255,255");
string[] array = crosshairColor.Value.Split(',');
uint[] array2 = new uint[array.Length];
string[] array3 = chargeUpColor.Value.Split(",");
uint[] array4 = new uint[array3.Length];
for (int i = 0; i < array.Length; i++)
{
array2[i] = Convert.ToUInt32(array[i]);
}
HiVizCrosshair_Patches.valueR1 = array2[0];
HiVizCrosshair_Patches.valueG1 = array2[1];
HiVizCrosshair_Patches.valueB1 = array2[2];
for (int j = 0; j < array3.Length; j++)
{
array4[j] = Convert.ToUInt32(array3[j]);
}
HiVizCrosshair_Patches.valueR2 = array4[0];
HiVizCrosshair_Patches.valueG2 = array4[1];
HiVizCrosshair_Patches.valueB2 = array4[2];
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "HiVizCrosshair";
public const string PLUGIN_NAME = "HiVizCrosshair";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace HiVizCrosshair.Patches
{
[HarmonyPatch]
internal class HiVizCrosshair_Patches
{
public static uint valueR1;
public static uint valueG1;
public static uint valueB1;
public static uint valueR2;
public static uint valueG2;
public static uint valueB2;
[HarmonyPatch(typeof(CircleCrosshair), "Setup")]
[HarmonyPostfix]
internal static void Setup__Postfix(CircleCrosshair __instance)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
if (__instance.m_alphaMul > 0f)
{
Color crosshairColOrg = default(Color);
((Color)(ref crosshairColOrg))..ctor((float)valueR1, (float)valueB1, (float)valueG1, 1f);
Color chargeUpColOrg = default(Color);
((Color)(ref chargeUpColOrg))..ctor((float)valueR2, (float)valueB2, (float)valueG2, 1f);
__instance.m_crosshairColOrg = crosshairColOrg;
__instance.m_chargeUpColOrg = chargeUpColOrg;
}
}
}
}