using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using InsanityDisplay.Config;
using InsanityDisplay.ModCompatibility;
using InsanityDisplay.UI;
using LCVR;
using LCVR.Player;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Adds an insanity meter to the hud in vanilla style")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("InsanityDisplay")]
[assembly: AssemblyCopyright("Confusified © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3df3c939-915d-40af-83e9-b834f47be026")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace InsanityDisplay
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Confusified.InsanityDisplay", "InsanityDisplay", "1.2.2")]
public class Initialise : BaseUnityPlugin
{
private const string modGUID = "com.Confusified.InsanityDisplay";
private const string modName = "InsanityDisplay";
private const string modVersion = "1.2.2";
public static readonly string configLocation = Utility.CombinePaths(new string[1] { Paths.ConfigPath + "\\" + "com.Confusified.InsanityDisplay".Substring(4).Replace(".", "\\") });
public static ConfigFile modConfig = new ConfigFile(configLocation + ".cfg", false);
private readonly Harmony _Harmony = new Harmony("com.Confusified.InsanityDisplay");
public static ManualLogSource modLogger;
public void Awake()
{
modLogger = Logger.CreateLogSource("com.Confusified.InsanityDisplay");
modLogger = ((BaseUnityPlugin)this).Logger;
ConfigHandler.InitialiseConfig();
CheckForModCompatibility();
_Harmony.PatchAll(Assembly.GetExecutingAssembly());
modLogger.LogInfo((object)"InsanityDisplay 1.2.2 loaded");
}
private static void CheckForModCompatibility()
{
foreach (KeyValuePair<string, Action> item in new Dictionary<string, Action>
{
{
"LCCrouchHUD",
delegate
{
CompatibilityList.ModInstalled.LCCrouchHUD = true;
}
},
{
"me.eladnlg.customhud",
delegate
{
CompatibilityList.ModInstalled.EladsHUD = true;
}
},
{
"com.an0n.patch",
delegate
{
CompatibilityList.ModInstalled.An0nPatches = true;
}
},
{
"ShaosilGaming.GeneralImprovements",
delegate
{
CompatibilityList.ModInstalled.GeneralImprovements = true;
}
},
{
"Matsuura.HealthMetrics",
delegate
{
CompatibilityList.ModInstalled.HealthMetrics = true;
}
},
{
"Matsuura.TestAccount666.DamageMetrics",
delegate
{
CompatibilityList.ModInstalled.DamageMetrics = true;
}
},
{
"BMX.LobbyCompatibility",
delegate
{
LobbyCompatibilityPatch.UseLobbyCompatibility("com.Confusified.InsanityDisplay", "1.2.2");
}
},
{
"ainavt.lc.lethalconfig",
delegate
{
LethalConfigPatch.SetLethalConfigEntries();
}
},
{
"io.daxcess.lcvr",
delegate
{
CompatibilityList.ModInstalled.LethalCompanyVR = true;
}
},
{
"InfectedCompany.InfectedCompany",
delegate
{
CompatibilityList.ModInstalled.InfectedCompany = true;
}
}
})
{
if (Chainloader.PluginInfos.ContainsKey(item.Key))
{
item.Value();
modLogger.LogDebug((object)("Found " + item.Key));
}
}
}
}
}
namespace InsanityDisplay.UI
{
public class IconHandler
{
public static Vector3 selfLocalPositionOffset = new Vector3(-6.8f, 4f, 0f);
public static Vector3 selfLocalPosition = Vector3.zero;
public static void AdjustIcon()
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB obj = GameNetworkManager.Instance?.localPlayerController;
object vanillaSprintMeter;
if (obj == null)
{
vanillaSprintMeter = null;
}
else
{
Image sprintMeterUI = obj.sprintMeterUI;
vanillaSprintMeter = ((sprintMeterUI != null) ? ((Component)sprintMeterUI).gameObject : null);
}
MeterHandler.vanillaSprintMeter = (GameObject)vanillaSprintMeter;
if (!Object.op_Implicit((Object)(object)MeterHandler.vanillaSprintMeter))
{
return;
}
GameObject topLeftCornerHUD = MeterHandler.TopLeftCornerHUD;
object obj2;
if (topLeftCornerHUD == null)
{
obj2 = null;
}
else
{
Transform transform = topLeftCornerHUD.transform;
if (transform == null)
{
obj2 = null;
}
else
{
Transform obj3 = transform.Find("Self");
obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null);
}
}
GameObject val = (GameObject)obj2;
HUDManager instance = HUDManager.Instance;
object obj4;
if (instance == null)
{
obj4 = null;
}
else
{
CanvasGroup selfRedCanvasGroup = instance.selfRedCanvasGroup;
obj4 = ((selfRedCanvasGroup != null) ? ((Component)selfRedCanvasGroup).gameObject : null);
}
GameObject val2 = (GameObject)obj4;
if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val2))
{
return;
}
selfLocalPosition = ((selfLocalPosition == Vector3.zero) ? val.transform.localPosition : selfLocalPosition);
if (ConfigSettings.ModEnabled.Value && val.transform.localPosition != selfLocalPosition + selfLocalPositionOffset)
{
Image insanityImage = MeterHandler.InsanityImage;
if (insanityImage != null && insanityImage.fillAmount > 0.2976f)
{
goto IL_0114;
}
}
Vector3 localPosition;
if (!ConfigSettings.iconAlwaysCentered.Value)
{
if ((!ConfigSettings.iconAlwaysCentered.Value && val.transform.localPosition != selfLocalPosition) || (!ConfigSettings.ModEnabled.Value && !ConfigSettings.iconAlwaysCentered.Value))
{
Image insanityImage2 = MeterHandler.InsanityImage;
if (insanityImage2 != null && insanityImage2.fillAmount <= 0.2976f)
{
Transform transform2 = val2.transform;
localPosition = (val.transform.localPosition = Vector3.Lerp(val.transform.localPosition, selfLocalPosition, MeterHandler.InsanityImage.fillAmount));
transform2.localPosition = localPosition;
}
}
return;
}
goto IL_0114;
IL_0114:
Transform transform3 = val2.transform;
localPosition = (val.transform.localPosition = Vector3.Lerp(val.transform.localPosition, selfLocalPosition + selfLocalPositionOffset, MeterHandler.InsanityImage.fillAmount));
transform3.localPosition = localPosition;
}
}
public class MeterHandler
{
public static Vector3 localPositionOffset = new Vector3(-3.4f, 3.7f, 0f);
private static Vector3 localScale = new Vector3(1.4f, 1.4f, 1.4f);
public const float accurate_MinValue = 0.2976f;
public const float accurate_MaxValue = 0.9101f;
private static float lastInsanityValue;
private static Color oldColorValue;
public static GameObject InsanityMeter;
public static Image InsanityImage;
public static GameObject TopLeftCornerHUD;
private static PlayerControllerB localPlayer;
public static GameObject vanillaSprintMeter;
public static void CreateInScene()
{
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)InsanityMeter != (Object)null))
{
localPlayer = GameNetworkManager.Instance?.localPlayerController;
PlayerControllerB obj = localPlayer;
object obj2;
if (obj == null)
{
obj2 = null;
}
else
{
Image sprintMeterUI = obj.sprintMeterUI;
obj2 = ((sprintMeterUI != null) ? ((Component)sprintMeterUI).gameObject : null);
}
vanillaSprintMeter = (GameObject)obj2;
InsanityMeter = Object.Instantiate<GameObject>(vanillaSprintMeter);
((Object)InsanityMeter).name = "InsanityMeter";
GameObject obj3 = vanillaSprintMeter;
TopLeftCornerHUD = ((obj3 != null) ? ((Component)obj3.transform.parent).gameObject : null);
Transform transform = InsanityMeter.transform;
transform.SetParent(TopLeftCornerHUD.transform);
transform.SetAsFirstSibling();
transform.localPosition = vanillaSprintMeter.transform.localPosition + localPositionOffset;
transform.localScale = localScale;
GameObject insanityMeter = InsanityMeter;
InsanityImage = ((insanityMeter != null) ? insanityMeter.GetComponent<Image>() : null);
UpdateMeter(InsanityImage);
InsanityMeter.SetActive(ConfigSettings.ModEnabled.Value);
IconHandler.AdjustIcon();
EnableCompatibilities(isMeterCreation: true);
}
}
public static void EnableCompatibilities(bool isMeterCreation = false, bool hasCustomBehaviour = false)
{
if (isMeterCreation)
{
Initialise.modLogger.LogInfo((object)"Enabling compatibilities");
}
EnableCompatibility(CompatibilityList.ModInstalled.LCCrouchHUD, ConfigSettings.Compat.LCCrouchHUD.Value, LCCrouchHUDCompatibility.MoveCrouchHUD, hasCustomBehaviour);
EnableCompatibility(CompatibilityList.ModInstalled.EladsHUD, ConfigSettings.Compat.EladsHUD.Value && (!CompatibilityList.ModInstalled.LethalCompanyVR || (CompatibilityList.ModInstalled.LethalCompanyVR && !ConfigSettings.Compat.LethalCompanyVR.Value)), delegate
{
if (!Object.op_Implicit((Object)(object)EladsHUDCompatibility.InsanityInfo) && Object.op_Implicit((Object)(object)InsanityMeter))
{
Object.Destroy((Object)(object)InsanityMeter);
InsanityMeter = null;
}
EladsHUDCompatibility.EditEladsHUD();
}, hasCustomBehaviour);
EnableCompatibility(CompatibilityList.ModInstalled.An0nPatches, ConfigSettings.Compat.An0nPatches.Value, An0nPatchesCompatibility.MoveTextHUD, hasCustomBehaviour);
EnableCompatibility(CompatibilityList.ModInstalled.GeneralImprovements, ConfigSettings.Compat.GeneralImprovements.Value, GeneralImprovementsCompatibility.MoveHPHud, hasCustomBehaviour);
EnableCompatibility(CompatibilityList.ModInstalled.HealthMetrics, ConfigSettings.Compat.HealthMetrics.Value, delegate
{
HealthMetrics_DamageMetricsCompatibility.MoveDisplay(usingHealthMetrics: true);
}, hasCustomBehaviour);
EnableCompatibility(CompatibilityList.ModInstalled.DamageMetrics, ConfigSettings.Compat.DamageMetrics.Value, delegate
{
HealthMetrics_DamageMetricsCompatibility.MoveDisplay(usingHealthMetrics: false);
}, hasCustomBehaviour);
EnableCompatibility(CompatibilityList.ModInstalled.LethalCompanyVR, ConfigSettings.Compat.LethalCompanyVR.Value, delegate
{
CoroutineHelper.Start(LethalCompanyVRCompatibility.EnableVRCompatibility());
});
EnableCompatibility(CompatibilityList.ModInstalled.InfectedCompany, ConfigSettings.Compat.InfectedCompany.Value, null, hasCustomBehaviour);
}
private static void EnableCompatibility(bool condition1, bool condition2, Action compatibilityAction = null, bool customBehaviour = false)
{
if ((condition1 && condition2) || (condition1 && customBehaviour))
{
compatibilityAction?.Invoke();
}
}
public static void UpdateMeter(Image imageMeter = null, TextMeshProUGUI textMeter = null)
{
if (!ConfigSettings.ModEnabled.Value || ((Object)(object)imageMeter == (Object)null && (Object)(object)textMeter == (Object)null))
{
return;
}
bool value = ConfigSettings.enableReverse.Value;
bool value2 = ConfigSettings.alwaysFull.Value;
bool value3 = ConfigSettings.useAccurateDisplay.Value;
bool gameHasStarted = GameNetworkManager.Instance.gameHasStarted;
localPlayer = GameNetworkManager.Instance.localPlayerController;
if ((Object)(object)localPlayer == (Object)null || (!value3 && !value2 && !value && !gameHasStarted && (((Object)(object)imageMeter != (Object)null && imageMeter.fillAmount != 0f) || ((Object)(object)textMeter != (Object)null && ((TMP_Text)textMeter).text != "0%"))))
{
SetValueForCorrectType(imageMeter, textMeter, 0f);
return;
}
if (value2 || (!value3 && value && !gameHasStarted && (((Object)(object)imageMeter != (Object)null && imageMeter.fillAmount != 1f) || ((Object)(object)textMeter != (Object)null && ((TMP_Text)textMeter).text != "100%"))))
{
SetValueForCorrectType(imageMeter, textMeter, 1f);
return;
}
float num = 0f;
bool flag = CompatibilityList.ModInstalled.EladsHUD && ConfigSettings.Compat.EladsHUD.Value;
if (ConfigSettings.Compat.InfectedCompany.Value && CompatibilityList.ModInstalled.InfectedCompany && (Object)(object)InfectedCompanyCompatibility.modInsanitySlider != (Object)null)
{
float num2 = InfectedCompanyCompatibility.modInsanitySlider.value / InfectedCompanyCompatibility.modInsanitySlider.maxValue;
if (!value3 || flag)
{
num = (value ? (1f - num2) : num2);
}
else
{
num = num2 * 0.61249995f;
num = (value ? (0.9101f - num) : (num + 0.2976f));
}
SetValueForCorrectType(imageMeter, textMeter, num);
}
else
{
float num3 = localPlayer.insanityLevel / localPlayer.maxInsanityLevel;
if (value3 && (!CompatibilityList.ModInstalled.EladsHUD || !flag))
{
num = num3 * 0.61249995f;
num = (value ? (0.9101f - num) : (num + 0.2976f));
}
else
{
num = (value ? (1f - num3) : num3);
}
SetValueForCorrectType(imageMeter, textMeter, num);
}
}
private static void SetValueForCorrectType(Image imageMeter, TextMeshProUGUI textMeter, float insanityValue)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
Color meterColor = default(Color);
ColorUtility.TryParseHtmlString("#" + ConfigSettings.MeterColor.Value, ref meterColor);
if ((Object)(object)textMeter != (Object)null)
{
string text = $"{Math.Floor(insanityValue * 100f)}%";
if (((TMP_Text)textMeter).text != text)
{
((TMP_Text)textMeter).text = text;
}
}
UpdateColor<TextMeshProUGUI>(textMeter, meterColor, insanityValue);
if ((Object)(object)imageMeter != (Object)null && imageMeter.fillAmount != insanityValue)
{
imageMeter.fillAmount = insanityValue;
}
UpdateColor<Image>(imageMeter, meterColor, insanityValue);
if (lastInsanityValue != insanityValue)
{
lastInsanityValue = insanityValue;
}
oldColorValue = meterColor;
}
private static void UpdateColor<T>(T meter, Color meterColor, float insanityValue) where T : Graphic
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)meter == (Object)null) && !(((Graphic)meter).color == meterColor))
{
((Graphic)meter).color = meterColor;
}
}
}
}
namespace InsanityDisplay.Patches
{
[HarmonyPatch(typeof(HUDManager))]
public class HUDManagerPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPostfix()
{
CoroutineHelper.Start(CreateInsanityMeter());
}
private static IEnumerator CreateInsanityMeter()
{
yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)GameNetworkManager.Instance.localPlayerController?.sprintMeterUI != (Object)null));
MeterHandler.CreateInScene();
}
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void SetMeterValues()
{
if ((Object)(object)MeterHandler.InsanityMeter != (Object)null && MeterHandler.InsanityMeter.activeSelf != ConfigSettings.ModEnabled.Value)
{
MeterHandler.InsanityMeter.SetActive(ConfigSettings.ModEnabled.Value);
}
if (CompatibilityList.ModInstalled.InfectedCompany && (Object)(object)InfectedCompanyCompatibility.modInsanitySlider != (Object)null)
{
bool flag = !ConfigSettings.ModEnabled.Value || ConfigSettings.alwaysFull.Value || !ConfigSettings.Compat.InfectedCompany.Value || (CompatibilityList.ModInstalled.EladsHUD && !ConfigSettings.Compat.EladsHUD.Value && ConfigSettings.Compat.InfectedCompany.Value);
GameObject gameObject = ((Component)InfectedCompanyCompatibility.modInsanitySlider).gameObject;
if (gameObject.activeSelf != flag)
{
gameObject.SetActive(flag);
}
}
MeterHandler.UpdateMeter(MeterHandler.InsanityImage, EladsHUDCompatibility.InsanityInfo);
IconHandler.AdjustIcon();
MeterHandler.EnableCompatibilities(isMeterCreation: false, hasCustomBehaviour: true);
}
}
[HarmonyPatch(typeof(StartOfRound))]
public class StartOfRoundPatch
{
[HarmonyPatch("StartGame")]
[HarmonyPostfix]
public static void RoundStartedPostfix(StartOfRound __instance)
{
if (CompatibilityList.ModInstalled.InfectedCompany)
{
CoroutineHelper.Start(InfectedCompanyCompatibility.ConvertInsanity());
}
}
[HarmonyPatch("EndOfGame")]
[HarmonyPostfix]
public static void EndOfRoundPostfix(StartOfRound __instance)
{
SetModMeterToNull();
}
[HarmonyPatch("OnDestroy")]
[HarmonyPostfix]
public static void LeftLobbbyPostfix(StartOfRound __instance)
{
SetModMeterToNull();
}
private static void SetModMeterToNull()
{
if (CompatibilityList.ModInstalled.InfectedCompany && (Object)(object)InfectedCompanyCompatibility.modInsanitySlider != (Object)null)
{
InfectedCompanyCompatibility.modInsanitySlider = null;
}
}
}
}
namespace InsanityDisplay.ModCompatibility
{
public class InfectedCompanyCompatibility
{
public static Slider modInsanitySlider;
public static IEnumerator ConvertInsanity()
{
yield return (object)new WaitUntil((Func<bool>)(() => RoundManager.Instance.currentLevel.spawnEnemiesAndScrap));
yield return (object)new WaitForSeconds(5f);
if (!((TMP_Text)HUDManager.Instance.globalNotificationText).text.Contains("You are infected"))
{
yield break;
}
while ((Object)(object)modInsanitySlider == (Object)null)
{
GameObject gameObject = GameObject.Find("UI_CustomPlayerHUD(Clone)/InfectedPlayerHUD/InsanityMeter").gameObject;
if (gameObject != null)
{
gameObject.TryGetComponent<Slider>(ref modInsanitySlider);
}
if ((Object)(object)modInsanitySlider != (Object)null)
{
Initialise.modLogger.LogDebug((object)"found");
break;
}
yield return null;
}
}
}
public class LethalCompanyVRCompatibility
{
public static IEnumerator EnableVRCompatibility()
{
if (VRSession.InVR)
{
Transform meterTransform = MeterHandler.InsanityMeter.transform;
meterTransform.SetParent(MeterHandler.vanillaSprintMeter.transform, false);
yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)VRSession.Instance != (Object)null));
Transform parent = meterTransform.parent;
meterTransform.SetParent(parent.parent, false);
meterTransform.localScale = parent.localScale * 0.86f;
meterTransform.rotation = parent.rotation;
Transform transform = ((Component)meterTransform.parent.Find("SelfRed")).gameObject.transform;
Transform transform2 = ((Component)meterTransform.parent.Find("Self")).gameObject.transform;
Vector3 localPosition = (transform2.localPosition += new Vector3(0f, IconHandler.selfLocalPositionOffset.y / 2f, IconHandler.selfLocalPositionOffset.x / 2f));
transform.localPosition = localPosition;
meterTransform.localPosition = parent.localPosition + new Vector3(0f, MeterHandler.localPositionOffset.y, MeterHandler.localPositionOffset.x);
if (!Plugin.Config.DisableArmHUD.Value)
{
meterTransform.localPosition -= new Vector3(0f, MeterHandler.localPositionOffset.y / 2f, MeterHandler.localPositionOffset.x);
Transform transform3 = ((Component)meterTransform.parent.Find("SelfRed")).gameObject.transform;
Transform transform4 = ((Component)meterTransform.parent.Find("Self")).gameObject.transform;
localPosition = (transform4.localPosition -= new Vector3(0f, IconHandler.selfLocalPositionOffset.y / 4f, IconHandler.selfLocalPositionOffset.x / 4f));
transform3.localPosition = localPosition;
}
meterTransform.SetParent(parent, true);
}
}
}
public class LethalConfigPatch
{
public static void SetLethalConfigEntries()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Expected O, but got Unknown
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Expected O, but got Unknown
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Expected O, but got Unknown
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Expected O, but got Unknown
BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(ConfigSettings.ModEnabled, false);
TextInputFieldConfigItem val2 = new TextInputFieldConfigItem(ConfigSettings.MeterColor, new TextInputFieldOptions
{
CharacterLimit = 9,
RequiresRestart = false
});
BoolCheckBoxConfigItem val3 = new BoolCheckBoxConfigItem(ConfigSettings.useAccurateDisplay, false);
BoolCheckBoxConfigItem val4 = new BoolCheckBoxConfigItem(ConfigSettings.enableReverse, false);
BoolCheckBoxConfigItem val5 = new BoolCheckBoxConfigItem(ConfigSettings.alwaysFull, false);
BoolCheckBoxConfigItem val6 = new BoolCheckBoxConfigItem(ConfigSettings.iconAlwaysCentered, false);
BoolCheckBoxConfigItem val7 = new BoolCheckBoxConfigItem(ConfigSettings.Compat.LCCrouchHUD, false);
BoolCheckBoxConfigItem val8 = new BoolCheckBoxConfigItem(ConfigSettings.Compat.An0nPatches, false);
BoolCheckBoxConfigItem val9 = new BoolCheckBoxConfigItem(ConfigSettings.Compat.EladsHUD, false);
BoolCheckBoxConfigItem val10 = new BoolCheckBoxConfigItem(ConfigSettings.Compat.GeneralImprovements, false);
BoolCheckBoxConfigItem val11 = new BoolCheckBoxConfigItem(ConfigSettings.Compat.HealthMetrics, false);
BoolCheckBoxConfigItem val12 = new BoolCheckBoxConfigItem(ConfigSettings.Compat.DamageMetrics, false);
BoolCheckBoxConfigItem val13 = new BoolCheckBoxConfigItem(ConfigSettings.Compat.LethalCompanyVR, true);
BoolCheckBoxConfigItem val14 = new BoolCheckBoxConfigItem(ConfigSettings.Compat.InfectedCompany, false);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val5);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val7);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val9);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val10);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val11);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val12);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val13);
LethalConfigManager.AddConfigItem((BaseConfigItem)val14);
LethalConfigManager.SetModDescription("Adds an insanity meter to the hud in vanilla style");
Initialise.modLogger.LogDebug((object)"Added entries to LethalConfig");
}
}
public class LobbyCompatibilityPatch
{
public static void UseLobbyCompatibility(string modGUID, string modVersion)
{
PluginHelper.RegisterPlugin(modGUID, Version.Parse(modVersion), (CompatibilityLevel)0, (VersionStrictness)0);
}
}
public class CompatibilityList
{
public class ModGUIDS
{
public const string LCCrouchHUD = "LCCrouchHUD";
public const string EladsHUD = "me.eladnlg.customhud";
public const string An0nPatches = "com.an0n.patch";
public const string GeneralImprovements = "ShaosilGaming.GeneralImprovements";
public const string HealthMetrics = "Matsuura.HealthMetrics";
public const string DamageMetrics = "Matsuura.TestAccount666.DamageMetrics";
public const string LobbyCompatibility = "BMX.LobbyCompatibility";
public const string LethalConfig = "ainavt.lc.lethalconfig";
public const string LethalCompanyVR = "io.daxcess.lcvr";
public const string InfectedCompany = "InfectedCompany.InfectedCompany";
}
public class ModInstalled
{
public static bool LCCrouchHUD;
public static bool EladsHUD;
public static bool An0nPatches;
public static bool GeneralImprovements;
public static bool HealthMetrics;
public static bool DamageMetrics;
public static bool LethalCompanyVR;
public static bool InfectedCompany;
}
}
public class EladsHUDCompatibility
{
private static Vector3 localPositionOffset = new Vector3(0f, 10f, 0f);
private static Vector3 Percentage_localPositionOffset = new Vector3(0f, 28.4f, 0f);
private static Vector3 batteryLocalPosition = Vector3.zero;
private static GameObject PercentageInsanityText;
private static Transform batteryUI;
public static TextMeshProUGUI InsanityInfo;
public static void EditEladsHUD()
{
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
GameObject vanillaSprintMeter = MeterHandler.vanillaSprintMeter;
object obj;
if (vanillaSprintMeter == null)
{
obj = null;
}
else
{
Transform obj2 = ((Component)vanillaSprintMeter.transform.parent).transform.parent.Find("PlayerInfo(Clone)/Stamina");
obj = ((obj2 != null) ? ((Component)obj2).gameObject : null);
}
GameObject val = (GameObject)obj;
if (Object.op_Implicit((Object)(object)val))
{
if (!Object.op_Implicit((Object)(object)MeterHandler.InsanityMeter))
{
MeterHandler.InsanityMeter = Object.Instantiate<GameObject>(val);
((Object)MeterHandler.InsanityMeter).name = "Insanity";
Transform obj3 = MeterHandler.InsanityMeter.transform.Find("CarryInfo");
Object.Destroy((Object)(object)((obj3 != null) ? ((Component)obj3).gameObject : null));
Transform obj4 = MeterHandler.InsanityMeter.transform.Find("Bar/Stamina Change FG");
Object.Destroy((Object)(object)((obj4 != null) ? ((Component)obj4).gameObject : null));
Transform parent = val.transform.parent;
Transform transform = val.transform;
batteryUI = ((Component)parent.Find("BatteryLayout")).gameObject.transform;
Transform transform2 = MeterHandler.InsanityMeter.transform;
transform2.SetParent(parent);
transform2.localPosition = transform.localPosition;
transform2.localScale = transform.localScale;
transform2.rotation = transform.rotation;
PercentageInsanityText = ((Component)transform2.Find("StaminaInfo")).gameObject;
batteryLocalPosition = ((batteryLocalPosition == Vector3.zero) ? batteryUI.localPosition : batteryLocalPosition);
InsanityInfo = PercentageInsanityText.GetComponent<TextMeshProUGUI>();
((TMP_Text)InsanityInfo).horizontalAlignment = (HorizontalAlignmentOptions)4;
MeterHandler.InsanityImage = ((Component)transform2.Find("Bar/StaminaBar")).gameObject.GetComponent<Image>();
Transform transform3 = MeterHandler.InsanityMeter.transform;
transform3.localPosition += localPositionOffset;
Transform transform4 = PercentageInsanityText.transform;
transform4.localPosition += Percentage_localPositionOffset;
}
MeterHandler.UpdateMeter(MeterHandler.InsanityImage, InsanityInfo);
bool value = ConfigSettings.Compat.EladsHUD.Value;
if ((value && batteryUI.localPosition != batteryLocalPosition + localPositionOffset) || (!value && batteryUI.localPosition != batteryLocalPosition))
{
batteryUI.localPosition = ((value && ConfigSettings.ModEnabled.Value) ? (batteryLocalPosition + localPositionOffset) : batteryLocalPosition);
}
bool flag = value && ConfigSettings.ModEnabled.Value;
if (MeterHandler.InsanityMeter.activeSelf != flag || PercentageInsanityText.activeSelf != flag)
{
MeterHandler.InsanityMeter.SetActive(flag);
PercentageInsanityText.SetActive(flag);
}
}
}
}
public class An0nPatchesCompatibility
{
private static Vector3 localPositionOffset = new Vector3(3f, 15f, 0f);
private static Vector3 localPosition = Vector3.zero;
public static void MoveTextHUD()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
if (CompatibilityList.ModInstalled.EladsHUD)
{
return;
}
GameObject topLeftCornerHUD = MeterHandler.TopLeftCornerHUD;
object obj;
if (topLeftCornerHUD == null)
{
obj = null;
}
else
{
Transform obj2 = topLeftCornerHUD.transform.Find("HPSP");
obj = ((obj2 != null) ? ((Component)obj2).gameObject : null);
}
GameObject val = (GameObject)obj;
if ((Object)(object)val == (Object)null)
{
Initialise.modLogger.LogError((object)"An0nTextHUD's HUD wasn't found");
return;
}
bool value = ConfigSettings.Compat.An0nPatches.Value;
localPosition = ((localPosition == Vector3.zero) ? val.transform.localPosition : localPosition);
if ((value && val.transform.localPosition != localPosition + localPositionOffset) || (!value && val.transform.localPosition != localPosition))
{
val.transform.localPosition = ((value && ConfigSettings.ModEnabled.Value) ? (localPosition + localPositionOffset) : localPosition);
}
}
}
public class GeneralImprovementsCompatibility
{
private static GameObject HitpointDisplay;
private static Vector3 localPosition = Vector3.zero;
private static Vector3 localPositionOffset = new Vector3(-2f, 28f, 0f);
public static void MoveHPHud()
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)HitpointDisplay))
{
GameObject topLeftCornerHUD = MeterHandler.TopLeftCornerHUD;
object hitpointDisplay;
if (topLeftCornerHUD == null)
{
hitpointDisplay = null;
}
else
{
Transform obj = topLeftCornerHUD.transform.Find("HPUI");
hitpointDisplay = ((obj != null) ? ((Component)obj).gameObject : null);
}
HitpointDisplay = (GameObject)hitpointDisplay;
}
if (Object.op_Implicit((Object)(object)HitpointDisplay))
{
localPosition = ((localPosition == Vector3.zero) ? HitpointDisplay.transform.localPosition : localPosition);
bool value = ConfigSettings.Compat.GeneralImprovements.Value;
if ((value && HitpointDisplay.transform.localPosition != localPosition + localPositionOffset) || (!value && HitpointDisplay.transform.localPosition != localPosition - IconHandler.selfLocalPositionOffset))
{
HitpointDisplay.transform.localPosition = ((value && ConfigSettings.ModEnabled.Value) ? (localPosition + localPositionOffset) : (localPosition - IconHandler.selfLocalPositionOffset));
}
}
}
}
public class HealthMetrics_DamageMetricsCompatibility
{
private static Vector3 localPositionOffset_Damage = new Vector3(-10f, 0f, 0f);
private static Vector3 localPositionOffset_Health = new Vector3(-2f, 0f, 0f);
private static Vector3 localPosition = Vector3.zero;
public static void MoveDisplay(bool usingHealthMetrics)
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)((Component)HUDManager.Instance.PTTIcon).transform.Find("HealthHUDDisplay")).gameObject;
if ((Object)(object)gameObject == (Object)null)
{
string text = (usingHealthMetrics ? "HealthMetrics" : "DamageMetrics");
Initialise.modLogger.LogError((object)(text + "' display wasn't found"));
return;
}
localPosition = ((localPosition == Vector3.zero) ? gameObject.transform.localPosition : localPosition);
bool value = ConfigSettings.Compat.HealthMetrics.Value;
bool value2 = ConfigSettings.Compat.DamageMetrics.Value;
if (ConfigSettings.ModEnabled.Value && ((usingHealthMetrics && value && gameObject.transform.localPosition != localPosition + localPositionOffset_Health) || (!usingHealthMetrics && value2 && gameObject.transform.localPosition != localPosition + localPositionOffset_Damage)))
{
gameObject.transform.localPosition = (usingHealthMetrics ? (localPosition + localPositionOffset_Health) : (localPosition + localPositionOffset_Damage));
}
else if (!ConfigSettings.ModEnabled.Value || (!value && usingHealthMetrics) || (!value2 && !usingHealthMetrics))
{
gameObject.transform.localPosition = localPosition;
}
}
}
public class LCCrouchHUDCompatibility
{
private static Vector3 positionToLocal = new Vector3(-16.2386f, -20.2468f, -12.0928f);
private static Vector3 localPositionOffset = new Vector3(0f, 4f, 0f);
public static void MoveCrouchHUD()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
Transform obj = MeterHandler.TopLeftCornerHUD.transform.Find("Self/CrouchIcon");
GameObject val = ((obj != null) ? ((Component)obj).gameObject : null);
if ((Object)(object)val == (Object)null)
{
Initialise.modLogger.LogError((object)"LCCrouchHud's icon wasn't found");
return;
}
bool value = ConfigSettings.Compat.LCCrouchHUD.Value;
if ((value && val.transform.localPosition != positionToLocal + localPositionOffset) || (!value && val.transform.localPosition != positionToLocal))
{
val.transform.localPosition = ((value && ConfigSettings.ModEnabled.Value) ? (positionToLocal + localPositionOffset) : positionToLocal);
}
}
}
}
namespace InsanityDisplay.Config
{
public class ConfigHandler
{
public static void InitialiseConfig()
{
ConfigSettings.ModEnabled = Initialise.modConfig.Bind<bool>("Display Settings", "Meter enabled", true, "Add a bar above the stamina bar which display your insanity");
ConfigSettings.MeterColor = Initialise.modConfig.Bind<string>("Display Settings", "Color of the Meter", "7300A6FF", "The colour that the insanity meter will have\n The colour value must be in HEX\nExample: FFFFFF(FF) (White)");
ConfigSettings.useAccurateDisplay = Initialise.modConfig.Bind<bool>("Display Settings", "Accurate meter", true, "Show your insanity value more accurately, instead of showing it in the vanilla way");
ConfigSettings.enableReverse = Initialise.modConfig.Bind<bool>("Display Settings", "Sanity Meter", false, "Turn the insanity meter into a sanity meter");
ConfigSettings.alwaysFull = Initialise.modConfig.Bind<bool>("Display Settings", "Always Show", false, "Always show the insanity meter, for aesthetic purposes");
ConfigSettings.iconAlwaysCentered = Initialise.modConfig.Bind<bool>("Display Settings", "Always Centered Player Icon", false, "Always have the player icon centered, instead of it moving to it's vanilla position when the insanity meter is not visible");
ConfigSettings.Compat.LCCrouchHUD = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable LCCrouchHUD compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
ConfigSettings.Compat.An0nPatches = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable An0n Patches compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
ConfigSettings.Compat.EladsHUD = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable Elads HUD compatibility", true, "Enabling this will add another bar above the stamina bar displaying your insanity level");
ConfigSettings.Compat.GeneralImprovements = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable GeneralImprovements compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
ConfigSettings.Compat.HealthMetrics = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable HealthMetrics compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
ConfigSettings.Compat.DamageMetrics = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable DamageMetrics compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
ConfigSettings.Compat.LethalCompanyVR = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable LethalCompanyVR compatibility", true, "Enabling this will add the insanity meter to the hud in VR");
ConfigSettings.Compat.InfectedCompany = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable InfectedCompany compatibility", true, "Enabling this will hide InfectedCompany's insanity meter and use this mod's insanity meter instead");
ConfigSettings.ConfigVersion = Initialise.modConfig.Bind<byte>("z Do Not Touch z", "Config Version", (byte)0, "The current version of your config file");
RemoveDeprecatedSettings();
FixColor();
ConfigSettings.MeterColor.SettingChanged += FixColor;
}
private static void FixColor(object obj = null, EventArgs args = null)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
if (ConfigSettings.MeterColor.Value.StartsWith("#"))
{
ConfigSettings.MeterColor.Value.Substring(1);
}
Color val = default(Color);
ColorUtility.TryParseHtmlString("#" + ConfigSettings.MeterColor.Value, ref val);
ConfigSettings.MeterColor.Value = ColorUtility.ToHtmlStringRGBA(val + Color.black);
Initialise.modLogger.LogInfo((object)$"{val} {val + Color.black}");
}
public static void RemoveDeprecatedSettings()
{
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
if (ConfigSettings.ConfigVersion.Value != ConfigSettings.CurrentVersion)
{
if (ConfigSettings.ConfigVersion.Value < 1)
{
ConfigEntry<bool> val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable LCCrouchHUD compatibility", true, (ConfigDescription)null);
ConfigSettings.Compat.LCCrouchHUD.Value = val.Value;
Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable An0n Patches compatibility", true, (ConfigDescription)null);
ConfigSettings.Compat.An0nPatches.Value = val.Value;
Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable Elads HUD compatibility", true, (ConfigDescription)null);
ConfigSettings.Compat.EladsHUD.Value = val.Value;
Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable GeneralImprovements compatibility", true, (ConfigDescription)null);
ConfigSettings.Compat.GeneralImprovements.Value = val.Value;
Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable HealthMetrics compatibility", true, (ConfigDescription)null);
ConfigSettings.Compat.HealthMetrics.Value = val.Value;
Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable DamageMetrics compatibility", true, (ConfigDescription)null);
ConfigSettings.Compat.DamageMetrics.Value = val.Value;
Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
ConfigEntry<Color> val2 = Initialise.modConfig.Bind<Color>("Display Settings", "Color of the meter", new Color(0.45f, 0f, 0.65f, 1f), (ConfigDescription)null);
ConfigSettings.MeterColor.Value = ColorUtility.ToHtmlStringRGB(val2.Value);
Initialise.modConfig.Remove(((ConfigEntryBase)val2).Definition);
}
ConfigSettings.ConfigVersion.Value = ConfigSettings.CurrentVersion;
Initialise.modLogger.LogDebug((object)"Succesfully updated config file version");
Initialise.modConfig.Save();
}
}
}
public class ConfigSettings
{
public class Compat
{
public static ConfigEntry<bool> LCCrouchHUD;
public static ConfigEntry<bool> An0nPatches;
public static ConfigEntry<bool> EladsHUD;
public static ConfigEntry<bool> GeneralImprovements;
public static ConfigEntry<bool> HealthMetrics;
public static ConfigEntry<bool> DamageMetrics;
public static ConfigEntry<bool> LethalCompanyVR;
public static ConfigEntry<bool> InfectedCompany;
}
public static ConfigEntry<bool> ModEnabled;
public static ConfigEntry<string> MeterColor;
public static ConfigEntry<bool> useAccurateDisplay;
public static ConfigEntry<bool> enableReverse;
public static ConfigEntry<bool> alwaysFull;
public static ConfigEntry<bool> iconAlwaysCentered;
public static ConfigEntry<byte> ConfigVersion;
public static byte CurrentVersion = 1;
}
}