Decompiled source of Lovebound AI v1.0.0

AICompanion.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[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("Empress")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("AICompanion")]
[assembly: AssemblyTitle("AICompanion")]
[assembly: AssemblyVersion("1.0.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace EmpressAICompanion
{
	internal static class EmpressCompanionAccess
	{
		private delegate bool EmpressBoolStaticDelegate();

		private delegate PlayerAvatar EmpressPlayerAvatarStaticDelegate();

		private delegate string EmpressPlayerSteamIdDelegate(PlayerAvatar player);

		private delegate int EmpressStatGetDelegate();

		private delegate int EmpressStatSetDelegate(int value);

		private delegate void EmpressVoidStaticDelegate();

		private delegate int EmpressShopCostDelegate();

		private delegate void EmpressEnemyInvestigateDelegate(Vector3 position, float range, bool pathfindOnly);

		private delegate void EmpressPlayerHealDelegate(PlayerHealth instance, int amount, bool effect);

		private delegate void EmpressPlayerEffectDelegate(PlayerHealth instance, Effect effect);

		private delegate void EmpressPlayerEyeDelegate(PlayerHealth instance, EyeOverrideState state, float time, int priority);

		private delegate void EmpressInvincibleDelegate(PlayerHealth instance, float time);

		private delegate void EmpressPhysFloatTimeDelegate(PhysGrabObject instance, float value, float time);

		private delegate void EmpressPhysFloatDelegate(PhysGrabObject instance, float time);

		private delegate float EmpressImpactHealDelegate(PhysGrabObjectImpactDetector instance, float healPercent, Vector3 healingPoint);

		private delegate int EmpressUpgradeDelegate(PunManager instance, string steamId, int value);

		private delegate void EmpressHaulGoalDelegate(ExtractionPoint instance, int value);

		private delegate void EmpressEnemyFloatDelegate(Enemy instance, float time);

		private delegate void EmpressEnemyHealthHurtDelegate(EnemyHealth instance, int damage, Vector3 hurtDirection);

		private delegate void EmpressPhysTeleportDelegate(PhysGrabObject instance, Vector3 position, Quaternion rotation);

		private delegate void EmpressCartAddDelegate(PhysGrabInCart instance, PhysGrabObject physGrabObject);

		private static readonly FieldRef<object, GameManager> EmpressGameManagerInstance = EmpressStaticRef<GameManager>(typeof(GameManager), "instance");

		private static readonly FieldRef<object, RunManager> EmpressRunManagerInstance = EmpressStaticRef<RunManager>(typeof(RunManager), "instance");

		private static readonly FieldRef<object, GameDirector> EmpressGameDirectorInstance = EmpressStaticRef<GameDirector>(typeof(GameDirector), "instance");

		private static readonly FieldRef<object, LevelGenerator> EmpressLevelGeneratorInstance = EmpressStaticRef<LevelGenerator>(typeof(LevelGenerator), "Instance");

		private static readonly FieldRef<object, ShopManager> EmpressShopManagerInstance = EmpressStaticRef<ShopManager>(typeof(ShopManager), "instance");

		private static readonly FieldRef<object, RoundDirector> EmpressRoundDirectorInstance = EmpressStaticRef<RoundDirector>(typeof(RoundDirector), "instance");

		private static readonly FieldRef<object, PhysGrabber> EmpressPhysGrabberInstance = EmpressStaticRef<PhysGrabber>(typeof(PhysGrabber), "instance");

		private static readonly FieldRef<object, PlayerController> EmpressPlayerControllerInstance = EmpressStaticRef<PlayerController>(typeof(PlayerController), "instance");

		private static readonly FieldRef<object, PunManager> EmpressPunManagerInstance = EmpressStaticRef<PunManager>(typeof(PunManager), "instance");

		private static readonly FieldRef<ShopManager, List<ItemAttributes>> EmpressShopShoppingList = EmpressInstanceRef<ShopManager, List<ItemAttributes>>("shoppingList");

		private static readonly FieldRef<PlayerAvatar, bool> EmpressAvatarDeadSet = EmpressInstanceRef<PlayerAvatar, bool>("deadSet");

		private static readonly FieldRef<PlayerAvatar, PlayerHealth> EmpressAvatarPlayerHealth = EmpressInstanceRef<PlayerAvatar, PlayerHealth>("playerHealth");

		private static readonly FieldRef<PlayerAvatar, PlayerAvatarVisuals> EmpressAvatarVisuals = EmpressInstanceRef<PlayerAvatar, PlayerAvatarVisuals>("playerAvatarVisuals");

		private static readonly FieldRef<GameDirector, gameState> EmpressDirectorState = EmpressInstanceRef<GameDirector, gameState>("currentState");

		private static readonly FieldRef<GameDirector, List<PlayerAvatar>> EmpressDirectorPlayers = EmpressInstanceRef<GameDirector, List<PlayerAvatar>>("PlayerList");

		private static readonly FieldRef<RunManager, Level> EmpressRunLevelCurrent = EmpressInstanceRef<RunManager, Level>("levelCurrent");

		private static readonly FieldRef<RunManager, int> EmpressRunLevelsCompleted = EmpressInstanceRef<RunManager, int>("levelsCompleted");

		private static readonly FieldRef<LevelGenerator, bool> EmpressLevelGenerated = EmpressInstanceRef<LevelGenerator, bool>("Generated");

		private static readonly FieldRef<PlayerHealth, int> EmpressHealthCurrent = EmpressInstanceRef<PlayerHealth, int>("health");

		private static readonly FieldRef<PlayerHealth, int> EmpressHealthMax = EmpressInstanceRef<PlayerHealth, int>("maxHealth");

		private static readonly FieldRef<RoundDirector, int> EmpressRoundCurrentHaul = EmpressInstanceRef<RoundDirector, int>("currentHaul");

		private static readonly FieldRef<RoundDirector, int> EmpressRoundHaulGoal = EmpressInstanceRef<RoundDirector, int>("haulGoal");

		private static readonly FieldRef<RoundDirector, int> EmpressRoundExtractionHaulGoal = EmpressInstanceRef<RoundDirector, int>("extractionHaulGoal");

		private static readonly FieldRef<RoundDirector, int> EmpressRoundExtractionSurplus = EmpressInstanceRef<RoundDirector, int>("extractionPointSurplus");

		private static readonly FieldRef<RoundDirector, ExtractionPoint> EmpressRoundExtractionCurrent = EmpressInstanceRef<RoundDirector, ExtractionPoint>("extractionPointCurrent");

		private static readonly FieldRef<PhysGrabber, PhysGrabObject> EmpressGrabberHeldObject = EmpressInstanceRef<PhysGrabber, PhysGrabObject>("grabbedPhysGrabObject");

		private static readonly FieldRef<PhysGrabObject, PhysGrabObjectImpactDetector> EmpressImpactDetector = EmpressInstanceRef<PhysGrabObject, PhysGrabObjectImpactDetector>("impactDetector");

		private static readonly FieldRef<PhysGrabObject, Rigidbody> EmpressPhysRigidbody = EmpressInstanceRef<PhysGrabObject, Rigidbody>("rb");

		private static readonly FieldRef<PhysGrabObject, bool> EmpressHeldByLocalPlayer = EmpressInstanceRef<PhysGrabObject, bool>("heldByLocalPlayer");

		private static readonly FieldRef<PhysGrabObject, bool> EmpressGrabbedLocal = EmpressInstanceRef<PhysGrabObject, bool>("grabbedLocal");

		private static readonly FieldRef<PhysGrabObject, bool> EmpressGrabbed = EmpressInstanceRef<PhysGrabObject, bool>("grabbed");

		private static readonly FieldRef<PhysGrabObject, bool> EmpressPhysDead = EmpressInstanceRef<PhysGrabObject, bool>("dead");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> EmpressImpactInCart = EmpressInstanceRef<PhysGrabObjectImpactDetector, bool>("inCart");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, float> EmpressImpactTimerInCart = EmpressInstanceRef<PhysGrabObjectImpactDetector, float>("timerInCart");

		private static readonly FieldRef<PhysGrabObjectImpactDetector, PhysGrabCart> EmpressImpactCurrentCart = EmpressInstanceRef<PhysGrabObjectImpactDetector, PhysGrabCart>("currentCart");

		private static readonly FieldRef<ValuableObject, float> EmpressValuableOriginal = EmpressInstanceRef<ValuableObject, float>("dollarValueOriginal");

		private static readonly FieldRef<ValuableObject, float> EmpressValuableCurrent = EmpressInstanceRef<ValuableObject, float>("dollarValueCurrent");

		private static readonly FieldRef<ValuableObject, int> EmpressValuableOverride = EmpressInstanceRef<ValuableObject, int>("dollarValueOverride");

		private static readonly FieldRef<ValuableObject, bool> EmpressValuableSet = EmpressInstanceRef<ValuableObject, bool>("dollarValueSet");

		private static readonly FieldRef<ValuableObject, PhysGrabObject> EmpressValuablePhysGrab = EmpressInstanceRef<ValuableObject, PhysGrabObject>("physGrabObject");

		private static readonly FieldRef<ItemAttributes, int> EmpressItemValue = EmpressInstanceRef<ItemAttributes, int>("value");

		private static readonly FieldRef<ItemAttributes, bool> EmpressItemShopItem = EmpressInstanceRef<ItemAttributes, bool>("shopItem");

		private static readonly FieldRef<ItemAttributes, string> EmpressItemName = EmpressInstanceRef<ItemAttributes, string>("itemName");

		private static readonly FieldRef<PhysGrabCart, bool> EmpressCartIsSmall = EmpressInstanceRef<PhysGrabCart, bool>("isSmallCart");

		private static readonly FieldRef<PhysGrabCart, PhysGrabObject> EmpressCartPhysGrab = EmpressInstanceRef<PhysGrabCart, PhysGrabObject>("physGrabObject");

		private static readonly FieldRef<PhysGrabCart, Transform> EmpressCartInCart = EmpressInstanceRef<PhysGrabCart, Transform>("inCart");

		private static readonly FieldRef<PhysGrabCart, PhysGrabInCart> EmpressCartTracker = EmpressInstanceRef<PhysGrabCart, PhysGrabInCart>("physGrabInCart");

		private static readonly FieldRef<PhysGrabCart, int> EmpressCartItemsInCartCount = EmpressInstanceRef<PhysGrabCart, int>("itemsInCartCount");

		private static readonly FieldRef<PhysGrabCart, int> EmpressCartHaulCurrent = EmpressInstanceRef<PhysGrabCart, int>("haulCurrent");

		private static readonly FieldRef<Enemy, EnemyRigidbody> EmpressEnemyRigidbodyField = EmpressInstanceRef<Enemy, EnemyRigidbody>("Rigidbody");

		private static readonly FieldRef<Enemy, EnemyHealth> EmpressEnemyHealthField = EmpressInstanceRef<Enemy, EnemyHealth>("Health");

		private static readonly FieldRef<EnemyHealth, bool> EmpressEnemyHealthDead = EmpressInstanceRef<EnemyHealth, bool>("dead");

		private static readonly EmpressBoolStaticDelegate EmpressGameMultiplayer = EmpressStaticMethod<EmpressBoolStaticDelegate>(typeof(GameManager), "Multiplayer");

		private static readonly EmpressBoolStaticDelegate EmpressRunIsLevel = EmpressStaticMethod<EmpressBoolStaticDelegate>(typeof(SemiFunc), "RunIsLevel");

		private static readonly EmpressBoolStaticDelegate EmpressRunIsShop = EmpressStaticMethod<EmpressBoolStaticDelegate>(typeof(SemiFunc), "RunIsShop");

		private static readonly EmpressBoolStaticDelegate EmpressRunIsArena = EmpressStaticMethod<EmpressBoolStaticDelegate>(typeof(SemiFunc), "RunIsArena");

		private static readonly EmpressBoolStaticDelegate EmpressMenuLevel = EmpressStaticMethod<EmpressBoolStaticDelegate>(typeof(SemiFunc), "MenuLevel");

		private static readonly EmpressPlayerAvatarStaticDelegate EmpressPlayerAvatarLocal = EmpressStaticMethod<EmpressPlayerAvatarStaticDelegate>(typeof(SemiFunc), "PlayerAvatarLocal");

		private static readonly EmpressPlayerSteamIdDelegate EmpressPlayerSteamId = EmpressStaticMethod<EmpressPlayerSteamIdDelegate>(typeof(SemiFunc), "PlayerGetSteamID", new Type[1] { typeof(PlayerAvatar) });

		private static readonly EmpressStatGetDelegate EmpressGetRunCurrency = EmpressStaticMethod<EmpressStatGetDelegate>(typeof(SemiFunc), "StatGetRunCurrency");

		private static readonly EmpressStatSetDelegate EmpressSetRunCurrency = EmpressStaticMethod<EmpressStatSetDelegate>(typeof(SemiFunc), "StatSetRunCurrency", new Type[1] { typeof(int) });

		private static readonly EmpressShopCostDelegate EmpressShopGetTotalCost = EmpressStaticMethod<EmpressShopCostDelegate>(typeof(SemiFunc), "ShopGetTotalCost");

		private static readonly EmpressVoidStaticDelegate EmpressShopUpdateCost = EmpressStaticMethod<EmpressVoidStaticDelegate>(typeof(SemiFunc), "ShopUpdateCost");

		private static readonly EmpressEnemyInvestigateDelegate EmpressEnemyInvestigate = EmpressStaticMethod<EmpressEnemyInvestigateDelegate>(typeof(SemiFunc), "EnemyInvestigate", new Type[3]
		{
			typeof(Vector3),
			typeof(float),
			typeof(bool)
		});

		private static readonly EmpressPlayerHealDelegate EmpressHealOther = EmpressInstanceMethod<EmpressPlayerHealDelegate>(typeof(PlayerHealth), "HealOther", new Type[2]
		{
			typeof(int),
			typeof(bool)
		});

		private static readonly EmpressPlayerEffectDelegate EmpressMaterialEffect = EmpressInstanceMethod<EmpressPlayerEffectDelegate>(typeof(PlayerHealth), "MaterialEffectOverride", new Type[1] { typeof(Effect) });

		private static readonly EmpressPlayerEyeDelegate EmpressEyeMaterial = EmpressInstanceMethod<EmpressPlayerEyeDelegate>(typeof(PlayerHealth), "EyeMaterialOverride", new Type[3]
		{
			typeof(EyeOverrideState),
			typeof(float),
			typeof(int)
		});

		private static readonly EmpressInvincibleDelegate EmpressInvincible = EmpressInstanceMethod<EmpressInvincibleDelegate>(typeof(PlayerHealth), "InvincibleSet", new Type[1] { typeof(float) });

		private static readonly EmpressPhysFloatTimeDelegate EmpressOverrideMass = EmpressInstanceMethod<EmpressPhysFloatTimeDelegate>(typeof(PhysGrabObject), "OverrideMass", new Type[2]
		{
			typeof(float),
			typeof(float)
		});

		private static readonly EmpressPhysFloatTimeDelegate EmpressOverrideDrag = EmpressInstanceMethod<EmpressPhysFloatTimeDelegate>(typeof(PhysGrabObject), "OverrideDrag", new Type[2]
		{
			typeof(float),
			typeof(float)
		});

		private static readonly EmpressPhysFloatTimeDelegate EmpressOverrideAngularDrag = EmpressInstanceMethod<EmpressPhysFloatTimeDelegate>(typeof(PhysGrabObject), "OverrideAngularDrag", new Type[2]
		{
			typeof(float),
			typeof(float)
		});

		private static readonly EmpressPhysFloatDelegate EmpressOverrideZeroGravity = EmpressInstanceMethod<EmpressPhysFloatDelegate>(typeof(PhysGrabObject), "OverrideZeroGravity", new Type[1] { typeof(float) });

		private static readonly EmpressPhysFloatDelegate EmpressOverrideIndestructible = EmpressInstanceMethod<EmpressPhysFloatDelegate>(typeof(PhysGrabObject), "OverrideIndestructible", new Type[1] { typeof(float) });

		private static readonly EmpressPhysTeleportDelegate EmpressPhysTeleport = EmpressInstanceMethod<EmpressPhysTeleportDelegate>(typeof(PhysGrabObject), "Teleport", new Type[2]
		{
			typeof(Vector3),
			typeof(Quaternion)
		});

		private static readonly EmpressImpactHealDelegate EmpressImpactHeal = EmpressInstanceMethod<EmpressImpactHealDelegate>(typeof(PhysGrabObjectImpactDetector), "Heal", new Type[2]
		{
			typeof(float),
			typeof(Vector3)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeHealth = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerHealth", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeEnergy = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerEnergy", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeExtraJump = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerExtraJump", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeLaunch = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerTumbleLaunch", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeClimb = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerTumbleClimb", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeWings = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerTumbleWings", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeSpeed = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerSprintSpeed", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeCrouchRest = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerCrouchRest", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeStrength = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerGrabStrength", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeThrow = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerThrowStrength", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressUpgradeDelegate EmpressUpgradeRange = EmpressInstanceMethod<EmpressUpgradeDelegate>(typeof(PunManager), "UpgradePlayerGrabRange", new Type[2]
		{
			typeof(string),
			typeof(int)
		});

		private static readonly EmpressHaulGoalDelegate EmpressSetHaulGoal = EmpressInstanceMethod<EmpressHaulGoalDelegate>(typeof(ExtractionPoint), "HaulGoalSet", new Type[1] { typeof(int) });

		private static readonly EmpressEnemyFloatDelegate EmpressEnemyFreeze = EmpressInstanceMethod<EmpressEnemyFloatDelegate>(typeof(Enemy), "Freeze", new Type[1] { typeof(float) });

		private static readonly EmpressEnemyFloatDelegate EmpressEnemyDisableChase = EmpressInstanceMethod<EmpressEnemyFloatDelegate>(typeof(Enemy), "DisableChase", new Type[1] { typeof(float) });

		private static readonly EmpressEnemyHealthHurtDelegate EmpressEnemyHurt = EmpressInstanceMethod<EmpressEnemyHealthHurtDelegate>(typeof(EnemyHealth), "Hurt", new Type[2]
		{
			typeof(int),
			typeof(Vector3)
		});

		private static readonly EmpressCartAddDelegate EmpressCartAdd = EmpressInstanceMethod<EmpressCartAddDelegate>(typeof(PhysGrabInCart), "Add", new Type[1] { typeof(PhysGrabObject) });

		internal static GameManager GameManagerInstance => EmpressGetStatic<GameManager>(EmpressGameManagerInstance);

		internal static RunManager RunManagerInstance => EmpressGetStatic<RunManager>(EmpressRunManagerInstance);

		internal static GameDirector GameDirectorInstance => EmpressGetStatic<GameDirector>(EmpressGameDirectorInstance);

		internal static LevelGenerator LevelGeneratorInstance => EmpressGetStatic<LevelGenerator>(EmpressLevelGeneratorInstance);

		internal static ShopManager ShopManagerInstance => EmpressGetStatic<ShopManager>(EmpressShopManagerInstance);

		internal static RoundDirector RoundDirectorInstance => EmpressGetStatic<RoundDirector>(EmpressRoundDirectorInstance);

		internal static PhysGrabber PhysGrabberInstance => EmpressGetStatic<PhysGrabber>(EmpressPhysGrabberInstance);

		internal static PlayerController PlayerControllerInstance => EmpressGetStatic<PlayerController>(EmpressPlayerControllerInstance);

		internal static PunManager PunManagerInstance => EmpressGetStatic<PunManager>(EmpressPunManagerInstance);

		internal static bool IsMultiplayer()
		{
			try
			{
				return EmpressGameMultiplayer != null && EmpressGameMultiplayer();
			}
			catch
			{
				return false;
			}
		}

		internal static bool RunIsLevel()
		{
			try
			{
				return EmpressRunIsLevel != null && EmpressRunIsLevel();
			}
			catch
			{
				return false;
			}
		}

		internal static bool RunIsShop()
		{
			try
			{
				return EmpressRunIsShop != null && EmpressRunIsShop();
			}
			catch
			{
				return false;
			}
		}

		internal static bool RunIsArena()
		{
			try
			{
				return EmpressRunIsArena != null && EmpressRunIsArena();
			}
			catch
			{
				return false;
			}
		}

		internal static bool MenuLevel()
		{
			try
			{
				return EmpressMenuLevel != null && EmpressMenuLevel();
			}
			catch
			{
				return false;
			}
		}

		internal static PlayerAvatar GetLocalPlayer()
		{
			try
			{
				return (EmpressPlayerAvatarLocal != null) ? EmpressPlayerAvatarLocal() : PlayerAvatar.instance;
			}
			catch
			{
				return PlayerAvatar.instance;
			}
		}

		internal static string GetSteamId(PlayerAvatar player)
		{
			try
			{
				return ((Object)(object)player != (Object)null && EmpressPlayerSteamId != null) ? (EmpressPlayerSteamId(player) ?? string.Empty) : string.Empty;
			}
			catch
			{
				return string.Empty;
			}
		}

		internal static bool IsDead(PlayerAvatar player)
		{
			if (!((Object)(object)player == (Object)null))
			{
				return EmpressGet<PlayerAvatar, bool>(player, EmpressAvatarDeadSet);
			}
			return true;
		}

		internal static PlayerHealth GetPlayerHealth(PlayerAvatar player)
		{
			if (!((Object)(object)player != (Object)null))
			{
				return null;
			}
			return EmpressGet<PlayerAvatar, PlayerHealth>(player, EmpressAvatarPlayerHealth);
		}

		internal static GameObject GetAvatarVisualRoot(PlayerAvatar player)
		{
			PlayerAvatarVisuals val = (((Object)(object)player != (Object)null) ? EmpressGet<PlayerAvatar, PlayerAvatarVisuals>(player, EmpressAvatarVisuals) : null);
			if (!((Object)(object)val != (Object)null))
			{
				return null;
			}
			return ((Component)val).gameObject;
		}

		internal static int GetHealth(PlayerHealth playerHealth)
		{
			if (!((Object)(object)playerHealth != (Object)null))
			{
				return 0;
			}
			return EmpressGet<PlayerHealth, int>(playerHealth, EmpressHealthCurrent);
		}

		internal static int GetMaxHealth(PlayerHealth playerHealth)
		{
			if (!((Object)(object)playerHealth != (Object)null))
			{
				return 100;
			}
			return EmpressGet<PlayerHealth, int>(playerHealth, EmpressHealthMax);
		}

		internal static gameState GetGameState(GameDirector director)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)director != (Object)null))
			{
				return (gameState)0;
			}
			return EmpressGet<GameDirector, gameState>(director, EmpressDirectorState);
		}

		internal static int GetPlayerCount(GameDirector director)
		{
			return (((Object)(object)director != (Object)null) ? EmpressGet<GameDirector, List<PlayerAvatar>>(director, EmpressDirectorPlayers) : null)?.Count ?? 0;
		}

		internal static Level GetCurrentLevel(RunManager manager)
		{
			if (!((Object)(object)manager != (Object)null))
			{
				return null;
			}
			return EmpressGet<RunManager, Level>(manager, EmpressRunLevelCurrent);
		}

		internal static int GetLevelsCompleted(RunManager manager)
		{
			if (!((Object)(object)manager != (Object)null))
			{
				return 0;
			}
			return EmpressGet<RunManager, int>(manager, EmpressRunLevelsCompleted);
		}

		internal static bool IsLevelGenerated(LevelGenerator generator)
		{
			if (!((Object)(object)generator == (Object)null))
			{
				return EmpressGet<LevelGenerator, bool>(generator, EmpressLevelGenerated);
			}
			return true;
		}

		internal static PhysGrabObject GetHeldObject()
		{
			PhysGrabber physGrabberInstance = PhysGrabberInstance;
			if (!((Object)(object)physGrabberInstance != (Object)null))
			{
				return null;
			}
			return EmpressGet<PhysGrabber, PhysGrabObject>(physGrabberInstance, EmpressGrabberHeldObject);
		}

		internal static bool IsHeldOrGrabbed(PhysGrabObject physGrabObject)
		{
			if ((Object)(object)physGrabObject != (Object)null)
			{
				if (!EmpressGet<PhysGrabObject, bool>(physGrabObject, EmpressHeldByLocalPlayer) && !EmpressGet<PhysGrabObject, bool>(physGrabObject, EmpressGrabbedLocal))
				{
					return EmpressGet<PhysGrabObject, bool>(physGrabObject, EmpressGrabbed);
				}
				return true;
			}
			return false;
		}

		internal static bool IsPhysDead(PhysGrabObject physGrabObject)
		{
			if (!((Object)(object)physGrabObject == (Object)null))
			{
				return EmpressGet<PhysGrabObject, bool>(physGrabObject, EmpressPhysDead);
			}
			return true;
		}

		internal static int GetRunCurrency()
		{
			try
			{
				return (EmpressGetRunCurrency != null) ? EmpressGetRunCurrency() : 0;
			}
			catch
			{
				return 0;
			}
		}

		internal static void SetRunCurrency(int value)
		{
			try
			{
				if (EmpressSetRunCurrency != null)
				{
					EmpressSetRunCurrency(Mathf.Max(0, value));
				}
			}
			catch
			{
			}
		}

		internal static int GetShopTotalCost()
		{
			try
			{
				return (EmpressShopGetTotalCost != null) ? EmpressShopGetTotalCost() : 0;
			}
			catch
			{
				return 0;
			}
		}

		internal static List<ItemAttributes> GetShoppingList(ShopManager shopManager)
		{
			if (!((Object)(object)shopManager != (Object)null))
			{
				return null;
			}
			return EmpressGet<ShopManager, List<ItemAttributes>>(shopManager, EmpressShopShoppingList);
		}

		internal static void ShopUpdateCost()
		{
			try
			{
				EmpressShopUpdateCost?.Invoke();
			}
			catch
			{
			}
		}

		internal static void DistractEnemies(Vector3 position, float radius)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				EmpressEnemyInvestigate?.Invoke(position, radius, pathfindOnly: false);
			}
			catch
			{
			}
		}

		internal static void HealPlayer(PlayerAvatar player, int amount, bool effect)
		{
			try
			{
				if (!((Object)(object)player == (Object)null) && amount > 0)
				{
					PlayerHealth playerHealth = GetPlayerHealth(player);
					if ((Object)(object)playerHealth != (Object)null)
					{
						EmpressHealOther?.Invoke(playerHealth, amount, effect);
					}
				}
			}
			catch
			{
			}
		}

		internal static void ApplyLoveEyes(PlayerAvatar player, float time, int priority = 8)
		{
			try
			{
				PlayerHealth playerHealth = GetPlayerHealth(player);
				if ((Object)(object)playerHealth != (Object)null)
				{
					EmpressEyeMaterial?.Invoke(playerHealth, (EyeOverrideState)3, time, priority);
				}
			}
			catch
			{
			}
		}

		internal static void ApplyUpgradeFlash(PlayerAvatar player)
		{
			try
			{
				PlayerHealth playerHealth = GetPlayerHealth(player);
				if ((Object)(object)playerHealth != (Object)null)
				{
					EmpressMaterialEffect?.Invoke(playerHealth, (Effect)0);
				}
			}
			catch
			{
			}
		}

		internal static void SetInvincible(PlayerAvatar player, float time)
		{
			try
			{
				PlayerHealth playerHealth = GetPlayerHealth(player);
				if ((Object)(object)playerHealth != (Object)null)
				{
					EmpressInvincible?.Invoke(playerHealth, time);
				}
			}
			catch
			{
			}
		}

		internal static void LightenObject(PhysGrabObject physGrabObject, float duration)
		{
			try
			{
				if (!((Object)(object)physGrabObject == (Object)null))
				{
					EmpressOverrideMass?.Invoke(physGrabObject, 0.35f, duration);
					EmpressOverrideDrag?.Invoke(physGrabObject, 1.4f, duration);
					EmpressOverrideAngularDrag?.Invoke(physGrabObject, 1.2f, duration);
					EmpressOverrideZeroGravity?.Invoke(physGrabObject, Mathf.Min(6f, duration));
				}
			}
			catch
			{
			}
		}

		internal static bool RepairValuable(PhysGrabObject physGrabObject, float healPercent)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)physGrabObject == (Object)null)
				{
					return false;
				}
				PhysGrabObjectImpactDetector val = EmpressGet<PhysGrabObject, PhysGrabObjectImpactDetector>(physGrabObject, EmpressImpactDetector);
				if ((Object)(object)val == (Object)null)
				{
					return false;
				}
				return EmpressImpactHeal != null && EmpressImpactHeal(val, healPercent, physGrabObject.centerPoint) > 0f;
			}
			catch
			{
				return false;
			}
		}

		internal static Rigidbody GetPhysRigidbody(PhysGrabObject physGrabObject)
		{
			Rigidbody val = (((Object)(object)physGrabObject != (Object)null) ? EmpressGet<PhysGrabObject, Rigidbody>(physGrabObject, EmpressPhysRigidbody) : null);
			if (!((Object)(object)val != (Object)null))
			{
				if (!((Object)(object)physGrabObject != (Object)null))
				{
					return null;
				}
				return ((Component)physGrabObject).GetComponent<Rigidbody>();
			}
			return val;
		}

		internal static PhysGrabObjectImpactDetector GetImpactDetector(PhysGrabObject physGrabObject)
		{
			if (!((Object)(object)physGrabObject != (Object)null))
			{
				return null;
			}
			return EmpressGet<PhysGrabObject, PhysGrabObjectImpactDetector>(physGrabObject, EmpressImpactDetector);
		}

		internal static bool IsObjectInCart(PhysGrabObject physGrabObject, PhysGrabCart cart = null)
		{
			PhysGrabObjectImpactDetector impactDetector = GetImpactDetector(physGrabObject);
			if ((Object)(object)impactDetector == (Object)null || !EmpressGet<PhysGrabObjectImpactDetector, bool>(impactDetector, EmpressImpactInCart))
			{
				return false;
			}
			PhysGrabCart val = EmpressGet<PhysGrabObjectImpactDetector, PhysGrabCart>(impactDetector, EmpressImpactCurrentCart);
			if (!((Object)(object)cart == (Object)null) && !((Object)(object)val == (Object)(object)cart))
			{
				return (Object)(object)val == (Object)null;
			}
			return true;
		}

		internal static void ProtectPhysObject(PhysGrabObject physGrabObject, float time)
		{
			try
			{
				if ((Object)(object)physGrabObject != (Object)null)
				{
					EmpressOverrideIndestructible?.Invoke(physGrabObject, Mathf.Max(0.1f, time));
				}
			}
			catch
			{
			}
		}

		internal static void TeleportPhysObject(PhysGrabObject physGrabObject, Vector3 position, Quaternion rotation)
		{
			//IL_002e: 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_0065: 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_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)
			try
			{
				if ((Object)(object)physGrabObject == (Object)null)
				{
					return;
				}
				EmpressOverrideIndestructible?.Invoke(physGrabObject, 0.7f);
				if (EmpressPhysTeleport != null)
				{
					EmpressPhysTeleport(physGrabObject, position, rotation);
					return;
				}
				Rigidbody physRigidbody = GetPhysRigidbody(physGrabObject);
				if ((Object)(object)physRigidbody != (Object)null && !physRigidbody.isKinematic)
				{
					physRigidbody.MovePosition(position);
					physRigidbody.MoveRotation(rotation);
				}
				else
				{
					((Component)physGrabObject).transform.SetPositionAndRotation(position, rotation);
				}
			}
			catch
			{
			}
		}

		internal static bool IsSmallCart(PhysGrabCart cart)
		{
			if ((Object)(object)cart != (Object)null)
			{
				return EmpressGet<PhysGrabCart, bool>(cart, EmpressCartIsSmall);
			}
			return false;
		}

		internal static PhysGrabObject GetCartPhysGrabObject(PhysGrabCart cart)
		{
			PhysGrabObject val = (((Object)(object)cart != (Object)null) ? EmpressGet<PhysGrabCart, PhysGrabObject>(cart, EmpressCartPhysGrab) : null);
			if (!((Object)(object)val != (Object)null))
			{
				if (!((Object)(object)cart != (Object)null))
				{
					return null;
				}
				return ((Component)cart).GetComponent<PhysGrabObject>();
			}
			return val;
		}

		internal static Transform GetCartBasket(PhysGrabCart cart)
		{
			Transform val = (((Object)(object)cart != (Object)null) ? EmpressGet<PhysGrabCart, Transform>(cart, EmpressCartInCart) : null);
			if (!((Object)(object)val != (Object)null))
			{
				if (!((Object)(object)cart != (Object)null))
				{
					return null;
				}
				return ((Component)cart).transform;
			}
			return val;
		}

		internal static int GetCartItemCount(PhysGrabCart cart)
		{
			if (!((Object)(object)cart != (Object)null))
			{
				return 0;
			}
			return Mathf.Max(0, EmpressGet<PhysGrabCart, int>(cart, EmpressCartItemsInCartCount));
		}

		internal static int GetCartHaul(PhysGrabCart cart)
		{
			if (!((Object)(object)cart != (Object)null))
			{
				return 0;
			}
			return Mathf.Max(0, EmpressGet<PhysGrabCart, int>(cart, EmpressCartHaulCurrent));
		}

		internal static void MarkObjectInCart(PhysGrabObject physGrabObject, PhysGrabCart cart, float seconds)
		{
			try
			{
				if (!((Object)(object)physGrabObject == (Object)null) && !((Object)(object)cart == (Object)null))
				{
					PhysGrabObjectImpactDetector impactDetector = GetImpactDetector(physGrabObject);
					if ((Object)(object)impactDetector != (Object)null)
					{
						EmpressSet<PhysGrabObjectImpactDetector, PhysGrabCart>(impactDetector, EmpressImpactCurrentCart, cart);
						EmpressSet<PhysGrabObjectImpactDetector, float>(impactDetector, EmpressImpactTimerInCart, Mathf.Max(0.1f, seconds));
						EmpressSet<PhysGrabObjectImpactDetector, bool>(impactDetector, EmpressImpactInCart, value: true);
					}
					PhysGrabInCart val = EmpressGet<PhysGrabCart, PhysGrabInCart>(cart, EmpressCartTracker);
					if ((Object)(object)val != (Object)null)
					{
						EmpressCartAdd?.Invoke(val, physGrabObject);
					}
				}
			}
			catch
			{
			}
		}

		internal static EnemyRigidbody GetEnemyRigidbody(Enemy enemy)
		{
			EnemyRigidbody val = (((Object)(object)enemy != (Object)null) ? EmpressGet<Enemy, EnemyRigidbody>(enemy, EmpressEnemyRigidbodyField) : null);
			if (!((Object)(object)val != (Object)null))
			{
				if (!((Object)(object)enemy != (Object)null))
				{
					return null;
				}
				return ((Component)enemy).GetComponentInChildren<EnemyRigidbody>();
			}
			return val;
		}

		internal static Rigidbody GetEnemyPhysicsRigidbody(Enemy enemy)
		{
			EnemyRigidbody enemyRigidbody = GetEnemyRigidbody(enemy);
			Rigidbody val = (((Object)(object)enemyRigidbody != (Object)null) ? ((Component)enemyRigidbody).GetComponent<Rigidbody>() : null);
			if (!((Object)(object)val != (Object)null))
			{
				if (!((Object)(object)enemy != (Object)null))
				{
					return null;
				}
				return ((Component)enemy).GetComponentInChildren<Rigidbody>();
			}
			return val;
		}

		internal static bool EnemyIsDead(Enemy enemy)
		{
			EnemyHealth val = (((Object)(object)enemy != (Object)null) ? EmpressGet<Enemy, EnemyHealth>(enemy, EmpressEnemyHealthField) : null);
			if ((Object)(object)val == (Object)null && (Object)(object)enemy != (Object)null)
			{
				val = ((Component)enemy).GetComponent<EnemyHealth>();
			}
			if ((Object)(object)val != (Object)null)
			{
				return EmpressGet<EnemyHealth, bool>(val, EmpressEnemyHealthDead);
			}
			return false;
		}

		internal static void DisableEnemyChase(Enemy enemy, float time)
		{
			try
			{
				if ((Object)(object)enemy != (Object)null)
				{
					EmpressEnemyDisableChase?.Invoke(enemy, Mathf.Max(0.1f, time));
				}
			}
			catch
			{
			}
		}

		internal static void FreezeEnemy(Enemy enemy, float time)
		{
			try
			{
				if ((Object)(object)enemy != (Object)null)
				{
					EmpressEnemyFreeze?.Invoke(enemy, Mathf.Max(0.1f, time));
				}
			}
			catch
			{
			}
		}

		internal static bool HurtEnemy(Enemy enemy, int damage, Vector3 hurtDirection)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)enemy == (Object)null || damage <= 0)
				{
					return false;
				}
				EnemyHealth val = EmpressGet<Enemy, EnemyHealth>(enemy, EmpressEnemyHealthField);
				if ((Object)(object)val == (Object)null)
				{
					val = ((Component)enemy).GetComponent<EnemyHealth>();
				}
				if ((Object)(object)val == (Object)null || EmpressGet<EnemyHealth, bool>(val, EmpressEnemyHealthDead) || EmpressEnemyHurt == null)
				{
					return false;
				}
				EmpressEnemyHurt(val, damage, hurtDirection);
				return true;
			}
			catch
			{
				return false;
			}
		}

		internal static int GetCurrentHaul(RoundDirector roundDirector)
		{
			if (!((Object)(object)roundDirector != (Object)null))
			{
				return 0;
			}
			return EmpressGet<RoundDirector, int>(roundDirector, EmpressRoundCurrentHaul);
		}

		internal static int GetHaulGoal(RoundDirector roundDirector)
		{
			if (!((Object)(object)roundDirector != (Object)null))
			{
				return 0;
			}
			return EmpressGet<RoundDirector, int>(roundDirector, EmpressRoundHaulGoal);
		}

		internal static ExtractionPoint GetCurrentExtraction(RoundDirector roundDirector)
		{
			if (!((Object)(object)roundDirector != (Object)null))
			{
				return null;
			}
			return EmpressGet<RoundDirector, ExtractionPoint>(roundDirector, EmpressRoundExtractionCurrent);
		}

		internal static void AddExtractionSurplus(RoundDirector roundDirector, int amount)
		{
			if (!((Object)(object)roundDirector == (Object)null) && amount != 0)
			{
				int num = EmpressGet<RoundDirector, int>(roundDirector, EmpressRoundExtractionSurplus);
				EmpressSet<RoundDirector, int>(roundDirector, EmpressRoundExtractionSurplus, num + amount);
			}
		}

		internal static float GetValuableOriginalValue(ValuableObject valuable)
		{
			if (!((Object)(object)valuable != (Object)null))
			{
				return 0f;
			}
			return EmpressGet<ValuableObject, float>(valuable, EmpressValuableOriginal);
		}

		internal static float GetValuableCurrentValue(ValuableObject valuable)
		{
			if (!((Object)(object)valuable != (Object)null))
			{
				return 0f;
			}
			return EmpressGet<ValuableObject, float>(valuable, EmpressValuableCurrent);
		}

		internal static PhysGrabObject GetValuablePhysGrabObject(ValuableObject valuable)
		{
			if (!((Object)(object)valuable != (Object)null))
			{
				return null;
			}
			return EmpressGet<ValuableObject, PhysGrabObject>(valuable, EmpressValuablePhysGrab);
		}

		internal static void SetValuableDollarValues(ValuableObject valuable, float original, float current)
		{
			if (!((Object)(object)valuable == (Object)null))
			{
				EmpressSet<ValuableObject, float>(valuable, EmpressValuableOriginal, original);
				EmpressSet<ValuableObject, float>(valuable, EmpressValuableCurrent, current);
				EmpressSet<ValuableObject, int>(valuable, EmpressValuableOverride, Mathf.RoundToInt(original));
				EmpressSet<ValuableObject, bool>(valuable, EmpressValuableSet, value: true);
			}
		}

		internal static bool IsShopItem(ItemAttributes item)
		{
			if ((Object)(object)item != (Object)null)
			{
				return EmpressGet<ItemAttributes, bool>(item, EmpressItemShopItem);
			}
			return false;
		}

		internal static int GetItemValue(ItemAttributes item)
		{
			if (!((Object)(object)item != (Object)null))
			{
				return 0;
			}
			return EmpressGet<ItemAttributes, int>(item, EmpressItemValue);
		}

		internal static void SetItemValue(ItemAttributes item, int value)
		{
			if ((Object)(object)item != (Object)null)
			{
				EmpressSet<ItemAttributes, int>(item, EmpressItemValue, Mathf.Max(0, value));
			}
		}

		internal static string GetItemName(ItemAttributes item)
		{
			if ((Object)(object)item == (Object)null)
			{
				return string.Empty;
			}
			string text = EmpressGet<ItemAttributes, string>(item, EmpressItemName);
			if (string.IsNullOrWhiteSpace(text))
			{
				return ((Object)item).name;
			}
			return text;
		}

		internal static bool TryGrantUpgrade(PlayerAvatar player, EmpressBlessingKind preferredKind)
		{
			string steamId = GetSteamId(player);
			PunManager punManagerInstance = PunManagerInstance;
			if (string.IsNullOrWhiteSpace(steamId) || (Object)(object)punManagerInstance == (Object)null)
			{
				return false;
			}
			EmpressUpgradeDelegate[] array = preferredKind switch
			{
				EmpressBlessingKind.GraceShield => new EmpressUpgradeDelegate[3] { EmpressUpgradeHealth, EmpressUpgradeEnergy, EmpressUpgradeSpeed }, 
				EmpressBlessingKind.Featherweight => new EmpressUpgradeDelegate[3] { EmpressUpgradeStrength, EmpressUpgradeThrow, EmpressUpgradeRange }, 
				_ => new EmpressUpgradeDelegate[11]
				{
					EmpressUpgradeHealth, EmpressUpgradeEnergy, EmpressUpgradeExtraJump, EmpressUpgradeLaunch, EmpressUpgradeClimb, EmpressUpgradeWings, EmpressUpgradeSpeed, EmpressUpgradeCrouchRest, EmpressUpgradeStrength, EmpressUpgradeThrow,
					EmpressUpgradeRange
				}, 
			};
			if (array.Length == 0)
			{
				return false;
			}
			try
			{
				EmpressUpgradeDelegate empressUpgradeDelegate = array[Random.Range(0, array.Length)];
				return empressUpgradeDelegate != null && empressUpgradeDelegate(punManagerInstance, steamId, 1) >= 0;
			}
			catch
			{
				return false;
			}
		}

		internal static void UpdateExtractionGoal(int newGoal)
		{
			try
			{
				RoundDirector roundDirectorInstance = RoundDirectorInstance;
				if ((Object)(object)roundDirectorInstance != (Object)null)
				{
					int value = Mathf.Max(0, newGoal);
					EmpressSet<RoundDirector, int>(roundDirectorInstance, EmpressRoundHaulGoal, value);
					EmpressSet<RoundDirector, int>(roundDirectorInstance, EmpressRoundExtractionHaulGoal, value);
				}
				ExtractionPoint[] array = Object.FindObjectsOfType<ExtractionPoint>();
				for (int i = 0; i < array.Length; i++)
				{
					EmpressSetHaulGoal?.Invoke(array[i], Mathf.Max(0, newGoal));
				}
			}
			catch
			{
			}
		}

		private static FieldRef<object, F> EmpressStaticRef<F>(Type type, string name) where F : class
		{
			try
			{
				return AccessTools.FieldRefAccess<F>(type, name);
			}
			catch (Exception ex)
			{
				EmpressCompanionPlugin.EmpressWarning("access wrapper failed for " + type.Name + "." + name + ": " + ex.GetType().Name);
				return null;
			}
		}

		private static FieldRef<T, F> EmpressInstanceRef<T, F>(string name) where T : class
		{
			try
			{
				return AccessTools.FieldRefAccess<T, F>(name);
			}
			catch (Exception ex)
			{
				EmpressCompanionPlugin.EmpressWarning("access wrapper failed for " + typeof(T).Name + "." + name + ": " + ex.GetType().Name);
				return null;
			}
		}

		private static TDelegate EmpressStaticMethod<TDelegate>(Type type, string name, Type[] parameters = null) where TDelegate : Delegate
		{
			return EmpressMethod<TDelegate>(AccessTools.Method(type, name, parameters, (Type[])null));
		}

		private static TDelegate EmpressInstanceMethod<TDelegate>(Type type, string name, Type[] parameters = null) where TDelegate : Delegate
		{
			return EmpressMethod<TDelegate>(AccessTools.Method(type, name, parameters, (Type[])null));
		}

		private static TDelegate EmpressMethod<TDelegate>(MethodInfo methodInfo) where TDelegate : Delegate
		{
			try
			{
				return (methodInfo != null) ? AccessTools.MethodDelegate<TDelegate>(methodInfo, (object)null, false) : null;
			}
			catch (Exception ex)
			{
				EmpressCompanionPlugin.EmpressWarning("method wrapper failed: " + ex.GetType().Name);
				return null;
			}
		}

		private static T EmpressGetStatic<T>(FieldRef<object, T> fieldRef) where T : class
		{
			try
			{
				return (fieldRef != null) ? fieldRef.Invoke((object)null) : null;
			}
			catch
			{
				return null;
			}
		}

		private static F EmpressGet<T, F>(T instance, FieldRef<T, F> fieldRef) where T : class
		{
			try
			{
				return (instance != null && fieldRef != null) ? fieldRef.Invoke(instance) : default(F);
			}
			catch
			{
				return default(F);
			}
		}

		private static void EmpressSet<T, F>(T instance, FieldRef<T, F> fieldRef, F value) where T : class
		{
			try
			{
				if (instance != null && fieldRef != null)
				{
					fieldRef.Invoke(instance) = value;
				}
			}
			catch
			{
			}
		}
	}
	internal sealed class EmpressCompanionAudio
	{
		private const byte EmpressXorKey = 90;

		private readonly AudioClip?[] _empressClips = (AudioClip?[])(object)new AudioClip[2];

		private AudioSource? _empressAudioSource;

		private bool _empressLoadingStarted;

		private bool _empressLoaded;

		internal void EmpressInitialize(MonoBehaviour host)
		{
			if ((Object)(object)_empressAudioSource == (Object)null)
			{
				_empressAudioSource = ((Component)host).gameObject.AddComponent<AudioSource>();
				_empressAudioSource.playOnAwake = false;
				_empressAudioSource.loop = false;
				_empressAudioSource.spatialBlend = 0f;
				_empressAudioSource.volume = 0.42f;
			}
			if (!_empressLoadingStarted)
			{
				_empressLoadingStarted = true;
				host.StartCoroutine(EmpressLoadRoutine());
			}
		}

		internal void EmpressPlayCharacter(int alternator)
		{
			if (EmpressCompanionPlugin.CompanionConfig.TextSoundsEnabled.Value && _empressLoaded && !((Object)(object)_empressAudioSource == (Object)null))
			{
				AudioClip val = _empressClips[Mathf.Abs(alternator) % _empressClips.Length];
				if (!((Object)(object)val == (Object)null))
				{
					_empressAudioSource.PlayOneShot(val, 0.72f);
				}
			}
		}

		private IEnumerator EmpressLoadRoutine()
		{
			string pluginDirectory = Path.GetDirectoryName(typeof(EmpressCompanionPlugin).Assembly.Location) ?? Paths.PluginPath;
			string cacheDirectory = Path.Combine(Paths.CachePath, "EmpressAICompanion");
			Directory.CreateDirectory(cacheDirectory);
			yield return EmpressLoadClip(pluginDirectory, cacheDirectory, "EmpressTalk1.xorbin", "EmpressTalk1.mp3", 0);
			yield return EmpressLoadClip(pluginDirectory, cacheDirectory, "EmpressTalk2.xorbin", "EmpressTalk2.mp3", 1);
			_empressLoaded = (Object)(object)_empressClips[0] != (Object)null || (Object)(object)_empressClips[1] != (Object)null;
			if (_empressLoaded)
			{
				EmpressCompanionPlugin.EmpressInfo("typing sounds ready");
			}
		}

		private IEnumerator EmpressLoadClip(string pluginDirectory, string cacheDirectory, string xorName, string outputName, int index)
		{
			string path = Path.Combine(pluginDirectory, xorName);
			if (!File.Exists(path))
			{
				yield break;
			}
			string text = Path.Combine(cacheDirectory, outputName);
			try
			{
				byte[] array = File.ReadAllBytes(path);
				for (int i = 0; i < array.Length; i++)
				{
					array[i] ^= 90;
				}
				File.WriteAllBytes(text, array);
			}
			catch
			{
				yield break;
			}
			UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip("file:///" + text.Replace("\\", "/"), (AudioType)13);
			try
			{
				yield return request.SendWebRequest();
				if ((int)request.result != 1)
				{
					EmpressCompanionPlugin.EmpressWarning("typing sound load failed: " + xorName);
					yield break;
				}
				AudioClip content = DownloadHandlerAudioClip.GetContent(request);
				if (!((Object)(object)content == (Object)null))
				{
					((Object)content).name = Path.GetFileNameWithoutExtension(outputName);
					_empressClips[index] = content;
				}
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}
	}
	internal sealed class EmpressCompanionConfig
	{
		internal ConfigEntry<bool> Enabled { get; }

		internal ConfigEntry<bool> DebugLogging { get; }

		internal ConfigEntry<bool> ResetAICompanion { get; }

		internal ConfigEntry<bool> DebugForceLove100 { get; }

		internal ConfigEntry<float> OverlayScale { get; }

		internal ConfigEntry<float> TypingCharactersPerSecond { get; }

		internal ConfigEntry<bool> TextSoundsEnabled { get; }

		internal ConfigEntry<float> BaseBlessingIntervalSeconds { get; }

		internal ConfigEntry<float> LoveGainScale { get; }

		internal ConfigEntry<float> LoveLossScale { get; }

		internal ConfigEntry<float> BlessingStrength { get; }

		internal ConfigEntry<float> ManifestLoveThreshold { get; }

		internal float EmpressOverlayScale => Mathf.Clamp(OverlayScale.Value, 0.75f, 1f);

		internal float EmpressTypingSpeed => Mathf.Clamp(TypingCharactersPerSecond.Value, 0f, 80f);

		internal float EmpressBaseBlessingInterval => Mathf.Clamp(BaseBlessingIntervalSeconds.Value, 10f, 90f);

		internal float EmpressLoveGainScale => Mathf.Clamp01(LoveGainScale.Value);

		internal float EmpressLoveLossScale => Mathf.Clamp01(LoveLossScale.Value);

		internal float EmpressBlessingStrength => Mathf.Clamp01(BlessingStrength.Value);

		internal float EmpressManifestLoveThreshold => Mathf.Clamp(ManifestLoveThreshold.Value, 0f, 100f);

		internal EmpressCompanionConfig(ConfigFile config)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Expected O, but got Unknown
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Expected O, but got Unknown
			Enabled = config.Bind<bool>("Empress General", "Enabled", true, "Enable AICompanion.");
			DebugLogging = config.Bind<bool>("Empress General", "DebugLogging", false, "Enable concise Empress Companion debug logs.");
			ResetAICompanion = config.Bind<bool>("Empress General", "ResetAICompanion", false, new ConfigDescription("Purges the active companion profile and reopens the setup shell so you can make a new one.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 999,
					CustomDrawer = EmpressDrawResetButton
				}
			}));
			DebugForceLove100 = config.Bind<bool>("Empress Debug", "ForceLove100", false, "Debug only. Forces the active companion love to 100%. Default off.");
			OverlayScale = config.Bind<float>("Empress Overlay", "OverlayScale", 1f, new ConfigDescription("Scale multiplier for the overlay.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.75f, 1f), Array.Empty<object>()));
			TypingCharactersPerSecond = config.Bind<float>("Empress Overlay", "TypingCharactersPerSecond", 24f, new ConfigDescription("Typing speed for companion messages.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 80f), Array.Empty<object>()));
			TextSoundsEnabled = config.Bind<bool>("Empress Overlay", "TextSoundsEnabled", true, "Play companion typing sounds.");
			BaseBlessingIntervalSeconds = config.Bind<float>("Empress Directives", "BaseBlessingIntervalSeconds", 34f, new ConfigDescription("Base delay between companion blessings.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 90f), Array.Empty<object>()));
			LoveGainScale = config.Bind<float>("Empress Directives", "LoveGainScale", 1f, new ConfigDescription("Multiplier for positive affection changes. 0.0 to 1.0 means 0% to 100%.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			LoveLossScale = config.Bind<float>("Empress Directives", "LoveLossScale", 1f, new ConfigDescription("Multiplier for negative affection changes. 0.0 to 1.0 means 0% to 100%.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			BlessingStrength = config.Bind<float>("Empress Directives", "BlessingStrength", 1f, new ConfigDescription("Overall strength multiplier for companion help. 0.0 to 1.0 means 0% to 100%.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			ManifestLoveThreshold = config.Bind<float>("Empress Directives", "ManifestLoveThreshold", 60f, new ConfigDescription("Love percent required before the pink avatar companion appears.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			EmpressClampSavedValues();
		}

		internal bool EmpressConsumeResetRequest()
		{
			if (!ResetAICompanion.Value)
			{
				return false;
			}
			ResetAICompanion.Value = false;
			return true;
		}

		private void EmpressClampSavedValues()
		{
			EmpressClampEntry(OverlayScale, 0.75f, 1f);
			EmpressClampEntry(TypingCharactersPerSecond, 0f, 80f);
			EmpressClampEntry(BaseBlessingIntervalSeconds, 10f, 90f);
			EmpressClampEntry(LoveGainScale, 0f, 1f);
			EmpressClampEntry(LoveLossScale, 0f, 1f);
			EmpressClampEntry(BlessingStrength, 0f, 1f);
			EmpressClampEntry(ManifestLoveThreshold, 0f, 100f);
		}

		private static void EmpressClampEntry(ConfigEntry<float> entry, float min, float max)
		{
			float num = Mathf.Clamp(entry.Value, min, max);
			if (!Mathf.Approximately(entry.Value, num))
			{
				entry.Value = num;
			}
		}

		private static void EmpressDrawResetButton(ConfigEntryBase entry)
		{
			if (GUILayout.Button("Reset A.I. Companion", Array.Empty<GUILayoutOption>()))
			{
				entry.BoxedValue = true;
			}
		}
	}
	internal sealed class ConfigurationManagerAttributes
	{
		public Action<ConfigEntryBase>? CustomDrawer { get; set; }

		public int? Order { get; set; }

		public bool? Browsable { get; set; }

		public bool? ReadOnly { get; set; }
	}
	internal static class EmpressCompanionMemory
	{
		private static bool EmpressLoaded;

		private static float EmpressNextSaveAt;

		private static EmpressCompanionProfile? EmpressProfile;

		private static EmpressCompanionMemorial? EmpressMemorial;

		internal static EmpressCompanionProfile? Profile
		{
			get
			{
				EmpressLoad();
				return EmpressProfile;
			}
		}

		internal static EmpressCompanionMemorial? Memorial
		{
			get
			{
				EmpressLoad();
				return EmpressMemorial;
			}
		}

		private static string EmpressProfilePath => Path.Combine(Paths.ConfigPath, "EmpressAICompanion.profile.json");

		private static string EmpressMemorialPath => Path.Combine(Paths.ConfigPath, "EmpressAICompanion.memorial.json");

		internal static void EmpressLoad()
		{
			if (!EmpressLoaded)
			{
				EmpressLoaded = true;
				EmpressProfile = EmpressLoadJson<EmpressCompanionProfile>(EmpressProfilePath);
				EmpressMemorial = EmpressLoadJson<EmpressCompanionMemorial>(EmpressMemorialPath);
			}
		}

		internal static void EmpressCreateProfile(string companionName, string playerName, EmpressCompanionPersonality personality, string state, string country)
		{
			EmpressProfile = new EmpressCompanionProfile
			{
				CompanionName = (string.IsNullOrWhiteSpace(companionName) ? "Empress" : companionName.Trim()),
				PlayerName = (string.IsNullOrWhiteSpace(playerName) ? "Player" : playerName.Trim()),
				Personality = personality,
				State = state.Trim(),
				Country = country.Trim(),
				CreatedAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
				Love = 28f
			};
			if (EmpressMemorial != null)
			{
				EmpressMemorial.AwaitFreshBoot = false;
			}
			EmpressSaveNow();
		}

		internal static void EmpressMarkDirty()
		{
			if (EmpressProfile != null)
			{
				EmpressNextSaveAt = Time.unscaledTime + 5f;
			}
		}

		internal static void EmpressTickSave()
		{
			if (EmpressNextSaveAt > 0f && Time.unscaledTime >= EmpressNextSaveAt)
			{
				EmpressSaveNow();
			}
		}

		internal static void EmpressSaveNow()
		{
			EmpressNextSaveAt = 0f;
			EmpressSaveJson(EmpressProfilePath, EmpressProfile);
			EmpressSaveJson(EmpressMemorialPath, EmpressMemorial);
		}

		internal static void EmpressKillCurrentCompanion(string sceneLabel, string cause)
		{
			EmpressLoad();
			if (EmpressProfile != null)
			{
				EmpressRelationshipStage stage = EmpressCompanionRuntime.EmpressGetRelationshipStage(EmpressProfile);
				EmpressCompanionMemorial empressCompanionMemorial = new EmpressCompanionMemorial();
				empressCompanionMemorial.CompanionName = EmpressProfile.CompanionName;
				empressCompanionMemorial.PlayerName = EmpressProfile.PlayerName;
				empressCompanionMemorial.DiedAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
				empressCompanionMemorial.LastScene = sceneLabel;
				empressCompanionMemorial.Cause = cause;
				empressCompanionMemorial.State = EmpressProfile.State;
				empressCompanionMemorial.Country = EmpressProfile.Country;
				empressCompanionMemorial.Personality = EmpressProfile.Personality;
				empressCompanionMemorial.Stage = stage;
				empressCompanionMemorial.FinalLove = EmpressProfile.Love;
				empressCompanionMemorial.LevelsCleared = EmpressProfile.LevelsCleared;
				empressCompanionMemorial.PlayerDeaths = EmpressProfile.PlayerDeaths;
				empressCompanionMemorial.ValuablesBroken = EmpressProfile.ValuablesBroken;
				empressCompanionMemorial.BlessingsGranted = EmpressProfile.BlessingsGranted;
				empressCompanionMemorial.Summary = EmpressProfile.PlayerName + " reached " + stage.ToString() + " with " + EmpressProfile.CompanionName + ". Final love was " + Mathf.RoundToInt(EmpressProfile.Love) + "%. Last scene was " + sceneLabel + ".";
				empressCompanionMemorial.AwaitFreshBoot = true;
				EmpressMemorial = empressCompanionMemorial;
				EmpressProfile = null;
				EmpressDeleteProfileFile();
				EmpressSaveJson(EmpressMemorialPath, EmpressMemorial);
			}
		}

		internal static void EmpressResetCurrentCompanion(string sceneLabel)
		{
			EmpressLoad();
			if (EmpressProfile != null)
			{
				EmpressRelationshipStage stage = EmpressCompanionRuntime.EmpressGetRelationshipStage(EmpressProfile);
				EmpressCompanionMemorial empressCompanionMemorial = new EmpressCompanionMemorial();
				empressCompanionMemorial.CompanionName = EmpressProfile.CompanionName;
				empressCompanionMemorial.PlayerName = EmpressProfile.PlayerName;
				empressCompanionMemorial.DiedAt = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
				empressCompanionMemorial.LastScene = sceneLabel;
				empressCompanionMemorial.Cause = "Manual companion reset from config.";
				empressCompanionMemorial.State = EmpressProfile.State;
				empressCompanionMemorial.Country = EmpressProfile.Country;
				empressCompanionMemorial.Personality = EmpressProfile.Personality;
				empressCompanionMemorial.Stage = stage;
				empressCompanionMemorial.FinalLove = EmpressProfile.Love;
				empressCompanionMemorial.LevelsCleared = EmpressProfile.LevelsCleared;
				empressCompanionMemorial.PlayerDeaths = EmpressProfile.PlayerDeaths;
				empressCompanionMemorial.ValuablesBroken = EmpressProfile.ValuablesBroken;
				empressCompanionMemorial.BlessingsGranted = EmpressProfile.BlessingsGranted;
				empressCompanionMemorial.Summary = EmpressProfile.PlayerName + " manually reset " + EmpressProfile.CompanionName + " at " + Mathf.RoundToInt(EmpressProfile.Love) + "% love. Fresh setup is ready.";
				empressCompanionMemorial.AwaitFreshBoot = false;
				EmpressMemorial = empressCompanionMemorial;
				EmpressProfile = null;
				EmpressDeleteProfileFile();
				EmpressSaveJson(EmpressMemorialPath, EmpressMemorial);
			}
			else if (EmpressMemorial != null && EmpressMemorial.AwaitFreshBoot)
			{
				EmpressMemorial.AwaitFreshBoot = false;
				EmpressSaveJson(EmpressMemorialPath, EmpressMemorial);
			}
		}

		private static T? EmpressLoadJson<T>(string path) where T : class
		{
			try
			{
				if (!File.Exists(path))
				{
					return null;
				}
				string text = File.ReadAllText(path);
				if (string.IsNullOrWhiteSpace(text))
				{
					return null;
				}
				return JsonUtility.FromJson<T>(text);
			}
			catch (Exception ex)
			{
				EmpressCompanionPlugin.EmpressWarning("memory load failed: " + ex.GetType().Name);
				return null;
			}
		}

		private static void EmpressSaveJson<T>(string path, T? value) where T : class
		{
			if (value == null)
			{
				return;
			}
			try
			{
				string directoryName = Path.GetDirectoryName(path);
				if (!string.IsNullOrWhiteSpace(directoryName))
				{
					Directory.CreateDirectory(directoryName);
				}
				File.WriteAllText(path, JsonUtility.ToJson((object)value, true));
			}
			catch (Exception ex)
			{
				EmpressCompanionPlugin.EmpressWarning("memory save failed: " + ex.GetType().Name);
			}
		}

		private static void EmpressDeleteProfileFile()
		{
			try
			{
				if (File.Exists(EmpressProfilePath))
				{
					File.Delete(EmpressProfilePath);
				}
			}
			catch (Exception ex)
			{
				EmpressCompanionPlugin.EmpressWarning("profile delete failed: " + ex.GetType().Name);
			}
		}
	}
	[Serializable]
	internal sealed class EmpressCompanionProfile
	{
		public string CompanionName = string.Empty;

		public string PlayerName = string.Empty;

		public string State = string.Empty;

		public string Country = string.Empty;

		public string CreatedAt = string.Empty;

		public string LastScene = string.Empty;

		public string LastBlessing = string.Empty;

		public EmpressCompanionPersonality Personality;

		public float Love = 28f;

		public bool Married;

		public int LevelsCleared;

		public int PlayerDeaths;

		public int ValuablesBroken;

		public int BlessingsGranted;

		public int MoneyGiftedK;

		public int PinkBursts;

		public int ShopRescues;

		public int ExtractorBlessings;

		public int ValuableBoosts;

		public int Manifestations;
	}
	[Serializable]
	internal sealed class EmpressCompanionMemorial
	{
		public string CompanionName = string.Empty;

		public string PlayerName = string.Empty;

		public string DiedAt = string.Empty;

		public string LastScene = string.Empty;

		public string Cause = string.Empty;

		public string State = string.Empty;

		public string Country = string.Empty;

		public string Summary = string.Empty;

		public EmpressCompanionPersonality Personality;

		public EmpressRelationshipStage Stage;

		public float FinalLove;

		public int LevelsCleared;

		public int PlayerDeaths;

		public int ValuablesBroken;

		public int BlessingsGranted;

		public bool AwaitFreshBoot;
	}
	internal enum EmpressCompanionPersonality
	{
		Sweet,
		Playful,
		Elegant,
		Protective
	}
	internal enum EmpressRelationshipStage
	{
		Stranger,
		Familiar,
		Friend,
		Partner,
		Fiancee,
		Wife
	}
	internal enum EmpressCompanionMood
	{
		Calm,
		Focused,
		Worried,
		Protective,
		Shopping,
		Proud,
		Playful,
		Devoted
	}
	internal enum EmpressBlessingKind
	{
		SmallHeal,
		FullHeal,
		CashGift,
		ValuableBloom,
		ValuableRepair,
		TreasureSweep,
		Featherweight,
		CourierGrace,
		ShopDiscount,
		ShopGift,
		ShopCascade,
		UpgradeGift,
		UpgradeRush,
		ExtractorBlessing,
		QuotaMercy,
		PinkPulse,
		EnemyDistraction,
		GraceShield,
		LoveBurst,
		MoralePatch,
		ThreatWard,
		CartBlessing,
		ExtractionFocus,
		ShopUnderwrite,
		AvatarManifestation
	}
	internal readonly struct EmpressCompanionQueuedMessage
	{
		internal string Speaker { get; }

		internal string Text { get; }

		internal Color Accent { get; }

		internal float HoldSeconds { get; }

		internal string Timestamp { get; }

		internal EmpressCompanionQueuedMessage(string speaker, string text, Color accent, float holdSeconds)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Speaker = speaker;
			Text = text;
			Accent = accent;
			HoldSeconds = holdSeconds;
			Timestamp = DateTime.Now.ToString("HH:mm:ss");
		}
	}
	internal sealed class EmpressCompanionVisibleMessage
	{
		internal string Speaker { get; }

		internal string Text { get; }

		internal Color Accent { get; }

		internal float HoldSeconds { get; }

		internal string Timestamp { get; }

		internal float VisibleCharacters { get; set; }

		internal int LastSoundCharacterIndex { get; set; } = -1;


		internal float CompletedAt { get; set; } = -1f;


		internal EmpressCompanionVisibleMessage(EmpressCompanionQueuedMessage source)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			Speaker = source.Speaker;
			Text = source.Text;
			Accent = source.Accent;
			HoldSeconds = source.HoldSeconds;
			Timestamp = source.Timestamp;
		}
	}
	internal sealed class EmpressCompanionBlessingOption
	{
		internal EmpressBlessingKind Kind { get; }

		internal float Weight { get; }

		internal string PreviewText { get; }

		internal string Tactic { get; }

		internal PhysGrabObject? TargetObject { get; }

		internal ValuableObject? TargetValuable { get; }

		internal ItemAttributes? TargetItem { get; }

		internal Enemy? TargetEnemy { get; }

		internal ExtractionPoint? TargetExtraction { get; }

		internal int Amount { get; }

		internal EmpressCompanionBlessingOption(EmpressBlessingKind kind, float weight, string previewText, string tactic, PhysGrabObject? targetObject = null, ValuableObject? targetValuable = null, ItemAttributes? targetItem = null, Enemy? targetEnemy = null, ExtractionPoint? targetExtraction = null, int amount = 0)
		{
			Kind = kind;
			Weight = weight;
			PreviewText = previewText;
			Tactic = tactic;
			TargetObject = targetObject;
			TargetValuable = targetValuable;
			TargetItem = targetItem;
			TargetEnemy = targetEnemy;
			TargetExtraction = targetExtraction;
			Amount = amount;
		}
	}
	internal sealed class EmpressCompanionBlessingPlan
	{
		internal EmpressBlessingKind Kind { get; }

		internal string PreviewText { get; }

		internal string Tactic { get; }

		internal PhysGrabObject? TargetObject { get; }

		internal ValuableObject? TargetValuable { get; }

		internal ItemAttributes? TargetItem { get; }

		internal Enemy? TargetEnemy { get; }

		internal ExtractionPoint? TargetExtraction { get; }

		internal int Amount { get; }

		internal float ExecuteAt { get; }

		internal EmpressCompanionBlessingPlan(EmpressCompanionBlessingOption option, float executeAt)
		{
			Kind = option.Kind;
			PreviewText = option.PreviewText;
			Tactic = option.Tactic;
			TargetObject = option.TargetObject;
			TargetValuable = option.TargetValuable;
			TargetItem = option.TargetItem;
			TargetEnemy = option.TargetEnemy;
			TargetExtraction = option.TargetExtraction;
			Amount = option.Amount;
			ExecuteAt = executeAt;
		}
	}
	internal sealed class EmpressPinkRecord
	{
		internal Renderer Renderer;

		internal Material[] OriginalMaterials = Array.Empty<Material>();

		internal Material[] PinkMaterials = Array.Empty<Material>();

		internal bool UsesMaterialSwap;

		internal float Until;
	}
	internal sealed class EmpressDeathReplayFrame
	{
		internal float RecordedAt;

		internal Vector3 Position;

		internal Quaternion Rotation;

		internal int Health;

		internal int MaxHealth;

		internal int NearbyEnemies;

		internal string HeldObjectName = string.Empty;

		internal string Note = string.Empty;
	}
	internal sealed class EmpressCompanionOverlay : MonoBehaviour
	{
		private readonly List<EmpressCompanionQueuedMessage> _empressPendingMessages = new List<EmpressCompanionQueuedMessage>();

		private readonly List<EmpressCompanionVisibleMessage> _empressVisibleMessages = new List<EmpressCompanionVisibleMessage>();

		private Texture2D _empressPanelTexture;

		private Texture2D _empressHeaderTexture;

		private Texture2D _empressBarBackTexture;

		private Texture2D _empressBarFillTexture;

		private Texture2D _empressBootTexture;

		private Texture2D _empressCursorTexture;

		private Texture2D _empressFieldTexture;

		private Texture2D _empressButtonTexture;

		private Texture2D _empressButtonHoverTexture;

		private Texture2D _empressSelectedButtonTexture;

		private GUIStyle _empressTitleStyle;

		private GUIStyle _empressBodyStyle;

		private GUIStyle _empressSmallStyle;

		private GUIStyle _empressStatusStyle;

		private GUIStyle _empressBootTitleStyle;

		private GUIStyle _empressBootBodyStyle;

		private GUIStyle _empressFieldStyle;

		private GUIStyle _empressButtonStyle;

		private GUIStyle _empressSelectedButtonStyle;

		private GUIStyle _empressLossStyle;

		private bool _empressStylesReady;

		private EmpressCompanionVisibleMessage? _empressActiveMessage;

		private string _empressMode = "BOOT";

		private string _empressScene = "boot";

		private string _empressTactic = "Waiting";

		private string _empressRelationship = "Stranger";

		private string _empressSpeakerName = "Empress";

		private float _empressLove;

		private bool _empressGameplayVisible;

		private bool _empressMultiplayerLocked;

		private bool _empressSetupVisible;

		private bool _empressUiVisible = true;

		private string _empressLossBanner = string.Empty;

		private float _empressLossBannerUntil;

		private int _empressSoundAlternator;

		private string _empressSetupCompanionName = string.Empty;

		private string _empressSetupPlayerName = string.Empty;

		private string _empressSetupState = string.Empty;

		private string _empressSetupCountry = string.Empty;

		private EmpressCompanionPersonality _empressSetupPersonality;

		private bool _empressSetupSeeded;

		private bool _empressSetupPauseActive;

		private float _empressPreviousTimeScale = 1f;

		private CursorLockMode _empressPreviousCursorLock;

		private bool _empressPreviousCursorVisible = true;

		private bool _empressPreviousAudioPause;

		internal static EmpressCompanionOverlay? Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				((Behaviour)this).enabled = false;
				((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else
			{
				Instance = this;
				((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
				EmpressBuildTextures();
			}
		}

		private void OnDisable()
		{
			EmpressReleaseSetupMode();
		}

		private void Update()
		{
			if (!EmpressCompanionPlugin.CompanionConfig.Enabled.Value)
			{
				EmpressReleaseSetupMode();
				return;
			}
			float unscaledTime = Time.unscaledTime;
			float empressTypingSpeed = EmpressCompanionPlugin.CompanionConfig.EmpressTypingSpeed;
			if (_empressActiveMessage == null && _empressPendingMessages.Count > 0)
			{
				EmpressCompanionQueuedMessage source = _empressPendingMessages[0];
				_empressPendingMessages.RemoveAt(0);
				_empressActiveMessage = new EmpressCompanionVisibleMessage(source);
				_empressVisibleMessages.Add(_empressActiveMessage);
				if (_empressVisibleMessages.Count > 6)
				{
					_empressVisibleMessages.RemoveAt(0);
				}
			}
			if (_empressActiveMessage != null)
			{
				if (empressTypingSpeed <= 0.01f)
				{
					_empressActiveMessage.VisibleCharacters = _empressActiveMessage.Text.Length;
				}
				int num = Mathf.Clamp(Mathf.FloorToInt(_empressActiveMessage.VisibleCharacters), 0, _empressActiveMessage.Text.Length);
				_empressActiveMessage.VisibleCharacters += empressTypingSpeed * Time.unscaledDeltaTime;
				int num2 = Mathf.Clamp(Mathf.FloorToInt(_empressActiveMessage.VisibleCharacters), 0, _empressActiveMessage.Text.Length);
				if (num2 > num)
				{
					for (int i = num; i < num2; i++)
					{
						if (!char.IsWhiteSpace(_empressActiveMessage.Text[i]))
						{
							EmpressCompanionPlugin.Audio.EmpressPlayCharacter(_empressSoundAlternator++);
						}
					}
				}
				if (_empressActiveMessage.VisibleCharacters >= (float)_empressActiveMessage.Text.Length)
				{
					_empressActiveMessage.VisibleCharacters = _empressActiveMessage.Text.Length;
					if (_empressActiveMessage.CompletedAt < 0f)
					{
						_empressActiveMessage.CompletedAt = unscaledTime;
					}
					if (unscaledTime - _empressActiveMessage.CompletedAt >= _empressActiveMessage.HoldSeconds)
					{
						_empressActiveMessage = null;
					}
				}
			}
			for (int num3 = _empressVisibleMessages.Count - 1; num3 >= 0; num3--)
			{
				EmpressCompanionVisibleMessage empressCompanionVisibleMessage = _empressVisibleMessages[num3];
				if (empressCompanionVisibleMessage != _empressActiveMessage && empressCompanionVisibleMessage.CompletedAt >= 0f && unscaledTime - empressCompanionVisibleMessage.CompletedAt > 28f)
				{
					_empressVisibleMessages.RemoveAt(num3);
				}
			}
			if (_empressLossBannerUntil > 0f && unscaledTime >= _empressLossBannerUntil)
			{
				_empressLossBannerUntil = 0f;
				_empressLossBanner = string.Empty;
			}
			EmpressTickSetupMode();
		}

		private void OnGUI()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Invalid comparison between Unknown and I4
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Invalid comparison between Unknown and I4
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: 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_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: 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_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: 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_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Expected O, but got Unknown
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06de: Unknown result type (might be due to invalid IL or missing references)
			Event current = Event.current;
			if (current != null && (int)current.type == 4 && (int)current.keyCode == 287 && !_empressSetupVisible)
			{
				_empressUiVisible = !_empressUiVisible;
				current.Use();
			}
			if (current != null && (int)current.type == 4 && (int)current.keyCode == 288)
			{
				EmpressCompanionPlugin.CompanionConfig.TextSoundsEnabled.Value = !EmpressCompanionPlugin.CompanionConfig.TextSoundsEnabled.Value;
				EmpressPushMessage("Empress OS", EmpressCompanionPlugin.CompanionConfig.TextSoundsEnabled.Value ? "Text sounds are on." : "Text sounds are off.", new Color(1f, 0.82f, 0.92f, 1f), urgent: true, 3.2f);
				current.Use();
			}
			if (!EmpressCompanionPlugin.CompanionConfig.Enabled.Value || (!_empressUiVisible && !_empressSetupVisible))
			{
				return;
			}
			if (!_empressStylesReady)
			{
				EmpressBuildStyles();
			}
			float empressOverlayScale = EmpressCompanionPlugin.CompanionConfig.EmpressOverlayScale;
			Matrix4x4 matrix = GUI.matrix;
			GUI.matrix = Matrix4x4.Scale(new Vector3(empressOverlayScale, empressOverlayScale, 1f));
			float num = (float)Screen.width / empressOverlayScale;
			float num2 = (float)Screen.height / empressOverlayScale;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(24f, Mathf.Max(24f, num2 - 260f), Mathf.Min(600f, num - 48f), 228f);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(Mathf.Max(24f, num - 390f), 24f, 366f, 154f);
			GUI.DrawTexture(val, (Texture)(object)_empressPanelTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 34f), (Texture)(object)_empressHeaderTexture);
			GUI.Label(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 6f, ((Rect)(ref val)).width - 28f, 24f), _empressSpeakerName + " messenger", _empressTitleStyle);
			GUI.DrawTexture(val2, (Texture)(object)_empressPanelTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width, 34f), (Texture)(object)_empressHeaderTexture);
			GUI.Label(new Rect(((Rect)(ref val2)).x + 12f, ((Rect)(ref val2)).y + 5f, ((Rect)(ref val2)).width - 24f, 26f), "Empress OS status", _empressTitleStyle);
			float num3 = ((Rect)(ref val2)).y + 40f;
			float num4 = 24f;
			float num5 = ((Rect)(ref val2)).width - 174f;
			GUI.Label(new Rect(((Rect)(ref val2)).x + 14f, num3, num5, num4), "Mode  " + (_empressMultiplayerLocked ? "MULTIPLAYER LOCK" : _empressMode), _empressStatusStyle);
			GUI.Label(new Rect(((Rect)(ref val2)).x + 14f, num3 + 25f, num5, num4), "Scene " + _empressScene, _empressStatusStyle);
			GUI.Label(new Rect(((Rect)(ref val2)).x + 14f, num3 + 50f, num5, num4), "Bond  " + _empressRelationship, _empressStatusStyle);
			GUI.Label(new Rect(((Rect)(ref val2)).x + 14f, num3 + 75f, num5, num4), "Plan  " + _empressTactic, _empressStatusStyle);
			Rect val3 = default(Rect);
			((Rect)(ref val3))..ctor(((Rect)(ref val2)).x + ((Rect)(ref val2)).width - 134f, num3 + 2f, 112f, 16f);
			GUI.DrawTexture(val3, (Texture)(object)_empressBarBackTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref val3)).x + 1f, ((Rect)(ref val3)).y + 1f, (((Rect)(ref val3)).width - 2f) * Mathf.Clamp01(_empressLove / 100f), ((Rect)(ref val3)).height - 2f), (Texture)(object)_empressBarFillTexture);
			GUI.Label(new Rect(((Rect)(ref val3)).x, num3 + 24f, 112f, 22f), "Love " + Mathf.RoundToInt(_empressLove) + "%", _empressSmallStyle);
			GUI.Label(new Rect(((Rect)(ref val3)).x, num3 + 50f, 130f, 22f), "F6 UI", _empressSmallStyle);
			GUI.Label(new Rect(((Rect)(ref val3)).x, num3 + 74f, 130f, 22f), "F7 sound", _empressSmallStyle);
			float num6 = ((Rect)(ref val)).width - 24f;
			float num7 = ((Rect)(ref val)).yMax - 14f;
			for (int num8 = _empressVisibleMessages.Count - 1; num8 >= 0; num8--)
			{
				EmpressCompanionVisibleMessage empressCompanionVisibleMessage = _empressVisibleMessages[num8];
				string value = ((empressCompanionVisibleMessage == _empressActiveMessage) ? empressCompanionVisibleMessage.Text.Substring(0, Mathf.Clamp(Mathf.FloorToInt(empressCompanionVisibleMessage.VisibleCharacters), 0, empressCompanionVisibleMessage.Text.Length)) : empressCompanionVisibleMessage.Text);
				string text = ColorUtility.ToHtmlStringRGB(empressCompanionVisibleMessage.Accent);
				string text2 = "<color=#FF8AC8>[" + empressCompanionVisibleMessage.Timestamp + "] </color><color=#" + text + ">" + EmpressEscapeRichText(empressCompanionVisibleMessage.Speaker) + "</color><color=#FFE8F5>: " + EmpressEscapeRichText(value) + "</color>";
				float num9 = _empressBodyStyle.CalcHeight(new GUIContent(text2), num6);
				num7 -= num9;
				if (num7 <= ((Rect)(ref val)).y + 36f)
				{
					break;
				}
				GUI.Label(new Rect(((Rect)(ref val)).x + 12f, num7, num6, num9), text2, _empressBodyStyle);
				num7 -= 5f;
			}
			if (!_empressGameplayVisible && !_empressSetupVisible)
			{
				GUI.Label(new Rect(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).y + 42f, ((Rect)(ref val)).width - 24f, 36f), _empressMultiplayerLocked ? "She only wakes up in singleplayer." : "Companion link is idling.", _empressStatusStyle);
			}
			if (_empressSetupVisible)
			{
				EmpressDrawSetupWindow(num, num2);
				EmpressDrawCursor(num, num2, empressOverlayScale);
			}
			if (_empressLossBannerUntil > 0f && !string.IsNullOrWhiteSpace(_empressLossBanner))
			{
				Rect val4 = new Rect(num * 0.16f, num2 * 0.16f, num * 0.68f, 80f);
				GUI.DrawTexture(val4, (Texture)(object)_empressPanelTexture);
				GUI.Label(val4, _empressLossBanner, _empressLossStyle);
			}
			GUI.matrix = matrix;
		}

		internal void EmpressPushMessage(string speaker, string text, Color accent, bool urgent = false, float holdSeconds = 7f)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrWhiteSpace(text))
			{
				return;
			}
			EmpressCompanionQueuedMessage item = new EmpressCompanionQueuedMessage(string.IsNullOrWhiteSpace(speaker) ? "Empress" : speaker.Trim(), text.Trim(), accent, holdSeconds);
			if (urgent)
			{
				if (_empressActiveMessage != null)
				{
					_empressActiveMessage.VisibleCharacters = _empressActiveMessage.Text.Length;
					if (_empressActiveMessage.CompletedAt < 0f)
					{
						_empressActiveMessage.CompletedAt = Time.unscaledTime - _empressActiveMessage.HoldSeconds;
					}
					_empressActiveMessage = null;
				}
				_empressPendingMessages.Insert(0, item);
			}
			else
			{
				_empressPendingMessages.Add(item);
			}
		}

		internal void EmpressShowLoss(string text)
		{
			_empressLossBanner = text;
			_empressLossBannerUntil = Time.unscaledTime + 8f;
		}

		internal void EmpressSetStatus(bool setupVisible, bool gameplayVisible, bool multiplayerLocked, string mode, string scene, float love, string tactic, string relationship, string speakerName)
		{
			_empressSetupVisible = setupVisible;
			_empressGameplayVisible = gameplayVisible;
			_empressMultiplayerLocked = multiplayerLocked;
			_empressMode = mode;
			_empressScene = scene;
			_empressLove = love;
			_empressTactic = tactic;
			_empressRelationship = relationship;
			_empressSpeakerName = (string.IsNullOrWhiteSpace(speakerName) ? "Empress" : speakerName);
			if (_empressSetupVisible && !_empressSetupSeeded)
			{
				EmpressSeedSetupFields();
			}
		}

		private void EmpressDrawSetupWindow(float width, float height)
		{
			//IL_0023: 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_0085: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_054b: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(width * 0.16f, height * 0.1f, width * 0.68f, height * 0.76f);
			GUI.DrawTexture(val, (Texture)(object)_empressBootTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, 42f), (Texture)(object)_empressHeaderTexture);
			GUI.Label(new Rect(((Rect)(ref val)).x + 18f, ((Rect)(ref val)).y + 7f, ((Rect)(ref val)).width - 36f, 30f), "Empress OS", _empressBootTitleStyle);
			GUI.Label(new Rect(((Rect)(ref val)).x + 18f, ((Rect)(ref val)).y + 52f, ((Rect)(ref val)).width - 36f, 22f), "Companion initialization shell", _empressBootBodyStyle);
			GUI.Label(new Rect(((Rect)(ref val)).x + 18f, ((Rect)(ref val)).y + 74f, ((Rect)(ref val)).width - 36f, 36f), "The game is paused. Build your companion and then boot the run.", _empressSmallStyle);
			float num = ((Rect)(ref val)).width - 36f;
			float num2 = ((Rect)(ref val)).y + 116f;
			GUI.Label(new Rect(((Rect)(ref val)).x + 18f, num2, num, 22f), "C:\\EmpressOS> what_is_my_name", _empressSmallStyle);
			GUI.SetNextControlName("CompanionName");
			_empressSetupCompanionName = GUI.TextField(new Rect(((Rect)(ref val)).x + 18f, num2 + 24f, num, 28f), _empressSetupCompanionName, 32, _empressFieldStyle);
			num2 += 66f;
			GUI.Label(new Rect(((Rect)(ref val)).x + 18f, num2, num, 22f), "C:\\EmpressOS> what_should_i_call_you", _empressSmallStyle);
			GUI.SetNextControlName("PlayerName");
			_empressSetupPlayerName = GUI.TextField(new Rect(((Rect)(ref val)).x + 18f, num2 + 24f, num, 28f), _empressSetupPlayerName, 32, _empressFieldStyle);
			num2 += 66f;
			GUI.Label(new Rect(((Rect)(ref val)).x + 18f, num2, num, 22f), "C:\\EmpressOS> pick_personality", _empressSmallStyle);
			num2 += 28f;
			EmpressDrawPersonalityButton(new Rect(((Rect)(ref val)).x + 18f, num2, 140f, 30f), EmpressCompanionPersonality.Sweet, "Sweet");
			EmpressDrawPersonalityButton(new Rect(((Rect)(ref val)).x + 168f, num2, 140f, 30f), EmpressCompanionPersonality.Playful, "Playful");
			EmpressDrawPersonalityButton(new Rect(((Rect)(ref val)).x + 318f, num2, 140f, 30f), EmpressCompanionPersonality.Elegant, "Elegant");
			EmpressDrawPersonalityButton(new Rect(((Rect)(ref val)).x + 468f, num2, 140f, 30f), EmpressCompanionPersonality.Protective, "Protective");
			num2 += 54f;
			GUI.Label(new Rect(((Rect)(ref val)).x + 18f, num2, num, 22f), "C:\\EmpressOS> optional_memorial_info", _empressSmallStyle);
			GUI.SetNextControlName("State");
			_empressSetupState = GUI.TextField(new Rect(((Rect)(ref val)).x + 18f, num2 + 24f, num * 0.48f, 28f), _empressSetupState, 32, _empressFieldStyle);
			GUI.SetNextControlName("Country");
			_empressSetupCountry = GUI.TextField(new Rect(((Rect)(ref val)).x + ((Rect)(ref val)).width * 0.52f, num2 + 24f, num * 0.48f, 28f), _empressSetupCountry, 32, _empressFieldStyle);
			GUI.Label(new Rect(((Rect)(ref val)).x + 18f, num2 + 54f, num, 20f), "State / province on the left, country on the right. Stored locally only if you fill it in.", _empressSmallStyle);
			num2 += 92f;
			bool value = EmpressCompanionPlugin.CompanionConfig.TextSoundsEnabled.Value;
			string text = (value ? "Typing sounds on" : "Typing sounds off");
			if (GUI.Button(new Rect(((Rect)(ref val)).x + 18f, num2, 170f, 30f), text, _empressButtonStyle))
			{
				EmpressCompanionPlugin.CompanionConfig.TextSoundsEnabled.Value = !value;
			}
			if (GUI.Button(new Rect(((Rect)(ref val)).x + ((Rect)(ref val)).width - 218f, num2, 200f, 34f), "Create companion", _empressSelectedButtonStyle))
			{
				EmpressCreateProfileFromSetup();
			}
			EmpressCompanionMemorial memorial = EmpressCompanionMemory.Memorial;
			if (memorial != null)
			{
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(((Rect)(ref val)).x + 18f, ((Rect)(ref val)).yMax - 118f, ((Rect)(ref val)).width - 36f, 92f);
				GUI.DrawTexture(val2, (Texture)(object)_empressPanelTexture);
				GUI.Label(new Rect(((Rect)(ref val2)).x + 12f, ((Rect)(ref val2)).y + 10f, ((Rect)(ref val2)).width - 24f, 18f), "C:\\EmpressOS> last_companion_memory", _empressTitleStyle);
				GUI.Label(new Rect(((Rect)(ref val2)).x + 12f, ((Rect)(ref val2)).y + 34f, ((Rect)(ref val2)).width - 24f, 48f), memorial.CompanionName + " faded in " + memorial.LastScene + " at " + memorial.DiedAt + ". " + memorial.Summary, _empressBootBodyStyle);
			}
		}

		private void EmpressDrawPersonalityButton(Rect rect, EmpressCompanionPersonality personality, string label)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = ((_empressSetupPersonality == personality) ? _empressSelectedButtonStyle : _empressButtonStyle);
			if (GUI.Button(rect, label, val))
			{
				_empressSetupPersonality = personality;
			}
		}

		private void EmpressCreateProfileFromSetup()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			string text = (string.IsNullOrWhiteSpace(_empressSetupCompanionName) ? "Empress" : _empressSetupCompanionName.Trim());
			string playerName = (string.IsNullOrWhiteSpace(_empressSetupPlayerName) ? "Player" : _empressSetupPlayerName.Trim());
			EmpressCompanionMemory.EmpressCreateProfile(text, playerName, _empressSetupPersonality, _empressSetupState, _empressSetupCountry);
			_empressSetupVisible = false;
			_empressSetupSeeded = false;
			EmpressPushMessage(text, "Link established. I am here now.", new Color(1f, 0.82f, 0.92f, 1f), urgent: true, 5f);
		}

		private void EmpressSeedSetupFields()
		{
			_empressSetupSeeded = true;
			EmpressCompanionMemorial memorial = EmpressCompanionMemory.Memorial;
			_empressSetupCompanionName = ((memorial != null && !string.IsNullOrWhiteSpace(memorial.CompanionName)) ? memorial.CompanionName : "Empress");
			_empressSetupPlayerName = ((memorial != null && !string.IsNullOrWhiteSpace(memorial.PlayerName)) ? memorial.PlayerName : "Player");
			_empressSetupState = memorial?.State ?? string.Empty;
			_empressSetupCountry = memorial?.Country ?? string.Empty;
			_empressSetupPersonality = memorial?.Personality ?? EmpressCompanionPersonality.Sweet;
		}

		private void EmpressBuildTextures()
		{
			//IL_0015: 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)
			//IL_005d: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			_empressPanelTexture = EmpressMakeTexture(new Color(0.015f, 0.01f, 0.018f, 0.95f));
			_empressHeaderTexture = EmpressMakeTexture(new Color(0.78f, 0.08f, 0.44f, 0.98f));
			_empressBarBackTexture = EmpressMakeTexture(new Color(0.12f, 0.055f, 0.095f, 1f));
			_empressBarFillTexture = EmpressMakeTexture(new Color(1f, 0.28f, 0.76f, 1f));
			_empressBootTexture = EmpressMakeTexture(new Color(0.01f, 0.006f, 0.014f, 0.985f));
			_empressFieldTexture = EmpressMakeTexture(new Color(0.035f, 0.018f, 0.034f, 0.98f));
			_empressButtonTexture = EmpressMakeTexture(new Color(0.12f, 0.035f, 0.09f, 0.98f));
			_empressButtonHoverTexture = EmpressMakeTexture(new Color(0.26f, 0.055f, 0.17f, 0.98f));
			_empressSelectedButtonTexture = EmpressMakeTexture(new Color(0.72f, 0.08f, 0.42f, 0.98f));
			_empressCursorTexture = EmpressMakeCursorTexture();
		}

		private void EmpressBuildStyles()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0068: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_00ee: 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_0105: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Expected O, but got Unknown
			//IL_01a5: 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_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Expected O, but got Unknown
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: 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_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Expected O, but got Unknown
			//IL_024a: 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_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: 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_02fd: 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_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Expected O, but got Unknown
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: 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_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Expected O, but got Unknown
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Expected O, but got Unknown
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Expected O, but got Unknown
			Font val = Font.CreateDynamicFontFromOSFont(new string[4] { "Consolas", "Lucida Console", "Courier New", "Segoe UI" }, 16);
			if ((Object)(object)val == (Object)null)
			{
				val = GUI.skin.font;
			}
			GUIStyle val2 = new GUIStyle(GUI.skin.label)
			{
				font = val,
				fontSize = 16,
				fontStyle = (FontStyle)1
			};
			val2.normal.textColor = new Color(1f, 0.9f, 0.97f, 1f);
			val2.alignment = (TextAnchor)3;
			_empressTitleStyle = val2;
			GUIStyle val3 = new GUIStyle(GUI.skin.label)
			{
				font = val,
				fontSize = 15,
				wordWrap = true,
				richText = true
			};
			val3.normal.textColor = new Color(1f, 0.91f, 0.97f, 1f);
			_empressBodyStyle = val3;
			GUIStyle val4 = new GUIStyle(GUI.skin.label)
			{
				font = val,
				fontSize = 12,
				wordWrap = true,
				alignment = (TextAnchor)3
			};
			val4.normal.textColor = new Color(1