using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AK;
using Agents;
using AssetShards;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BetterBioTracker.Comps;
using Enemies;
using FluffyUnderware.DevTools.Extensions;
using GTFO.API;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppInterop.Runtime.InteropTypes.Fields;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using Player;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BetterBioTracker")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+git87a17a8-master")]
[assembly: AssemblyProduct("BetterBioTracker")]
[assembly: AssemblyTitle("BetterBioTracker")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BetterBioTracker
{
public static class CFG
{
public const string SEC_FEAT = "1. Features";
public const string SEC_MODES = "2. Screen Modes";
public const string SEC_THERMAL = "3. Thermal Vision";
public const string SEC_MISC = "4. Miscellaneous";
public static bool UseWideRadar { get; private set; }
public static bool UseColoredTargets { get; private set; }
public static bool AddPlayersToTracker { get; private set; }
public static bool UseThermalRadarMode { get; private set; }
public static bool UseThermalOnlyMode { get; private set; }
public static bool UseOldZoom { get; private set; }
public static float TargetSizeMult { get; private set; }
public static float WorldAlbedoFactor { get; private set; }
public static float AmbientHeat { get; private set; }
public static float AmbientColorFactor { get; private set; }
public static float Brightness { get; private set; }
public static string ThermalPaletteName { get; private set; }
internal static void BindAll(ConfigFile cfg)
{
UseWideRadar = cfg.Bind<bool>("1. Features", "Use Wide Radar", true, "Remove aesthetic components from Bio-tracker screen and widen the radar?").Value;
UseColoredTargets = cfg.Bind<bool>("1. Features", "Use Colored Targets", true, "Dynamically change Enemy Targets color in Bio-Tracker screen?").Value;
AddPlayersToTracker = cfg.Bind<bool>("1. Features", "Add Players to Tracker", true, "Add Players to Bio-tracker radar?").Value;
UseThermalRadarMode = cfg.Bind<bool>("2. Screen Modes", "Use Thermal-Radar Mode", true, "Add Thermal-Radar Mode to your mode cycle?").Value;
UseThermalOnlyMode = cfg.Bind<bool>("2. Screen Modes", "Use Thermal-Only Mode", true, "Use Thermal-Only Mode to your mode cycle?").Value;
ThermalPaletteName = cfg.Bind<string>("3. Thermal Vision", "Thermal Screen Palette Name", "Ironbow", "Filename of Thermal Screen Color Palette (Under the plugins/BetterBioTracker/palette folder, Only Accept PNG file)").Value;
WorldAlbedoFactor = cfg.Bind<float>("3. Thermal Vision", "Albedo Factor", 0.1f, (ConfigDescription)null).Value;
AmbientHeat = cfg.Bind<float>("3. Thermal Vision", "Ambient Heat", 0.02f, (ConfigDescription)null).Value;
AmbientColorFactor = cfg.Bind<float>("3. Thermal Vision", "Ambient Color Factor", 5f, (ConfigDescription)null).Value;
Brightness = cfg.Bind<float>("3. Thermal Vision", "Screen Brightness", 0.5f, (ConfigDescription)null).Value;
UseOldZoom = cfg.Bind<bool>("4. Miscellaneous", "Use Pre R6 Zoom Animation", false, "Use Old Zooming Animation?").Value;
TargetSizeMult = cfg.Bind<float>("4. Miscellaneous", "Target Size Multiplier", 1f, "Multiplier for Targets size in Bio-tracker screen").Value;
}
}
[BepInPlugin("BetterBioTracker", "BetterBioTracker", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class EntryPoint : BasePlugin
{
private Harmony _Harmony;
public override void Load()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
CFG.BindAll(((BasePlugin)this).Config);
ClassInjector.RegisterTypeInIl2Cpp<RadarScreenItem>();
ClassInjector.RegisterTypeInIl2Cpp<BioScreenRef>();
ClassInjector.RegisterTypeInIl2Cpp<BetterBio>();
_Harmony = new Harmony("BetterBioTracker.Harmony");
_Harmony.PatchAll();
AssetAPI.OnStartupAssetsLoaded += AssetAPI_OnStartupAssetsLoaded;
}
private void AssetAPI_OnStartupAssetsLoaded()
{
AssetShardManager.LoadMultipleShardsAsync(Il2CppStringArray.op_Implicit(new string[2]
{
AssetShardManager.GetShardName((AssetBundleName)130, (AssetBundleShard)1),
AssetShardManager.GetShardName((AssetBundleName)50, (AssetBundleShard)2)
}), Action.op_Implicit((Action)OnGearShardsLoaded), 1, (LoadSceneMode)1, "");
}
private void OnGearShardsLoaded()
{
BioScreenRef.LoadResources();
}
public override bool Unload()
{
_Harmony.UnpatchSelf();
return ((BasePlugin)this).Unload();
}
}
[HarmonyPatch]
internal static class Inject_BioSpawn
{
private static bool s_ScreenPrefabProcessed;
[HarmonyPatch(typeof(GearPartSpawner), "OnShardsLoaded")]
[HarmonyPrefix]
private static void Pre_ShardsLoaded()
{
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
if (s_ScreenPrefabProcessed)
{
return;
}
GameObject loadedAsset = AssetAPI.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/Items/Gear/Parts/Tools/Screen/Screen_2.prefab");
if ((Object)(object)loadedAsset == (Object)null)
{
return;
}
GUIX_VirtualScene componentInChildren = loadedAsset.GetComponentInChildren<GUIX_VirtualScene>();
componentInChildren.useDepth = true;
Transform val = ((Component)componentInChildren).transform.Find("GUIX_layer/GUIX_Display_EnemyScanner_a");
Transform val2 = val.Find("RadarCircle");
GameObject gameObject = ((Component)loadedAsset.transform.Find("Screen_Display_2")).gameObject;
Renderer component;
if (CFG.UseWideRadar)
{
val2.Find("arrow_Element (1)").parent = val;
val2.Find("arrow_Element (4)").parent = val;
val2.localPosition = new Vector3(2.941f, -2.315f, 0f);
((Component)val2.Find("Circle_1 (1)")).gameObject.SetActive(false);
((Component)val2.Find("Circle_1 (2)")).gameObject.SetActive(false);
GameObject obj = GameObject.CreatePrimitive((PrimitiveType)4);
((Object)obj).name = "Wide Radar Gizmo";
Object.Destroy((Object)(object)obj.GetComponent<Collider>());
obj.transform.parent = val2;
obj.transform.localPosition = new Vector3(0f, 1.7f, 0f);
obj.transform.localEulerAngles = new Vector3(90f, 0f, 180f);
obj.transform.localScale = new Vector3(0.65856f, 1f, 0.3298462f);
component = obj.GetComponent<Renderer>();
DisableChild(val, "ClampsCircle (1)");
DisableChild(val, "MeeterBar_c (1)");
DisableChild(val, "TopFrame (1)");
DisableChild(val, "BackgroundDots_a");
DisableChild(val, "gradientLines");
DisableChild(val, "gradientLines (1)");
DisableChild(val, "Button_Arrow_Bounce");
DisableChild(val, "Button_SpinningCutCircle");
DisableChild(val, "ARIndicator/ARIndicatorText (1)");
DisableChild(val, "ARIndicator/ARIndicatorText (2)");
DisableChild(val, "ARIndicator/ARIndicatorText (3)");
DisableChild(val, "ARIndicator/ARIndicatorText (4)");
DisableChild(val, "ARIndicator/ARIndicatorText (5)");
DisableChild(val, "ARIndicator/ARIndicatorText (6)");
DisableChild(val, "ARIndicator/ARIndicatorText (7)");
DisableChild(val, "ARIndicator/ARIndicatorText (8)");
DisableChild(val, "ARIndicator/ARIndicatorText (9)");
}
else
{
component = ((Component)val2.Find("Circle_1 (1)")).GetComponent<Renderer>();
}
foreach (Renderer componentsInChild in ((Component)val2).GetComponentsInChildren<Renderer>())
{
if (!((Object)((Component)componentsInChild).gameObject).name.Equals("Wide Radar Gizmo"))
{
RadarScreenItem radarScreenItem = ((Component)componentsInChild).gameObject.AddComponent<RadarScreenItem>();
radarScreenItem.Renderer.Value = componentsInChild;
radarScreenItem.DefaultMat.Value = componentsInChild.sharedMaterial;
}
}
BioScreenRef bioScreenRef = ((Component)loadedAsset.GetComponent<EnemyScannerScreen>()).gameObject.AddComponent<BioScreenRef>();
bioScreenRef.VirtScene.Value = componentInChildren;
bioScreenRef.RadarImageRenderer.Value = component;
bioScreenRef.ScreenRenderer.Value = gameObject.GetComponent<Renderer>();
s_ScreenPrefabProcessed = true;
}
[HarmonyPatch(typeof(EnemyScanner), "OnGearSpawnComplete")]
[HarmonyPostfix]
private static void Post_ScannerSpawned(EnemyScanner __instance)
{
((Component)__instance).gameObject.AddComponent<BetterBio>();
foreach (Renderer componentsInChild in ((Component)((ItemEquippable)__instance).GearPartHolder).gameObject.GetComponentsInChildren<Renderer>(true))
{
componentsInChild.material.renderQueue = 3000;
}
}
[HarmonyPatch(typeof(EnemyScannerGraphics), "Start")]
[HarmonyPrefix]
private static void Pre_GraphicsStart(EnemyScannerGraphics __instance)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (CFG.UseWideRadar)
{
Transform transform = ((Component)__instance.m_display).transform;
transform.localPosition = new Vector3(0.0494f, 0f, 0.1315f);
transform.localScale = new Vector3(0.3395262f, 1.102f, 0.166f);
}
}
private static void DisableChild(Transform guixRoot, string path)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
Transform val = guixRoot.Find(path);
if ((Object)(object)val == (Object)null)
{
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(37, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Unable to find: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(path);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" from tracker screen!");
}
Logger.Error(val2);
}
else
{
((Component)val).gameObject.SetActiveRecursively(false);
}
}
}
[HarmonyPatch(typeof(EnemyAgent), "UpdateScannerData")]
internal class Inject_ColoredBio
{
private static readonly Color s_GlueCol = new Color(0.5f, 0.5f, 0.5f, 1f);
private static readonly Color s_HibernateCol = new Color(0.7f, 0.7f, 0.7f, 1f);
private static readonly Color s_HeartbeatOnCol;
private static readonly Color s_HeartbeatOffCol;
private static readonly Color s_HibernateWakeupCol;
private static readonly Color s_ScoutRoamingCol;
private static readonly Color s_ScoutFeelerCol;
private static readonly Color s_ScoutScreamCol;
private static readonly Color s_ActiveCol;
private static void Postfix(EnemyAgent __instance)
{
//IL_0033: 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)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
Color val;
if (!CFG.UseColoredTargets)
{
val = __instance.m_scannerColor;
Color val2 = ((Color)(ref val)).AlphaMultiplied(CFG.TargetSizeMult);
__instance.m_scannerData.m_matProp.SetColor(EnemyScannerGraphics._Color, val2);
}
else
{
val = GetStateColor(__instance);
Color val3 = ((Color)(ref val)).AlphaMultiplied(CFG.TargetSizeMult);
__instance.m_scannerData.m_matProp.SetColor(EnemyScannerGraphics._Color, val3);
}
}
private static Color GetStateColor(EnemyAgent agent)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Invalid comparison between Unknown and I4
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected I4, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Invalid comparison between Unknown and I4
//IL_0085: 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_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Invalid comparison between Unknown and I4
//IL_00a4: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
bool heartbeatActive = agent.Locomotion.Hibernate.m_heartbeatActive;
ES_StateEnum currentStateEnum = agent.Locomotion.CurrentStateEnum;
if ((int)currentStateEnum != 2)
{
switch (currentStateEnum - 12)
{
default:
if ((int)currentStateEnum == 28)
{
break;
}
goto case 4;
case 2:
if (agent.IsHibernationDetecting)
{
if (!heartbeatActive)
{
return s_HeartbeatOffCol;
}
return s_HeartbeatOnCol;
}
return s_HibernateCol;
case 3:
return s_HibernateWakeupCol;
case 0:
return s_ScoutFeelerCol;
case 1:
return s_ScoutScreamCol;
case 5:
return s_GlueCol;
case 4:
return s_ActiveCol;
}
}
if (agent.AI.m_scoutPath == null)
{
return s_ActiveCol;
}
if ((int)agent.Locomotion.ScoutScream.m_state == 4)
{
return s_ActiveCol;
}
return s_ScoutRoamingCol;
}
static Inject_ColoredBio()
{
//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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_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_0060: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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)
Color yellow = Color.yellow;
s_HeartbeatOnCol = ((Color)(ref yellow)).RGBMultiplied(0.7f);
yellow = Color.yellow;
s_HeartbeatOffCol = ((Color)(ref yellow)).RGBMultiplied(0.6f);
s_HibernateWakeupCol = new Color(0.8f, 0.4549f, 0.0392f, 1f);
yellow = Color.yellow;
s_ScoutRoamingCol = ((Color)(ref yellow)).RGBMultiplied(0.7f);
s_ScoutFeelerCol = new Color(1f, 0.1f, 0.1f, 1f);
s_ScoutScreamCol = Color.cyan;
s_ActiveCol = new Color(1f, 0.1f, 0.1f, 1f);
}
}
internal static class Logger
{
private static readonly ManualLogSource _Logger;
static Logger()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
_Logger = new ManualLogSource("BetterBioTracker");
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)
{
}
}
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resource
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
resourceMan = new ResourceManager("BetterBioTracker.Resource", typeof(Resource).Assembly);
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static byte[] Radar => (byte[])ResourceManager.GetObject("Radar", resourceCulture);
internal Resource()
{
}
}
[GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")]
[CompilerGenerated]
internal static class VersionInfo
{
public const string RootNamespace = "BetterBioTracker";
public const string Version = "1.0.0";
public const string VersionPrerelease = null;
public const string VersionMetadata = "git87a17a8-master";
public const string SemVer = "1.0.0+git87a17a8-master";
public const string GitRevShort = "87a17a8";
public const string GitRevLong = "87a17a8b7edc66878d95342e8d3b7e8987e276f0";
public const string GitBranch = "master";
public const string GitTag = null;
public const int GitCommitsSinceTag = 0;
public const bool GitIsDirty = false;
}
}
namespace BetterBioTracker.Comps
{
internal sealed class BetterBio : MonoBehaviour
{
[HarmonyPatch(typeof(EnemyScanner), "Update")]
private static class Inject_EnemyScanner
{
private static void Prefix()
{
BetterBio.OnPreEnemyTargetRender?.Invoke();
}
private static void Postfix()
{
BetterBio.OnPostEnemyTargetRender?.Invoke();
}
}
[HarmonyPatch(typeof(EnemyScannerGraphics), "IsDetected")]
private static class Inject_EnemyScannerGraphics_Culling
{
private static void Postfix(EnemyScannerGraphics __instance, EnemyAgent enemyAgent, ref bool __result)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
__result = !IsTargetCulled(__instance, enemyAgent.Position);
}
}
[HarmonyPatch(typeof(MapDetails), "OnNavMeshGenerationDone")]
private static class Inject_MapDetails
{
private static void Prefix()
{
BetterBio.OnNavGenerationDone?.Invoke();
}
}
public enum ScreenState
{
Default,
Thermal_Radar,
Thermal
}
private EnemyScanner _Scanner;
private EnemyScannerGraphics _Graphics;
private BioScreenRef _ScreenRef;
private MaterialPropertyBlock _PlayerCircleMatProps;
private static Transform s_CullTransform;
private int _ScreenStateIndex;
private ScreenState[] _ScreenStatePool;
private static event Action OnPreEnemyTargetRender;
private static event Action OnPostEnemyTargetRender;
private static event Action OnNavGenerationDone;
private void Start()
{
//IL_0055: 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)
_Scanner = ((Component)this).GetComponent<EnemyScanner>();
_Graphics = _Scanner.m_graphics;
_ScreenRef = ((Component)_Scanner.m_screen).GetComponent<BioScreenRef>();
if (CFG.UseOldZoom)
{
ItemFPSSettingsDataBlock itemFPSData = ((ItemEquippable)_Scanner).ItemFPSData;
itemFPSData.localPosZoom = new Vector3(0.01f, -0.065f, 0.42f);
itemFPSData.localRotZoom = new Vector3(-14.76f, 0.19f, 1f);
((Item)_Scanner).ItemDataBlock.ShowCrosshairWhenAiming = false;
}
Setup_CullTransform();
Setup_DisplayTeammate();
Setup_ThermalVision();
}
private void OnDestroy()
{
Clear_DisplayTeammate();
Clear_CullTransform();
}
private void Update()
{
Update_ThermalVision_Input();
Update_CullTransform();
}
private void Setup_DisplayTeammate()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
_PlayerCircleMatProps = new MaterialPropertyBlock();
MaterialPropertyBlock playerCircleMatProps = _PlayerCircleMatProps;
Color cyan = Color.cyan;
playerCircleMatProps.SetColor("_Color", ((Color)(ref cyan)).AlphaMultiplied(0.25f));
OnPostEnemyTargetRender += PostRender_DisplayTeammate;
}
private void Clear_DisplayTeammate()
{
if (_PlayerCircleMatProps != null)
{
_PlayerCircleMatProps.Dispose();
_PlayerCircleMatProps = null;
}
OnPostEnemyTargetRender -= PostRender_DisplayTeammate;
}
private void PostRender_DisplayTeammate()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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)
if (!CFG.AddPlayersToTracker)
{
return;
}
EnemyScannerGraphics graphics = _Graphics;
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
float num = default(float);
float num2 = default(float);
float num3 = default(float);
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (!((Agent)current).IsLocallyOwned && !IsTargetCulled(_Graphics, ((Agent)current).Position))
{
Matrix4x4 val = Matrix4x4.TRS(((Agent)current).Position, Quaternion.identity, Vector3.one);
Color playerColor = current.Owner.PlayerColor;
Color.RGBToHSV(playerColor, ref num, ref num2, ref num3);
Color val2 = Color.HSVToRGB(num, num2, 1f);
playerColor = ((Color)(ref val2)).AlphaMultiplied(0.5f * CFG.TargetSizeMult);
_PlayerCircleMatProps.SetColor("_Color", playerColor);
graphics.m_cmd.DrawMesh(graphics.m_targetMesh, val, graphics.m_targetMaterial, 0, 0, _PlayerCircleMatProps);
}
}
}
private void Setup_CullTransform()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
s_CullTransform = new GameObject("BioTracker Culling Transform").transform;
}
private void Clear_CullTransform()
{
if ((Object)(object)s_CullTransform != (Object)null)
{
Object.Destroy((Object)(object)((Component)s_CullTransform).gameObject);
s_CullTransform = null;
}
}
private void Update_CullTransform()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_0074: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_Scanner != (Object)null && (Object)(object)((Item)_Scanner).Owner != (Object)null)
{
s_CullTransform.position = ((Agent)((Item)_Scanner).Owner).Position;
if (Vector3Ext.NotApproximately(_Graphics.m_scanFwd, Vector3.zero))
{
Quaternion identity = Quaternion.identity;
((Quaternion)(ref identity)).SetLookRotation(_Graphics.m_scanFwd, Vector3.up);
s_CullTransform.rotation = identity;
}
else
{
s_CullTransform.rotation = Quaternion.identity;
}
}
}
private static bool IsTargetCulled(EnemyScannerGraphics graphics, Vector3 position)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_005c: 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)
float num = ((Component)graphics.m_display).transform.localScale.z / ((Component)graphics.m_display).transform.localScale.x;
float num2 = graphics.m_width * 0.5f;
float num3 = graphics.m_width * num;
Vector3 val = s_CullTransform.InverseTransformPoint(position);
if (!(Mathf.Abs(val.x) > num2) && !(val.z > num3))
{
return val.z < 0f;
}
return true;
}
private void Setup_ThermalVision()
{
List<ScreenState> list = new List<ScreenState> { ScreenState.Default };
if (CFG.UseThermalRadarMode)
{
list.Add(ScreenState.Thermal_Radar);
}
if (CFG.UseThermalOnlyMode)
{
list.Add(ScreenState.Thermal);
}
_ScreenStatePool = list.ToArray();
list.Clear();
SetThermalScreen(ScreenState.Default);
}
private void Update_ThermalVision_Input()
{
if (_ScreenStatePool.Length > 1 && InputMapper.GetButtonDownKeyMouseGamepad((InputAction)11, (eFocusState)4))
{
_ScreenStateIndex = (_ScreenStateIndex + 1) % _ScreenStatePool.Length;
SetThermalScreen(_ScreenStatePool[_ScreenStateIndex]);
}
}
private void SetThermalScreen(ScreenState state)
{
switch (state)
{
case ScreenState.Default:
_Graphics.m_display.forceRenderingOff = false;
_ScreenRef.SetRadarGizmoEnabled(enabled: true);
_ScreenRef.SetThermalEnabled(enabled: false);
((ItemEquippable)_Scanner).Sound.Post(EVENTS.BUTTONGENERICDEACTIVATE, true);
break;
case ScreenState.Thermal_Radar:
_Graphics.m_display.forceRenderingOff = false;
_ScreenRef.SetRadarGizmoEnabled(enabled: true);
_ScreenRef.SetThermalEnabled(enabled: true);
((ItemEquippable)_Scanner).Sound.Post(EVENTS.BUTTONGENERICBLIPONE, true);
break;
case ScreenState.Thermal:
_Graphics.m_display.forceRenderingOff = true;
_ScreenRef.SetRadarGizmoEnabled(enabled: false);
_ScreenRef.SetThermalEnabled(enabled: true);
((ItemEquippable)_Scanner).Sound.Post(EVENTS.BUTTONGENERICBLIPTWO, true);
break;
}
}
}
internal sealed class BioScreenRef : MonoBehaviour
{
public static Material Mat_Invisible;
public static Material Mat_Thermal;
public static Material Mat_NonThermal;
public static Material Mat_RadarImage;
private static bool s_IsResourceSetupDone;
public Il2CppReferenceField<GUIX_VirtualScene> VirtScene;
public Il2CppReferenceField<Renderer> RadarImageRenderer;
public Il2CppReferenceField<Renderer> ScreenRenderer;
private RadarScreenItem[] _RadarItems;
private bool _ThermalRenderingEnabled;
private void Start()
{
_RadarItems = Il2CppArrayBase<RadarScreenItem>.op_Implicit(((Component)this).GetComponentsInChildren<RadarScreenItem>(true));
if (CFG.UseWideRadar)
{
RadarImageRenderer.Value.sharedMaterial = Mat_RadarImage;
}
SetThermalEnabled(enabled: false);
SetRadarGizmoEnabled(enabled: true);
}
public static void LoadResources()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: 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_009c: Expected O, but got Unknown
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Expected O, but got Unknown
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Expected O, but got Unknown
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Expected O, but got Unknown
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Expected O, but got Unknown
//IL_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Expected O, but got Unknown
if (s_IsResourceSetupDone)
{
return;
}
Texture2D val = new Texture2D(1, 1, (TextureFormat)2, false)
{
name = "ClearTexture",
hideFlags = (HideFlags)61
};
val.SetPixel(0, 0, Color.clear);
val.Apply();
Texture2D val2 = new Texture2D(512, 256, (TextureFormat)5, false)
{
name = "RadarBGTexture",
hideFlags = (HideFlags)61
};
ImageConversion.LoadImage(val2, Il2CppStructArray<byte>.op_Implicit(Resource.Radar));
Mat_RadarImage = new Material(Shader.Find("Unlit/Transparent"))
{
name = "BetterBio - Radar Image Material",
mainTexture = (Texture)(object)val2,
hideFlags = (HideFlags)61
};
Mat_Invisible = new Material(Shader.Find("Unlit/Transparent"))
{
name = "BetterBio - Invisible Material",
mainTexture = (Texture)(object)val,
hideFlags = (HideFlags)61
};
Mat_Thermal = new Material(((Component)AssetAPI.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/Items/Gear/Parts/Sights/Sight_19_t.prefab").transform.Find("Sight_19_Thermal")).GetComponent<Renderer>().sharedMaterial)
{
name = "BetterBio - Thermal Material",
hideFlags = (HideFlags)61,
renderQueue = 2000
};
Mat_Thermal.SetTexture("_ReticuleA", (Texture)(object)val);
Mat_Thermal.SetTexture("_ReticuleB", (Texture)(object)val);
Mat_Thermal.SetTexture("_ReticuleC", (Texture)(object)val);
Mat_Thermal.SetColor("_ReticuleColorA", ColorExt.Hex("#82f3ff") * 0.25f);
Mat_Thermal.SetFloat("_OffAngleFade", 0f);
Mat_Thermal.SetFloat("_AmbientTemp", CFG.AmbientHeat);
Mat_Thermal.SetFloat("_AmbientColorFactor", CFG.AmbientColorFactor);
Mat_Thermal.SetFloat("_AlbedoColorFactor", CFG.WorldAlbedoFactor);
Mat_Thermal.SetFloat("_ProjDist1", 0f);
Mat_Thermal.SetFloat("_ProjSize1", 1f);
Mat_Thermal.SetFloat("_RatioAdjust", 0.58f);
Mat_Thermal.SetFloat("_ScreenIntensity", 0.05f * CFG.Brightness);
Mat_Thermal.SetFloat("_Zoom", 0.67f);
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "palette", CFG.ThermalPaletteName + ".png");
bool flag = default(bool);
if (File.Exists(text))
{
byte[] array = File.ReadAllBytes(text);
Texture2D val3 = new Texture2D(256, 64, (TextureFormat)20, false);
if (ImageConversion.LoadImage(val3, Il2CppStructArray<byte>.op_Implicit(array)))
{
Mat_Thermal.SetTexture("_HeatTex", (Texture)(object)val3);
}
else
{
BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Unable to convert file to texture: ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(text);
}
Logger.Warn(val4);
Logger.Warn("This will default color palette to Ironbow style!");
}
}
else
{
BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Unable to find Palette file in path: ");
((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(text);
}
Logger.Warn(val4);
Logger.Warn("This will default color palette to Ironbow style!");
}
Mat_NonThermal = new Material(((Component)AssetAPI.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/Items/Gear/Parts/Tools/Screen/Screen_2.prefab").transform.Find("Screen_Display_2")).GetComponent<Renderer>().sharedMaterial)
{
name = "BetterBio - Screen Material",
hideFlags = (HideFlags)61
};
s_IsResourceSetupDone = true;
}
public void SetRadarGizmoEnabled(bool enabled)
{
if (CFG.UseWideRadar)
{
RadarImageRenderer.Value.sharedMaterial = (enabled ? Mat_RadarImage : Mat_Invisible);
}
RadarScreenItem[] radarItems = _RadarItems;
for (int i = 0; i < radarItems.Length; i++)
{
radarItems[i].SetVisible(enabled);
}
}
public void SetThermalEnabled(bool enabled)
{
_ThermalRenderingEnabled = enabled;
if ((Object)(object)RadarImageRenderer.Value != (Object)null)
{
ScreenRenderer.Value.sharedMaterial = (enabled ? Mat_Thermal : Mat_NonThermal);
}
if (enabled)
{
RenderTexture target = VirtScene.Value.virtualCamera.target;
Mat_Thermal.SetTexture("_ReticuleA", (Texture)(object)target);
}
}
}
internal sealed class RadarScreenItem : MonoBehaviour
{
public Il2CppReferenceField<Material> DefaultMat;
public Il2CppReferenceField<Renderer> Renderer;
public void SetVisible(bool visible)
{
Renderer.Value.sharedMaterial = (visible ? Il2CppReferenceField<Material>.op_Implicit(DefaultMat) : BioScreenRef.Mat_Invisible);
((Component)this).gameObject.SetActive(visible);
}
}
}