Decompiled source of CursedCargo v1.0.0

plugins\CursedCargo.dll

Decompiled 40 minutes ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CursedCargo.Audio;
using CursedCargo.Commands;
using CursedCargo.Config;
using CursedCargo.Core;
using CursedCargo.Data;
using CursedCargo.Network;
using CursedCargo.UI;
using CursedCargo.Visuals;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CursedCargoTeam")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Anomalous valuables, extraction synergies, contraband incidents, containment perks, and a field codex for R.E.P.O.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CursedCargo")]
[assembly: AssemblyTitle("CursedCargo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 CursedCargo
{
	[BepInPlugin("com.cursedcargo.repo", "CursedCargo", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.cursedcargo.repo";

		public const string PluginName = "CursedCargo";

		public const string PluginVersion = "1.0.0";

		private Harmony? _harmony;

		internal static ManualLogSource Log { get; private set; }

		internal static Plugin Instance { get; private set; }

		private void Awake()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			ModConfig.Initialize(((BaseUnityPlugin)this).Config);
			CodexSaveStore.Load();
			NetworkSync.Initialize();
			CargoChatCommands.RegisterAll();
			_harmony = new Harmony("com.cursedcargo.repo");
			_harmony.PatchAll(typeof(Plugin).Assembly);
			SpawnRuntimeHost();
			Log.LogInfo((object)"CursedCargo v1.0.0 initialized — 24 Anomalies, 10 Incidents, 10 Synergy Combos, 12 Containment Perks loaded.");
		}

		private void OnDestroy()
		{
			CodexSaveStore.SaveIfDirty();
			Harmony? harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private static void SpawnRuntimeHost()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			GameObject val = new GameObject("CursedCargo_RuntimeHost")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<CursedCargoRuntimeHost>();
		}
	}
	internal sealed class CursedCargoRuntimeHost : MonoBehaviour
	{
		private void Start()
		{
			ProceduralSfx.EnsureInitialized();
		}

		private void Update()
		{
			RunSessionManager.Tick(Time.deltaTime);
			CodexTerminalUI.TickInput();
		}

		private void OnGUI()
		{
			ScannerHud.Draw();
			CodexTerminalUI.Draw();
		}

		private void OnApplicationQuit()
		{
			CodexSaveStore.Save();
		}
	}
}
namespace CursedCargo.Visuals
{
	public sealed class AnomalyVisuals : MonoBehaviour
	{
		private static Material? _sharedParticleMat;

		private static Texture2D? _softDotTexture;

		private static readonly int EmissionColorId = Shader.PropertyToID("_EmissionColor");

		private AnomalyDefinition _def;

		private Light? _auraLight;

		private ParticleSystem? _particles;

		private readonly List<Renderer> _renderers = new List<Renderer>();

		private MaterialPropertyBlock? _mpb;

		private float _baseLightIntensity;

		private float _baseLightRange;

		private float _pulseSpeed;

		private float _phaseOffset;

		private float _instability01;

		public void Initialize(AnomalyDefinition def)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			_def = def;
			_phaseOffset = Random.Range(0f, 6.28f);
			_mpb = new MaterialPropertyBlock();
			if (ModConfig.EnableVisualAuras.Value)
			{
				CacheRenderers();
				BuildAuraLight();
				BuildParticles();
			}
		}

		public void SetInstabilityVisual(float normalized)
		{
			_instability01 = Mathf.Clamp01(normalized);
		}

		public void BurstParticles(int count)
		{
			if ((Object)(object)_particles != (Object)null)
			{
				_particles.Emit(count);
			}
		}

		private void CacheRenderers()
		{
			_renderers.Clear();
			MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshRenderer>(true);
			foreach (MeshRenderer val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null && (Object)(object)((Renderer)val).sharedMaterial != (Object)null)
				{
					_renderers.Add((Renderer)(object)val);
				}
			}
		}

		private void BuildAuraLight()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("CursedCargo_AuraLight");
			val.transform.SetParent(((Component)this).transform, false);
			val.transform.localPosition = Vector3.up * 0.18f;
			_auraLight = val.AddComponent<Light>();
			_auraLight.type = (LightType)2;
			_auraLight.color = _def.PrimaryColor;
			_auraLight.shadows = (LightShadows)0;
			if (_def.Type == AnomalyType.SolarBeacon)
			{
				_baseLightIntensity = 3.2f;
				_baseLightRange = 11.5f;
				_pulseSpeed = 2f;
			}
			else
			{
				_baseLightIntensity = _def.Tier switch
				{
					AnomalyTier.Eldritch => 1.75f, 
					AnomalyTier.Volatile => 1.55f, 
					AnomalyTier.Rare => 1.25f, 
					_ => 0.95f, 
				};
				_baseLightRange = _def.Tier switch
				{
					AnomalyTier.Eldritch => 4.2f, 
					AnomalyTier.Volatile => 3.6f, 
					AnomalyTier.Rare => 3f, 
					_ => 2.4f, 
				};
				_pulseSpeed = ((_def.Tier >= AnomalyTier.Volatile) ? 4.2f : 2.3f);
			}
			_auraLight.intensity = _baseLightIntensity;
			_auraLight.range = _baseLightRange;
		}

		private void BuildParticles()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0036: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			EnsureParticleMaterial();
			if (!((Object)(object)_sharedParticleMat == (Object)null))
			{
				GameObject val = new GameObject("CursedCargo_AuraFX");
				val.transform.SetParent(((Component)this).transform, false);
				val.transform.localPosition = Vector3.up * 0.1f;
				_particles = val.AddComponent<ParticleSystem>();
				MainModule main = _particles.main;
				((MainModule)(ref main)).loop = true;
				((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.9f, 1.8f);
				((MainModule)(ref main)).startSpeed = ((_def.Type == AnomalyType.HeliumInfused) ? new MinMaxCurve(0.25f, 0.55f) : new MinMaxCurve(0.08f, 0.3f));
				((MainModule)(ref main)).startSize = new MinMaxCurve(0.045f, 0.11f);
				((MainModule)(ref main)).maxParticles = 32;
				((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
				((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit((_def.Type == AnomalyType.HeliumInfused) ? (-0.18f) : (-0.04f));
				((MainModule)(ref main)).startColor = new MinMaxGradient(_def.PrimaryColor, _def.SecondaryColor);
				EmissionModule emission = _particles.emission;
				((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(_def.Tier switch
				{
					AnomalyTier.Eldritch => 12f, 
					AnomalyTier.Volatile => 10f, 
					AnomalyTier.Rare => 7f, 
					_ => 5f, 
				});
				ShapeModule shape = _particles.shape;
				((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
				((ShapeModule)(ref shape)).radius = 0.28f;
				SizeOverLifetimeModule sizeOverLifetime = _particles.sizeOverLifetime;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.EaseInOut(0f, 1f, 1f, 0f));
				ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
				if ((Object)(object)component != (Object)null)
				{
					((Renderer)component).sharedMaterial = _sharedParticleMat;
					component.renderMode = (ParticleSystemRenderMode)0;
				}
			}
		}

		private void Update()
		{
			//IL_0125: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			if (_def == null || !ModConfig.EnableVisualAuras.Value)
			{
				return;
			}
			float num = _pulseSpeed + _instability01 * 9f;
			float num2 = 0.5f + 0.5f * Mathf.Sin(Time.time * num + _phaseOffset);
			if ((Object)(object)_auraLight != (Object)null)
			{
				float num3 = ((_def.Type == AnomalyType.VolatileNitro && _instability01 > 0.5f) ? Random.Range(0.75f, 1.35f) : 1f);
				_auraLight.intensity = _baseLightIntensity * (0.72f + 0.45f * num2 + _instability01 * 0.9f) * num3;
				_auraLight.color = Color.Lerp(_def.PrimaryColor, _def.SecondaryColor, num2 * 0.5f);
			}
			if (_mpb == null || _renderers.Count <= 0)
			{
				return;
			}
			float num4 = 0.12f + 0.18f * num2 + _instability01 * 0.45f;
			Color val = _def.PrimaryColor * num4;
			for (int i = 0; i < _renderers.Count; i++)
			{
				Renderer val2 = _renderers[i];
				if (!((Object)(object)val2 == (Object)null))
				{
					val2.GetPropertyBlock(_mpb);
					_mpb.SetColor(EmissionColorId, val);
					val2.SetPropertyBlock(_mpb);
				}
			}
		}

		private void OnDestroy()
		{
			if (_mpb == null)
			{
				return;
			}
			for (int i = 0; i < _renderers.Count; i++)
			{
				Renderer val = _renderers[i];
				if (!((Object)(object)val == (Object)null))
				{
					val.SetPropertyBlock((MaterialPropertyBlock)null);
				}
			}
		}

		private static void EnsureParticleMaterial()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_sharedParticleMat != (Object)null)
			{
				return;
			}
			if ((Object)(object)_softDotTexture == (Object)null)
			{
				_softDotTexture = new Texture2D(32, 32, (TextureFormat)4, false);
				float num = 15.5f;
				for (int i = 0; i < 32; i++)
				{
					for (int j = 0; j < 32; j++)
					{
						float num2 = ((float)j - num) / num;
						float num3 = ((float)i - num) / num;
						float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3);
						float num5 = Mathf.Clamp01(1f - num4);
						num5 *= num5;
						_softDotTexture.SetPixel(j, i, new Color(1f, 1f, 1f, num5));
					}
				}
				_softDotTexture.Apply();
				((Object)_softDotTexture).hideFlags = (HideFlags)61;
			}
			Shader val = Shader.Find("Universal Render Pipeline/Particles/Unlit") ?? Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Sprites/Default") ?? Shader.Find("Legacy Shaders/Particles/Alpha Blended");
			if (!((Object)(object)val == (Object)null))
			{
				_sharedParticleMat = new Material(val)
				{
					mainTexture = (Texture)(object)_softDotTexture,
					hideFlags = (HideFlags)61
				};
				if (_sharedParticleMat.HasProperty("_BaseMap"))
				{
					_sharedParticleMat.SetTexture("_BaseMap", (Texture)(object)_softDotTexture);
				}
			}
		}
	}
}
namespace CursedCargo.UI
{
	public static class CodexTerminalUI
	{
		private static int _activeTab;

		private static int _tierFilter = -1;

		private static AnomalyType _selectedAnomaly = AnomalyType.Magnetic;

		private static Vector2 _codexListScroll;

		private static Vector2 _perksScroll;

		private static Vector2 _briefingScroll;

		private static GUIStyle? _headerStyle;

		private static GUIStyle? _subHeaderStyle;

		private static GUIStyle? _labelStyle;

		private static GUIStyle? _mutedStyle;

		private static GUIStyle? _btnStyle;

		private static GUIStyle? _tabBtnStyle;

		public static bool IsOpen { get; private set; }

		public static void Toggle()
		{
			IsOpen = !IsOpen;
			if (!IsOpen)
			{
				CodexSaveStore.SaveIfDirty();
			}
		}

		public static void Close()
		{
			if (IsOpen)
			{
				IsOpen = false;
				CodexSaveStore.SaveIfDirty();
			}
		}

		public static void TickInput()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(ModConfig.CodexHotkey.Value) && SemiFunc.NoTextInputsActive())
			{
				Toggle();
			}
			else if (IsOpen && Input.GetKeyDown((KeyCode)27))
			{
				Close();
			}
			if (IsOpen)
			{
				SemiFunc.CursorUnlock(0.15f);
				SemiFunc.InputDisableAiming();
				SemiFunc.InputDisableMovement();
				Cursor.visible = true;
				Cursor.lockState = (CursorLockMode)0;
			}
		}

		public static void Draw()
		{
			//IL_0023: 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_0099: 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_009f: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			if (IsOpen)
			{
				EnsureStyles();
				UiTheme.DrawRect(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), new Color(0f, 0f, 0f, 0.58f));
				float num = Mathf.Min(960f, (float)Screen.width - 48f);
				float num2 = Mathf.Min(650f, (float)Screen.height - 48f);
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((float)Screen.width - num) * 0.5f, ((float)Screen.height - num2) * 0.5f, num, num2);
				UiTheme.DrawBorderedBox(val, UiTheme.BgDark, UiTheme.Gold * 0.8f, 2f);
				UiTheme.DrawRect(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 4f), UiTheme.Gold);
				DrawHeader(val);
				DrawTabBar(val);
				Rect area = default(Rect);
				((Rect)(ref area))..ctor(((Rect)(ref val)).x + 16f, ((Rect)(ref val)).y + 114f, ((Rect)(ref val)).width - 32f, ((Rect)(ref val)).height - 130f);
				switch (_activeTab)
				{
				case 0:
					DrawCodexTab(area);
					break;
				case 1:
					DrawPerksTab(area);
					break;
				case 2:
					DrawBriefingTab(area);
					break;
				case 3:
					DrawControlsTab(area);
					break;
				}
			}
		}

		private static void DrawHeader(Rect win)
		{
			//IL_0026: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_0186: Unknown result type (might be due to invalid IL or missing references)
			float num = ((Rect)(ref win)).x + 16f;
			float num2 = ((Rect)(ref win)).y + 14f;
			_headerStyle.normal.textColor = UiTheme.Gold;
			GUI.Label(new Rect(num, num2, 480f, 26f), "CURSED CARGO // SYNDICATE CONTAINMENT TERMINAL", _headerStyle);
			int clearanceRank = CodexSaveStore.ClearanceRank;
			int containmentXp = CodexSaveStore.Profile.containmentXp;
			int xpForCurrentRank = CodexSaveStore.XpForCurrentRank;
			int xpForNextRank = CodexSaveStore.XpForNextRank;
			float progress = ((clearanceRank >= 10) ? 1f : Mathf.Clamp01((float)(containmentXp - xpForCurrentRank) / (float)Mathf.Max(1, xpForNextRank - xpForCurrentRank)));
			_mutedStyle.normal.textColor = UiTheme.TextMuted;
			GUI.Label(new Rect(num, num2 + 26f, 280f, 18f), $"Clearance Rank {clearanceRank}/10   |   Codex: {CodexSaveStore.DiscoveredCount}/{AnomalyCatalog.All.Count}   |   Perks: {CodexSaveStore.Profile.equippedPerks.Count}/{PerkCatalog.GetMaxEquipSlots(clearanceRank)}", _mutedStyle);
			UiTheme.DrawProgressBar(new Rect(num + 295f, num2 + 30f, 240f, 10f), progress, UiTheme.Gold, new Color(0.18f, 0.21f, 0.28f, 0.9f));
			if (GUI.Button(new Rect(((Rect)(ref win)).xMax - 92f, num2 + 2f, 76f, 28f), "CLOSE [X]", _btnStyle))
			{
				Close();
			}
		}

		private static void DrawTabBar(Rect win)
		{
			//IL_0079: 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_0095: 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_00a5: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			string[] array = new string[4] { "FIELD CODEX (24)", "CONTAINMENT PERKS (12)", "SYNDICATE BRIEFING", "TELEMETRY & CONTROLS" };
			float num = ((Rect)(ref win)).x + 16f;
			float num2 = ((Rect)(ref win)).y + 72f;
			float num3 = (((Rect)(ref win)).width - 32f - 18f) / 4f;
			for (int i = 0; i < array.Length; i++)
			{
				Rect val = new Rect(num + (float)i * (num3 + 6f), num2, num3, 32f);
				bool flag = _activeTab == i;
				UiTheme.DrawBorderedBox(val, flag ? UiTheme.BgCardHover : UiTheme.BgPanel, flag ? UiTheme.Gold : UiTheme.BorderSubtle, flag ? 1.5f : 1f);
				_tabBtnStyle.normal.textColor = (flag ? UiTheme.Gold : UiTheme.TextPrimary);
				if (GUI.Button(val, array[i], _tabBtnStyle))
				{
					_activeTab = i;
				}
			}
		}

		private static void DrawCodexTab(Rect area)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
			string[] array = new string[5] { "ALL", "UNCOMMON", "RARE", "VOLATILE", "ELDRITCH" };
			float num = ((Rect)(ref area)).x;
			for (int i = -1; i <= 3; i++)
			{
				Rect val = new Rect(num, ((Rect)(ref area)).y, 102f, 24f);
				bool flag = _tierFilter == i;
				Color val2 = ((i < 0) ? UiTheme.TextPrimary : AnomalyDefinition.GetTierColor((AnomalyTier)i));
				UiTheme.DrawBorderedBox(val, flag ? (val2 * 0.25f) : UiTheme.BgPanel, flag ? val2 : UiTheme.BorderSubtle);
				_tabBtnStyle.normal.textColor = (flag ? val2 : UiTheme.TextMuted);
				if (GUI.Button(val, array[i + 1], _tabBtnStyle))
				{
					_tierFilter = i;
				}
				num += 108f;
			}
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(((Rect)(ref area)).x, ((Rect)(ref area)).y + 32f, 340f, ((Rect)(ref area)).height - 32f);
			Rect val3 = default(Rect);
			((Rect)(ref val3))..ctor(((Rect)(ref rect)).xMax + 14f, ((Rect)(ref area)).y + 32f, ((Rect)(ref area)).width - ((Rect)(ref rect)).width - 14f, ((Rect)(ref area)).height - 32f);
			UiTheme.DrawBorderedBox(rect, UiTheme.BgPanel, UiTheme.BorderSubtle);
			UiTheme.DrawBorderedBox(val3, UiTheme.BgPanel, UiTheme.BorderSubtle);
			List<AnomalyDefinition> list = new List<AnomalyDefinition>();
			foreach (AnomalyDefinition item in AnomalyCatalog.All)
			{
				if (_tierFilter < 0 || item.Tier == (AnomalyTier)_tierFilter)
				{
					list.Add(item);
				}
			}
			float num2 = 38f;
			Rect val4 = default(Rect);
			((Rect)(ref val4))..ctor(0f, 0f, ((Rect)(ref rect)).width - 20f, Mathf.Max(((Rect)(ref rect)).height - 8f, (float)list.Count * (num2 + 4f) + 8f));
			_codexListScroll = GUI.BeginScrollView(new Rect(((Rect)(ref rect)).x + 4f, ((Rect)(ref rect)).y + 4f, ((Rect)(ref rect)).width - 8f, ((Rect)(ref rect)).height - 8f), _codexListScroll, val4);
			Rect val5 = default(Rect);
			for (int j = 0; j < list.Count; j++)
			{
				AnomalyDefinition anomalyDefinition = list[j];
				AnomalyCodexEntry entry = CodexSaveStore.GetEntry(anomalyDefinition.Type);
				bool flag2 = entry?.discovered ?? false;
				bool flag3 = _selectedAnomaly == anomalyDefinition.Type;
				((Rect)(ref val5))..ctor(2f, 4f + (float)j * (num2 + 4f), ((Rect)(ref val4)).width - 4f, num2);
				UiTheme.DrawBorderedBox(val5, flag3 ? UiTheme.BgCardHover : UiTheme.BgCard, flag3 ? anomalyDefinition.PrimaryColor : UiTheme.BorderSubtle, flag3 ? 1.5f : 1f);
				UiTheme.DrawRect(new Rect(((Rect)(ref val5)).x, ((Rect)(ref val5)).y, 4f, ((Rect)(ref val5)).height), anomalyDefinition.PrimaryColor);
				_labelStyle.normal.textColor = (flag2 ? UiTheme.TextPrimary : UiTheme.TextMuted);
				string text = (flag2 ? ("[" + anomalyDefinition.Code + "] " + anomalyDefinition.DisplayName) : ("[" + anomalyDefinition.Code + "] " + anomalyDefinition.DisplayName + " (Undiscovered)"));
				GUI.Label(new Rect(((Rect)(ref val5)).x + 10f, ((Rect)(ref val5)).y + 3f, ((Rect)(ref val5)).width - 84f, 18f), text, _labelStyle);
				_mutedStyle.normal.textColor = anomalyDefinition.PrimaryColor;
				GUI.Label(new Rect(((Rect)(ref val5)).x + 10f, ((Rect)(ref val5)).y + 20f, ((Rect)(ref val5)).width - 84f, 16f), $"{anomalyDefinition.TierLabel}  •  +{anomalyDefinition.BonusPercent}% Value", _mutedStyle);
				_mutedStyle.normal.textColor = (flag2 ? UiTheme.Green : UiTheme.TextMuted);
				GUI.Label(new Rect(((Rect)(ref val5)).xMax - 72f, ((Rect)(ref val5)).y + 10f, 66f, 18f), flag2 ? $"x{entry.extractedCount}" : "LOCKED", _mutedStyle);
				if (GUI.Button(val5, GUIContent.none, GUIStyle.none))
				{
					_selectedAnomaly = anomalyDefinition.Type;
				}
			}
			GUI.EndScrollView();
			DrawAnomalyDetail(val3, AnomalyCatalog.GetRequired(_selectedAnomaly));
		}

		private static void DrawAnomalyDetail(Rect area, AnomalyDefinition def)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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)
			//IL_0121: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: 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_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			AnomalyCodexEntry entry = CodexSaveStore.GetEntry(def.Type);
			bool flag = entry?.discovered ?? false;
			float num = ((Rect)(ref area)).x + 18f;
			float num2 = ((Rect)(ref area)).y + 16f;
			float num3 = ((Rect)(ref area)).width - 36f;
			UiTheme.DrawRect(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y, ((Rect)(ref area)).width, 4f), def.PrimaryColor);
			_headerStyle.normal.textColor = def.PrimaryColor;
			GUI.Label(new Rect(num, num2, num3, 28f), "[" + def.Code + "]  " + def.DisplayName.ToUpperInvariant(), _headerStyle);
			num2 += 28f;
			_subHeaderStyle.normal.textColor = UiTheme.TextMuted;
			GUI.Label(new Rect(num, num2, num3, 20f), $"{def.TierLabel} ANOMALY   |   {def.Tagline}   |   BASE VALUE: +{def.BonusPercent}%", _subHeaderStyle);
			num2 += 28f;
			UiTheme.DrawRect(new Rect(num, num2, num3, 1f), UiTheme.BorderSubtle);
			num2 += 12f;
			_subHeaderStyle.normal.textColor = UiTheme.Gold;
			GUI.Label(new Rect(num, num2, num3, 18f), "BEHAVIOR & MECHANICS", _subHeaderStyle);
			num2 += 20f;
			_labelStyle.normal.textColor = UiTheme.TextPrimary;
			GUI.Label(new Rect(num, num2, num3, 62f), def.EffectSummary, _labelStyle);
			num2 += 66f;
			_subHeaderStyle.normal.textColor = UiTheme.Green;
			GUI.Label(new Rect(num, num2, num3, 18f), "CONTAINMENT COUNTERPLAY", _subHeaderStyle);
			num2 += 20f;
			_labelStyle.normal.textColor = UiTheme.TextPrimary;
			GUI.Label(new Rect(num, num2, num3, 54f), def.CounterplayTip, _labelStyle);
			num2 += 58f;
			_subHeaderStyle.normal.textColor = def.SecondaryColor;
			GUI.Label(new Rect(num, num2, num3, 18f), "SYNDICATE ARCHIVE NOTE", _subHeaderStyle);
			num2 += 20f;
			_mutedStyle.normal.textColor = UiTheme.TextMuted;
			GUI.Label(new Rect(num, num2, num3, 60f), flag ? def.CodexLore : "Encounter this anomaly in the field to decrypt the Syndicate archive dossier.", _mutedStyle);
			num2 += 68f;
			UiTheme.DrawRect(new Rect(num, num2, num3, 1f), UiTheme.BorderSubtle);
			num2 += 12f;
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(num, num2, num3, 78f);
			UiTheme.DrawBorderedBox(rect, UiTheme.BgCard, UiTheme.BorderSubtle);
			_labelStyle.normal.textColor = UiTheme.TextPrimary;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 10f, num3 - 24f, 20f), string.Format("Status: {0}    |    Audio Signature: {1}", flag ? "CATALOGED" : "UNDISCOVERED", def.AudioProfile), _labelStyle);
			GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 32f, num3 - 24f, 20f), $"Total Extracted: {entry?.extractedCount ?? 0}    |    Pristine Deliveries: {entry?.pristineCount ?? 0}", _labelStyle);
			GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 52f, num3 - 24f, 20f), $"Highest Recorded Appraisal: ${entry?.highestValue ?? 0:N0}", _labelStyle);
		}

		private static void DrawPerksTab(Rect area)
		{
			//IL_0025: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: 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_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			int maxEquipSlots = PerkCatalog.GetMaxEquipSlots(CodexSaveStore.ClearanceRank);
			int count = CodexSaveStore.Profile.equippedPerks.Count;
			_subHeaderStyle.normal.textColor = UiTheme.TextPrimary;
			GUI.Label(new Rect(((Rect)(ref area)).x, ((Rect)(ref area)).y, ((Rect)(ref area)).width, 22f), $"ACTIVE LOADOUT: {count} / {maxEquipSlots} SLOTS   (Unlock extra slots at Clearance Rank 5 and Rank 9. Earn XP by discovering & extracting anomalies!)", _subHeaderStyle);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref area)).x, ((Rect)(ref area)).y + 28f, ((Rect)(ref area)).width, ((Rect)(ref area)).height - 28f);
			int num = 2;
			int num2 = Mathf.CeilToInt((float)PerkCatalog.All.Count / (float)num);
			float num3 = (((Rect)(ref val)).width - 28f) / (float)num;
			float num4 = 104f;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(0f, 0f, ((Rect)(ref val)).width - 18f, (float)num2 * (num4 + 10f) + 8f);
			_perksScroll = GUI.BeginScrollView(val, _perksScroll, val2);
			Rect rect = default(Rect);
			Rect val3 = default(Rect);
			for (int i = 0; i < PerkCatalog.All.Count; i++)
			{
				ContainmentPerkDefinition containmentPerkDefinition = PerkCatalog.All[i];
				int num5 = i % num;
				int num6 = i / num;
				((Rect)(ref rect))..ctor((float)num5 * (num3 + 10f), (float)num6 * (num4 + 10f), num3, num4);
				bool flag = CodexSaveStore.IsPerkUnlocked(containmentPerkDefinition.Type);
				bool flag2 = CodexSaveStore.IsPerkEquipped(containmentPerkDefinition.Type);
				Color border = (Color)(flag2 ? containmentPerkDefinition.AccentColor : (flag ? UiTheme.BorderSubtle : new Color(0.22f, 0.22f, 0.25f, 0.6f)));
				UiTheme.DrawBorderedBox(rect, flag2 ? UiTheme.BgCardHover : UiTheme.BgCard, border, flag2 ? 2f : 1f);
				UiTheme.DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 5f, ((Rect)(ref rect)).height), flag ? containmentPerkDefinition.AccentColor : Color.gray);
				_subHeaderStyle.normal.textColor = (flag ? containmentPerkDefinition.AccentColor : UiTheme.TextMuted);
				GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 8f, ((Rect)(ref rect)).width - 110f, 20f), containmentPerkDefinition.Name, _subHeaderStyle);
				_labelStyle.normal.textColor = (flag ? UiTheme.TextPrimary : UiTheme.TextMuted);
				GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 30f, ((Rect)(ref rect)).width - 22f, 20f), containmentPerkDefinition.ShortEffect, _labelStyle);
				_mutedStyle.normal.textColor = UiTheme.TextMuted;
				GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 50f, ((Rect)(ref rect)).width - 22f, 46f), containmentPerkDefinition.DetailedDescription, _mutedStyle);
				((Rect)(ref val3))..ctor(((Rect)(ref rect)).xMax - 96f, ((Rect)(ref rect)).y + 8f, 86f, 24f);
				if (!flag)
				{
					_mutedStyle.normal.textColor = UiTheme.Red;
					GUI.Label(val3, $"RANK {containmentPerkDefinition.RequiredRank}", _mutedStyle);
				}
				else if (GUI.Button(val3, flag2 ? "EQUIPPED" : "EQUIP", _btnStyle) && CodexSaveStore.TogglePerk(containmentPerkDefinition.Type) && SemiFunc.IsMasterClientOrSingleplayer())
				{
					NetworkSync.BroadcastLevelState(RunSessionManager.ActiveIncident, RunSessionManager.ActiveContract, CodexSaveStore.GetEquippedPerkMask());
				}
			}
			GUI.EndScrollView();
		}

		private static void DrawBriefingTab(Rect area)
		{
			//IL_0000: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0068: 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_0088: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: 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_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			Rect val = area;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(0f, 0f, ((Rect)(ref area)).width - 18f, 760f);
			_briefingScroll = GUI.BeginScrollView(val, _briefingScroll, val2);
			float num = 4f;
			float num2 = ((Rect)(ref val2)).width - 8f;
			ContrabandIncidentDefinition contrabandIncidentDefinition = IncidentCatalog.Get(RunSessionManager.ActiveIncident);
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(4f, num, num2, 118f);
			UiTheme.DrawBorderedBox(rect, UiTheme.BgCard, contrabandIncidentDefinition.AccentColor, 1.5f);
			_subHeaderStyle.normal.textColor = contrabandIncidentDefinition.AccentColor;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).y + 10f, num2 - 28f, 20f), "ACTIVE INCIDENT: " + contrabandIncidentDefinition.Name.ToUpperInvariant() + "  [" + contrabandIncidentDefinition.ShortTag + "]", _subHeaderStyle);
			_labelStyle.normal.textColor = UiTheme.TextPrimary;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).y + 32f, num2 - 28f, 34f), contrabandIncidentDefinition.Description, _labelStyle);
			SyndicateContract activeContract = RunSessionManager.ActiveContract;
			string text = ((activeContract != null) ? $"ACTIVE CONTRACT: {activeContract.Title} — {activeContract.Description}  [{activeContract.StatusText} | +${activeContract.RewardCurrency:N0}]" : "ACTIVE CONTRACT: None assigned (enter a level to receive a Syndicate Bounty).");
			_labelStyle.normal.textColor = UiTheme.Gold;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).y + 72f, num2 - 28f, 36f), text, _labelStyle);
			num += 130f;
			_subHeaderStyle.normal.textColor = UiTheme.Gold;
			GUI.Label(new Rect(4f, num, num2, 22f), "EXTRACTION SYNERGY COMBOS (EXTRACT MATCHING SETS IN THE SAME EXTRACTION TUBE)", _subHeaderStyle);
			num += 26f;
			Rect rect2 = default(Rect);
			for (int i = 0; i < ComboCatalog.All.Count; i++)
			{
				ExtractionComboDefinition extractionComboDefinition = ComboCatalog.All[i];
				bool flag = CodexSaveStore.HasCombo(extractionComboDefinition.Id);
				((Rect)(ref rect2))..ctor(4f, num, num2, 46f);
				UiTheme.DrawBorderedBox(rect2, UiTheme.BgCard, flag ? extractionComboDefinition.AccentColor : UiTheme.BorderSubtle);
				UiTheme.DrawRect(new Rect(((Rect)(ref rect2)).x, ((Rect)(ref rect2)).y, 4f, ((Rect)(ref rect2)).height), extractionComboDefinition.AccentColor);
				_subHeaderStyle.normal.textColor = extractionComboDefinition.AccentColor;
				GUI.Label(new Rect(((Rect)(ref rect2)).x + 12f, ((Rect)(ref rect2)).y + 4f, 240f, 18f), extractionComboDefinition.Name.ToUpperInvariant(), _subHeaderStyle);
				_labelStyle.normal.textColor = UiTheme.Gold;
				GUI.Label(new Rect(((Rect)(ref rect2)).xMax - 190f, ((Rect)(ref rect2)).y + 4f, 100f, 18f), $"+${extractionComboDefinition.BaseBonusCurrency:N0}", _labelStyle);
				_mutedStyle.normal.textColor = (flag ? UiTheme.Green : UiTheme.TextMuted);
				GUI.Label(new Rect(((Rect)(ref rect2)).xMax - 86f, ((Rect)(ref rect2)).y + 4f, 78f, 18f), flag ? "LOGGED" : "UNSEEN", _mutedStyle);
				_mutedStyle.normal.textColor = UiTheme.TextPrimary;
				GUI.Label(new Rect(((Rect)(ref rect2)).x + 12f, ((Rect)(ref rect2)).y + 23f, num2 - 24f, 18f), extractionComboDefinition.RequirementText, _mutedStyle);
				num += 52f;
			}
			GUI.EndScrollView();
		}

		private static void DrawControlsTab(Rect area)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			float num = ((Rect)(ref area)).x + 6f;
			float num2 = ((Rect)(ref area)).y + 6f;
			float num3 = ((Rect)(ref area)).width - 12f;
			CodexProfileData profile = CodexSaveStore.Profile;
			UiTheme.DrawBorderedBox(new Rect(num, num2, num3, 106f), UiTheme.BgCard, UiTheme.BorderSubtle);
			_subHeaderStyle.normal.textColor = UiTheme.Gold;
			GUI.Label(new Rect(num + 14f, num2 + 10f, num3 - 28f, 20f), "LIFETIME SYNDICATE SERVICE RECORD", _subHeaderStyle);
			_labelStyle.normal.textColor = UiTheme.TextPrimary;
			GUI.Label(new Rect(num + 14f, num2 + 34f, num3 - 28f, 20f), $"Total Anomalies Extracted: {profile.totalAnomaliesExtracted}   |   Pristine Deliveries: {profile.totalPristineExtracted}   |   Contracts Completed: {profile.totalContractsCompleted}", _labelStyle);
			GUI.Label(new Rect(num + 14f, num2 + 56f, num3 - 28f, 20f), $"Lifetime Cursed Earnings: ${profile.totalCursedEarnings:N0}   |   Combos Logged: {profile.triggeredCombos.Count}/{ComboCatalog.All.Count}   |   Incidents Survived: {profile.experiencedIncidents.Count}/10", _labelStyle);
			GUI.Label(new Rect(num + 14f, num2 + 78f, num3 - 28f, 20f), $"Current Level — Active Anomalies: {RunSessionManager.ActiveAnomalies.Count}   |   Extracted This Level: {RunSessionManager.LevelExtractedHistory.Count}   |   Volatile Detonations: {RunSessionManager.VolatileDetonationsThisLevel}", _labelStyle);
			num2 += 120f;
			UiTheme.DrawBorderedBox(new Rect(num, num2, num3, 210f), UiTheme.BgCard, UiTheme.BorderSubtle);
			_subHeaderStyle.normal.textColor = UiTheme.TextPrimary;
			GUI.Label(new Rect(num + 14f, num2 + 10f, num3 - 28f, 20f), "QUICK CLIENT PREFERENCES (ALL SETTINGS ALSO AVAILABLE IN REPOConfig / BEPINEX CONFIG)", _subHeaderStyle);
			float num4 = num2 + 38f;
			ModConfig.EnableScannerHud.Value = GUI.Toggle(new Rect(num + 16f, num4, 320f, 22f), ModConfig.EnableScannerHud.Value, " Enable Live Anomaly Scanner HUD");
			ModConfig.EnableTelemetryStrip.Value = GUI.Toggle(new Rect(num + 360f, num4, 320f, 22f), ModConfig.EnableTelemetryStrip.Value, " Enable Top-Right Incident & Contract Strip");
			num4 += 28f;
			ModConfig.EnableVisualAuras.Value = GUI.Toggle(new Rect(num + 16f, num4, 320f, 22f), ModConfig.EnableVisualAuras.Value, " Enable Glowing Anomaly Visual Auras");
			ModConfig.EnableHazardBeacons.Value = GUI.Toggle(new Rect(num + 360f, num4, 320f, 22f), ModConfig.EnableHazardBeacons.Value, " Enable Hazard Sense World Beacons");
			num4 += 28f;
			ModConfig.EnableProceduralAudio.Value = GUI.Toggle(new Rect(num + 16f, num4, 320f, 22f), ModConfig.EnableProceduralAudio.Value, " Enable Synthesized Anomaly Sound Effects");
			ModConfig.EnableVoicePitchEffects.Value = GUI.Toggle(new Rect(num + 360f, num4, 320f, 22f), ModConfig.EnableVoicePitchEffects.Value, " Enable Helium / Eldritch Voice Pitch FX");
			num4 += 34f;
			_labelStyle.normal.textColor = UiTheme.TextPrimary;
			GUI.Label(new Rect(num + 16f, num4, 200f, 20f), $"SFX Volume: {Mathf.RoundToInt(ModConfig.AudioVolume.Value * 100f)}%", _labelStyle);
			ModConfig.AudioVolume.Value = GUI.HorizontalSlider(new Rect(num + 210f, num4 + 4f, 260f, 18f), ModConfig.AudioVolume.Value, 0f, 1.5f);
			num4 += 36f;
			if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.RunIsLevel())
			{
				if (GUI.Button(new Rect(num + 16f, num4, 260f, 28f), "HOST: MUTATE HELD / AIMED VALUABLE", _btnStyle))
				{
					CargoChatCommands.TryMutateTargetValuable();
				}
				if (GUI.Button(new Rect(num + 290f, num4, 240f, 28f), "HOST: RE-SYNC STATE TO LOBBY", _btnStyle))
				{
					RunSessionManager.BroadcastFullStateToClients();
					RunSessionManager.PushToast("STATE RE-SYNCED", "Broadcasted anomaly & contract state to all players.", UiTheme.Green, 3.5f);
				}
			}
			else
			{
				_mutedStyle.normal.textColor = UiTheme.TextMuted;
				GUI.Label(new Rect(num + 16f, num4, num3 - 32f, 24f), "Host sandbox controls become available during an active level when you are the Host or playing Solo.", _mutedStyle);
			}
		}

		private static void EnsureStyles()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_0090: 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_009d: 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_00b0: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Expected O, but got Unknown
			if (_headerStyle == null)
			{
				_headerStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 18,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3
				};
				_subHeaderStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 12,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3
				};
				_labelStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 12,
					wordWrap = true,
					alignment = (TextAnchor)0
				};
				_mutedStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					wordWrap = true,
					alignment = (TextAnchor)0
				};
				_btnStyle = new GUIStyle(GUI.skin.button)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1
				};
				_tabBtnStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
			}
		}
	}
	public static class UiTheme
	{
		private static readonly Dictionary<Color32, Texture2D> SolidCache = new Dictionary<Color32, Texture2D>();

		public static readonly Color BgDark = new Color(0.06f, 0.08f, 0.11f, 0.92f);

		public static readonly Color BgPanel = new Color(0.1f, 0.13f, 0.18f, 0.94f);

		public static readonly Color BgCard = new Color(0.13f, 0.16f, 0.22f, 0.94f);

		public static readonly Color BgCardHover = new Color(0.18f, 0.22f, 0.3f, 0.96f);

		public static readonly Color BorderSubtle = new Color(0.28f, 0.35f, 0.45f, 0.7f);

		public static readonly Color TextPrimary = new Color(0.95f, 0.97f, 1f, 1f);

		public static readonly Color TextMuted = new Color(0.68f, 0.75f, 0.84f, 1f);

		public static readonly Color Gold = new Color(1f, 0.84f, 0.26f, 1f);

		public static readonly Color Green = new Color(0.28f, 0.94f, 0.6f, 1f);

		public static readonly Color Red = new Color(1f, 0.32f, 0.32f, 1f);

		public static Texture2D Solid(Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0036: 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)
			Color32 key = Color32.op_Implicit(color);
			if (SolidCache.TryGetValue(key, out Texture2D value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			value = new Texture2D(1, 1, (TextureFormat)4, false)
			{
				hideFlags = (HideFlags)61
			};
			value.SetPixel(0, 0, color);
			value.Apply();
			SolidCache[key] = value;
			return value;
		}

		public static void DrawRect(Rect rect, Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			GUI.DrawTexture(rect, (Texture)(object)Solid(color));
		}

		public static void DrawBorderedBox(Rect rect, Color fill, Color border, float borderThickness = 1f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: 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_0022: 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_0061: 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_0084: 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)
			DrawRect(rect, fill);
			DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, borderThickness), border);
			DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - borderThickness, ((Rect)(ref rect)).width, borderThickness), border);
			DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, borderThickness, ((Rect)(ref rect)).height), border);
			DrawRect(new Rect(((Rect)(ref rect)).xMax - borderThickness, ((Rect)(ref rect)).y, borderThickness, ((Rect)(ref rect)).height), border);
		}

		public static void DrawProgressBar(Rect rect, float progress01, Color fillColor, Color bgColor)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			DrawRect(rect, bgColor);
			float num = Mathf.Clamp01(progress01) * ((Rect)(ref rect)).width;
			if (num > 0.5f)
			{
				DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, num, ((Rect)(ref rect)).height), fillColor);
			}
		}
	}
	public static class ScannerHud
	{
		private static GUIStyle? _titleStyle;

		private static GUIStyle? _badgeStyle;

		private static GUIStyle? _bodyStyle;

		private static GUIStyle? _smallStyle;

		private static GUIStyle? _valueStyle;

		private static GUIStyle? _centerSmallStyle;

		public static void Draw()
		{
			EnsureStyles();
			DrawToasts();
			if (SemiFunc.IsMainMenu() || CodexTerminalUI.IsOpen)
			{
				return;
			}
			if (SemiFunc.RunIsShop())
			{
				if (ModConfig.EnableTelemetryStrip.Value)
				{
					DrawShopTerminalPrompt();
				}
			}
			else if (SemiFunc.RunIsLevel())
			{
				if (ModConfig.EnableHazardBeacons.Value && RunSessionManager.HasPerk(ContainmentPerkType.HazardSense))
				{
					DrawHazardBeacons();
				}
				if (ModConfig.EnableTelemetryStrip.Value)
				{
					DrawTelemetryStrip();
				}
				if (ModConfig.EnableScannerHud.Value)
				{
					DrawActiveAnomalyScanner();
				}
			}
		}

		private static void DrawActiveAnomalyScanner()
		{
			//IL_00a9: 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_00b1: 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_00e4: 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_013a: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: 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_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			AnomalousCargo focusedAnomaly = GetFocusedAnomaly();
			if (!((Object)(object)focusedAnomaly == (Object)null) && focusedAnomaly.Definition != null && !((Object)(object)focusedAnomaly.Valuable == (Object)null))
			{
				focusedAnomaly.MarkLocalDiscovered();
				AnomalyDefinition definition = focusedAnomaly.Definition;
				float num = 370f;
				float num2 = ((!string.IsNullOrEmpty(focusedAnomaly.MeterLabel)) ? 24f : 0f);
				float num3 = ((!string.IsNullOrEmpty(focusedAnomaly.LiveStatusNote)) ? 20f : 0f);
				float num4 = 128f + num2 + num3;
				float num5 = ((float)Screen.width - num) * 0.5f;
				float num6 = (float)Screen.height - num4 - 98f;
				Rect rect = default(Rect);
				((Rect)(ref rect))..ctor(num5, num6, num, num4);
				UiTheme.DrawBorderedBox(rect, UiTheme.BgDark, definition.PrimaryColor * 0.85f, 1.5f);
				UiTheme.DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 5f, ((Rect)(ref rect)).height), definition.PrimaryColor);
				float num7 = ((Rect)(ref rect)).x + 14f;
				float num8 = ((Rect)(ref rect)).y + 8f;
				float num9 = ((Rect)(ref rect)).width - 24f;
				_titleStyle.normal.textColor = (focusedAnomaly.IsOvercharged ? UiTheme.Gold : UiTheme.TextPrimary);
				string text = (focusedAnomaly.IsOvercharged ? ("[" + definition.Code + "] OVERCHARGED " + definition.DisplayName.ToUpperInvariant()) : ("[" + definition.Code + "] " + definition.DisplayName.ToUpperInvariant()));
				GUI.Label(new Rect(num7, num8, num9 - 92f, 22f), text, _titleStyle);
				Rect val = new Rect(((Rect)(ref rect)).xMax - 92f, num8 + 1f, 82f, 19f);
				UiTheme.DrawRect(val, definition.PrimaryColor * 0.3f);
				UiTheme.DrawBorderedBox(val, Color.clear, definition.PrimaryColor);
				_badgeStyle.normal.textColor = definition.PrimaryColor;
				GUI.Label(val, definition.TierLabel, _badgeStyle);
				num8 += 24f;
				int num10 = Mathf.RoundToInt(focusedAnomaly.Valuable.dollarValueCurrent);
				_valueStyle.normal.textColor = UiTheme.Gold;
				GUI.Label(new Rect(num7, num8, 170f, 20f), $"${num10:N0}  (+{definition.BonusPercent}%)", _valueStyle);
				_smallStyle.normal.textColor = (focusedAnomaly.HasTakenDamage ? UiTheme.Red : UiTheme.Green);
				GUI.Label(new Rect(num7 + 175f, num8 + 2f, num9 - 175f, 18f), focusedAnomaly.HasTakenDamage ? "INTEGRITY: DAMAGED" : "INTEGRITY: PRISTINE", _smallStyle);
				num8 += 22f;
				if (!string.IsNullOrEmpty(focusedAnomaly.MeterLabel))
				{
					_smallStyle.normal.textColor = UiTheme.TextMuted;
					GUI.Label(new Rect(num7, num8, 130f, 16f), focusedAnomaly.MeterLabel, _smallStyle);
					UiTheme.DrawProgressBar(new Rect(num7 + 132f, num8 + 3f, num9 - 134f, 11f), fillColor: (focusedAnomaly.AnomalyType == AnomalyType.VolatileNitro) ? Color.Lerp(UiTheme.Gold, UiTheme.Red, focusedAnomaly.MeterPrimary) : definition.PrimaryColor, progress01: focusedAnomaly.MeterPrimary, bgColor: new Color(0.18f, 0.21f, 0.28f, 0.9f));
					num8 += 22f;
				}
				if (!string.IsNullOrEmpty(focusedAnomaly.LiveStatusNote))
				{
					_smallStyle.normal.textColor = definition.SecondaryColor;
					GUI.Label(new Rect(num7, num8, num9, 18f), "> " + focusedAnomaly.LiveStatusNote, _smallStyle);
					num8 += 20f;
				}
				_bodyStyle.normal.textColor = UiTheme.TextPrimary;
				GUI.Label(new Rect(num7, num8, num9, 34f), definition.EffectSummary, _bodyStyle);
				num8 += 34f;
				_smallStyle.normal.textColor = UiTheme.TextMuted;
				GUI.Label(new Rect(num7, num8, num9, 32f), "TIP: " + definition.CounterplayTip, _smallStyle);
			}
		}

		private static void DrawTelemetryStrip()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_013c: 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_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			float num = 278f;
			SyndicateContract activeContract = RunSessionManager.ActiveContract;
			float num2 = ((activeContract != null) ? 104f : 62f);
			float num3 = (float)Screen.width - num - 16f;
			float num4 = 16f;
			ContrabandIncidentDefinition contrabandIncidentDefinition = IncidentCatalog.Get(RunSessionManager.ActiveIncident);
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(num3, num4, num, num2);
			UiTheme.DrawBorderedBox(rect, UiTheme.BgDark, UiTheme.BorderSubtle);
			UiTheme.DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 3f), contrabandIncidentDefinition.AccentColor);
			float num5 = ((Rect)(ref rect)).x + 10f;
			float num6 = ((Rect)(ref rect)).y + 8f;
			float num7 = ((Rect)(ref rect)).width - 20f;
			_titleStyle.normal.textColor = contrabandIncidentDefinition.AccentColor;
			GUI.Label(new Rect(num5, num6, num7 - 72f, 18f), contrabandIncidentDefinition.Name.ToUpperInvariant(), _titleStyle);
			_smallStyle.normal.textColor = UiTheme.TextMuted;
			GUI.Label(new Rect(((Rect)(ref rect)).xMax - 76f, num6 + 1f, 68f, 16f), $"[{ModConfig.CodexHotkey.Value}] CODEX", _smallStyle);
			num6 += 20f;
			_smallStyle.normal.textColor = UiTheme.TextPrimary;
			int count = RunSessionManager.ActiveAnomalies.Count;
			int count2 = RunSessionManager.LevelExtractedHistory.Count;
			GUI.Label(new Rect(num5, num6, num7, 17f), $"Active Anomalies: {count}   |   Extracted: {count2}", _smallStyle);
			num6 += 21f;
			if (activeContract != null)
			{
				UiTheme.DrawRect(new Rect(num5, num6, num7, 1f), UiTheme.BorderSubtle);
				num6 += 5f;
				Color val = (activeContract.Completed ? UiTheme.Green : (activeContract.Failed ? UiTheme.Red : UiTheme.Gold));
				_smallStyle.normal.textColor = val;
				GUI.Label(new Rect(num5, num6, num7 - 70f, 16f), "CONTRACT: " + activeContract.Title, _smallStyle);
				_smallStyle.normal.textColor = UiTheme.Gold;
				GUI.Label(new Rect(((Rect)(ref rect)).xMax - 72f, num6, 64f, 16f), $"+${activeContract.RewardCurrency:N0}", _smallStyle);
				num6 += 17f;
				_smallStyle.normal.textColor = UiTheme.TextMuted;
				GUI.Label(new Rect(num5, num6, num7 - 76f, 16f), activeContract.Description, _smallStyle);
				_smallStyle.normal.textColor = val;
				GUI.Label(new Rect(((Rect)(ref rect)).xMax - 80f, num6, 72f, 16f), activeContract.StatusText, _smallStyle);
				num6 += 18f;
				UiTheme.DrawProgressBar(new Rect(num5, num6, num7, 6f), activeContract.Progress01, val, new Color(0.16f, 0.2f, 0.26f, 0.9f));
			}
		}

		private static void DrawShopTerminalPrompt()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
			float num = 278f;
			float num2 = 64f;
			float num3 = (float)Screen.width - num - 16f;
			float num4 = 16f;
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor(num3, num4, num, num2);
			UiTheme.DrawBorderedBox(rect, UiTheme.BgDark, UiTheme.Gold * 0.75f);
			UiTheme.DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 3f), UiTheme.Gold);
			int clearanceRank = CodexSaveStore.ClearanceRank;
			int count = CodexSaveStore.Profile.equippedPerks.Count;
			int maxEquipSlots = PerkCatalog.GetMaxEquipSlots(clearanceRank);
			_titleStyle.normal.textColor = UiTheme.Gold;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 10f, ((Rect)(ref rect)).y + 8f, ((Rect)(ref rect)).width - 20f, 18f), "SYNDICATE CONTAINMENT TERMINAL", _titleStyle);
			_smallStyle.normal.textColor = UiTheme.TextPrimary;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 10f, ((Rect)(ref rect)).y + 27f, ((Rect)(ref rect)).width - 20f, 16f), $"Clearance Rank {clearanceRank}/10  |  Perks: {count}/{maxEquipSlots}", _smallStyle);
			_smallStyle.normal.textColor = UiTheme.TextMuted;
			GUI.Label(new Rect(((Rect)(ref rect)).x + 10f, ((Rect)(ref rect)).y + 44f, ((Rect)(ref rect)).width - 20f, 16f), $"Press [{ModConfig.CodexHotkey.Value}] to inspect Codex & Perks", _smallStyle);
		}

		private static void DrawToasts()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			IReadOnlyList<ToastNotification> activeToasts = RunSessionManager.ActiveToasts;
			if (activeToasts.Count != 0)
			{
				float num = 420f;
				float num2 = ((float)Screen.width - num) * 0.5f;
				float num3 = 20f;
				Rect rect = default(Rect);
				for (int i = 0; i < activeToasts.Count; i++)
				{
					ToastNotification toastNotification = activeToasts[i];
					float num4 = Mathf.Clamp01((toastNotification.RemainingSeconds < 0.7f) ? (toastNotification.RemainingSeconds / 0.7f) : 1f);
					Color color = GUI.color;
					GUI.color = new Color(1f, 1f, 1f, num4);
					((Rect)(ref rect))..ctor(num2, num3, num, 52f);
					UiTheme.DrawBorderedBox(rect, UiTheme.BgDark, toastNotification.AccentColor, 1.5f);
					UiTheme.DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 5f, ((Rect)(ref rect)).height), toastNotification.AccentColor);
					_titleStyle.normal.textColor = toastNotification.AccentColor;
					GUI.Label(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).y + 7f, ((Rect)(ref rect)).width - 22f, 19f), toastNotification.Title, _titleStyle);
					_bodyStyle.normal.textColor = UiTheme.TextPrimary;
					GUI.Label(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).y + 26f, ((Rect)(ref rect)).width - 22f, 20f), toastNotification.Subtitle, _bodyStyle);
					GUI.color = color;
					num3 += 58f;
				}
			}
		}

		private static void DrawHazardBeacons()
		{
			//IL_0066: 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_009e: 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_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_00b7: 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_00be: 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_00de: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			Camera val = SemiFunc.MainCamera();
			PlayerAvatar val2 = SemiFunc.PlayerAvatarLocal();
			if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
			{
				return;
			}
			IReadOnlyList<AnomalousCargo> activeAnomalies = RunSessionManager.ActiveAnomalies;
			for (int i = 0; i < activeAnomalies.Count; i++)
			{
				AnomalousCargo anomalousCargo = activeAnomalies[i];
				if ((Object)(object)anomalousCargo == (Object)null || anomalousCargo.IsExtracted || (Object)(object)anomalousCargo.Valuable == (Object)null)
				{
					continue;
				}
				float num = Vector3.Distance(((Component)val2).transform.position, ((Component)anomalousCargo).transform.position);
				if (num < 2.2f || num > 18f)
				{
					continue;
				}
				Vector3 val3 = val.WorldToScreenPoint(((Component)anomalousCargo).transform.position + Vector3.up * 0.35f);
				if (!(val3.z <= 0f))
				{
					float x = val3.x;
					float num2 = (float)Screen.height - val3.y;
					if (!(x < 16f) && !(x > (float)Screen.width - 16f) && !(num2 < 16f) && !(num2 > (float)Screen.height - 16f))
					{
						Color primaryColor = anomalousCargo.Definition.PrimaryColor;
						UiTheme.DrawBorderedBox(new Rect(x - 5f, num2 - 5f, 10f, 10f), primaryColor * 0.45f, primaryColor, 1.5f);
						_centerSmallStyle.normal.textColor = primaryColor;
						GUI.Label(new Rect(x - 55f, num2 + 7f, 110f, 16f), $"{anomalousCargo.Definition.DisplayName} ({Mathf.RoundToInt(num)}m)", _centerSmallStyle);
					}
				}
			}
		}

		private static AnomalousCargo? GetFocusedAnomaly()
		{
			PhysGrabObject val = SemiFunc.PhysGrabberLocalGetGrabbedPhysGrabObject();
			if ((Object)(object)val != (Object)null)
			{
				AnomalousCargo component = ((Component)val).GetComponent<AnomalousCargo>();
				if ((Object)(object)component != (Object)null)
				{
					return component;
				}
			}
			if ((Object)(object)PhysGrabber.instance != (Object)null && (Object)(object)PhysGrabber.instance.currentlyLookingAtPhysGrabObject != (Object)null)
			{
				AnomalousCargo component2 = ((Component)PhysGrabber.instance.currentlyLookingAtPhysGrabObject).GetComponent<AnomalousCargo>();
				if ((Object)(object)component2 != (Object)null)
				{
					return component2;
				}
			}
			return null;
		}

		private static void EnsureStyles()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0043: 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_0050: 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_0063: Expected O, but got Unknown
			//IL_006d: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_00eb: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			if (_titleStyle == null)
			{
				_titleStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 13,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3,
					wordWrap = false
				};
				_badgeStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 10,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				_valueStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 13,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3
				};
				_bodyStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					wordWrap = true,
					alignment = (TextAnchor)0
				};
				_smallStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 10,
					wordWrap = true,
					alignment = (TextAnchor)0
				};
				_centerSmallStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 10,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)1
				};
			}
		}
	}
}
namespace CursedCargo.Patches
{
	[HarmonyPatch(typeof(ExtractionPoint))]
	internal static class ExtractionPatches
	{
		[HarmonyPatch("DestroyTheFirstPhysObjectsInHaulList")]
		[HarmonyPrefix]
		private static void DestroyFirstHaul_Prefix()
		{
			CaptureHaulListAnomalies();
		}

		[HarmonyPatch("DestroyAllPhysObjectsInHaulList")]
		[HarmonyPrefix]
		private static void DestroyAllHaul_Prefix()
		{
			CaptureHaulListAnomalies();
		}

		[HarmonyPatch("StateSet")]
		[HarmonyPostfix]
		private static void StateSet_Postfix(State newState)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			if ((int)newState == 6)
			{
				CaptureHaulListAnomalies();
			}
			else if ((int)newState == 7 || (int)newState == 8)
			{
				CaptureHaulListAnomalies();
				RunSessionManager.FinalizeExtractionBatch();
			}
		}

		private static void CaptureHaulListAnomalies()
		{
			RoundDirector instance = RoundDirector.instance;
			if ((Object)(object)instance == (Object)null || instance.dollarHaulList == null)
			{
				return;
			}
			for (int i = 0; i < instance.dollarHaulList.Count; i++)
			{
				GameObject val = instance.dollarHaulList[i];
				if (!((Object)(object)val == (Object)null))
				{
					AnomalousCargo component = val.GetComponent<AnomalousCargo>();
					if ((Object)(object)component != (Object)null && !component.IsExtracted)
					{
						RunSessionManager.RecordExtractedCargo(component);
					}
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class LevelLifecyclePatches
	{
		[HarmonyPatch(typeof(LevelGenerator), "Start")]
		[HarmonyPrefix]
		private static void LevelGeneratorStart_Prefix()
		{
			RunSessionManager.ResetForNewLevel(rollFreshHostState: true);
		}

		[HarmonyPatch(typeof(RoundDirector), "StartRoundLogic")]
		[HarmonyPostfix]
		private static void StartRoundLogic_Postfix()
		{
			RunSessionManager.OnRoundStartedPresentation();
		}

		[HarmonyPatch(typeof(RunManager), "ChangeLevel")]
		[HarmonyPrefix]
		private static void ChangeLevel_Prefix()
		{
			CodexSaveStore.SaveIfDirty();
			RunSessionManager.ResetForNewLevel(rollFreshHostState: false);
		}

		[HarmonyPatch(typeof(RunManager), "ResetProgress")]
		[HarmonyPostfix]
		private static void ResetProgress_Postfix()
		{
			RunSessionManager.ResetForNewLevel(rollFreshHostState: false);
		}

		[HarmonyPatch(typeof(PlayerAvatar), "Start")]
		[HarmonyPostfix]
		private static void PlayerAvatarStart_Postfix(PlayerAvatar __instance)
		{
			if ((Object)(object)__instance != (Object)null && __instance.isLocal && SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClient())
			{
				NetworkSync.RequestFullStateFromHost();
			}
		}
	}
	[HarmonyPatch]
	internal static class ValuablePatches
	{
		[HarmonyPatch(typeof(ValuableObject), "DollarValueSetLogic")]
		[HarmonyPostfix]
		private static void DollarValueSetLogic_Postfix(ValuableObject __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				RunSessionManager.TryMutateValuableOnHost(__instance);
			}
		}

		[HarmonyPatch(typeof(ValuableObject), "DollarValueSetRPC")]
		[HarmonyPostfix]
		private static void DollarValueSetRPC_Postfix(ValuableObject __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				((Component)__instance).GetComponent<AnomalousCargo>()?.ReapplySyncedBaseValue();
			}
		}

		[HarmonyPatch(typeof(ValuableObject), "Discover")]
		[HarmonyPostfix]
		private static void Discover_Postfix(ValuableObject __instance, bool __result)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				AnomalousCargo component = ((Component)__instance).GetComponent<AnomalousCargo>();
				if ((Object)(object)component != (Object)null && (__result || __instance.discovered))
				{
					component.MarkLocalDiscovered();
				}
			}
		}

		[HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "Break")]
		[HarmonyPostfix]
		private static void ImpactBreak_Postfix(PhysGrabObjectImpactDetector __instance, float valueLost, int breakLevel)
		{
			if (!((Object)(object)__instance == (Object)null) && __instance.isValuable)
			{
				((Component)__instance).GetComponent<AnomalousCargo>()?.OnImpactBreak(valueLost, breakLevel);
			}
		}
	}
}
namespace CursedCargo.Network
{
	public enum PulseEffectKind
	{
		ParticleBurst = 1,
		VolatileExplosion,
		AudioProfile,
		StabilizerVent
	}
	public static class NetworkSync
	{
		private static NetworkedEvent? _evtAnomalySpawn;

		private static NetworkedEvent? _evtAnomalyState;

		private static NetworkedEvent? _evtLevelState;

		private static NetworkedEvent? _evtToastBonus;

		private static NetworkedEvent? _evtEffectPulse;

		private static NetworkedEvent? _evtRequestFullState;

		private static bool _initialized;

		public static void Initialize()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			if (!_initialized)
			{
				_initialized = true;
				_evtAnomalySpawn = new NetworkedEvent("CursedCargo.AnomalySpawn", (Action<EventData>)HandleAnomalySpawn);
				_evtAnomalyState = new NetworkedEvent("CursedCargo.AnomalyState", (Action<EventData>)HandleAnomalyState);
				_evtLevelState = new NetworkedEvent("CursedCargo.LevelState", (Action<EventData>)HandleLevelState);
				_evtToastBonus = new NetworkedEvent("CursedCargo.ToastBonus", (Action<EventData>)HandleToastBonus);
				_evtEffectPulse = new NetworkedEvent("CursedCargo.EffectPulse", (Action<EventData>)HandleEffectPulse);
				_evtRequestFullState = new NetworkedEvent("CursedCargo.RequestFullState", (Action<EventData>)HandleRequestFullState);
			}
		}

		public static void BroadcastAnomalySpawn(int viewId, AnomalyType type, float baseOriginalValue, float currentValue, int seed, bool overcharged)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (_evtAnomalySpawn != null && SemiFunc.IsMultiplayer() && viewId > 0)
			{
				object[] array = new object[6]
				{
					viewId,
					(int)type,
					baseOriginalValue,
					currentValue,
					seed,
					overcharged
				};
				_evtAnomalySpawn.RaiseEvent((object)array, NetworkingEvents.RaiseOthers, SendOptions.SendReliable);
			}
		}

		public static void BroadcastAnomalyState(int viewId, float currentValue, float originalValue, float meterA, float meterB, string statusNote)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (_evtAnomalyState != null && SemiFunc.IsMultiplayer() && viewId > 0)
			{
				object[] array = new object[6]
				{
					viewId,
					currentValue,
					originalValue,
					meterA,
					meterB,
					statusNote ?? string.Empty
				};
				_evtAnomalyState.RaiseEvent((object)array, NetworkingEvents.RaiseOthers, SendOptions.SendUnreliable);
			}
		}

		public static void BroadcastLevelState(ContrabandIncidentType incident, SyndicateContract? contract, int hostPerkMask)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			if (_evtLevelState != null && SemiFunc.IsMultiplayer())
			{
				object[] array = new object[8]
				{
					(int)incident,
					contract?.Id ?? string.Empty,
					contract?.TargetAmount ?? 0,
					contract?.RewardCurrency ?? 0,
					contract?.CurrentProgress ?? 0,
					contract?.Completed ?? false,
					contract?.Failed ?? false,
					hostPerkMask
				};
				_evtLevelState.RaiseEvent((object)array, NetworkingEvents.RaiseOthers, SendOptions.SendReliable);
			}
		}

		public static void BroadcastToastBonus(string title, string subtitle, Color color, int soundKind)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (_evtToastBonus != null && SemiFunc.IsMultiplayer())
			{
				object[] array = new object[6] { title, subtitle, color.r, color.g, color.b, soundKind };
				_evtToastBonus.RaiseEvent((object)array, NetworkingEvents.RaiseOthers, SendOptions.SendReliable);
			}
		}

		public static void BroadcastEffectPulse(int viewId, PulseEffectKind kind, Vector3 pos, int extraInt = 0)
		{
			//IL_0029: 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)
			if (_evtEffectPulse != null && SemiFunc.IsMultiplayer())
			{
				object[] array = new object[4]
				{
					viewId,
					(int)kind,
					pos,
					extraInt
				};
				_evtEffectPulse.RaiseEvent((object)array, NetworkingEvents.RaiseOthers, SendOptions.SendReliable);
			}
		}

		public static void RequestFullStateFromHost()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (_evtRequestFullState != null && SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClient())
			{
				_evtRequestFullState.RaiseEvent((object)1, NetworkingEvents.RaiseMasterClient, SendOptions.SendReliable);
			}
		}

		private static void HandleAnomalySpawn(EventData eventData)
		{
			try
			{
				if (eventData.CustomData is object[] array && array.Length >= 5)
				{
					int viewId = Convert.ToInt32(array[0]);
					AnomalyType type = (AnomalyType)Convert.ToInt32(array[1]);
					float baseOrig = Convert.ToSingle(array[2]);
					float curVal = Convert.ToSingle(array[3]);
					int seed = Convert.ToInt32(array[4]);
					bool overcharged = array.Length >= 6 && Convert.ToBoolean(array[5]);
					RunSessionManager.ApplySyncedAnomaly(viewId, type, baseOrig, curVal, seed, overcharged);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("HandleAnomalySpawn error: " + ex.Message));
			}
		}

		private static void HandleAnomalyState(EventData eventData)
		{
			try
			{
				if (eventData.CustomData is object[] array && array.Length >= 6)
				{
					int viewId = Convert.ToInt32(array[0]);
					float curVal = Convert.ToSingle(array[1]);
					float origVal = Convert.ToSingle(array[2]);
					float meterA = Convert.ToSingle(array[3]);
					float meterB = Convert.ToSingle(array[4]);
					string note = (array[5] as string) ?? string.Empty;
					RunSessionManager.ApplySyncedAnomalyState(viewId, curVal, origVal, meterA, meterB, note);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("HandleAnomalyState error: " + ex.Message));
			}
		}

		private static void HandleLevelState(EventData eventData)
		{
			try
			{
				if (eventData.CustomData is object[] array && array.Length >= 8)
				{
					int incident = Convert.ToInt32(array[0]);
					string contractId = (array[1] as string) ?? string.Empty;
					int target = Convert.ToInt32(array[2]);
					int reward = Convert.ToInt32(array[3]);
					int progress = Convert.ToInt32(array[4]);
					bool completed = Convert.ToBoolean(array[5]);
					bool failed = Convert.ToBoolean(array[6]);
					int hostPerkMask = Convert.ToInt32(array[7]);
					RunSessionManager.ApplySyncedLevelState((ContrabandIncidentType)incident, contractId, target, reward, progress, completed, failed, hostPerkMask);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("HandleLevelState error: " + ex.Message));
			}
		}

		private static void HandleToastBonus(EventData eventData)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (eventData.CustomData is object[] array && array.Length >= 6)
				{
					string title = (array[0] as string) ?? string.Empty;
					string subtitle = (array[1] as string) ?? string.Empty;
					Color accentColor = default(Color);
					((Color)(ref accentColor))..ctor(Convert.ToSingle(array[2]), Convert.ToSingle(array[3]), Convert.ToSingle(array[4]), 1f);
					int num = Convert.ToInt32(array[5]);
					RunSessionManager.PushToast(title, subtitle, accentColor);
					switch (num)
					{
					case 1:
						ProceduralSfx.PlayComboFanfare();
						break;
					case 2:
						ProceduralSfx.PlayContractComplete();
						break;
					case 3:
						ProceduralSfx.PlayScanPing();
						break;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("HandleToastBonus error: " + ex.Message));
			}
		}

		private static void HandleEffectPulse(EventData eventData)
		{
			//IL_0043: 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)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (eventData.CustomData is object[] array && array.Length >= 4)
				{
					int viewId = Convert.ToInt32(array[0]);
					PulseEffectKind pulseEffectKind = (PulseEffectKind)Convert.ToInt32(array[1]);
					Vector3 val = ((array[2] is Vector3 val2) ? val2 : Vector3.zero);
					int num = Convert.ToInt32(array[3]);
					AnomalousCargo anomalousCargo = RunSessionManager.FindByViewId(viewId);
					switch (pulseEffectKind)
					{
					case PulseEffectKind.ParticleBurst:
						anomalousCargo?.Visuals?.BurstParticles((num > 0) ? num : 16);
						break;
					case PulseEffectKind.VolatileExplosion:
						ProceduralSfx.PlayExplosion(val);
						SemiFunc.CameraShakeDistance(val, 5.5f, 0.85f, 4f, 22f);
						anomalousCargo?.Visuals?.BurstParticles(32);
						break;
					case PulseEffectKind.AudioProfile:
						ProceduralSfx.PlayAtPoint((AnomalyAudioProfile)num, val, 0.9f);
						break;
					case PulseEffectKind.StabilizerVent:
						ProceduralSfx.PlayAtPoint(AnomalyAudioProfile.CryoShimmer, val);
						anomalousCargo?.Visuals?.BurstParticles(20);
						break;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("HandleEffectPulse error: " + ex.Message));
			}
		}

		private static void HandleRequestFullState(EventData eventData)
		{
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				RunSessionManager.BroadcastFullStateToClients();
			}
		}
	}
}
namespace CursedCargo.Data
{
	public static class AnomalyCatalog
	{
		private static readonly Dictionary<AnomalyType, AnomalyDefinition> Definitions;

		private static readonly List<AnomalyDefinition> OrderedList;

		public static IReadOnlyList<AnomalyDefinition> All => OrderedList;

		static AnomalyCatalog()
		{
			//IL_003e: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unkn