Decompiled source of DrogozSurvivor v0.1.40

DrogozSurvivor/DrogozSurvivor.dll

Decompiled 2 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DrogozSurvivor.Components;
using DrogozSurvivor.Modules;
using DrogozSurvivor.Modules.Characters;
using DrogozSurvivor.Networking;
using DrogozSurvivor.SkillStates;
using DrogozSurvivor.Survivors.Drogoz;
using EntityStates;
using EntityStates.AI.Walker;
using HG;
using HG.BlendableTypes;
using KinematicCharacterController;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ConVar;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPathsBetter;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[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("DrogozSurvivor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f6825da06efe7c533e2780ed4b201b8673a9e50e")]
[assembly: AssemblyProduct("DrogozSurvivor")]
[assembly: AssemblyTitle("DrogozSurvivor")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DrogozSurvivor
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Personal.DrogozSurvivor", "DrogozSurvivor", "0.1.40")]
	public class DrogozSurvivorPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.Personal.DrogozSurvivor";

		public const string MODNAME = "DrogozSurvivor";

		public const string MODVERSION = "0.1.40";

		public const string DEVELOPER_PREFIX = "PERSONAL";

		public static DrogozSurvivorPlugin instance;

		private void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			DrogozConfig.Init();
			DrogozDamageTypes.Init();
			DrogozCards.Init();
			DrogozAfterburner.Init();
			DrogozEasyTarget.Init();
			DrogozSittingDuck.Init();
			DrogozIronclad.Init();
			DrogozMark.Init();
			DrogozTalents.Init();
			DrogozDragonPunchHooks.Init();
			DrogozModelRestorer.Init();
			NetworkingAPI.RegisterMessageType<SyncThrustRefund>();
			NetworkingAPI.RegisterMessageType<SyncFireSpitRefund>();
			NetworkingAPI.RegisterMessageType<SyncSalvoRefund>();
			NetworkingAPI.RegisterMessageType<SyncDrogozCards>();
			NetworkingAPI.RegisterMessageType<SyncDragonPunchDamage>();
			Projectiles.Init();
			Language.Init();
			new DrogozSurvivor.Survivors.Drogoz.DrogozSurvivor().Initialize();
			DrogozCardCatalog.InitIcons();
			DrogozCards.RefreshBuffIcons();
			DrogozCardLoadoutRows.Init();
			new ContentPacks().Initialize();
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			Debug("General", data);
		}

		internal static void Debug(string tag, object data)
		{
			if (_logSource != null && DrogozConfig.IsDebugTagEnabled(tag))
			{
				_logSource.LogDebug((object)("[" + tag + "] " + data));
			}
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void ErrorAssetBundle(string assetName, string bundleName)
		{
			Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace DrogozSurvivor.Networking
{
	public class SyncDragonPunchDamage : INetMessage, ISerializableObject
	{
		private NetworkInstanceId attackerNetId;

		private NetworkInstanceId victimNetId;

		private float damage;

		private float proc;

		private Vector3 position;

		public SyncDragonPunchDamage()
		{
		}

		public SyncDragonPunchDamage(NetworkInstanceId attackerNetId, NetworkInstanceId victimNetId, float damage, float proc, Vector3 position)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			this.attackerNetId = attackerNetId;
			this.victimNetId = victimNetId;
			this.damage = damage;
			this.proc = proc;
			this.position = position;
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(attackerNetId);
			writer.Write(victimNetId);
			writer.Write(damage);
			writer.Write(proc);
			writer.Write(position.x);
			writer.Write(position.y);
			writer.Write(position.z);
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			attackerNetId = reader.ReadNetworkId();
			victimNetId = reader.ReadNetworkId();
			damage = reader.ReadSingle();
			proc = reader.ReadSingle();
			position = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
		}

		public void OnReceived()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			if (NetworkServer.active)
			{
				GameObject val = Util.FindNetworkObject(attackerNetId);
				GameObject val2 = Util.FindNetworkObject(victimNetId);
				HealthComponent val3 = (Object.op_Implicit((Object)(object)val2) ? val2.GetComponent<HealthComponent>() : null);
				if (Object.op_Implicit((Object)(object)val3) && val3.alive)
				{
					DamageInfo val4 = new DamageInfo
					{
						attacker = val,
						inflictor = val,
						damage = damage,
						position = position,
						force = Vector3.zero,
						crit = false,
						damageColorIndex = (DamageColorIndex)0,
						procCoefficient = proc,
						damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)8)
					};
					val3.TakeDamage(val4);
					GlobalEventManager.instance.OnHitEnemy(val4, val2);
					GlobalEventManager.instance.OnHitAll(val4, val2);
				}
			}
		}
	}
	public class SyncDrogozCards : INetMessage, ISerializableObject
	{
		private NetworkInstanceId bodyNetId;

		private byte[] cardIndices = new byte[5];

		private byte[] ranks = new byte[5];

		public SyncDrogozCards()
		{
		}

		public SyncDrogozCards(NetworkInstanceId bodyNetId, CardLoadout loadout)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			this.bodyNetId = bodyNetId;
			for (int i = 0; i < 5; i++)
			{
				CardSlot cardSlot = ((loadout != null && loadout.Slots != null) ? loadout.Slots[i] : null);
				int num = ((cardSlot != null) ? DrogozCardCatalog.IndexOf(cardSlot.CardId) : (-1));
				cardIndices[i] = (byte)((num >= 0) ? ((uint)num) : 255u);
				ranks[i] = (byte)((cardSlot != null) ? ((uint)Mathf.Clamp(cardSlot.Rank, 0, 5)) : 0u);
			}
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(bodyNetId);
			for (int i = 0; i < 5; i++)
			{
				writer.Write(cardIndices[i]);
				writer.Write(ranks[i]);
			}
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			bodyNetId = reader.ReadNetworkId();
			for (int i = 0; i < 5; i++)
			{
				cardIndices[i] = reader.ReadByte();
				ranks[i] = reader.ReadByte();
			}
		}

		public void OnReceived()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			GameObject val = Util.FindNetworkObject(bodyNetId);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			DrogozCardLoadoutComponent drogozCardLoadoutComponent = val.GetComponent<DrogozCardLoadoutComponent>();
			if (!Object.op_Implicit((Object)(object)drogozCardLoadoutComponent))
			{
				drogozCardLoadoutComponent = val.AddComponent<DrogozCardLoadoutComponent>();
			}
			CardLoadout cardLoadout = new CardLoadout();
			for (int i = 0; i < 5; i++)
			{
				int num = cardIndices[i];
				if (num < DrogozCardCatalog.Cards.Length)
				{
					cardLoadout.SetSlot(i, DrogozCardCatalog.Cards[num].Id, ranks[i]);
				}
			}
			drogozCardLoadoutComponent.SetLoadout(cardLoadout);
			Log.Debug("Networking", $"Received card loadout for netId={bodyNetId} complete={cardLoadout.IsComplete()} points={cardLoadout.TotalPoints()}");
		}
	}
	public class SyncFireSpitRefund : INetMessage, ISerializableObject
	{
		private NetworkInstanceId bodyNetId;

		private float seconds;

		public SyncFireSpitRefund()
		{
		}

		public SyncFireSpitRefund(NetworkInstanceId bodyNetId, float seconds)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			this.bodyNetId = bodyNetId;
			this.seconds = seconds;
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(bodyNetId);
			writer.Write(seconds);
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			bodyNetId = reader.ReadNetworkId();
			seconds = reader.ReadSingle();
		}

		public void OnReceived()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active || seconds <= 0f || float.IsNaN(seconds) || float.IsInfinity(seconds))
			{
				return;
			}
			GameObject val = Util.FindNetworkObject(bodyNetId);
			if (Object.op_Implicit((Object)(object)val))
			{
				CharacterBody component = val.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && ((NetworkBehaviour)component).hasAuthority)
				{
					FireSpit.ReduceCooldown(component, seconds);
				}
			}
		}
	}
	public class SyncSalvoRefund : INetMessage, ISerializableObject
	{
		private NetworkInstanceId bodyNetId;

		private float seconds;

		public SyncSalvoRefund()
		{
		}

		public SyncSalvoRefund(NetworkInstanceId bodyNetId, float seconds)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			this.bodyNetId = bodyNetId;
			this.seconds = seconds;
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(bodyNetId);
			writer.Write(seconds);
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			bodyNetId = reader.ReadNetworkId();
			seconds = reader.ReadSingle();
		}

		public void OnReceived()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active || seconds <= 0f || float.IsNaN(seconds) || float.IsInfinity(seconds))
			{
				return;
			}
			GameObject val = Util.FindNetworkObject(bodyNetId);
			if (Object.op_Implicit((Object)(object)val))
			{
				CharacterBody component = val.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && ((NetworkBehaviour)component).hasAuthority)
				{
					DrogozCards.ReduceSalvoCooldown(component, seconds);
				}
			}
		}
	}
	public class SyncThrustRefund : INetMessage, ISerializableObject
	{
		private NetworkInstanceId bodyNetId;

		private float seconds;

		public SyncThrustRefund()
		{
		}

		public SyncThrustRefund(NetworkInstanceId bodyNetId, float seconds)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			this.bodyNetId = bodyNetId;
			this.seconds = seconds;
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(bodyNetId);
			writer.Write(seconds);
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			bodyNetId = reader.ReadNetworkId();
			seconds = reader.ReadSingle();
		}

		public void OnReceived()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active || seconds <= 0f || float.IsNaN(seconds) || float.IsInfinity(seconds))
			{
				return;
			}
			GameObject val = Util.FindNetworkObject(bodyNetId);
			if (Object.op_Implicit((Object)(object)val))
			{
				CharacterBody component = val.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && ((NetworkBehaviour)component).hasAuthority)
				{
					Thrust.ReduceCooldown(component, seconds);
				}
			}
		}
	}
}
namespace DrogozSurvivor.Modules
{
	internal static class Asset
	{
		internal static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>();

		internal static AssetBundle LoadAssetBundle(string bundleName)
		{
			if (bundleName == "myassetbundle")
			{
				Log.Error("AssetBundle name hasn't been changed. not loading any assets to avoid conflicts.\nMake sure to rename your assetbundle filename and rename the AssetBundleName field in your character setup code ");
				return null;
			}
			if (loadedBundles.ContainsKey(bundleName))
			{
				return loadedBundles[bundleName];
			}
			AssetBundle val = null;
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)DrogozSurvivorPlugin.instance).Info.Location);
				string text = Path.Combine(directoryName, "AssetBundles", bundleName);
				if (!File.Exists(text))
				{
					text = Path.Combine(directoryName, bundleName);
				}
				val = AssetBundle.LoadFromFile(text);
			}
			catch (Exception arg)
			{
				Log.Error($"Error loading asset bundle, {bundleName}. Your asset bundle must be in a folder next to your mod dll called 'AssetBundles'. Follow the guide to build and install your mod correctly!\n{arg}");
			}
			loadedBundles[bundleName] = val;
			return val;
		}

		internal static GameObject CloneTracer(string originalTracerName, string newTracerName)
		{
			if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null)
			{
				return null;
			}
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true);
			if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>()))
			{
				val.AddComponent<EffectComponent>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>()))
			{
				val.AddComponent<VFXAttributes>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
			{
				val.AddComponent<NetworkIdentity>();
			}
			val.GetComponent<Tracer>().speed = 250f;
			val.GetComponent<Tracer>().length = 50f;
			Content.CreateAndAddEffectDef(val);
			return val;
		}

		internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert)
		{
			if (!Object.op_Implicit((Object)(object)objectToConvert))
			{
				return;
			}
			MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial))
				{
					((Renderer)val).sharedMaterial.ConvertDefaultShaderToHopoo();
				}
			}
			SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val2 in componentsInChildren2)
			{
				if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial))
				{
					((Renderer)val2).sharedMaterial.ConvertDefaultShaderToHopoo();
				}
			}
		}

		internal static GameObject LoadCrosshair(string crosshairName)
		{
			GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair");
			if ((Object)(object)val == (Object)null)
			{
				Log.Error("could not load crosshair with the name " + crosshairName + ". defaulting to Standard");
				return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair");
			}
			return val;
		}

		internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, bool parentToTransform)
		{
			return assetBundle.LoadEffect(resourceName, "", parentToTransform);
		}

		internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, string soundName = "", bool parentToTransform = false)
		{
			//IL_003c: 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)
			GameObject val = assetBundle.LoadAsset<GameObject>(resourceName);
			if (!Object.op_Implicit((Object)(object)val))
			{
				Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name);
				return null;
			}
			val.AddComponent<DestroyOnTimer>().duration = 12f;
			val.AddComponent<NetworkIdentity>();
			val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
			EffectComponent obj = val.AddComponent<EffectComponent>();
			obj.applyScale = false;
			obj.effectIndex = (EffectIndex)(-1);
			obj.parentToReferencedTransform = parentToTransform;
			obj.positionAtReferencedTransform = true;
			obj.soundName = soundName;
			Content.CreateAndAddEffectDef(val);
			return val;
		}

		internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName)
		{
			GameObject val = assetBundle.LoadAsset<GameObject>(ghostName);
			if ((Object)(object)val == (Object)null)
			{
				Log.Error("Failed to load ghost prefab " + ghostName);
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
			{
				val.AddComponent<NetworkIdentity>();
			}
			if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>()))
			{
				val.AddComponent<ProjectileGhostController>();
			}
			ConvertAllRenderersToHopooShader(val);
			return val;
		}

		internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName)
		{
			return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName);
		}

		internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName)
		{
			GameObject val = assetBundle.LoadAsset<GameObject>(newPrefabName);
			if ((Object)(object)val == (Object)null)
			{
				Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name);
				return null;
			}
			Content.AddProjectilePrefab(val);
			return val;
		}
	}
	public static class Config
	{
		public static ConfigFile MyConfig = ((BaseUnityPlugin)DrogozSurvivorPlugin.instance).Config;

		public static ConfigEntry<bool> CharacterEnableConfig(string section, string characterName, string description = "", bool enabledByDefault = true)
		{
			if (string.IsNullOrEmpty(description))
			{
				description = "Set to false to disable this character and as much of its code and content as possible";
			}
			return BindAndOptions(section, "Enable " + characterName, enabledByDefault, description, restartRequired: true);
		}

		public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, string description = "", bool restartRequired = false)
		{
			return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired);
		}

		public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, float min, float max, string description = "", bool restartRequired = false)
		{
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			if (restartRequired)
			{
				description += " (restart required)";
			}
			ConfigEntry<T> result = MyConfig.Bind<T>(section, name, defaultValue, description);
			Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
			return result;
		}

		public static ConfigEntry<float> BindAndOptionsSlider(string section, string name, float defaultValue, string description, float min = 0f, float max = 20f, bool restartRequired = false)
		{
			return BindAndOptions(section, name, defaultValue, min, max, description, restartRequired);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void TryRegisterOption<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired)
		{
		}

		public static bool GetKeyPressed(KeyboardShortcut entry)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyCode modifier in ((KeyboardShortcut)(ref entry)).Modifiers)
			{
				if (!Input.GetKey(modifier))
				{
					return false;
				}
			}
			return Input.GetKeyDown(((KeyboardShortcut)(ref entry)).MainKey);
		}
	}
	internal class Content
	{
		internal static void AddCharacterBodyPrefab(GameObject bprefab)
		{
			ContentPacks.bodyPrefabs.Add(bprefab);
		}

		internal static void AddMasterPrefab(GameObject prefab)
		{
			ContentPacks.masterPrefabs.Add(prefab);
		}

		internal static void AddProjectilePrefab(GameObject prefab)
		{
			ContentPacks.projectilePrefabs.Add(prefab);
		}

		internal static void AddSurvivorDef(SurvivorDef survivorDef)
		{
			ContentPacks.survivorDefs.Add(survivorDef);
		}

		internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f);
		}

		internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition);
		}

		internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f);
		}

		internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			SurvivorDef obj = ScriptableObject.CreateInstance<SurvivorDef>();
			obj.bodyPrefab = bodyPrefab;
			obj.displayPrefab = displayPrefab;
			obj.primaryColor = charColor;
			obj.cachedName = ((Object)bodyPrefab).name.Replace("Body", "");
			obj.displayNameToken = tokenPrefix + "NAME";
			obj.descriptionToken = tokenPrefix + "DESCRIPTION";
			obj.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR";
			obj.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE";
			obj.desiredSortPosition = sortPosition;
			obj.unlockableDef = unlockableDef;
			AddSurvivorDef(obj);
		}

		internal static void AddUnlockableDef(UnlockableDef unlockableDef)
		{
			ContentPacks.unlockableDefs.Add(unlockableDef);
		}

		internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, AssetReferenceT<Sprite> achievementIconRef)
		{
			UnlockableDef obj = ScriptableObject.CreateInstance<UnlockableDef>();
			obj.cachedName = identifier;
			obj.nameToken = nameToken;
			obj.achievementIconRef = achievementIconRef;
			AddUnlockableDef(obj);
			return obj;
		}

		internal static void AddSkillDef(SkillDef skillDef)
		{
			ContentPacks.skillDefs.Add(skillDef);
		}

		internal static void AddSkillFamily(SkillFamily skillFamily)
		{
			ContentPacks.skillFamilies.Add(skillFamily);
		}

		internal static void AddEntityState(Type entityState)
		{
			ContentPacks.entityStates.Add(entityState);
		}

		internal static void AddBuffDef(BuffDef buffDef)
		{
			ContentPacks.buffDefs.Add(buffDef);
		}

		internal static BuffDef CreateAndAddBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			BuffDef obj = ScriptableObject.CreateInstance<BuffDef>();
			((Object)obj).name = buffName;
			obj.buffColor = buffColor;
			obj.canStack = canStack;
			obj.isDebuff = isDebuff;
			obj.eliteDef = null;
			obj.iconSprite = buffIcon;
			AddBuffDef(obj);
			return obj;
		}

		internal static void AddEffectDef(EffectDef effectDef)
		{
			ContentPacks.effectDefs.Add(effectDef);
		}

		internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_000d: Expected O, but got Unknown
			EffectDef val = new EffectDef(effectPrefab);
			AddEffectDef(val);
			return val;
		}

		internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef)
		{
			ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef);
		}

		internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName)
		{
			NetworkSoundEventDef obj = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
			obj.akId = AkSoundEngine.GetIDFromString(eventName);
			obj.eventName = eventName;
			AddNetworkSoundEventDef(obj);
			return obj;
		}
	}
	internal class ContentPacks : IContentPackProvider
	{
		private static readonly FieldInfo IdentifierField = typeof(ContentPack).GetField("_identifier", BindingFlags.Instance | BindingFlags.NonPublic);

		internal ContentPack contentPack = new ContentPack();

		public static List<GameObject> bodyPrefabs = new List<GameObject>();

		public static List<GameObject> masterPrefabs = new List<GameObject>();

		public static List<GameObject> projectilePrefabs = new List<GameObject>();

		public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>();

		public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();

		public static List<SkillFamily> skillFamilies = new List<SkillFamily>();

		public static List<SkillDef> skillDefs = new List<SkillDef>();

		public static List<Type> entityStates = new List<Type>();

		public static List<BuffDef> buffDefs = new List<BuffDef>();

		public static List<EffectDef> effectDefs = new List<EffectDef>();

		public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();

		public string identifier => "com.Personal.DrogozSurvivor";

		public void Initialize()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)this);
		}

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			if (IdentifierField == null)
			{
				throw new InvalidOperationException("ContentPack._identifier was not found.");
			}
			IdentifierField.SetValue(contentPack, identifier);
			contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray());
			contentPack.masterPrefabs.Add(masterPrefabs.ToArray());
			contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
			contentPack.survivorDefs.Add(survivorDefs.ToArray());
			contentPack.unlockableDefs.Add(unlockableDefs.ToArray());
			contentPack.skillDefs.Add(skillDefs.ToArray());
			contentPack.skillFamilies.Add(skillFamilies.ToArray());
			contentPack.entityStateTypes.Add(entityStates.ToArray());
			contentPack.buffDefs.Add(buffDefs.ToArray());
			contentPack.effectDefs.Add(effectDefs.ToArray());
			contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	internal static class DrogozAfterburner
	{
		internal static BuffDef buffDef;

		private static bool hooked;

		internal static void Init()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)buffDef))
			{
				BuffDef cloakSpeed = Buffs.CloakSpeed;
				string source;
				Sprite val = DrogozIcons.LoadBuffIcon(null, null, null, "afterburner.png", out source);
				buffDef = Content.CreateAndAddBuff("PERSONAL_DROGOZ_AFTERBURNER", val, (Color)(Object.op_Implicit((Object)(object)cloakSpeed) ? cloakSpeed.buffColor : new Color(0.35f, 0.85f, 1f)), canStack: false, isDebuff: false);
				buffDef.isCooldown = false;
				Log.Debug("Buffs", $"Afterburner icon loaded={(Object)(object)val != (Object)null} source={source}");
				if (!hooked)
				{
					RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(HandleStatCoefficients);
					hooked = true;
				}
			}
		}

		internal static void Apply(CharacterBody body, float duration)
		{
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)buffDef) && !(duration <= 0f))
			{
				body.AddTimedBuff(buffDef, duration);
				Log.Debug("Buffs", $"Afterburner applied body={((Object)body).name} duration={duration:0.0}s hasIcon={(Object)(object)buffDef.iconSprite != (Object)null}");
			}
		}

		private static void HandleStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)buffDef) && sender.GetBuffCount(buffDef.buffIndex) > 0)
			{
				args.moveSpeedMultAdd += Mathf.Max(0f, DrogozConfig.ThrustMoveSpeedBonus.Value);
			}
		}
	}
	[Serializable]
	public class CardDefinition
	{
		public string Id;

		public string Name;

		public string Description;

		public string IconTexture;

		[NonSerialized]
		public Sprite Icon;
	}
	internal static class DrogozCardCatalog
	{
		internal const int SlotCount = 5;

		internal const int PointLimit = 15;

		internal const int MaxRank = 5;

		internal static readonly CardDefinition[] Cards = new CardDefinition[16]
		{
			new CardDefinition
			{
				Id = "rocket_radius",
				Name = "Wide Blast",
				Description = "Each rank adds 0.25m to the Rocket Launcher explosion radius.",
				IconTexture = "card_rocket_damage"
			},
			new CardDefinition
			{
				Id = "rocket_jump",
				Name = "Rocket Jump",
				Description = "Each rank increases rocket self-knockback by 15%.",
				IconTexture = "card_last_rocket"
			},
			new CardDefinition
			{
				Id = "hot_swap",
				Name = "Hot Swap",
				Description = "Each rank gives a 6% chance to refund one Primary rocket on a rocket hit. Failed attempts build toward a guaranteed refund. Salvo waits up to 4s for in-flight refunds and can add up to 6 extra rockets.",
				IconTexture = "card_salvo_recycling"
			},
			new CardDefinition
			{
				Id = "fire_spit_sustain",
				Name = "Lung Capacity",
				Description = "Each rank heals 1% max health per unique Fire Spit detonation enemy hit. Healing is capped at 10% per detonation.",
				IconTexture = "card_fire_spit_sustain"
			},
			new CardDefinition
			{
				Id = "scent_trail",
				Name = "Scent Trail",
				Description = "Each rank reduces Fire Spit cooldown by 0.25s per unique detonation enemy hit. Refund is capped at 5s per detonation (6 second cooldown).",
				IconTexture = "card_rocket_boss"
			},
			new CardDefinition
			{
				Id = "fire_spit_reach",
				Name = "Expanded Blast",
				Description = "Each rank adds 0.7m to the Fire Spit detonation radius.",
				IconTexture = "card_rocket_radius"
			},
			new CardDefinition
			{
				Id = "masterful",
				Name = "Lasting Brand",
				Description = "Each rank adds 0.5s to Draconic Brand duration when a direct Fire Spit hit lands.",
				IconTexture = "card_draconic_brand"
			},
			new CardDefinition
			{
				Id = "thrust_plating",
				Name = "Survival",
				Description = "Each rank gives 5% damage reduction for 3 seconds after Thrust.",
				IconTexture = "card_thrust_plating"
			},
			new CardDefinition
			{
				Id = "thrust_force",
				Name = "Propel",
				Description = "Each rank increases Thrust impulse and velocity by 10%.",
				IconTexture = "card_rocket_jump"
			},
			new CardDefinition
			{
				Id = "emergency_flare",
				Name = "Emergency Flare",
				Description = "Each rank heals 2% max health immediately after Thrust.",
				IconTexture = "card_salvo_damage"
			},
			new CardDefinition
			{
				Id = "salvo_recycling",
				Name = "Spitfire",
				Description = "Salvo: each rank reduces Salvo cooldown by 0.2s per unique enemy hit (cap 5s per barrage). Dragon Punch: after Dragon Punch ends, gain 10% movement speed per rank for 3s (cap 50%).",
				IconTexture = "card_fire_spit_reach"
			},
			new CardDefinition
			{
				Id = "bask",
				Name = "Bask",
				Description = "Salvo: each rank heals 1% max health per unique Salvo enemy hit (cap 10% per barrage). Dragon Punch: each rank heals 2% max health per Dragon Punch kill (cap 10% per punch).",
				IconTexture = "card_emergency_flare"
			},
			new CardDefinition
			{
				Id = "hyper_boost",
				Name = "Hyper Boost",
				Description = "Salvo: each rank restores 1% Booster fuel per unique Salvo enemy hit (cap 20% per barrage). Dragon Punch: each rank grants 10% damage reduction while channeling (cap 50%).",
				IconTexture = "card_overdrive"
			},
			new CardDefinition
			{
				Id = "booster_control",
				Name = "Altitude",
				Description = "Each rank adds 5% Booster strafing and steering while flying.",
				IconTexture = "card_booster_reserve"
			},
			new CardDefinition
			{
				Id = "booster_capacity",
				Name = "Adrenaline",
				Description = "When health drops below 30%, gain 10% movement speed per rank for 2 seconds (10 second cooldown).",
				IconTexture = "card_booster_control"
			},
			new CardDefinition
			{
				Id = "overdrive",
				Name = "Concussive Round",
				Description = "Direct Rocket Launcher hits have an 8% chance per rank to stun the enemy hit for 0.5 seconds (5 second cooldown).",
				IconTexture = "card_fire_spit_brand_duration"
			}
		};

		internal static void InitIcons()
		{
			//IL_0057: 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)
			DrogozSurvivor.Survivors.Drogoz.DrogozSurvivor instance = DrogozSurvivor.Survivors.Drogoz.DrogozSurvivor.instance;
			if (instance == null || !Object.op_Implicit((Object)(object)instance.assetBundle))
			{
				return;
			}
			for (int i = 0; i < Cards.Length; i++)
			{
				CardDefinition cardDefinition = Cards[i];
				Texture2D val = instance.assetBundle.LoadAsset<Texture2D>(cardDefinition.IconTexture);
				if (Object.op_Implicit((Object)(object)val))
				{
					cardDefinition.Icon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
					((Object)cardDefinition.Icon).name = cardDefinition.Id;
				}
			}
		}

		internal static CardDefinition Find(string id)
		{
			if (string.IsNullOrEmpty(id))
			{
				return null;
			}
			for (int i = 0; i < Cards.Length; i++)
			{
				if (Cards[i].Id == id)
				{
					return Cards[i];
				}
			}
			return null;
		}

		internal static int IndexOf(string id)
		{
			if (string.IsNullOrEmpty(id))
			{
				return -1;
			}
			for (int i = 0; i < Cards.Length; i++)
			{
				if (Cards[i].Id == id)
				{
					return i;
				}
			}
			return -1;
		}
	}
	[Serializable]
	public class CardSlot
	{
		public string CardId = "";

		public int Rank;
	}
	[Serializable]
	public class CardLoadout
	{
		public CardSlot[] Slots = new CardSlot[5];

		public CardLoadout()
		{
			for (int i = 0; i < Slots.Length; i++)
			{
				Slots[i] = new CardSlot();
			}
		}

		public bool IsComplete()
		{
			if (Slots == null || Slots.Length != 5 || TotalPoints() != 15)
			{
				return false;
			}
			for (int i = 0; i < Slots.Length; i++)
			{
				CardSlot cardSlot = Slots[i];
				if (cardSlot == null || string.IsNullOrEmpty(cardSlot.CardId) || cardSlot.Rank <= 0 || DrogozCardCatalog.Find(cardSlot.CardId) == null)
				{
					return false;
				}
				for (int j = i + 1; j < Slots.Length; j++)
				{
					if (Slots[j] != null && Slots[j].CardId == cardSlot.CardId)
					{
						return false;
					}
				}
			}
			return true;
		}

		public int TotalPoints()
		{
			if (Slots == null)
			{
				return 0;
			}
			int num = 0;
			for (int i = 0; i < Slots.Length; i++)
			{
				if (Slots[i] != null && !string.IsNullOrEmpty(Slots[i].CardId))
				{
					num += Mathf.Clamp(Slots[i].Rank, 0, 5);
				}
			}
			return num;
		}

		public int GetRank(string cardId)
		{
			if (string.IsNullOrEmpty(cardId) || Slots == null)
			{
				return 0;
			}
			for (int i = 0; i < Slots.Length; i++)
			{
				if (Slots[i] != null && Slots[i].CardId == cardId)
				{
					return Mathf.Clamp(Slots[i].Rank, 0, 5);
				}
			}
			return 0;
		}

		public int FindSlot(string cardId)
		{
			if (string.IsNullOrEmpty(cardId) || Slots == null)
			{
				return -1;
			}
			for (int i = 0; i < Slots.Length; i++)
			{
				if (Slots[i] != null && Slots[i].CardId == cardId)
				{
					return i;
				}
			}
			return -1;
		}

		public bool CanSetRank(string cardId, int rank)
		{
			if (Slots == null || rank < 0 || rank > 5 || DrogozCardCatalog.Find(cardId) == null)
			{
				return false;
			}
			int rank2 = GetRank(cardId);
			return TotalPoints() - rank2 + rank <= 15;
		}

		public void SetSlot(int slotIndex, string cardId, int rank)
		{
			if (Slots == null || slotIndex < 0 || slotIndex >= Slots.Length)
			{
				return;
			}
			if (Slots[slotIndex] == null)
			{
				Slots[slotIndex] = new CardSlot();
			}
			if (rank <= 0 || string.IsNullOrEmpty(cardId) || DrogozCardCatalog.Find(cardId) == null)
			{
				ClearSlot(slotIndex);
				return;
			}
			rank = Mathf.Clamp(rank, 1, 5);
			int num = TotalPoints();
			if (!string.IsNullOrEmpty(Slots[slotIndex].CardId))
			{
				num -= Mathf.Clamp(Slots[slotIndex].Rank, 0, 5);
			}
			for (int i = 0; i < Slots.Length; i++)
			{
				if (i != slotIndex && Slots[i] != null && Slots[i].CardId == cardId)
				{
					num -= Mathf.Clamp(Slots[i].Rank, 0, 5);
				}
			}
			if (num + rank > 15)
			{
				return;
			}
			for (int j = 0; j < Slots.Length; j++)
			{
				if (j != slotIndex && Slots[j] != null && Slots[j].CardId == cardId)
				{
					ClearSlot(j);
				}
			}
			Slots[slotIndex].CardId = cardId;
			Slots[slotIndex].Rank = rank;
		}

		public void ClearSlot(int slotIndex)
		{
			if (Slots != null && slotIndex >= 0 && slotIndex < Slots.Length)
			{
				if (Slots[slotIndex] == null)
				{
					Slots[slotIndex] = new CardSlot();
				}
				Slots[slotIndex].CardId = "";
				Slots[slotIndex].Rank = 0;
			}
		}

		public CardLoadout Clone()
		{
			CardLoadout cardLoadout = new CardLoadout();
			if (Slots == null || Slots.Length != 5)
			{
				return cardLoadout;
			}
			for (int i = 0; i < Slots.Length; i++)
			{
				cardLoadout.Slots[i].CardId = ((Slots[i] != null) ? Slots[i].CardId : "");
				cardLoadout.Slots[i].Rank = ((Slots[i] != null) ? Slots[i].Rank : 0);
			}
			return cardLoadout;
		}

		public void Save()
		{
			DrogozCardLoadoutStorage.Save(this);
		}
	}
	internal static class DrogozCardLoadoutStorage
	{
		private static readonly string FilePath = Path.Combine(Paths.ConfigPath, "com.Personal.DrogozSurvivor.cards.json");

		private static CardLoadout current;

		internal static CardLoadout Current
		{
			get
			{
				if (current == null)
				{
					current = Load();
				}
				return current;
			}
			set
			{
				current = Normalize(value);
			}
		}

		internal static event Action Changed;

		internal static CardLoadout Load()
		{
			if (!File.Exists(FilePath))
			{
				Log.Debug("Loadouts", "No saved card loadout file. Using empty loadout.");
				return new CardLoadout();
			}
			try
			{
				CardLoadout cardLoadout = Normalize(JsonUtility.FromJson<CardLoadout>(File.ReadAllText(FilePath)));
				Log.Debug("Loadouts", $"Loaded card loadout complete={cardLoadout.IsComplete()} points={cardLoadout.TotalPoints()}/{15}");
				return cardLoadout;
			}
			catch (Exception ex)
			{
				Log.Warning("Could not load Drogoz cards: " + ex.Message);
				return new CardLoadout();
			}
		}

		internal static void Save(CardLoadout loadout)
		{
			if (loadout == null || !loadout.IsComplete())
			{
				Log.Debug("Loadouts", $"Refused to save invalid card loadout complete={loadout?.IsComplete() ?? false} points={loadout?.TotalPoints() ?? 0}/{15}");
				return;
			}
			current = Normalize(loadout);
			Log.Debug("Loadouts", $"Saved valid card loadout points={current.TotalPoints()}/{15}");
			try
			{
				Directory.CreateDirectory(Path.GetDirectoryName(FilePath));
				File.WriteAllText(FilePath, JsonUtility.ToJson((object)current, true));
			}
			catch (Exception ex)
			{
				Log.Warning("Could not save Drogoz cards: " + ex.Message);
			}
			DrogozCardLoadoutStorage.Changed?.Invoke();
		}

		private static CardLoadout Normalize(CardLoadout loadout)
		{
			if (loadout == null || loadout.Slots == null || loadout.Slots.Length != 5)
			{
				return new CardLoadout();
			}
			CardLoadout cardLoadout = loadout.Clone();
			for (int i = 0; i < cardLoadout.Slots.Length; i++)
			{
				if (cardLoadout.Slots[i] == null)
				{
					cardLoadout.Slots[i] = new CardSlot();
				}
				if (DrogozCardCatalog.Find(cardLoadout.Slots[i].CardId) == null)
				{
					cardLoadout.ClearSlot(i);
				}
				else
				{
					cardLoadout.Slots[i].Rank = Mathf.Clamp(cardLoadout.Slots[i].Rank, 0, 5);
				}
				if (cardLoadout.Slots[i].Rank <= 0)
				{
					cardLoadout.ClearSlot(i);
				}
			}
			for (int j = 0; j < cardLoadout.Slots.Length; j++)
			{
				for (int k = j + 1; k < cardLoadout.Slots.Length; k++)
				{
					if (!string.IsNullOrEmpty(cardLoadout.Slots[j].CardId) && cardLoadout.Slots[j].CardId == cardLoadout.Slots[k].CardId)
					{
						cardLoadout.ClearSlot(k);
					}
				}
			}
			while (cardLoadout.TotalPoints() > 15)
			{
				bool flag = false;
				for (int num = cardLoadout.Slots.Length - 1; num >= 0; num--)
				{
					if (cardLoadout.Slots[num].Rank > 0)
					{
						cardLoadout.Slots[num].Rank--;
						if (cardLoadout.Slots[num].Rank <= 0)
						{
							cardLoadout.ClearSlot(num);
						}
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					break;
				}
			}
			return cardLoadout;
		}
	}
	internal static class DrogozCards
	{
		internal const float SalvoRefundCap = 5f;

		internal const float SalvoBaseRefundCap = 4.5f;

		internal const float SalvoBaseRefundPerHit = 0.225f;

		internal const float ScentTrailRefundCap = 5f;

		internal const float ScentTrailCooldown = 6f;

		internal const float ConcussiveCooldown = 5f;

		internal const float HotSwapChancePerRank = 0.06f;

		internal const int HotSwapSalvoExtraCap = 6;

		internal const float SpitfireSpeedDuration = 3f;

		internal const float SpitfireSpeedPerRank = 0.1f;

		internal static BuffDef thrustPlatingBuff;

		internal static BuffDef baskBuff;

		internal static BuffDef adrenalineBuff;

		internal static BuffDef wyrmJetsAirBuff;

		internal static BuffDef spitfireBuff;

		private static bool hooked;

		internal static void Init()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)thrustPlatingBuff))
			{
				BuffDef armorBoost = Buffs.ArmorBoost;
				thrustPlatingBuff = Content.CreateAndAddBuff("PERSONAL_DROGOZ_THRUST_PLATING", Object.op_Implicit((Object)(object)armorBoost) ? armorBoost.iconSprite : null, (Color)(Object.op_Implicit((Object)(object)armorBoost) ? armorBoost.buffColor : new Color(0.6f, 0.8f, 1f)), canStack: false, isDebuff: false);
				thrustPlatingBuff.isCooldown = false;
				thrustPlatingBuff.isHidden = false;
				baskBuff = Content.CreateAndAddBuff("PERSONAL_DROGOZ_BASK", null, new Color(1f, 0.45f, 0.1f), canStack: false, isDebuff: false);
				baskBuff.isCooldown = false;
				baskBuff.isHidden = false;
				adrenalineBuff = Content.CreateAndAddBuff("PERSONAL_DROGOZ_ADRENALINE", null, new Color(1f, 0.65f, 0.2f), canStack: false, isDebuff: false);
				adrenalineBuff.isCooldown = false;
				adrenalineBuff.isHidden = false;
				wyrmJetsAirBuff = Content.CreateAndAddBuff("PERSONAL_DROGOZ_WYRM_JETS_AIR", DrogozIcons.LoadEmbeddedSprite("thermalshielding.png"), new Color(1f, 0.55f, 0.15f), canStack: false, isDebuff: false);
				wyrmJetsAirBuff.isCooldown = false;
				wyrmJetsAirBuff.isHidden = false;
				spitfireBuff = Content.CreateAndAddBuff("PERSONAL_DROGOZ_SPITFIRE_SPEED", null, new Color(1f, 0.6f, 0.2f), canStack: false, isDebuff: false);
				spitfireBuff.isCooldown = false;
				spitfireBuff.isHidden = false;
				if (!hooked)
				{
					HealthComponent.TakeDamage += new hook_TakeDamage(HandleTakeDamage);
					CharacterBody.onBodyAwakeGlobal += HandleBodyAwake;
					RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(HandleStatCoefficients);
					hooked = true;
				}
			}
		}

		internal static void RefreshBuffIcons()
		{
			CardDefinition cardDefinition = DrogozCardCatalog.Find("thrust_plating");
			CardDefinition cardDefinition2 = DrogozCardCatalog.Find("bask");
			CardDefinition cardDefinition3 = DrogozCardCatalog.Find("booster_capacity");
			CardDefinition cardDefinition4 = DrogozCardCatalog.Find("salvo_recycling");
			if (cardDefinition != null && Object.op_Implicit((Object)(object)cardDefinition.Icon) && Object.op_Implicit((Object)(object)thrustPlatingBuff))
			{
				thrustPlatingBuff.iconSprite = cardDefinition.Icon;
			}
			if (cardDefinition2 != null && Object.op_Implicit((Object)(object)cardDefinition2.Icon) && Object.op_Implicit((Object)(object)baskBuff))
			{
				baskBuff.iconSprite = cardDefinition2.Icon;
			}
			if (cardDefinition3 != null && Object.op_Implicit((Object)(object)cardDefinition3.Icon) && Object.op_Implicit((Object)(object)adrenalineBuff))
			{
				adrenalineBuff.iconSprite = cardDefinition3.Icon;
			}
			if (cardDefinition4 != null && Object.op_Implicit((Object)(object)cardDefinition4.Icon) && Object.op_Implicit((Object)(object)spitfireBuff))
			{
				spitfireBuff.iconSprite = cardDefinition4.Icon;
			}
			Log.Debug("Buffs", $"Card buff icons: Survival={cardDefinition != null && (Object)(object)cardDefinition.Icon != (Object)null} Bask={cardDefinition2 != null && (Object)(object)cardDefinition2.Icon != (Object)null} Adrenaline={cardDefinition3 != null && (Object)(object)cardDefinition3.Icon != (Object)null}");
		}

		internal static int GetRank(CharacterBody body, string cardId)
		{
			if (!DrogozConfig.LoadoutCardsEnabled.Value || !Object.op_Implicit((Object)(object)body) || string.IsNullOrEmpty(cardId))
			{
				return 0;
			}
			DrogozCardLoadoutComponent component = ((Component)body).GetComponent<DrogozCardLoadoutComponent>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return 0;
			}
			return component.GetRank(cardId);
		}

		private static void HandleStatCoefficients(CharacterBody body, StatHookEventArgs args)
		{
			if (!Object.op_Implicit((Object)(object)body))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)adrenalineBuff) && body.HasBuff(adrenalineBuff))
			{
				int rank = GetRank(body, "booster_capacity");
				if (rank > 0)
				{
					args.moveSpeedMultAdd += 0.1f * (float)rank;
				}
			}
			if (Object.op_Implicit((Object)(object)spitfireBuff) && body.HasBuff(spitfireBuff))
			{
				int rank2 = GetRank(body, "salvo_recycling");
				if (rank2 > 0)
				{
					args.moveSpeedMultAdd += 0.1f * (float)rank2;
				}
			}
		}

		private static void HandleBodyAwake(CharacterBody body)
		{
			InitializeBodyLoadout(body);
		}

		internal static bool InitializeBodyLoadout(CharacterBody body)
		{
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)body) || !body.isPlayerControlled || (NetworkClient.active && !body.hasEffectiveAuthority))
			{
				return false;
			}
			DrogozCardLoadoutComponent drogozCardLoadoutComponent = ((Component)body).GetComponent<DrogozCardLoadoutComponent>();
			if (!Object.op_Implicit((Object)(object)drogozCardLoadoutComponent))
			{
				drogozCardLoadoutComponent = ((Component)body).gameObject.AddComponent<DrogozCardLoadoutComponent>();
			}
			if (!DrogozConfig.LoadoutCardsEnabled.Value)
			{
				drogozCardLoadoutComponent.SetLoadout(new CardLoadout());
				return true;
			}
			CardLoadout current = DrogozCardLoadoutStorage.Current;
			Log.Debug("Networking", $"Body loadout init {((Object)body).name} server={NetworkServer.active} client={NetworkClient.active} authority={body.hasEffectiveAuthority} localComplete={current.IsComplete()} points={current.TotalPoints()}");
			if (NetworkServer.active && body.hasEffectiveAuthority)
			{
				drogozCardLoadoutComponent.SetLoadout(current);
			}
			if (NetworkClient.active && body.hasEffectiveAuthority)
			{
				NetworkIdentity component = ((Component)body).GetComponent<NetworkIdentity>();
				if (Object.op_Implicit((Object)(object)component))
				{
					NetMessageExtensions.Send((INetMessage)(object)new SyncDrogozCards(component.netId, current), (NetworkDestination)2);
				}
			}
			return true;
		}

		internal static void ApplyThrustPlating(CharacterBody body)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			int rank = GetRank(body, "thrust_plating");
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)thrustPlatingBuff) && rank > 0)
			{
				body.AddTimedBuff(thrustPlatingBuff, 3f);
				Log.Debug("Buffs", $"Survival applied body={((Object)body).name} rank={rank} reduction={0.05f * (float)rank:0.00} duration=3s buffIndex={thrustPlatingBuff.buffIndex} hasIcon={(Object)(object)thrustPlatingBuff.iconSprite != (Object)null}");
			}
		}

		internal static void HealEmergencyFlare(CharacterBody body)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			int rank = GetRank(body, "emergency_flare");
			if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && rank > 0)
			{
				float num = body.maxHealth * 0.02f * (float)rank;
				body.healthComponent.Heal(num, default(ProcChainMask), true);
				Log.Debug("Abilities", $"Emergency Flare healed body={((Object)body).name} rank={rank} amount={num:0.0}");
			}
		}

		internal static void HealFireSpitSustain(CharacterBody body, float healPercent)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && !(healPercent <= 0f))
			{
				float num = body.maxHealth * healPercent;
				body.healthComponent.Heal(num, default(ProcChainMask), true);
				Log.Debug("Abilities", $"Lung Capacity healed body={((Object)body).name} percent={healPercent:0.00} amount={num:0.0}");
			}
		}

		internal static float GetFireSpitRadius(CharacterBody body)
		{
			return Mathf.Max(0.5f, DrogozConfig.FireSpitDetonationRadius.Value + 0.7f * (float)GetRank(body, "fire_spit_reach"));
		}

		internal static float GetRocketRadius(CharacterBody body, float baseRadius)
		{
			int rank = GetRank(body, "rocket_radius");
			float num = Mathf.Max(0.5f, baseRadius + 0.25f * (float)rank);
			if (rank > 0)
			{
				Log.Debug("Abilities", $"Wide Blast body={((Object)body).name} rank={rank} base={baseRadius:0.00} radius={num:0.00}");
			}
			return num;
		}

		internal static float GetRocketSelfKnockbackMultiplier(CharacterBody body)
		{
			int rank = GetRank(body, "rocket_jump");
			if (rank > 0)
			{
				Log.Debug("Abilities", $"Rocket Jump body={((Object)body).name} rank={rank} multiplier={1f + 0.15f * (float)rank:0.00}");
			}
			return 1f + 0.15f * (float)rank;
		}

		internal static float GetThrustForceMultiplier(CharacterBody body)
		{
			int rank = GetRank(body, "thrust_force");
			float num = Mathf.Max(0f, DrogozConfig.ThrustForceMultiplier.Value) * (1f + 0.1f * (float)rank);
			if (rank > 0)
			{
				Log.Debug("Abilities", $"Propel body={((Object)body).name} rank={rank} forceMultiplier={num:0.00}");
			}
			return num;
		}

		internal static float GetBoosterControlMultiplier(CharacterBody body)
		{
			return 1f + 0.05f * (float)GetRank(body, "booster_control");
		}

		internal static bool TryBeginScentTrailDetonation(CharacterBody owner)
		{
			int rank = GetRank(owner, "scent_trail");
			DrogozCardLoadoutComponent drogozCardLoadoutComponent = (Object.op_Implicit((Object)(object)owner) ? ((Component)owner).GetComponent<DrogozCardLoadoutComponent>() : null);
			if (!NetworkServer.active || rank <= 0 || !Object.op_Implicit((Object)(object)drogozCardLoadoutComponent) || Time.time < drogozCardLoadoutComponent.NextScentTrailTime)
			{
				return false;
			}
			drogozCardLoadoutComponent.NextScentTrailTime = Time.time + 6f;
			Log.Debug("Abilities", $"Scent Trail detonation started body={((Object)owner).name} rank={rank} cooldown={6f:0.0}s cap={5f:0.0}s");
			return true;
		}

		internal static void RefundFireSpit(CharacterBody owner, float seconds)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || seconds <= 0f || float.IsNaN(seconds) || float.IsInfinity(seconds))
			{
				return;
			}
			if (owner.hasEffectiveAuthority)
			{
				bool flag = FireSpit.ReduceCooldown(owner, seconds);
				Log.Debug("Abilities", $"Fire Spit refund body={((Object)owner).name} seconds={seconds:0.00} changed={flag}");
				return;
			}
			NetworkIdentity component = ((Component)owner).GetComponent<NetworkIdentity>();
			if (Object.op_Implicit((Object)(object)component) && component.connectionToClient != null)
			{
				NetMessageExtensions.Send((INetMessage)(object)new SyncFireSpitRefund(component.netId, seconds), component.connectionToClient);
			}
		}

		internal static void OnRocketHit(CharacterBody owner, HealthComponent victim, GameObject rocket, bool salvo, bool directHit)
		{
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)victim) || !Object.op_Implicit((Object)(object)rocket))
			{
				return;
			}
			DrogozSalvoCardTracker component = rocket.GetComponent<DrogozSalvoCardTracker>();
			if (Object.op_Implicit((Object)(object)component) && component.TryReport(victim))
			{
				if (!salvo && directHit)
				{
					TryConcussiveRound(owner, victim.body);
				}
				TryHotSwap(owner, salvo);
				if (salvo)
				{
					RefundBaseSalvo(owner);
					RefundSalvo(owner);
					HealFromSalvo(owner);
					RestoreSalvoFuel(owner);
				}
			}
		}

		internal static bool TryConcussiveRound(CharacterBody owner, CharacterBody victim, float? forcedRoll = null)
		{
			int rank = GetRank(owner, "overdrive");
			DrogozCardLoadoutComponent component = ((Component)owner).GetComponent<DrogozCardLoadoutComponent>();
			if (rank <= 0 || !Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)victim))
			{
				return false;
			}
			if (!forcedRoll.HasValue && Time.time < component.NextConcussiveTime)
			{
				return false;
			}
			int num = component.ConcussiveFailures + 1;
			int num2 = Mathf.Max(8, 16 - rank);
			float num3 = forcedRoll ?? Random.value;
			float num4 = 0.08f * (float)rank;
			bool flag = num >= num2;
			bool flag2 = flag || num3 <= num4;
			component.RegisterConcussiveAttempt(flag2);
			Log.Debug("Loadouts", $"Concussive Round roll body={((Object)owner).name} target={((Object)victim).name} rank={rank} roll={num3:0.000} chance={num4:0.000} failures={num}/{num2} guaranteed={flag} success={flag2}");
			if (!flag2)
			{
				return false;
			}
			component.NextConcussiveTime = Time.time + 5f;
			SetStateOnHurt.SetStunOnObject(((Component)victim).gameObject, 0.5f);
			Log.Debug("Abilities", $"Concussive Round stunned target={((Object)victim).name} duration=0.5s cooldown={5f:0.0}s");
			return true;
		}

		internal static bool TryHotSwap(CharacterBody owner, bool salvo, float? forcedRoll = null)
		{
			int rank = GetRank(owner, "hot_swap");
			DrogozCardLoadoutComponent component = ((Component)owner).GetComponent<DrogozCardLoadoutComponent>();
			if (rank <= 0 || !Object.op_Implicit((Object)(object)component))
			{
				return false;
			}
			DrogozSalvoModeComponent drogozSalvoModeComponent = (salvo ? ((Component)owner).GetComponent<DrogozSalvoModeComponent>() : null);
			bool flag = Object.op_Implicit((Object)(object)drogozSalvoModeComponent) && drogozSalvoModeComponent.CardBarrageActive;
			if (flag && drogozSalvoModeComponent.CardAmmo >= 6)
			{
				return false;
			}
			if (!flag)
			{
				GenericSkill val = (Object.op_Implicit((Object)(object)owner.skillLocator) ? owner.skillLocator.primary : null);
				if (!Object.op_Implicit((Object)(object)val) || val.stock >= val.maxStock)
				{
					return false;
				}
			}
			int num = component.HotSwapFailures + 1;
			int num2 = Mathf.Max(10, 20 - 2 * rank);
			float num3 = forcedRoll ?? Random.value;
			float num4 = 0.06f * (float)rank;
			bool flag2 = num >= num2;
			bool flag3 = flag2 || num3 <= num4;
			component.RegisterHotSwapAttempt(flag3);
			Log.Debug("Loadouts", $"Hot Swap roll body={((Object)owner).name} salvo={flag} rank={rank} roll={num3:0.000} chance={num4:0.000} failures={num}/{num2} guaranteed={flag2} success={flag3}");
			if (!flag3)
			{
				return false;
			}
			if (flag)
			{
				drogozSalvoModeComponent.AddCardAmmo(1);
				Log.Debug("Loadouts", $"Hot Swap refunded Salvo ammo body={((Object)owner).name} bonusAmmo={drogozSalvoModeComponent.CardAmmo}");
				return true;
			}
			GenericSkill primary = owner.skillLocator.primary;
			primary.AddOneStock();
			Log.Debug("Loadouts", $"Hot Swap refunded Primary ammo body={((Object)owner).name} stock={primary.stock}/{primary.maxStock}");
			return true;
		}

		private static void RefundBaseSalvo(CharacterBody owner)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			DrogozSalvoModeComponent component = ((Component)owner).GetComponent<DrogozSalvoModeComponent>();
			if (!Object.op_Implicit((Object)(object)component) || !component.CardBarrageActive)
			{
				return;
			}
			float num = Mathf.Min(0.225f, Mathf.Max(0f, 4.5f - component.BaseRefundUsed));
			if (num <= 0f)
			{
				return;
			}
			component.AddBaseRefund(num);
			Log.Debug("Abilities", $"Salvo base refund body={((Object)owner).name} amount={num:0.00} used={component.BaseRefundUsed:0.00}/{4.5f:0.00}");
			if (owner.hasEffectiveAuthority)
			{
				ReduceSalvoCooldown(owner, num);
				return;
			}
			NetworkIdentity component2 = ((Component)owner).GetComponent<NetworkIdentity>();
			if (Object.op_Implicit((Object)(object)component2) && component2.connectionToClient != null)
			{
				NetMessageExtensions.Send((INetMessage)(object)new SyncSalvoRefund(component2.netId, num), component2.connectionToClient);
			}
		}

		private static void RefundSalvo(CharacterBody owner)
		{
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			int rank = GetRank(owner, "salvo_recycling");
			if (rank <= 0)
			{
				return;
			}
			DrogozSalvoModeComponent component = ((Component)owner).GetComponent<DrogozSalvoModeComponent>();
			if (!Object.op_Implicit((Object)(object)component) || !component.CardBarrageActive)
			{
				return;
			}
			float num = Mathf.Min(0.2f * (float)rank, Mathf.Max(0f, 5f - component.CardRefundUsed));
			if (num <= 0f)
			{
				return;
			}
			component.AddCardRefund(num);
			Log.Debug("Abilities", $"Spitfire Salvo refund body={((Object)owner).name} rank={rank} amount={num:0.00} used={component.CardRefundUsed:0.00}/{5f:0.00}");
			if (owner.hasEffectiveAuthority)
			{
				ReduceSalvoCooldown(owner, num);
				return;
			}
			NetworkIdentity component2 = ((Component)owner).GetComponent<NetworkIdentity>();
			if (Object.op_Implicit((Object)(object)component2) && component2.connectionToClient != null)
			{
				NetMessageExtensions.Send((INetMessage)(object)new SyncSalvoRefund(component2.netId, num), component2.connectionToClient);
			}
		}

		internal static bool ReduceSalvoCooldown(CharacterBody body, float seconds)
		{
			if (!Object.op_Implicit((Object)(object)body) || seconds <= 0f || float.IsNaN(seconds) || float.IsInfinity(seconds) || !Object.op_Implicit((Object)(object)body.skillLocator))
			{
				return false;
			}
			GenericSkill special = body.skillLocator.special;
			if (!Object.op_Implicit((Object)(object)special) || !Object.op_Implicit((Object)(object)special.skillDef) || special.skillDef.skillName != "DrogozSalvo")
			{
				return false;
			}
			if (special.stock >= special.maxStock || special.rechargeStock <= 0 || special.cooldownRemaining <= 0f)
			{
				return false;
			}
			float cooldownRemaining = special.cooldownRemaining;
			float finalRechargeInterval = special.GetFinalRechargeInterval();
			special.rechargeStopwatch = Mathf.Min(finalRechargeInterval, special.rechargeStopwatch + Mathf.Max(0f, seconds));
			return special.cooldownRemaining < cooldownRemaining - 0.0001f;
		}

		internal static void ApplyDragonPunchKillCards(CharacterBody owner, ref float healPercentUsed)
		{
			if (!Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)owner.healthComponent) || !owner.healthComponent.alive)
			{
				return;
			}
			int rank = GetRank(owner, "bask");
			if (rank <= 0)
			{
				return;
			}
			float num = Mathf.Min(0.02f * (float)rank, Mathf.Max(0f, 0.1f - healPercentUsed));
			if (num > 0f)
			{
				healPercentUsed += num;
				if (Object.op_Implicit((Object)(object)baskBuff))
				{
					owner.AddTimedBuff(baskBuff, 0.5f);
				}
				DrogozHealOverTime drogozHealOverTime = ((Component)owner).gameObject.GetComponent<DrogozHealOverTime>();
				if (!Object.op_Implicit((Object)(object)drogozHealOverTime))
				{
					drogozHealOverTime = ((Component)owner).gameObject.AddComponent<DrogozHealOverTime>();
				}
				drogozHealOverTime.AddHeal(owner.maxHealth * num, 0.5f);
				Log.Debug("Buffs", $"Bask Dragon Punch heal body={((Object)owner).name} rank={rank} percent={num:0.00} used={healPercentUsed:0.00}/0.10");
			}
		}

		internal static void ApplyDragonPunchEndCards(CharacterBody owner)
		{
			if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)spitfireBuff))
			{
				int rank = GetRank(owner, "salvo_recycling");
				if (rank > 0 && (NetworkServer.active || owner.hasEffectiveAuthority))
				{
					owner.AddTimedBuff(spitfireBuff, 3f);
					Log.Debug("Buffs", $"Spitfire Dragon Punch aftermath speed body={((Object)owner).name} rank={rank} bonus={0.1f * (float)rank:0.00} duration={3f:0.0}s");
				}
			}
		}

		internal static void HealFromSalvo(CharacterBody owner)
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			int rank = GetRank(owner, "bask");
			DrogozSalvoModeComponent component = ((Component)owner).GetComponent<DrogozSalvoModeComponent>();
			if (rank <= 0 || !Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			float num = Mathf.Min(0.01f * (float)rank, Mathf.Max(0f, 0.1f - component.CardHealPercentUsed));
			if (!(num <= 0f))
			{
				component.AddCardHealPercent(num);
				if (Object.op_Implicit((Object)(object)baskBuff))
				{
					owner.AddTimedBuff(baskBuff, 0.5f);
				}
				Log.Debug("Buffs", string.Format("Bask healing body={0} rank={1} percent={2:0.00} used={3:0.00}/0.10 buff={4}", ((Object)owner).name, rank, num, component.CardHealPercentUsed, Object.op_Implicit((Object)(object)baskBuff) ? ((object)baskBuff.buffIndex/*cast due to .constrained prefix*/).ToString() : "none"));
				DrogozHealOverTime drogozHealOverTime = ((Component)owner).gameObject.GetComponent<DrogozHealOverTime>();
				if (!Object.op_Implicit((Object)(object)drogozHealOverTime))
				{
					drogozHealOverTime = ((Component)owner).gameObject.AddComponent<DrogozHealOverTime>();
				}
				drogozHealOverTime.AddHeal(owner.maxHealth * num, 0.5f);
			}
		}

		internal static void RestoreSalvoFuel(CharacterBody owner)
		{
			int rank = GetRank(owner, "hyper_boost");
			DrogozSalvoModeComponent component = ((Component)owner).GetComponent<DrogozSalvoModeComponent>();
			if (rank <= 0 || !Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			float num = Mathf.Min(0.01f * (float)rank, Mathf.Max(0f, 0.2f - component.CardFuelPercentUsed));
			if (!(num <= 0f))
			{
				DrogozBooster component2 = ((Component)owner).GetComponent<DrogozBooster>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					component.AddCardFuelPercent(num);
					component2.SetFuel(component2.Fuel + component2.FuelCapacity * num);
					Log.Debug("Abilities", $"Hyper Boost fuel body={((Object)owner).name} rank={rank} percent={num:0.00} used={component.CardFuelPercentUsed:0.00}/0.20 fuel={component2.Fuel:0.0}/{component2.FuelCapacity:0.0}");
				}
			}
		}

		private static void HandleTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)self.body.characterMotor) && !self.body.characterMotor.isGrounded)
			{
				DrogozMiscComponent component = ((Component)self.body).GetComponent<DrogozMiscComponent>();
				if ((Object.op_Implicit((Object)(object)wyrmJetsAirBuff) && self.body.GetBuffCount(wyrmJetsAirBuff.buffIndex) > 0) || (Object.op_Implicit((Object)(object)component) && component.HasWyrmJets))
				{
					float num = Mathf.Clamp01(DrogozConfig.WyrmJetsAirDamageReduction.Value);
					if (num > 0f)
					{
						float damage = damageInfo.damage;
						damageInfo.damage *= 1f - num;
						Log.Debug("Talents", $"Wyrm Jets reduced airborne damage body={((Object)self.body).name} reduction={num:0.00} before={damage:0.0} after={damageInfo.damage:0.0}");
					}
				}
			}
			if (NetworkServer.active && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)self.body))
			{
				DrogozDragonPunchComponent component2 = ((Component)self.body).GetComponent<DrogozDragonPunchComponent>();
				if (Object.op_Implicit((Object)(object)component2) && component2.IsActive && !component2.IsFlying)
				{
					int rank = GetRank(self.body, "hyper_boost");
					if (rank > 0)
					{
						float num2 = Mathf.Min(0.5f, 0.1f * (float)rank);
						float damage2 = damageInfo.damage;
						damageInfo.damage *= 1f - num2;
						Log.Debug("Buffs", $"Hyper Boost channel damage reduction body={((Object)self.body).name} rank={rank} reduction={num2:0.00} before={damage2:0.0} after={damageInfo.damage:0.0}");
					}
				}
			}
			int rank2 = GetRank(self.body, "thrust_plating");
			if (NetworkServer.active && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)thrustPlatingBuff) && self.body.GetBuffCount(thrustPlatingBuff.buffIndex) > 0 && rank2 > 0)
			{
				float damage3 = damageInfo.damage;
				damageInfo.damage *= 1f - Mathf.Clamp01(0.05f * (float)rank2);
				Log.Debug("Buffs", $"Survival reduced damage body={((Object)self.body).name} rank={rank2} before={damage3:0.0} after={damageInfo.damage:0.0}");
			}
			orig.Invoke(self, damageInfo);
		}
	}
	internal static class DrogozCardSelfTest
	{
		internal static void Run(CharacterBody body, Action<string> log)
		{
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !Object.op_Implicit((Object)(object)body.skillLocator))
			{
				log("Card self-test failed: Drogoz body is not ready.");
				return;
			}
			DrogozCardLoadoutComponent component = ((Component)body).GetComponent<DrogozCardLoadoutComponent>();
			CardLoadout cardLoadout = (Object.op_Implicit((Object)(object)component) ? component.GetLoadout() : null);
			if (cardLoadout == null || !cardLoadout.IsComplete())
			{
				log("Card self-test failed: save a complete five-slot loadout with 15 points first.");
				return;
			}
			HealthComponent healthComponent = body.healthComponent;
			DrogozBooster component2 = ((Component)body).GetComponent<DrogozBooster>();
			GenericSkill primary = body.skillLocator.primary;
			GenericSkill secondary = body.skillLocator.secondary;
			GenericSkill special = body.skillLocator.special;
			DrogozSalvoModeComponent component3 = ((Component)body).GetComponent<DrogozSalvoModeComponent>();
			float health = healthComponent.health;
			float fuel = (Object.op_Implicit((Object)(object)component2) ? component2.Fuel : 0f);
			int stock = (Object.op_Implicit((Object)(object)primary) ? primary.stock : 0);
			float rechargeStopwatch = (Object.op_Implicit((Object)(object)primary) ? primary.rechargeStopwatch : 0f);
			int stock2 = (Object.op_Implicit((Object)(object)secondary) ? secondary.stock : 0);
			float rechargeStopwatch2 = (Object.op_Implicit((Object)(object)secondary) ? secondary.rechargeStopwatch : 0f);
			int stock3 = (Object.op_Implicit((Object)(object)special) ? special.stock : 0);
			float rechargeStopwatch3 = (Object.op_Implicit((Object)(object)special) ? special.rechargeStopwatch : 0f);
			float nextConcussiveTime = (Object.op_Implicit((Object)(object)component) ? component.NextConcussiveTime : 0f);
			float nextScentTrailTime = (Object.op_Implicit((Object)(object)component) ? component.NextScentTrailTime : 0f);
			CharacterBody val = null;
			log("Card self-test: loadout valid, points=" + cardLoadout.TotalPoints() + "/" + 15);
			try
			{
				if ((cardLoadout.GetRank("bask") > 0 || cardLoadout.GetRank("hyper_boost") > 0) && Object.op_Implicit((Object)(object)component3))
				{
					component3.DebugBeginCardBarrage();
				}
				for (int i = 0; i < cardLoadout.Slots.Length; i++)
				{
					CardSlot cardSlot = cardLoadout.Slots[i];
					if (cardSlot == null || string.IsNullOrEmpty(cardSlot.CardId) || cardSlot.Rank <= 0)
					{
						continue;
					}
					int rank = cardSlot.Rank;
					switch (cardSlot.CardId)
					{
					case "rocket_radius":
						log("PASS Wide Blast R" + rank + ": radius=" + DrogozCards.GetRocketRadius(body, 6f).ToString("0.00"));
						break;
					case "rocket_jump":
						log("PASS Rocket Jump R" + rank + ": knockback x" + DrogozCards.GetRocketSelfKnockbackMultiplier(body).ToString("0.00"));
						break;
					case "hot_swap":
						if (Object.op_Implicit((Object)(object)primary))
						{
							primary.stock = Mathf.Max(0, primary.maxStock - 1);
							int stock4 = primary.stock;
							bool flag4 = DrogozCards.TryHotSwap(body, salvo: false, 0f);
							log(((flag4 && primary.stock > stock4) ? "PASS" : "FAIL") + " Hot Swap R" + rank + ": ammo " + stock4 + " -> " + primary.stock);
						}
						break;
					case "fire_spit_sustain":
					{
						healthComponent.health = body.maxHealth * 0.5f;
						float health3 = healthComponent.health;
						DrogozCards.HealFireSpitSustain(body, 0.01f * (float)rank);
						log(((healthComponent.health > health3) ? "PASS" : "FAIL") + " Lung Capacity R" + rank + ": heal " + (healthComponent.health - health3).ToString("0.0"));
						break;
					}
					case "scent_trail":
						if (Object.op_Implicit((Object)(object)secondary))
						{
							secondary.stock = 0;
							secondary.rechargeStopwatch = 0f;
							component.NextScentTrailTime = 0f;
							bool num = DrogozCards.TryBeginScentTrailDetonation(body);
							float cooldownRemaining2 = secondary.cooldownRemaining;
							DrogozCards.RefundFireSpit(body, 0.25f * (float)rank);
							bool flag5 = num && secondary.cooldownRemaining < cooldownRemaining2 && component.NextScentTrailTime > Time.time;
							log((flag5 ? "PASS" : "FAIL") + " Scent Trail R" + rank + ": refund " + (cooldownRemaining2 - secondary.cooldownRemaining).ToString("0.00") + "s cooldown=6s");
						}
						break;
					case "fire_spit_reach":
						log("PASS Expanded Blast R" + rank + ": radius=" + DrogozCards.GetFireSpitRadius(body).ToString("0.00"));
						break;
					case "masterful":
						val = FindEnemy(body);
						if (Object.op_Implicit((Object)(object)val))
						{
							DrogozMark.Apply(val, ((Component)body).gameObject, 0.5f * (float)rank);
							log((val.HasBuff(DrogozMark.buffDef) ? "PASS" : "FAIL") + " Lasting Brand R" + rank + ": enemy buff applied hasIcon=" + ((Object)(object)DrogozMark.buffDef != (Object)null && (Object)(object)DrogozMark.buffDef.iconSprite != (Object)null));
						}
						else
						{
							log("SKIP Lasting Brand R" + rank + ": no living enemy target");
						}
						break;
					case "thrust_plating":
						DrogozCards.ApplyThrustPlating(body);
						log((body.HasBuff(DrogozCards.thrustPlatingBuff) ? "PASS" : "FAIL") + " Survival R" + rank + ": buff applied");
						break;
					case "thrust_force":
						log("PASS Propel R" + rank + ": force x" + DrogozCards.GetThrustForceMultiplier(body).ToString("0.00"));
						break;
					case "emergency_flare":
					{
						healthComponent.health = body.maxHealth * 0.5f;
						float health4 = healthComponent.health;
						DrogozCards.HealEmergencyFlare(body);
						log(((healthComponent.health > health4) ? "PASS" : "FAIL") + " Emergency Flare R" + rank + ": heal " + (healthComponent.health - health4).ToString("0.0"));
						break;
					}
					case "salvo_recycling":
						if (Object.op_Implicit((Object)(object)special))
						{
							special.stock = 0;
							special.rechargeStopwatch = 0f;
							float cooldownRemaining = special.cooldownRemaining;
							bool flag3 = DrogozCards.ReduceSalvoCooldown(body, 0.2f * (float)rank);
							log((flag3 ? "PASS" : "FAIL") + " Spitfire R" + rank + ": refund " + (cooldownRemaining - special.cooldownRemaining).ToString("0.00") + "s");
						}
						break;
					case "bask":
					{
						healthComponent.health = body.maxHealth * 0.5f;
						float health2 = healthComponent.health;
						DrogozCards.HealFromSalvo(body);
						log(((healthComponent.health > health2) ? "PASS" : "FAIL") + " Bask R" + rank + ": heal over time started");
						break;
					}
					case "hyper_boost":
						if (Object.op_Implicit((Object)(object)component2))
						{
							component2.SetFuel(component2.FuelCapacity * 0.5f);
							float fuel2 = component2.Fuel;
							DrogozCards.RestoreSalvoFuel(body);
							log(((component2.Fuel > fuel2) ? "PASS" : "FAIL") + " Hyper Boost R" + rank + ": fuel +" + (component2.Fuel - fuel2).ToString("0.0"));
						}
						break;
					case "booster_control":
						log("PASS Altitude R" + rank + ": control x" + DrogozCards.GetBoosterControlMultiplier(body).ToString("0.00"));
						break;
					case "booster_capacity":
						body.AddTimedBuff(DrogozCards.adrenalineBuff, 2f);
						log((body.HasBuff(DrogozCards.adrenalineBuff) ? "PASS" : "FAIL") + " Adrenaline R" + rank + ": speed buff applied");
						break;
					case "overdrive":
					{
						CharacterBody val2 = FindEnemy(body);
						if (Object.op_Implicit((Object)(object)val2))
						{
							bool flag = DrogozCards.TryConcussiveRound(body, val2, 0f);
							bool flag2 = component.NextConcussiveTime > Time.time;
							log(((flag && flag2) ? "PASS" : "FAIL") + " Concussive Round R" + rank + ": direct-hit stun executed cooldown=5s");
						}
						else
						{
							log("SKIP Concussive Round R" + rank + ": no living enemy target");
						}
						break;
					}
					default:
						log("UNKNOWN card id: " + cardSlot.CardId);
						break;
					}
				}
			}
			catch (Exception ex)
			{
				log("Card self-test error: " + ex.Message);
			}
			finally
			{
				healthComponent.health = health;
				if (Object.op_Implicit((Object)(object)component2))
				{
					component2.SetFuel(fuel);
				}
				if (Object.op_Implicit((Object)(object)primary))
				{
					primary.stock = stock;
					primary.rechargeStopwatch = rechargeStopwatch;
				}
				if (Object.op_Implicit((Object)(object)secondary))
				{
					secondary.stock = stock2;
					secondary.rechargeStopwatch = rechargeStopwatch2;
				}
				if (Object.op_Implicit((Object)(object)special))
				{
					special.stock = stock3;
					special.rechargeStopwatch = rechargeStopwatch3;
				}
				if (Object.op_Implicit((Object)(object)component3))
				{
					component3.DebugEndCardBarrage();
				}
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)DrogozMark.buffDef))
				{
					val.RemoveBuff(DrogozMark.buffDef);
				}
				if (body.HasBuff(DrogozCards.thrustPlatingBuff))
				{
					body.RemoveBuff(DrogozCards.thrustPlatingBuff);
				}
				if (body.HasBuff(DrogozCards.adrenalineBuff))
				{
					body.RemoveBuff(DrogozCards.adrenalineBuff);
				}
				if (Object.op_Implicit((Object)(object)component))
				{
					component.NextConcussiveTime = nextConcussiveTime;
					component.NextScentTrailTime = nextScentTrailTime;
				}
				body.RecalculateStats();
				log("Card self-test complete. Health, fuel, ammo, and cooldowns restored.");
			}
		}

		private static CharacterBody FindEnemy(CharacterBody owner)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			List<BaseAI> instancesList = InstanceTracker.GetInstancesList<BaseAI>();
			for (int i = 0; i < instancesList.Count; i++)
			{
				BaseAI val = instancesList[i];
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.body) && Object.op_Implicit((Object)(object)val.body.healthComponent) && val.body.healthComponent.alive && !((Object)(object)val.body == (Object)(object)owner) && Object.op_Implicit((Object)(object)owner.teamComponent) && Object.op_Implicit((Object)(object)val.body.teamComponent) && val.body.teamComponent.teamIndex != owner.teamComponent.teamIndex)
				{
					return val.body;
				}
			}
			return null;
		}
	}
	internal static class DrogozConfig
	{
		internal static ConfigEntry<bool> UseRoR2Facing;

		internal static ConfigEntry<float> AimFacingYawOffset;

		internal static ConfigEntry<bool> DebugEnabled;

		internal static ConfigEntry<bool> DebugGeneral;

		internal static ConfigEntry<bool> DebugAbilities;

		internal static ConfigEntry<bool> DebugBuffs;

		internal static ConfigEntry<bool> DebugLoadouts;

		internal static ConfigEntry<bool> DebugNetworking;

		internal static ConfigEntry<bool> DebugAnimation;

		internal static ConfigEntry<bool> DebugTalents;

		internal static ConfigEntry<bool> DebugBooster;

		internal static ConfigEntry<bool> DebugAudio;

		internal static ConfigEntry<bool> DebugVfx;

		internal static ConfigEntry<bool> AllowTwoTalents;

		internal static ConfigEntry<bool> LoadoutCardsEnabled;

		internal static ConfigEntry<float> AudioVolumeScale;

		internal static ConfigEntry<float> RocketDirectProc;

		internal static ConfigEntry<float> RocketSplashProc;

		internal static ConfigEntry<float> SalvoDirectProc;

		internal static ConfigEntry<float> SalvoSplashProc;

		internal static ConfigEntry<float> FireSpitDirectProc;

		internal static ConfigEntry<float> FireSpitDetonationProc;

		internal static ConfigEntry<float> RocketDamage;

		internal static ConfigEntry<float> RocketRadius;

		internal static ConfigEntry<float> RocketSpeed;

		internal static ConfigEntry<float> RocketForce;

		internal static ConfigEntry<float> RocketFireInterval;

		internal static ConfigEntry<float> RocketReloadDuration;

		internal static ConfigEntry<float> RocketAutoReloadDelay;

		internal static ConfigEntry<int> RocketMaxStock;

		internal static ConfigEntry<float> RocketSelfKnockback;

		internal static ConfigEntry<float> RocketSelfKnockbackHorizontal;

		internal static ConfigEntry<bool> RocketSelfDamage;

		internal static ConfigEntry<float> RocketSelfDamageMultiplier;

		internal static ConfigEntry<bool> RocketUseFalloff;

		internal static ConfigEntry<float> ThrustCooldown;

		internal static ConfigEntry<float> ThrustRefundPerEnemy;

		internal static ConfigEntry<float> ThrustUpwardVelocity;

		internal static ConfigEntry<float> ThrustForwardVelocity;

		internal static ConfigEntry<float> ThrustForceMultiplier;

		internal static ConfigEntry<float> ThrustMomentumOverride;

		internal static ConfigEntry<float> ThrustRedirectMaxTurnAngle;

		internal static ConfigEntry<float> ThrustBoosterRefillPercent;

		internal static ConfigEntry<float> ThrustDuration;

		internal static ConfigEntry<float> ThrustMoveSpeedBonus;

		internal static ConfigEntry<float> ThrustFuelEfficiencyReduction;

		internal static ConfigEntry<float> ThrustFuelEfficiencyDuration;

		internal static ConfigEntry<float> FireSpitCooldown;

		internal static ConfigEntry<float> FireSpitDirectDamage;

		internal static ConfigEntry<float> FireSpitDetonationDamage;

		internal static ConfigEntry<float> FireSpitDetonationRadius;

		internal static ConfigEntry<float> FireSpitRocketDetonationRadius;

		internal static ConfigEntry<bool> FireSpitUseFalloff;

		internal static ConfigEntry<float> FireSpitSpeed;

		internal static ConfigEntry<float> FireSpitGravityScale;

		internal static ConfigEntry<float> FireSpitHitboxScale;

		internal static ConfigEntry<float> FireSpitVisualScale;

		internal static ConfigEntry<float> FireSpitExplosionScale;

		internal static ConfigEntry<bool> FireSpitTerrormorphParticles;

		internal static ConfigEntry<float> FireSpitLifetime;

		internal static ConfigEntry<float> FireSpitForce;

		internal static ConfigEntry<float> FireSpitCastDuration;

		internal static ConfigEntry<float> MarkDamageBonus;

		internal static ConfigEntry<float> MarkDuration;

		internal static ConfigEntry<float> SalvoCooldown;

		internal static ConfigEntry<float> SalvoDamage;

		internal static ConfigEntry<float> SalvoRadius;

		internal static ConfigEntry<float> SalvoShotInterval;

		internal static ConfigEntry<float> SalvoReloadDelay;

		internal static ConfigEntry<float> SalvoShieldBonus;

		internal static ConfigEntry<int> CombustibleBurnStacks;

		internal static ConfigEntry<float> CombustibleBurnDuration;

		internal static ConfigEntry<float> CombustibleBurnDamageMultiplier;

		internal static ConfigEntry<float> CombustibleKnockbackForce;

		internal static ConfigEntry<float> CombustibleAirKnockbackForce;

		internal static ConfigEntry<float> WyrmJetsVerticalSpeedMultiplier;

		internal static ConfigEntry<float> WyrmJetsVerticalAccelerationMultiplier;

		internal static ConfigEntry<float> WyrmJetsHorizontalSpeedMultiplier;

		internal static ConfigEntry<float> WyrmJetsSteeringMultiplier;

		internal static ConfigEntry<float> WyrmJetsAirDamageReduction;

		internal static ConfigEntry<int> ReignOfTerrorAmmo;

		internal static ConfigEntry<float> ReignOfTerrorCooldownReduction;

		internal static ConfigEntry<float> DragonPunchCooldown;

		internal static ConfigEntry<float> DragonPunchDamage;

		internal static ConfigEntry<float> DragonPunchProc;

		internal static ConfigEntry<float> DragonPunchChannel;

		internal static ConfigEntry<float> DragonPunchFlightTime;

		internal static ConfigEntry<float> DragonPunchSpeed;

		internal static ConfigEntry<float> DragonPunchRadius;

		internal static ConfigEntry<float> DragonPunchExecuteThreshold;

		internal static ConfigEntry<float> DragonPunchRefund;

		internal static ConfigEntry<float> DragonPunchCancelLockout;

		internal static ConfigEntry<float> DragonPunchKillRadius;

		internal static ConfigEntry<float> DragonPunchKillDamage;

		internal static ConfigEntry<float> SittingDuckRadius;

		internal static ConfigEntry<float> SittingDuckCheckInterval;

		internal static ConfigEntry<float> SittingDuckAttention;

		internal static ConfigEntry<bool> SittingDuckAffectsUntargeted;

		internal static ConfigEntry<float> DragonPunchReignDamage;

		internal static ConfigEntry<float> DragonPunchReignConeAngle;

		internal static ConfigEntry<float> DragonPunchReignConeRadius;

		internal static ConfigEntry<float> DragonPunchReignProc;

		internal static ConfigEntry<float> DragonPunchReignCooldownReductionPerKill;

		internal static ConfigEntry<float> DragonPunchReignFlightTime;

		internal static ConfigEntry<float> DragonPunchReignHitCooldown;

		internal static ConfigEntry<float> DragonPunchReignDamageGrowthPerHit;

		internal static ConfigEntry<float> DragonPunchReignMaxDamageMultiplier;

		internal static ConfigEntry<float> DragonPunchReignKillDurationBonus;

		internal static ConfigEntry<float> DragonPunchReignKillDurationFalloff;

		internal static ConfigEntry<float> DragonPunchReignHitStop;

		internal static ConfigEntry<float> DragonPunchReignStartSpeedFactor;

		internal static ConfigEntry<float> DragonPunchReignMaxSpeedFactor;

		internal static ConfigEntry<float> DragonPunchReignMaxRadiusFactor;

		internal static ConfigEntry<float> BoosterFuelPerExtraJump;

		internal static ConfigEntry<float> BoosterAimPitchOffset;

		internal static ConfigEntry<float> BoosterFuelCapacity;

		internal static ConfigEntry<float> BoosterFuelDrainRate;

		internal static ConfigEntry<float> BoosterFuelRefillDelay;

		internal static ConfigEntry<float> BoosterFuelRefillRate;

		internal static ConfigEntry<float> BoosterOverspeedDrag;

		internal static ConfigEntry<float> BoosterOverspeedDragMax;

		internal static ConfigEntry<float> BoosterOverspeedDragFullSpeed;

		internal static ConfigEntry<float> BoosterReactivationPercent;

		internal static ConfigEntry<float> BoosterGroundRefillMultiplier;

		internal static ConfigEntry<float> BoosterAirRefillMultiplier;

		internal static ConfigEntry<float> BoosterLiftAcceleration;

		internal static ConfigEntry<float> BoosterMaxLiftSpeed;

		internal static ConfigEntry<float> BoosterHorizontalAcceleration;

		internal static ConfigEntry<float> BoosterSteeringSpeed;

		internal static ConfigEntry<float> BoosterMaxHorizontalSpeed;

		internal static ConfigEntry<float> BoosterMoveSpeedBonusEffectiveness;

		internal static ConfigEntry<float> BoosterAirControlMultiplier;

		internal static ConfigEntry<float> NormalAirControlMultiplier;

		internal static ConfigEntry<bool> BoosterShowFuelHud;

		internal static ConfigEntry<bool> AirAggroEnabled;

		internal static ConfigEntry<float> AirAggroChance;

		internal static ConfigEntry<float> AirAggroRadius;

		internal static ConfigEntry<float> AirAggroMaxDistanceRatio;

		internal static ConfigEntry<float> AirAggroAttentionDuration;

		internal static ConfigEntry<float> AirAggroCheckInterval;

		internal static bool IsDebugTagEnabled(string tag)
		{
			if (!DebugEnabled.Value)
			{
				return false;
			}
			return tag switch
			{
				"Abilities" => DebugAbilities.Value, 
				"Buffs" => DebugBuffs.Value, 
				"Loadouts" => DebugLoadouts.Value, 
				"Networking" => DebugNetworking.Value, 
				"Animation" => DebugAnimation.Value, 
				"Talents" => DebugTalents.Value, 
				"Booster" => DebugBooster.Value, 
				"Audio" => DebugAudio.Value, 
				"Vfx" => DebugVfx.Value, 
				_ => DebugGeneral.Value, 
			};
		}

		internal static void Init()
		{
			UseRoR2Facing = Config.BindAndOptions("General", "UseRoR2Facing", defaultValue: false, "Use normal Risk of Rain 2 movement-facing instead of forcing the model to face the crosshair.");
			AimFacingYawOffset = Config.BindAndOptions("General", "AimFacingYawOffset", -20f, "Model facing offset in degrees while crosshair-facing is active. Negative values turn the model left. The crosshair and projectiles do not change.");
			DebugEnabled = Config.BindAndOptions("Debug", "Enabled", defaultValue: false, "Master switch for all Drogoz debug logs.");
			DebugGeneral = Config.BindAndOptions("Debug", "General", defaultValue: false, "General setup and content debug logs.");
			DebugAbilities = Config.BindAndOptions("Debug", "Abilities", defaultValue: false, "Ability activation, cooldowns, healing, and damage-effect logs.");
			DebugBuffs = Config.BindAndOptions("Debug", "Buffs", defaultValue: false, "Buff creation, icons, application, Easy Target, and damage-reduction logs.");
			DebugLoadouts = Config.BindAndOptions("Debug", "Loadouts", defaultValue: false, "Loadout-card rank, save, and validation logs.");
			DebugNetworking = Config.BindAndOptions("Debug", "Networking", defaultValue: false, "Card loadout network sync logs.");
			DebugAnimation = Config.BindAndOptions("Debug", "Animation", defaultValue: false, "Animation state and reload logs.");
			DebugTalents = Config.BindAndOptions("Debug", "Talents", defaultValue: false, "Talent selection and talent-effect logs.");
			DebugBooster = Config.BindAndOptions("Debug", "Booster", defaultValue: false, "Booster speed, fuel, and movement logs.");
			DebugAudio = Config.BindAndOptions("Debug", "Audio", defaultValue: false, "Wwise and Unity audio debug logs.");
			DebugVfx = Config.BindAndOptions("Debug", "Vfx", defaultValue: false, "Explosion and effect debug logs.");
			AllowTwoTalents = Config.BindAndOptions("General", "AllowTwoTalents", defaultValue: false, "Allow two talent rows so one talent from each pair can be active. Restart required.", restartRequired: true);
			LoadoutCardsEnabled = Config.BindAndOptions("General", "LoadoutCardsEnabled", defaultValue: false, "Show the loadout-card screen and apply card effects. Restart required.", restartRequired: true);
			AudioVolumeScale = Config.BindAndOptions("Audio", "VolumeScale", 1f, "Multiplier for all Drogoz custom audio. 1.0 uses the authored level.");
			RocketDirectProc = Config.BindAndOptions("ProcCoefficients", "RocketDirect", 1f, "Proc coefficient for a direct Rocket Launcher hit.");
			RocketSplashProc = Config.BindAndOptions("ProcCoefficients", "RocketSplash", 0.5f, "Proc coefficient for Rocket Launcher splash hits.");
			SalvoDirectProc = Config.BindAndOptions("ProcCoefficients", "SalvoDirect", 0.65f, "Proc coefficient for direct Salvo rocket hits.");
			SalvoSplashProc = Config.BindAndOptions("ProcCoefficients", "SalvoSplash", 0.5f, "Proc coefficient for Salvo rocket splash hits.");
			FireSpitDirectProc = Config.BindAndOptions("ProcCoefficients", "FireSpitDirect", 1f, "Proc coefficient for a direct Fire Spit hit.");
			FireSpitDetonationProc = Config.BindAndOptions("ProcCoefficients", "FireSpitDetonation", 0.5f, "Proc coefficient for Fire Spit detonation splash.");
			RocketDamage = Config.BindAndOptions("RocketLauncher", "Damage", 4.8f, "Rocket damage coefficient. 4.8 is 480%.");
			RocketRadius = Config.BindAndOptions("RocketLauncher", "Radius", 6f, "Rocket explosion radius in meters. The explosion VFX uses the same scale.");
			RocketSpeed = Config.BindAndOptions("RocketLauncher", "Speed", 75f, "Rocket forward speed in meters per second.");
			RocketForce = Config.BindAndOptions("RocketLauncher", "Force", 600f, "Rocket knockback force against enemies.");
			RocketFireInterval = Config.BindAndOptions("RocketLauncher", "FireInterval", 0.85f, "Seconds between rockets before attack speed.");
			RocketReloadDuration = Config.BindAndOptions("RocketLauncher", "ReloadDuration", 2.5f, "Seconds for a full reload before attack speed.");
			RocketAutoReloadDelay = Config.BindAndOptions("RocketLauncher", "AutoReloadDelay", 1.5f, "Seconds after not shooting before a partial magazine auto reloads. Auto reload can be interrupted by Primary, Fire Spit, Salvo, and Salvo barrage.");
			RocketMaxStock = Config.BindAndOptions("RocketLauncher", "MaxStock", 6, "Maximum Rocket Launcher stocks.");
			RocketSelfKnockback = Config.BindAndOptions("RocketLauncher", "SelfKnockback", 720f, "Rocket jump force applied to Drogoz.");
			RocketSelfKnockbackHorizontal = Config.BindAndOptions("RocketLauncher", "SelfKnockbackHorizontal", 1.15f, "Horizontal multiplier for Drogoz rocket jumps.");
			RocketSelfDamage = Config.BindAndOptions("RocketLauncher", "SelfDamage", defaultValue: true, "Allow rockets to damage Drogoz.");
			RocketSelfDamageMultiplier = Config.BindAndOptions("RocketLauncher", "SelfDamageMultiplier", 0.15f, "Fraction of rocket damage dealt to Drogoz. 0.15 is 15%.");
			RocketUseFalloff = Config.BindAndOptions("RocketLauncher", "UseFalloff", defaultValue: true, "Use gradual HalfLinear damage falloff for rocket splash.");
			ThrustCooldown = Config.BindAndOptions("Thrust", "Cooldown", 11f, "Seconds for Thrust cooldown.");
			ThrustRefundPerEnemy = Config.BindAndOptions("Thrust", "RefundPerEnemy", 1.5f, "Seconds removed from Thrust cooldown for each enemy hit by a Fire Spit detonation.");
			ThrustUpwardVelocity = Config.BindAndOptions("Thrust", "UpwardVelocity", 22f, "Minimum upward speed in meters per second.");
			ThrustForwardVelocity = Config.BindAndOptions("Thrust", "ForwardVelocity", 6f, "Forward speed in meters per second.");
			ThrustForceMultiplier = Config.BindAndOptions("Thrust", "ForceMultiplier", 1.3f, "Multiplier for all Thrust impulse and velocity. 1.3 is 30% stronger.");
			ThrustMomentumOverride = Config.BindAndOptions("Thrust", "MomentumOverride", 0.55f, "Legacy additive-mode momentum removal. Thrust now redirects horizontal momentum and no longer uses this value.");
			ThrustRedirectMaxTurnAngle = Config.BindAndOptions("Thrust", "RedirectMaxTurnAngle", 75f, "Maximum degrees Thrust can turn existing horizontal momentum toward the crosshair in one activation.");
			ThrustBoosterRefillPercent = Config.BindAndOptions("Thrust", "BoosterRefillPercent", 0.25f, "Fraction of maximum booster fuel restored on each Thrust activation. 0.25 is 25%.");
			ThrustDuration = Config.BindAndOptions("Thrust", "Duration", 0.25f, "Seconds before Thrust returns to the main state.");
			ThrustMoveSpeedBonus = Config.BindAndOptions("Thrust", "MoveSpeedBonus", 0.2f, "Extra movement speed from Afterburner. 0.2 is 20% faster movement.");
			ThrustFuelEfficiencyReduction = Config.BindAndOptions("Thrust", "FuelEfficiencyReduction", 0.2f, "Fraction of Booster fuel drain removed by Afterburner. 0.2 is 20% less fuel use.");
			ThrustFuelEfficiencyDuration = Config.BindAndOptions("Thrust", "FuelEfficiencyDuration", 5f, "Seconds of Afterburner movement speed and reduced Booster fuel drain.");
			FireSpitCooldown = Config.BindAndOptions("FireSpit", "Cooldown", 8f, "Seconds for Fire Spit cooldown.");
			FireSpitDirectDamage = Config.BindAndOptions("FireSpit", "DirectDamage", 1.2f, "Direct-hit damage coefficient. 1.2 is 120%.");
			FireSpitDetonationDamage = Config.BindAndOptions("FireSpit", "DetonationDamage", 15f, "Detonation damage coefficient. 15 is 1500%.");
			FireSpitDetonationRadius = Config.BindAndOptions("FireSpit", "DetonationRadius", 15f, "Fire Spit detonation radius in meters.");
			FireSpitRocketDetonationRadius = Config.BindAndOptions("FireSpit", "RocketDetonationRadius", 15f, "Radius around a rocket explosion that detonates Fire Spit. This can be larger than the damage radius.");
			FireSpitUseFalloff = Config.BindAndOptions("FireSpit", "UseFalloff", defaultValue: true, "Use gradual HalfLinear damage falloff for Fire Spit detonation.");
			FireSpitSpeed = Config.BindAndOptions("FireSpit", "Speed", 20f, "Fire Spit projectile speed in meters per second.");
			FireSpitGravityScale = Config.BindAndOptions("FireSpit", "GravityScale", 0f, "Fire Spit gravity scale. Default 0 keeps it straight. Paladins stores 0.7.");
			FireSpitHitboxScale = Config.BindAndOptions("FireSpit", "HitboxScale", 1f, "Fire Spit collider size multiplier. 1 keeps the collider smaller than the visible blob.");
			FireSpitVisualScale = Config.BindAndOptions("FireSpit", "VisualScale", 1.75f, "Fire Spit model size multiplier.");
			FireSpitExplosionScale = Config.BindAndOptions("FireSpit", "ExplosionScale", 2f, "Fire Spit explosion effect size multiplier. 2 is 100% bigger.");
			FireSpitTerrormorphParticles = Config.BindAndOptions("FireSpit", "TerrormorphParticles", defaultValue: true, "Show the green particle layer for Terrormorph explosions. Disable it to keep only the green flash.");
			FireSpitLifetime = Con