Decompiled source of Rounds Russian And Chaos Cards v1.0.3

ChaosRuPack.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using ChaosRuPack.Cards;
using ChaosRuPack.Effects;
using ChaosRuPack.Localization;
using ChaosRuPack.Patches;
using ChaosRuPack.Visuals;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ChaosRuPack")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0df200283f082f5b79403ceda080c43cafbf1b54")]
[assembly: AssemblyProduct("ChaosRuPack")]
[assembly: AssemblyTitle("ChaosRuPack")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ChaosRuPack
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.artut.rounds.russianchaoscards", "ROUNDS Russian & Chaos Cards", "1.0.3")]
	[BepInProcess("Rounds.exe")]
	public class ChaosRuPackPlugin : BaseUnityPlugin
	{
		public const string ModId = "com.artut.rounds.russianchaoscards";

		public const string ModName = "ROUNDS Russian & Chaos Cards";

		public const string Version = "1.0.3";

		public const string ModInitials = "CR";

		public static ChaosRuPackPlugin Instance { get; private set; }

		private void Awake()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			new Harmony("com.artut.rounds.russianchaoscards").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[ROUNDS Russian & Chaos Cards] v1.0.3 Harmony patches applied (Full Russian Card Localization active).");
		}

		private void Start()
		{
			CyrillicFontManager.GetOrCreateFallbackFont();
			CardArtManager.LoadCustomArtFolder();
			VisualEffectsSettings.RegisterUnboundSettingsMenu();
			((Component)this).gameObject.AddComponent<UILocalizationBehaviour>();
			CustomCard.BuildCard<RicochetSurgeCard>();
			CustomCard.BuildCard<PhaseBlinkCard>();
			CustomCard.BuildCard<GravityTetherCard>();
			CustomCard.BuildCard<BerserkersGambitCard>();
			CustomCard.BuildCard<KineticChargerCard>();
			CustomCard.BuildCard<EchoChamberCard>();
			CustomCard.BuildCard<BackstabAnomalyCard>();
			CustomCard.BuildCard<SuperGrowCard>();
			CustomCard.BuildCard<SuperDrillCard>();
			CustomCard.BuildCard<SuperGlassCannonCard>();
			CustomCard.BuildCard<SuperWindUpCard>();
			CustomCard.BuildCard<UltraLaserCard>();
			CustomCard.BuildCard<AntiLaserCard>();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[ROUNDS Russian & Chaos Cards] Registered 13 custom cards with tag [CR].");
		}
	}
}
namespace ChaosRuPack.Visuals
{
	public static class CardArtManager
	{
		private static readonly Dictionary<string, Texture2D> _customTextures = new Dictionary<string, Texture2D>(StringComparer.OrdinalIgnoreCase);

		private static bool _loaded;

		private static readonly Dictionary<string, string[]> FallbackArtMap = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase)
		{
			{
				"Ricochet Surge",
				new string[2] { "RICCOCHET", "TRICKSTER" }
			},
			{
				"Phase Blink",
				new string[2] { "TELEPORT", "Shockwave" }
			},
			{
				"Gravity Tether",
				new string[2] { "Implode", "SUPERNOVA" }
			},
			{
				"Berserker's Gambit",
				new string[2] { "TASTE OF BLOOD", "BRAWLER" }
			},
			{
				"Kinetic Charger",
				new string[2] { "CHASE", "SHIELD CHARGE" }
			},
			{
				"Echo Chamber",
				new string[2] { "ECHO", "BURST" }
			},
			{
				"Backstab Anomaly",
				new string[2] { "SNEAKY", "TELEPORT" }
			},
			{
				"Super Grow",
				new string[2] { "GROW", "BIG BULLET" }
			},
			{
				"Super Drill",
				new string[1] { "DRILL AMMO" }
			},
			{
				"Super Glass Cannon",
				new string[1] { "GLASS CANNON" }
			},
			{
				"Super Wind Up",
				new string[1] { "WIND UP" }
			},
			{
				"Ultra Laser",
				new string[2] { "SUPERNOVA", "OVERPOWERED" }
			},
			{
				"Anti Laser",
				new string[2] { "EMP", "SILENCE" }
			}
		};

		public static void LoadCustomArtFolder()
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			_loaded = true;
			_customTextures.Clear();
			try
			{
				_customTextures["Ultra Laser"] = GenerateUltraLaserAvatar();
				_customTextures["Anti Laser"] = GenerateAntiLaserAvatar();
				string path = Path.Combine(Path.GetDirectoryName(typeof(ChaosRuPackPlugin).Assembly.Location) ?? "", "CardArt");
				if (!Directory.Exists(path))
				{
					return;
				}
				string[] files = Directory.GetFiles(path);
				foreach (string path2 in files)
				{
					string text = Path.GetExtension(path2).ToLowerInvariant();
					if (!(text != ".png") || !(text != ".jpg") || !(text != ".jpeg"))
					{
						byte[] array = File.ReadAllBytes(path2);
						Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
						if (ImageConversion.LoadImage(val, array))
						{
							((Texture)val).wrapMode = (TextureWrapMode)1;
							((Texture)val).filterMode = (FilterMode)1;
							Object.DontDestroyOnLoad((Object)(object)val);
							((Object)val).hideFlags = (HideFlags)61;
							string key = Path.GetFileNameWithoutExtension(path2).Trim();
							_customTextures[key] = val;
						}
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[ChaosRuPack] Error initializing CardArt: " + ex.Message));
			}
		}

		private static Texture2D GenerateUltraLaserAvatar()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			Color[] array = (Color[])(object)new Color[65536];
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(76f, 128f);
			new Vector2(246f, 128f);
			Vector2[] array2 = (Vector2[])(object)new Vector2[3]
			{
				new Vector2(36f, 182f),
				new Vector2(28f, 128f),
				new Vector2(36f, 74f)
			};
			Vector2 val3 = default(Vector2);
			for (int i = 0; i < 256; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					((Vector2)(ref val3))..ctor((float)j, (float)i);
					float num = Mathf.Clamp01(1f - Vector2.Distance(val3, val2) / 190f);
					Color val4 = Color.Lerp(new Color(0.04f, 0.06f, 0.12f, 1f), new Color(0.08f, 0.18f, 0.34f, 1f), num * 0.7f);
					float num2 = Vector2.Distance(val3, val2);
					float num3 = Mathf.Abs(num2 - 38f);
					if (num3 < 4.5f)
					{
						float num4 = 1f - num3 / 4.5f;
						val4 = Color.Lerp(val4, new Color(0.25f, 0.9f, 1f, 1f), num4 * 0.85f);
					}
					for (int k = 0; k < array2.Length; k++)
					{
						float num5 = Vector2.Distance(val3, array2[k]);
						if (num5 < 16f)
						{
							float num6 = 1f - num5 / 16f;
							Color val5 = ((num5 < 7f) ? new Color(1f, 0.98f, 0.8f, 1f) : new Color(1f, 0.75f, 0.2f, 1f));
							val4 = Color.Lerp(val4, val5, Mathf.Pow(num6, 0.7f));
						}
						float num7 = DistanceToSegment(val3, array2[k], val2);
						if (num7 < 5f)
						{
							val4 = Color.Lerp(val4, new Color(0.35f, 0.95f, 1f, 1f), (1f - num7 / 5f) * 0.65f);
						}
					}
					if ((float)j >= val2.x - 4f)
					{
						float num8 = Mathf.Abs((float)i - val2.y);
						if (num8 < 42f)
						{
							float num9 = 1f - num8 / 42f;
							val4 = Color.Lerp(val4, new Color(0.15f, 0.65f, 1f, 1f), num9 * 0.75f);
						}
						if (num8 < 24f)
						{
							float num10 = 1f - num8 / 24f;
							val4 = Color.Lerp(val4, new Color(0.45f, 0.98f, 1f, 1f), num10 * 0.92f);
						}
						if (num8 < 11f)
						{
							float num11 = 1f - num8 / 11f;
							val4 = Color.Lerp(val4, new Color(1f, 1f, 0.94f, 1f), Mathf.Pow(num11, 0.5f));
						}
					}
					if (num2 < 28f)
					{
						float num12 = 1f - num2 / 28f;
						Color val6 = (Color)((num2 < 13f) ? Color.white : new Color(0.4f, 0.95f, 1f, 1f));
						val4 = Color.Lerp(val4, val6, Mathf.Pow(num12, 0.6f));
					}
					float num13 = Mathf.Abs(Vector2.Distance(val3, new Vector2(236f, 128f)) - 46f);
					if (num13 < 5.5f)
					{
						val4 = Color.Lerp(val4, new Color(1f, 0.85f, 0.3f, 1f), (1f - num13 / 5.5f) * 0.9f);
					}
					array[i * 256 + j] = val4;
				}
			}
			val.SetPixels(array);
			val.Apply();
			Object.DontDestroyOnLoad((Object)(object)val);
			((Object)val).hideFlags = (HideFlags)61;
			return val;
		}

		private static Texture2D GenerateAntiLaserAvatar()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			Color[] array = (Color[])(object)new Color[65536];
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(128f, 128f);
			for (int i = 0; i < 256; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					Vector2 val3 = new Vector2((float)j, (float)i);
					float num = Vector2.Distance(val3, val2);
					Color val4 = Color.Lerp(new Color(0.06f, 0.04f, 0.1f, 1f), new Color(0.22f, 0.06f, 0.16f, 1f), Mathf.Clamp01(1f - num / 180f));
					if ((float)j < 96f || (float)j > 160f)
					{
						float num2 = Mathf.Abs((float)i - 128f);
						if (num2 < 16f)
						{
							float num3 = 1f - num2 / 16f;
							val4 = Color.Lerp(val4, new Color(0.25f, 0.75f, 0.95f, 1f), num3 * 0.55f);
						}
					}
					float num4 = Mathf.Abs(num - 68f);
					if (num4 < 6f)
					{
						val4 = Color.Lerp(val4, new Color(0.25f, 0.85f, 1f, 1f), (1f - num4 / 6f) * 0.95f);
					}
					float num5 = DistanceToSegment(val3, new Vector2(68f, 68f), new Vector2(188f, 188f));
					float num6 = DistanceToSegment(val3, new Vector2(68f, 188f), new Vector2(188f, 68f));
					float num7 = Mathf.Min(num5, num6);
					if (num7 < 14f)
					{
						float num8 = 1f - num7 / 14f;
						Color val5 = ((num7 < 5.5f) ? new Color(1f, 0.95f, 0.85f, 1f) : new Color(1f, 0.25f, 0.35f, 1f));
						val4 = Color.Lerp(val4, val5, Mathf.Pow(num8, 0.6f));
					}
					array[i * 256 + j] = val4;
				}
			}
			val.SetPixels(array);
			val.Apply();
			Object.DontDestroyOnLoad((Object)(object)val);
			((Object)val).hideFlags = (HideFlags)61;
			return val;
		}

		private static float DistanceToSegment(Vector2 p, Vector2 a, Vector2 b)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = b - a;
			float sqrMagnitude = ((Vector2)(ref val)).sqrMagnitude;
			if (sqrMagnitude < 0.0001f)
			{
				return Vector2.Distance(p, a);
			}
			float num = Mathf.Clamp01(Vector2.Dot(p - a, val) / sqrMagnitude);
			return Vector2.Distance(p, a + val * num);
		}

		public static GameObject GetVanillaCardArt(params string[] vanillaCardNames)
		{
			if ((Object)(object)CardChoice.instance == (Object)null || CardChoice.instance.cards == null || vanillaCardNames == null)
			{
				return null;
			}
			for (int i = 0; i < vanillaCardNames.Length; i++)
			{
				string text = vanillaCardNames[i]?.Trim();
				if (string.IsNullOrEmpty(text))
				{
					continue;
				}
				for (int j = 0; j < CardChoice.instance.cards.Length; j++)
				{
					CardInfo val = CardChoice.instance.cards[j];
					if ((Object)(object)val != (Object)null && (Object)(object)val.cardArt != (Object)null && string.Equals(val.cardName?.Trim(), text, StringComparison.OrdinalIgnoreCase))
					{
						return val.cardArt;
					}
				}
			}
			return null;
		}

		public static void EnsureFallbackCardArt(CardInfo cardInfo)
		{
			if (!((Object)(object)cardInfo == (Object)null) && !((Object)(object)cardInfo.cardArt != (Object)null))
			{
				string text = cardInfo.cardName?.Trim();
				if (!string.IsNullOrEmpty(text) && FallbackArtMap.TryGetValue(text, out var value))
				{
					cardInfo.cardArt = GetVanillaCardArt(value);
				}
			}
		}

		public static Texture2D TryGetCustomTextureForCard(CardInfo cardInfo)
		{
			if (!_loaded)
			{
				LoadCustomArtFolder();
			}
			if ((Object)(object)cardInfo == (Object)null || _customTextures.Count == 0)
			{
				return null;
			}
			string text = cardInfo.cardName?.Trim() ?? "";
			string text2 = RussianCardTranslator.TranslateCardName(text)?.Trim() ?? "";
			if (!string.IsNullOrEmpty(text) && _customTextures.TryGetValue(text, out var value))
			{
				return value;
			}
			if (!string.IsNullOrEmpty(text2) && _customTextures.TryGetValue(text2, out var value2))
			{
				return value2;
			}
			if (_customTextures.TryGetValue("all", out var value3))
			{
				return value3;
			}
			if (_customTextures.TryGetValue("default", out var value4))
			{
				return value4;
			}
			return null;
		}

		public static void ApplyCustomAvatarIfPresent(CardVisuals visuals)
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: 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_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)visuals == (Object)null)
			{
				return;
			}
			Texture2D val = TryGetCustomTextureForCard(((Component)visuals).GetComponentInParent<CardInfo>());
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Transform val2 = ((Component)visuals).transform.Find("Canvas/Front/Background/Art");
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			for (int i = 0; i < val2.childCount; i++)
			{
				Transform child = val2.GetChild(i);
				if (((Object)child).name != "ChaosRuPack_CustomAvatar")
				{
					((Component)child).gameObject.SetActive(false);
				}
			}
			Transform val3 = val2.Find("ChaosRuPack_CustomAvatar");
			RawImage component;
			if ((Object)(object)val3 != (Object)null)
			{
				component = ((Component)val3).gameObject.GetComponent<RawImage>();
				goto IL_0285;
			}
			GameObject val4 = new GameObject("ChaosRuPack_CustomAvatar", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(RawImage)
			});
			val4.transform.SetParent(val2, false);
			val4.transform.SetAsFirstSibling();
			RectTransform component2 = val4.GetComponent<RectTransform>();
			RectTransform component3 = ((Component)val2).GetComponent<RectTransform>();
			Rect rect;
			if ((Object)(object)component3 != (Object)null)
			{
				rect = component3.rect;
				if (((Rect)(ref rect)).width > 10f)
				{
					rect = component3.rect;
					if (((Rect)(ref rect)).height > 10f)
					{
						component2.anchorMin = Vector2.zero;
						component2.anchorMax = Vector2.one;
						component2.pivot = new Vector2(0.5f, 0.5f);
						component2.anchoredPosition = Vector2.zero;
						component2.sizeDelta = Vector2.zero;
						((Transform)component2).localScale = Vector3.one;
						goto IL_027f;
					}
				}
			}
			component2.anchorMin = new Vector2(0.5f, 0.5f);
			component2.anchorMax = new Vector2(0.5f, 0.5f);
			component2.pivot = new Vector2(0.5f, 0.5f);
			component2.anchoredPosition = Vector2.zero;
			((Transform)component2).localScale = Vector3.one;
			float num = 500f;
			float num2 = 450f;
			Transform val5 = ((Component)visuals).transform.Find("Canvas/Front/Background");
			if ((Object)(object)val5 != (Object)null)
			{
				RectTransform component4 = ((Component)val5).GetComponent<RectTransform>();
				if ((Object)(object)component4 != (Object)null)
				{
					rect = component4.rect;
					if (((Rect)(ref rect)).width > 20f)
					{
						rect = component4.rect;
						num = ((Rect)(ref rect)).width * 0.95f;
						rect = component4.rect;
						num2 = ((Rect)(ref rect)).height * 0.52f;
					}
				}
			}
			component2.sizeDelta = new Vector2(num, num2);
			goto IL_027f;
			IL_027f:
			component = val4.GetComponent<RawImage>();
			goto IL_0285;
			IL_0285:
			if ((Object)(object)component != (Object)null)
			{
				component.texture = (Texture)(object)val;
				((Graphic)component).color = (Color)(visuals.isSelected ? Color.white : new Color(0.45f, 0.45f, 0.45f, 0.9f));
			}
		}

		public static void UpdateCustomAvatarSelection(CardVisuals visuals)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)visuals == (Object)null)
			{
				return;
			}
			Transform val = ((Component)visuals).transform.Find("Canvas/Front/Background/Art/ChaosRuPack_CustomAvatar");
			if ((Object)(object)val != (Object)null)
			{
				RawImage component = ((Component)val).GetComponent<RawImage>();
				if ((Object)(object)component != (Object)null)
				{
					((Graphic)component).color = (Color)(visuals.isSelected ? Color.white : new Color(0.45f, 0.45f, 0.45f, 0.9f));
				}
			}
		}
	}
}
namespace ChaosRuPack.Patches
{
	[HarmonyPatch]
	public static class CardLocalizationPatch
	{
		private struct VanillaTextState
		{
			public float FontSize;

			public float FontSizeMin;

			public float FontSizeMax;

			public bool AutoSize;
		}

		private static readonly Dictionary<int, VanillaTextState> BaseTextStates = new Dictionary<int, VanillaTextState>();

		private static VanillaTextState _statTemplateState;

		private static bool _hasStatTemplateState;

		private static VanillaTextState GetOrRecordTextState(TMP_Text t, VanillaTextState? fallback = null)
		{
			if ((Object)(object)t == (Object)null)
			{
				return fallback.GetValueOrDefault();
			}
			int instanceID = ((Object)t).GetInstanceID();
			if (!BaseTextStates.TryGetValue(instanceID, out var value) || value.FontSize <= 1f)
			{
				value = ((!fallback.HasValue || !(fallback.Value.FontSize > 1f)) ? new VanillaTextState
				{
					FontSize = t.fontSize,
					FontSizeMin = t.fontSizeMin,
					FontSizeMax = t.fontSizeMax,
					AutoSize = t.enableAutoSizing
				} : fallback.Value);
				BaseTextStates[instanceID] = value;
			}
			return value;
		}

		private static void ApplyScaledTextState(TMP_Text t, VanillaTextState state, float scale, float minScale)
		{
			if (!((Object)(object)t == (Object)null) && !(state.FontSize <= 1f))
			{
				t.enableAutoSizing = state.AutoSize;
				if (state.AutoSize)
				{
					t.fontSizeMax = state.FontSizeMax * scale;
					t.fontSizeMin = Mathf.Min(state.FontSizeMin * minScale, t.fontSizeMax * minScale);
				}
				else
				{
					t.fontSize = state.FontSize * scale;
				}
			}
		}

		[HarmonyPatch(typeof(CardInfoStat), "GetSimpleAmount")]
		[HarmonyPostfix]
		public static void GetSimpleAmount_Postfix(ref string __result)
		{
			if (!string.IsNullOrEmpty(__result))
			{
				__result = RussianCardTranslator.TranslateSimpleAmountString(__result);
			}
		}

		[HarmonyPatch(typeof(CardInfoDisplayer), "DrawCard")]
		[HarmonyPrefix]
		public static void DrawCard_Prefix(CardInfoDisplayer __instance, ref CardInfoStat[] stats, ref string cardName, ref string description)
		{
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			if ((Object)(object)__instance != (Object)null)
			{
				GetOrRecordTextState((TMP_Text)(object)__instance.nameText);
				GetOrRecordTextState((TMP_Text)(object)__instance.effectText);
				if ((Object)(object)__instance.statObject != (Object)null)
				{
					TMP_Text[] componentsInChildren = __instance.statObject.GetComponentsInChildren<TMP_Text>(true);
					for (int i = 0; i < componentsInChildren.Length; i++)
					{
						VanillaTextState orRecordTextState = GetOrRecordTextState(componentsInChildren[i]);
						if (!_hasStatTemplateState && orRecordTextState.FontSize > 1f)
						{
							_statTemplateState = orRecordTextState;
							_hasStatTemplateState = true;
						}
					}
				}
				CyrillicFontManager.EnsureCyrillicOnText((TMP_Text)(object)__instance.nameText);
				CyrillicFontManager.EnsureCyrillicOnText((TMP_Text)(object)__instance.effectText);
				if ((Object)(object)__instance.statObject != (Object)null)
				{
					CyrillicFontManager.EnsureCyrillicInHierarchy(__instance.statObject);
				}
			}
			if (!string.IsNullOrEmpty(cardName))
			{
				cardName = RussianCardTranslator.TranslateCardName(cardName);
			}
			if (!string.IsNullOrEmpty(description))
			{
				description = RussianCardTranslator.TranslateDescription(description);
			}
			if (stats == null || stats.Length == 0)
			{
				return;
			}
			CardInfoStat[] array = (CardInfoStat[])(object)new CardInfoStat[stats.Length];
			for (int j = 0; j < stats.Length; j++)
			{
				CardInfoStat val = stats[j];
				if (val != null)
				{
					array[j] = new CardInfoStat
					{
						positive = val.positive,
						simepleAmount = val.simepleAmount,
						amount = RussianCardTranslator.TranslateStatAmount(val.amount),
						stat = RussianCardTranslator.TranslateStatName(val.stat)
					};
				}
			}
			stats = array;
		}

		[HarmonyPatch(typeof(CardInfoDisplayer), "DrawCard")]
		[HarmonyPostfix]
		public static void DrawCard_Postfix(CardInfoDisplayer __instance)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return;
			}
			CyrillicFontManager.EnsureCyrillicInHierarchy(((Component)__instance).gameObject);
			if ((Object)(object)__instance.nameText != (Object)null)
			{
				VanillaTextState orRecordTextState = GetOrRecordTextState((TMP_Text)(object)__instance.nameText);
				((TMP_Text)__instance.nameText).enableWordWrapping = true;
				int num = ((((TMP_Text)__instance.nameText).text != null) ? ((TMP_Text)__instance.nameText).text.Length : 0);
				float scale = ((num <= 11) ? 0.96f : Mathf.Clamp(11.5f / (float)num, 0.65f, 0.96f));
				ApplyScaledTextState((TMP_Text)(object)__instance.nameText, orRecordTextState, scale, 0.65f);
			}
			if ((Object)(object)__instance.effectText != (Object)null)
			{
				VanillaTextState orRecordTextState2 = GetOrRecordTextState((TMP_Text)(object)__instance.effectText);
				((TMP_Text)__instance.effectText).enableWordWrapping = true;
				float scale2 = ((((((TMP_Text)__instance.effectText).text != null) ? ((TMP_Text)__instance.effectText).text.Length : 0) <= 65) ? 0.92f : 0.82f);
				ApplyScaledTextState((TMP_Text)(object)__instance.effectText, orRecordTextState2, scale2, 0.7f);
			}
			if (!((Object)(object)__instance.grid != (Object)null))
			{
				return;
			}
			VanillaTextState? fallback = (_hasStatTemplateState ? new VanillaTextState?(_statTemplateState) : ((VanillaTextState?)null));
			TMP_Text[] componentsInChildren = __instance.grid.GetComponentsInChildren<TMP_Text>(true);
			foreach (TMP_Text val in componentsInChildren)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)__instance.nameText) && !((Object)(object)val == (Object)(object)__instance.effectText))
				{
					if (!string.IsNullOrEmpty(val.text))
					{
						val.text = RussianCardTranslator.TranslateSimpleAmountString(val.text);
					}
					VanillaTextState orRecordTextState3 = GetOrRecordTextState(val, fallback);
					float scale3 = ((((val.text != null) ? val.text.Length : 0) <= 14) ? 0.9f : 0.78f);
					ApplyScaledTextState(val, orRecordTextState3, scale3, 0.68f);
				}
			}
		}

		[HarmonyPatch(typeof(CardBar), "AddCard")]
		[HarmonyPostfix]
		public static void CardBar_AddCard_Postfix(CardBar __instance, CardInfo card)
		{
			if ((Object)(object)__instance == (Object)null || (Object)(object)card == (Object)null)
			{
				return;
			}
			CyrillicFontManager.EnsureCyrillicInHierarchy(((Component)__instance).gameObject);
			string text = RussianCardTranslator.TranslateCardName(card.cardName);
			if (string.IsNullOrEmpty(text) || text.Length < 2)
			{
				return;
			}
			int childCount = ((Component)__instance).transform.childCount;
			if (childCount > 0)
			{
				TMP_Text componentInChildren = ((Component)((Component)__instance).transform.GetChild(childCount - 1)).GetComponentInChildren<TMP_Text>(true);
				if ((Object)(object)componentInChildren != (Object)null)
				{
					CyrillicFontManager.EnsureCyrillicOnText(componentInChildren);
					string text2 = char.ToUpper(text[0]).ToString() + char.ToLower(text[1]);
					componentInChildren.text = text2;
				}
			}
		}

		[HarmonyPatch(typeof(UIHandler), "ShowJoinGameText")]
		[HarmonyPrefix]
		public static void ShowJoinGameText_Prefix(UIHandler __instance, ref string text)
		{
			if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.jointGameText != (Object)null)
			{
				CyrillicFontManager.EnsureCyrillicOnMaskText((TMP_Text)(object)__instance.jointGameText);
			}
			if (!string.IsNullOrEmpty(text))
			{
				text = RussianCardTranslator.TranslateUIText(text);
			}
		}

		[HarmonyPatch(typeof(UIHandler), "DisplayScreenText")]
		[HarmonyPrefix]
		public static void DisplayScreenText_Prefix(UIHandler __instance, ref string text)
		{
			if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.gameOverText != (Object)null)
			{
				CyrillicFontManager.EnsureCyrillicOnMaskText((TMP_Text)(object)__instance.gameOverText);
			}
			if (!string.IsNullOrEmpty(text))
			{
				text = RussianCardTranslator.TranslateGameMessage(text);
			}
		}

		[HarmonyPatch(typeof(UIHandler), "DisplayScreenTextLoop", new Type[] { typeof(string) })]
		[HarmonyPrefix]
		public static void DisplayScreenTextLoop1_Prefix(UIHandler __instance, ref string text)
		{
			if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.gameOverText != (Object)null)
			{
				CyrillicFontManager.EnsureCyrillicOnMaskText((TMP_Text)(object)__instance.gameOverText);
			}
			if (!string.IsNullOrEmpty(text))
			{
				text = RussianCardTranslator.TranslateGameMessage(text);
			}
		}

		[HarmonyPatch(typeof(UIHandler), "DisplayScreenTextLoop", new Type[]
		{
			typeof(Color),
			typeof(string)
		})]
		[HarmonyPrefix]
		public static void DisplayScreenTextLoop2_Prefix(UIHandler __instance, ref string text)
		{
			if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.gameOverText != (Object)null)
			{
				CyrillicFontManager.EnsureCyrillicOnMaskText((TMP_Text)(object)__instance.gameOverText);
			}
			if (!string.IsNullOrEmpty(text))
			{
				text = RussianCardTranslator.TranslateGameMessage(text);
			}
		}

		[HarmonyPatch(typeof(PointVisualizer), "HalfOrange")]
		[HarmonyPatch(typeof(PointVisualizer), "RoundOrange")]
		[HarmonyPatch(typeof(PointVisualizer), "HalfBlue")]
		[HarmonyPatch(typeof(PointVisualizer), "RoundOBlue")]
		[HarmonyPostfix]
		public static void PointVisualizer_Postfix(PointVisualizer __instance)
		{
			if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.text != (Object)null)
			{
				CyrillicFontManager.EnsureCyrillicOnMaskText((TMP_Text)(object)__instance.text);
				((TMP_Text)__instance.text).text = RussianCardTranslator.TranslateGameMessage(((TMP_Text)__instance.text).text);
				CyrillicFontManager.DisableSubMeshesUnderMask(((Component)__instance.text).gameObject);
			}
		}

		[HarmonyPatch(typeof(CardVisuals), "Start")]
		[HarmonyPrefix]
		public static void CardVisuals_Start_Prefix(CardVisuals __instance)
		{
			if ((Object)(object)__instance != (Object)null)
			{
				CardArtManager.EnsureFallbackCardArt(((Component)__instance).GetComponentInParent<CardInfo>());
			}
		}

		[HarmonyPatch(typeof(CardVisuals), "Start")]
		[HarmonyPostfix]
		public static void CardVisuals_Start_Postfix(CardVisuals __instance)
		{
			if ((Object)(object)__instance != (Object)null)
			{
				CardArtManager.ApplyCustomAvatarIfPresent(__instance);
			}
		}

		[HarmonyPatch(typeof(CardVisuals), "ChangeSelected")]
		[HarmonyPostfix]
		public static void CardVisuals_ChangeSelected_Postfix(CardVisuals __instance)
		{
			if ((Object)(object)__instance != (Object)null)
			{
				CardArtManager.UpdateCustomAvatarSelection(__instance);
			}
		}

		[HarmonyPatch(typeof(ListMenuPage), "Open")]
		[HarmonyPostfix]
		public static void ListMenuPage_Open_Postfix(ListMenuPage __instance)
		{
			if ((Object)(object)__instance != (Object)null && Time.timeSinceLevelLoad > 0.55f)
			{
				TranslateHierarchyUI(((Component)__instance).gameObject);
			}
		}

		[HarmonyPatch(typeof(EscapeMenuHandler), "ToggleEsc")]
		[HarmonyPostfix]
		public static void EscapeMenuHandler_ToggleEsc_Postfix(EscapeMenuHandler __instance)
		{
			if ((Object)(object)__instance != (Object)null)
			{
				TranslateHierarchyUI(((Component)__instance).gameObject);
			}
		}

		[HarmonyPatch(typeof(CharacterSelectionInstance), "StartPicking")]
		[HarmonyPatch(typeof(CharacterSelectionInstance), "ReadyUp")]
		[HarmonyPostfix]
		public static void CharacterSelectionInstance_Postfix(CharacterSelectionInstance __instance)
		{
			if ((Object)(object)__instance != (Object)null)
			{
				TranslateHierarchyUI(((Component)__instance).gameObject);
			}
		}

		[HarmonyPatch(typeof(DevConsole), "Send")]
		[HarmonyPatch(typeof(DevConsole), "SpawnCard")]
		[HarmonyPrefix]
		[HarmonyPriority(800)]
		public static void DevConsole_CardName_Prefix(ref string message)
		{
			if (!string.IsNullOrEmpty(message) && RussianCardTranslator.TryGetEnglishCardName(message, out var englishName))
			{
				message = englishName;
			}
		}

		public static void TranslateHierarchyUI(GameObject root)
		{
			if (!((Object)(object)root == (Object)null))
			{
				TMP_Text[] componentsInChildren = root.GetComponentsInChildren<TMP_Text>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					TranslateSingleUIText(componentsInChildren[i]);
				}
			}
		}

		public static void TranslateAllActiveUI()
		{
			TMP_Text[] array = Object.FindObjectsOfType<TMP_Text>();
			for (int i = 0; i < array.Length; i++)
			{
				TranslateSingleUIText(array[i]);
			}
		}

		private static void TranslateSingleUIText(TMP_Text t)
		{
			if ((Object)(object)t == (Object)null || (Object)(object)((Component)t).GetComponentInParent<CardInfoDisplayer>() != (Object)null || (Object)(object)((Component)t).GetComponentInParent<CardInfo>() != (Object)null)
			{
				return;
			}
			if ((Object)(object)((Component)t).GetComponent<Mask>() != (Object)null || (Object)(object)((Component)t).GetComponentInChildren<GeneralParticleSystem>(true) != (Object)null)
			{
				CyrillicFontManager.DisableSubMeshesUnderMask(((Component)t).gameObject);
				return;
			}
			CyrillicFontManager.EnsureCyrillicOnText(t);
			TMP_InputField componentInParent = ((Component)t).GetComponentInParent<TMP_InputField>();
			if ((!((Object)(object)componentInParent != (Object)null) || !((Object)(object)componentInParent.textComponent == (Object)(object)t)) && !string.IsNullOrEmpty(t.text))
			{
				string text = RussianCardTranslator.TranslateUIText(t.text);
				if (!string.Equals(text, t.text, StringComparison.Ordinal))
				{
					t.text = text;
				}
			}
		}
	}
	public class UILocalizationBehaviour : MonoBehaviour
	{
		private float _timer;

		private void Update()
		{
			if (!(Time.timeSinceLevelLoad < 0.65f))
			{
				_timer += Time.unscaledDeltaTime;
				if (_timer >= 0.35f)
				{
					_timer = 0f;
					CardLocalizationPatch.TranslateAllActiveUI();
				}
			}
		}
	}
	public static class VisualEffectsSettings
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__7_0;

			internal void <RegisterUnboundSettingsMenu>b__7_0()
			{
			}
		}

		private const string PrefsKey = "ChaosRuPack_EffectsIntensity";

		private static float _intensityPercent = -1f;

		public static float IntensityPercent
		{
			get
			{
				if (_intensityPercent < 0f)
				{
					_intensityPercent = PlayerPrefs.GetFloat("ChaosRuPack_EffectsIntensity", 100f);
				}
				return Mathf.Clamp(_intensityPercent, 0f, 100f);
			}
			set
			{
				_intensityPercent = Mathf.Clamp(Mathf.Round(value), 0f, 100f);
				PlayerPrefs.SetFloat("ChaosRuPack_EffectsIntensity", _intensityPercent);
				PlayerPrefs.Save();
			}
		}

		public static float Multiplier => IntensityPercent * 0.01f;

		public static void RegisterUnboundSettingsMenu()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			object obj = <>c.<>9__7_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
				};
				<>c.<>9__7_0 = val;
				obj = (object)val;
			}
			Unbound.RegisterMenu("Настройки Эффектов [CR]", (UnityAction)obj, (Action<GameObject>)BuildMenuGui, (GameObject)null, true);
		}

		private static void BuildMenuGui(GameObject menu)
		{
			TextMeshProUGUI textComponent = default(TextMeshProUGUI);
			MenuHandler.CreateText("ХАОС И РУСИФИКАТОР [CR] — ЭФФЕКТЫ", menu, ref textComponent, 40, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
			CyrillicFontManager.EnsureCyrillicOnText((TMP_Text)(object)textComponent);
			Slider val = default(Slider);
			CyrillicFontManager.EnsureCyrillicInHierarchy(MenuHandler.CreateSlider("Тряска экрана и спецэффекты (%)", menu, 28, 0f, 100f, IntensityPercent, (UnityAction<float>)OnSliderChanged, ref val, true, (Color?)null, (Direction)0, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null));
			CyrillicFontManager.EnsureCyrillicInHierarchy(menu);
			static void OnSliderChanged(float intensityPercent)
			{
				IntensityPercent = intensityPercent;
			}
		}
	}
	[HarmonyPatch]
	public static class EffectsIntensityPatch
	{
		private static bool _isCreatingSlider;

		[HarmonyPatch(typeof(OptionsButton), "OnEnable")]
		[HarmonyPostfix]
		public static void OptionsButton_OnEnable_Postfix(OptionsButton __instance)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			if (_isCreatingSlider || (Object)(object)__instance == (Object)null || (int)__instance.settingsTarget != 3)
			{
				return;
			}
			string text = ((Object)((Component)__instance).gameObject).name ?? "";
			if (text.IndexOf("Clone", StringComparison.OrdinalIgnoreCase) >= 0 || text == "ChaosRuPack_EffectsSlider")
			{
				return;
			}
			Transform parent = ((Component)__instance).transform.parent;
			if ((Object)(object)parent == (Object)null)
			{
				return;
			}
			Transform val = parent.Find("ChaosRuPack_EffectsSlider");
			if ((Object)(object)val != (Object)null)
			{
				CustomOptionsSliderRow component = ((Component)val).GetComponent<CustomOptionsSliderRow>();
				if ((Object)(object)component != (Object)null)
				{
					component.RefreshUI();
				}
				return;
			}
			_isCreatingSlider = true;
			try
			{
				GameObject obj = Object.Instantiate<GameObject>(((Component)__instance).gameObject, parent);
				((Object)obj).name = "ChaosRuPack_EffectsSlider";
				obj.transform.SetSiblingIndex(((Component)__instance).transform.GetSiblingIndex() + 1);
				OptionsButton component2 = obj.GetComponent<OptionsButton>();
				if ((Object)(object)component2 != (Object)null)
				{
					Object.Destroy((Object)(object)component2);
				}
				obj.AddComponent<CustomOptionsSliderRow>().Init();
			}
			finally
			{
				_isCreatingSlider = false;
			}
		}

		[HarmonyPatch(typeof(GamefeelManager), "AddGameFeel")]
		[HarmonyPrefix]
		public static bool AddGameFeel_Prefix(ref Vector2 directionForce)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.005f)
			{
				return false;
			}
			directionForce *= multiplier;
			return true;
		}

		[HarmonyPatch(typeof(GamefeelManager), "GameFeel")]
		[HarmonyPrefix]
		public static bool GameFeel_Prefix(ref Vector2 directionForce)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.005f)
			{
				return false;
			}
			directionForce *= multiplier;
			return true;
		}

		[HarmonyPatch(typeof(GamefeelManager), "AddUIGameFeel")]
		[HarmonyPrefix]
		public static bool AddUIGameFeel_Prefix(ref Vector2 directionForce)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.005f)
			{
				return false;
			}
			directionForce *= multiplier;
			return true;
		}

		[HarmonyPatch(typeof(GamefeelManager), "AddUIGameFeelOverTime")]
		[HarmonyPrefix]
		public static bool AddUIGameFeelOverTime_Prefix(ref float amount)
		{
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.005f)
			{
				return false;
			}
			amount *= multiplier;
			return true;
		}

		[HarmonyPatch(typeof(Screenshaker), "OnGameFeel")]
		[HarmonyPrefix]
		public static bool Screenshaker_OnGameFeel_Prefix(ref Vector2 feelDirection)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.005f)
			{
				return false;
			}
			feelDirection *= multiplier;
			return true;
		}

		[HarmonyPatch(typeof(Screenshaker), "OnUIGameFeel")]
		[HarmonyPrefix]
		public static bool Screenshaker_OnUIGameFeel_Prefix(ref Vector2 feelDirection)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.005f)
			{
				return false;
			}
			feelDirection *= multiplier;
			return true;
		}

		[HarmonyPatch(typeof(Screenshaker), "ShakeInternal")]
		[HarmonyPrefix]
		public static bool Screenshaker_ShakeInternal_Prefix(ref Vector2 direction)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.005f)
			{
				return false;
			}
			direction *= multiplier;
			return true;
		}

		[HarmonyPatch(typeof(ChomaticAberrationFeeler), "OnGameFeel")]
		[HarmonyPrefix]
		public static bool Aberration_OnGameFeel_Prefix(ref Vector2 feelDirection)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.005f)
			{
				return false;
			}
			feelDirection *= multiplier;
			return true;
		}

		[HarmonyPatch(typeof(ChomaticAberrationFeeler), "OnUIGameFeel")]
		[HarmonyPrefix]
		public static bool Aberration_OnUIGameFeel_Prefix(ref Vector2 feelDirection)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.005f)
			{
				return false;
			}
			feelDirection *= multiplier;
			return true;
		}

		[HarmonyPatch(typeof(AddShake), "DoShake")]
		[HarmonyPrefix]
		public static bool AddShake_DoShake_Prefix()
		{
			return VisualEffectsSettings.Multiplier > 0.005f;
		}

		[HarmonyPatch(typeof(ObjectShake), "Update")]
		[HarmonyPrefix]
		public static bool ObjectShake_Update_Prefix(ObjectShake __instance)
		{
			float multiplier = VisualEffectsSettings.Multiplier;
			if ((Object)(object)__instance != (Object)null)
			{
				__instance.globalMultiplier = multiplier;
			}
			return multiplier > 0.005f;
		}

		[HarmonyPatch(typeof(GridVisualizer), "BulletCall")]
		[HarmonyPrefix]
		public static bool GridVisualizer_BulletCall_Prefix()
		{
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.01f)
			{
				return false;
			}
			if (multiplier < 0.99f && Random.value > multiplier)
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(DynamicParticles), "PlayBulletHit")]
		[HarmonyPrefix]
		public static bool DynamicParticles_PlayBulletHit_Prefix(ref float damage)
		{
			float multiplier = VisualEffectsSettings.Multiplier;
			if (multiplier <= 0.01f)
			{
				return false;
			}
			damage *= multiplier;
			return true;
		}
	}
	public class CustomOptionsSliderRow : MonoBehaviour
	{
		private Slider _slider;

		private TMP_Text _label;

		private bool _updating;

		public void Init()
		{
			TMP_Text[] componentsInChildren = ((Component)this).GetComponentsInChildren<TMP_Text>(true);
			if (componentsInChildren != null && componentsInChildren.Length != 0)
			{
				_label = componentsInChildren[0];
				CyrillicFontManager.EnsureCyrillicOnText(_label);
				_label.enableAutoSizing = true;
				_label.fontSizeMin = 14f;
				_label.fontSizeMax = 28f;
			}
			_slider = ((Component)this).GetComponentInChildren<Slider>(true);
			if ((Object)(object)_slider != (Object)null)
			{
				((UnityEventBase)_slider.onValueChanged).RemoveAllListeners();
				_slider.minValue = 0f;
				_slider.maxValue = 1f;
				_slider.wholeNumbers = false;
				((UnityEvent<float>)(object)_slider.onValueChanged).AddListener((UnityAction<float>)OnSliderValueChanged);
			}
			RefreshUI();
		}

		private void OnEnable()
		{
			RefreshUI();
		}

		public void RefreshUI()
		{
			_updating = true;
			float intensityPercent = VisualEffectsSettings.IntensityPercent;
			if ((Object)(object)_slider != (Object)null)
			{
				_slider.value = intensityPercent * 0.01f;
			}
			if ((Object)(object)_label != (Object)null)
			{
				_label.text = $"ТРЯСКА И ЭФФЕКТЫ: {Mathf.RoundToInt(intensityPercent)}%";
			}
			_updating = false;
		}

		private void OnSliderValueChanged(float normalizedValue)
		{
			if (!_updating)
			{
				float num = (VisualEffectsSettings.IntensityPercent = Mathf.Round(normalizedValue * 100f));
				if ((Object)(object)_label != (Object)null)
				{
					_label.text = $"ТРЯСКА И ЭФФЕКТЫ: {Mathf.RoundToInt(num)}%";
				}
			}
		}
	}
}
namespace ChaosRuPack.Localization
{
	public static class CyrillicFontManager
	{
		private static TMP_FontAsset _cyrillicFallbackFont;

		private static bool _initialized;

		private static readonly HashSet<int> _patchedFontIds = new HashSet<int>();

		public static TMP_FontAsset GetOrCreateFallbackFont()
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			if ((Object)(object)_cyrillicFallbackFont != (Object)null)
			{
				return _cyrillicFallbackFont;
			}
			if (_initialized)
			{
				return null;
			}
			_initialized = true;
			try
			{
				string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
				string[] obj = new string[8]
				{
					Path.Combine(folderPath, "seguisb.ttf"),
					Path.Combine(folderPath, "segoeui.ttf"),
					Path.Combine(folderPath, "arial.ttf"),
					Path.Combine(folderPath, "tahoma.ttf"),
					"C:\\Windows\\Fonts\\seguisb.ttf",
					"C:\\Windows\\Fonts\\segoeui.ttf",
					"C:\\Windows\\Fonts\\arial.ttf",
					"C:\\Windows\\Fonts\\tahoma.ttf"
				};
				Font val = null;
				string[] array = obj;
				foreach (string text in array)
				{
					if (File.Exists(text))
					{
						val = new Font(text);
						if ((Object)(object)val != (Object)null)
						{
							break;
						}
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					val = Font.CreateDynamicFontFromOSFont(new string[3] { "Segoe UI", "Arial", "Tahoma" }, 64);
				}
				if ((Object)(object)val != (Object)null)
				{
					Object.DontDestroyOnLoad((Object)(object)val);
					((Object)val).hideFlags = (HideFlags)61;
					_cyrillicFallbackFont = TMP_FontAsset.CreateFontAsset(val);
					if ((Object)(object)_cyrillicFallbackFont != (Object)null)
					{
						((Object)_cyrillicFallbackFont).name = "ChaosRuPack_CyrillicRegular";
						_cyrillicFallbackFont.normalStyle = 0f;
						_cyrillicFallbackFont.boldStyle = 0.25f;
						Object.DontDestroyOnLoad((Object)(object)_cyrillicFallbackFont);
						((Object)_cyrillicFallbackFont).hideFlags = (HideFlags)61;
						if (TMP_Settings.fallbackFontAssets != null && !TMP_Settings.fallbackFontAssets.Contains(_cyrillicFallbackFont))
						{
							TMP_Settings.fallbackFontAssets.Add(_cyrillicFallbackFont);
						}
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[ChaosRuPack] Failed to initialize Cyrillic fallback font: " + ex.Message));
			}
			return _cyrillicFallbackFont;
		}

		public static void EnsureCyrillicOnMaskText(TMP_Text textComponent)
		{
			//IL_000c: 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)
			if (!((Object)(object)textComponent == (Object)null))
			{
				textComponent.fontStyle = (FontStyles)(textComponent.fontStyle & -2);
				TMP_FontAsset orCreateFallbackFont = GetOrCreateFallbackFont();
				if ((Object)(object)orCreateFallbackFont != (Object)null && (Object)(object)textComponent.font != (Object)(object)orCreateFallbackFont)
				{
					textComponent.font = orCreateFallbackFont;
				}
				DisableSubMeshesUnderMask(((Component)textComponent).gameObject);
			}
		}

		public static void DisableSubMeshesUnderMask(GameObject maskObj)
		{
			if ((Object)(object)maskObj == (Object)null)
			{
				return;
			}
			TMP_SubMeshUI[] componentsInChildren = maskObj.GetComponentsInChildren<TMP_SubMeshUI>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if ((Object)(object)componentsInChildren[i] != (Object)null && (Object)(object)((Component)componentsInChildren[i]).gameObject != (Object)(object)maskObj)
				{
					((Behaviour)componentsInChildren[i]).enabled = false;
					((Component)componentsInChildren[i]).gameObject.SetActive(false);
				}
			}
		}

		public static void EnsureCyrillicOnText(TMP_Text textComponent)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)textComponent == (Object)null)
			{
				return;
			}
			if ((Object)(object)((Component)textComponent).GetComponent<Mask>() != (Object)null || (Object)(object)((Component)textComponent).GetComponentInChildren<GeneralParticleSystem>(true) != (Object)null)
			{
				EnsureCyrillicOnMaskText(textComponent);
				return;
			}
			textComponent.fontStyle = (FontStyles)(textComponent.fontStyle & -2);
			TMP_FontAsset orCreateFallbackFont = GetOrCreateFallbackFont();
			if ((Object)(object)orCreateFallbackFont == (Object)null)
			{
				return;
			}
			TMP_FontAsset font = textComponent.font;
			if (!((Object)(object)font != (Object)null) || !((Object)(object)font != (Object)(object)orCreateFallbackFont))
			{
				return;
			}
			int instanceID = ((Object)font).GetInstanceID();
			if (!_patchedFontIds.Contains(instanceID))
			{
				if (font.fallbackFontAssetTable == null)
				{
					font.fallbackFontAssetTable = new List<TMP_FontAsset>();
				}
				if (!font.fallbackFontAssetTable.Contains(orCreateFallbackFont))
				{
					font.fallbackFontAssetTable.Insert(0, orCreateFallbackFont);
				}
				_patchedFontIds.Add(instanceID);
			}
		}

		public static void EnsureCyrillicInHierarchy(GameObject root)
		{
			if ((Object)(object)root == (Object)null)
			{
				return;
			}
			TMP_Text[] componentsInChildren = root.GetComponentsInChildren<TMP_Text>(true);
			foreach (TMP_Text val in componentsInChildren)
			{
				if (!((Object)(object)val == (Object)null))
				{
					if ((Object)(object)((Component)val).GetComponent<Mask>() != (Object)null || (Object)(object)((Component)val).GetComponentInChildren<GeneralParticleSystem>(true) != (Object)null)
					{
						DisableSubMeshesUnderMask(((Component)val).gameObject);
					}
					else
					{
						EnsureCyrillicOnText(val);
					}
				}
			}
		}
	}
	public static class RussianCardTranslator
	{
		private static readonly Dictionary<string, string> CardNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "QUICK SHOT", "БЫСТРЫЙ ВЫСТРЕЛ" },
			{ "EXPLOSIVE BULLET", "ВЗРЫВНАЯ ПУЛЯ" },
			{ "HOMING", "САМОНАВЕДЕНИЕ" },
			{ "HUGE", "ГИГАНТ" },
			{ "Fast forward", "УСКОРЕНИЕ" },
			{ "DAZZLE", "ОГЛУШЕНИЕ" },
			{ "MAYHEM", "БЕЗУМИЕ" },
			{ "POISON", "ЯД" },
			{ "PHOENIX", "ФЕНИКС" },
			{ "RICCOCHET", "РИКОШЕТ" },
			{ "RICOCHET", "РИКОШЕТ" },
			{ "WIND UP", "РАСКРУТКА" },
			{ "CAREFUL PLANNING", "ТОЧНЫЙ РАСЧЁТ" },
			{ "BOUNCY", "ПРЫГУЧАЯ ПУЛЯ" },
			{ "DRILL AMMO", "БУРОВЫЕ ПАТРОНЫ" },
			{ "ECHO", "ЭХО" },
			{ "SNEAKY", "ХИТРАЯ ПУЛЯ" },
			{ "SCAVENGER", "МАРОДЁР" },
			{ "TASTE OF BLOOD", "ВКУС КРОВИ" },
			{ "SHIELDS UP", "ЩИТЫ ВВЕРХ" },
			{ "Refresh", "ОБНОВЛЕНИЕ" },
			{ "DEFENDER", "ЗАЩИТНИК" },
			{ "BUCKSHOT", "КАРТЕЧЬ" },
			{ "TANK", "ТАНК" },
			{ "TOXIC CLOUD", "ТОКСИЧНОЕ ОБЛАКО" },
			{ "TIMED DETONATION", "ЧАСОВАЯ БОМБА" },
			{ "FASTBALL", "ФАСТБОЛ" },
			{ "FAST BALL", "ФАСТБОЛ" },
			{ "CHILLING PRESENCE", "ЛЕДЯНАЯ АУРА" },
			{ "Target BOUNCE", "ПРИЦЕЛЬНЫЙ ОТСКОК" },
			{ "Demonic pact", "СДЕЛКА С ДЬЯВОЛОМ" },
			{ "BIG BULLET", "БОЛЬШАЯ ПУЛЯ" },
			{ "GROW", "РОСТ" },
			{ "CHASE", "ПОГОНЯ" },
			{ "STEADY SHOT", "ТВЁРДАЯ РУКА" },
			{ "QUICK RELOAD", "БЫСТРАЯ ЗАРЯДКА" },
			{ "PARASITE", "ПАРАЗИТ" },
			{ "TRICKSTER", "ТРИКСТЕР" },
			{ "GLASS CANNON", "ХРУСТАЛЬНАЯ ПУШКА" },
			{ "BARRAGE", "ШКВАЛ ОГНЯ" },
			{ "BRAWLER", "ВЫШИБАЛА" },
			{ "DECAY", "РАСПАД" },
			{ "THRUSTER", "УСКОРИТЕЛЬ" },
			{ "COLD BULLETS", "ЛЕДЯНЫЕ ПУЛИ" },
			{ "LIFESTEALER", "ПОХИТИТЕЛЬ ЖИЗНИ" },
			{ "COMBINE", "СИНТЕЗ" },
			{ "PRISITNE PERSEVERENCE", "СТОЙКОСТЬ" },
			{ "PRISTINE PERSEVERANCE", "СТОЙКОСТЬ" },
			{ "REMOTE", "РАДИОУПРАВЛЕНИЕ" },
			{ "LEECH", "ПИЯВКА" },
			{ "ABYSSAL COUNTDOWN", "ЗОВ БЕЗДНЫ" },
			{ "SPRAY", "ПУЛЕМЁТ" },
			{ "BURST", "ОЧЕРЕДЬ" },
			{ "OVERPOWER", "ПЕРЕГРУЗКА" },
			{ "SAW", "ПИЛА" },
			{ "EMPOWER", "УСИЛЕНИЕ" },
			{ "FROST SLAM", "МОРОЗНЫЙ УДАР" },
			{ "RADAR SHOT", "РАДАРНЫЙ ВЫСТРЕЛ" },
			{ "TELEPORT", "ТЕЛЕПОРТ" },
			{ "Implode", "ИМПЛОЗИЯ" },
			{ "RADIANCE", "СИЯНИЕ" },
			{ "Shockwave", "УДАРНАЯ ВОЛНА" },
			{ "TACTICAL RELOAD", "ТАКТИЧЕСКАЯ ЗАРЯДКА" },
			{ "Healing field", "ПОЛЕ ИСЦЕЛЕНИЯ" },
			{ "STATIC FIELD", "СТАТИЧЕСКОЕ ПОЛЕ" },
			{ "EMP", "ЭМИ" },
			{ "BOMBS AWAY", "БОМБОМЕТАНИЕ" },
			{ "SHIELD CHARGE", "РЫВОК СО ЩИТОМ" },
			{ "SUPERNOVA", "СВЕРХНОВАЯ" },
			{ "SILENCE", "БЕЗМОЛВИЕ" },
			{ "Ricochet Surge", "ИМПУЛЬСНЫЙ РИКОШЕТ" },
			{ "Phase Blink", "ФАЗОВЫЙ СКАЧОК" },
			{ "Gravity Tether", "ГРАВИ-ПРИВЯЗЬ" },
			{ "Berserker's Gambit", "ГАМБИТ БЕРСЕРКА" },
			{ "Kinetic Charger", "КИНЕТИЧЕСКИЙ ЗАРЯД" },
			{ "Echo Chamber", "ЭХО-ПАТРОННИК" },
			{ "Backstab Anomaly", "УДАР В СПИНУ" },
			{ "Super Grow", "СУПЕР УСИЛЕНИЕ" },
			{ "Super Drill", "СУПЕР ДРЕЛЬ" },
			{ "Super Glass Cannon", "СУПЕР ХРУСТАЛЬНАЯ ПУШКА" },
			{ "Super Wind Up", "СУПЕР РАСКРУТКА" },
			{ "Ultra Laser", "УЛЬТРА-ЛАЗЕР" },
			{ "Anti Laser", "АНТИ-ЛАЗЕР" }
		};

		private static readonly Dictionary<string, string> CardDescriptions = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "Bullet explodes on impact", "Пули взрываются при попадании" },
			{ "Bullets home towards visible targets", "Пули самонаводятся на видимых врагов" },
			{ "Bullets keep the default trajectory", "Пули летят по прямой траектории" },
			{ "Bullets stun the oponent multiple times", "Пули многократно оглушают врага" },
			{ "Bullets deal damage over 3 seconds", "Пули наносят урон в течение 3 секунд" },
			{ "Respawn once on death", "Возрождает один раз после смерти" },
			{ "Bullets lose half of their speed when they bounce", "Пули теряют половину скорости при отскоке" },
			{ "Blocking triggers another, delayed block", "Блок вызывает второй отложенный блок" },
			{ "Bullets avoid the ground", "Пули огибают землю и препятствия" },
			{ "Dealing damage reloads your weapon", "Нанесение урона мгновенно перезаряжает оружие" },
			{ "+50% movement speed 3s after dealing DMG", "+50% к скорости бега на 3 сек. после нанесения урона" },
			{ "Firing your last bullet triggers a block.\nDisabled continuous reloading.", "Последний патрон в обойме активирует блок.\nОтключает авто-перезарядку." },
			{ "You get block back when deal damage", "Нанесение урона сбрасывает перезарядку блока" },
			{ "Adds a shotgun vibe to your attack", "Превращает выстрел в залп дробовика" },
			{ "Bullets spawn a poison cloud on impact. \nClouds deal damage and slow.", "Пули создают ядовитое облако при ударе.\nОблако наносит урон и замедляет." },
			{ "Bullets spawn a poison cloud on impact.\nClouds deal damage and slow.", "Пули создают ядовитое облако при ударе.\nОблако наносит урон и замедляет." },
			{ "Bullets spawn bombs that explode after half a second", "Пули создают бомбы, взрывающиеся через 0.5 сек." },
			{ "Slightly slow nearby enemies", "Слегка замедляет врагов поблизости" },
			{ "Bullets aim for visible targets when bouncing", "При отскоке пули наводятся на видимых врагов" },
			{ "Shooting costs 10HP\nRemoves shooting cooldown", "Выстрел отнимает 10 HP.\nУбирает задержку между выстрелами." },
			{ "Bigger bullets", "Увеличивает размер и мощь пуль" },
			{ "Bullets gets more damage over time when travelling", "Чем дольше летит пуля, тем выше её урон" },
			{ "+60% movement when moving towards the opponent", "+60% к скорости при движении в сторону врага" },
			{ "Bullets deal damage over 5 seconds", "Пули наносят растянутый урон за 5 секунд" },
			{ "Bullets deal 80% more DMG per bounce", "Каждый отскок увеличивает урон пули на 80%" },
			{ "Fire many bullets at the same time", "Выпускает веер пуль одновременно" },
			{ "+200% HP 3s after dealing DMG", "+200% HP на 3 секунды после нанесения урона" },
			{ "Damage done to you is dealt over 4 seconds", "Получаемый урон растягивается на 4 секунды" },
			{ "Bullets have thrusters that push targets", "Пули снабжены двигателями и сильно толкают цель" },
			{ "Steal hp from your opponent when near", "Вытягивает здоровье из врагов поблизости" },
			{ "+400% HP when above 90% HP", "+400% HP, пока ваше здоровье выше 90%" },
			{ "Steer bullet with right stick / mouse", "Пулями можно управлять курсором мыши / стиком" },
			{ "Stand still to summon dark powers", "Стойте на месте, чтобы призвать тёмную сферу" },
			{ "Multiple bullets are fired in a sequence", "Выпускает очередь из нескольких пуль подряд" },
			{ "Deal 15% of your max HP to enemies around you when you block", "При блоке наносит врагам вокруг урон, равный 15% вашего макс. HP" },
			{ "Blocking spawns a saw around you for a short while", "Блок ненадолго создаёт циркулярную пилу вокруг вас" },
			{ "Blocking increases the damage and speed of your next shot.\nThe shot also triggers any on block abilities where it lands.", "Блок усиливает и ускоряет следующий выстрел.\nТочка попадания также активирует все эффекты блока." },
			{ "Slows enemies around you when you block", "Замедляет врагов вокруг вас при блоке" },
			{ "Blocking scans the area for enemies. You automatically shoot any enemy found.", "Блок сканирует область и автоматически стреляет в найденного врага" },
			{ "Blocking teleports you forward", "Блок телепортирует вас вперёд" },
			{ "Blocking pulls enemies towards you", "Блок притягивает врагов к вам" },
			{ "Spawn damaging sun waves when reloading.\nThe rate increases during the reload sequence.", "Во время перезарядки испускает солнечные волны урона" },
			{ "Blocking pushes enemies away", "Блок отталкивает врагов ударной волной" },
			{ "Blocking reloads your weapon", "Блок мгновенно перезаряжает оружие" },
			{ "Blocking creates a healing field", "Блок создаёт исцеляющее поле" },
			{ "Blocking creates a field that slows and deals damage", "Блок создаёт поле, которое замедляет и ранит врагов" },
			{ "Blocking spawns a ring of slowing projectiles", "Блок выпускает кольцо замедляющих снарядов" },
			{ "Spawn a bunch of small bombs around you when you block", "Блок разбрасывает связку бомб вокруг вас" },
			{ "Blocking launches you forward and gives you a second automatic block upon ending the charge", "Блок бросает вас вперёд и даёт второй блок в конце рывка" },
			{ "Spawns a field that pulls enemies in and stuns after a while", "Создаёт сверхновую, которая стягивает и оглушает врагов" },
			{ "Blocking silences enemies nearby", "Блок накладывает безмолвие на ближайших врагов" }
		};

		private static readonly Dictionary<string, string> StatNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "Bullet speed", "Скорость пули" },
			{ "Projectile speed", "Скорость снаряда" },
			{ "Reload time", "Перезарядка" },
			{ "Reload speed", "Скор. зарядки" },
			{ "ATKSPD", "Скорострельность" },
			{ "Attack Speed", "Скорострельность" },
			{ "DMG", "Урон" },
			{ "Damage", "Урон" },
			{ "Splash DMG", "Урон по области" },
			{ "HP", "Здоровье" },
			{ "Health", "Здоровье" },
			{ "Max HP", "Макс. здоровье" },
			{ "Bullet bounces", "Отскоки пуль" },
			{ "Bullet bounce", "Отскок пули" },
			{ "Bounces", "Отскоки пуль" },
			{ "Bullet", "Пуля" },
			{ "Bullets", "Пули" },
			{ "Bullets drill through walls", "Бурение стен" },
			{ "Block cooldown", "Откат блока" },
			{ "Life steal", "Вампиризм" },
			{ "AMMO", "Патроны" },
			{ "Bullet slow", "Замедление" },
			{ "Movement speed", "Скорость бега" },
			{ "Move Speed", "Скорость бега" },
			{ "Bounce DMG & Speed", "Бонус за отскок" },
			{ "Blink Distance", "Дальность скачка" },
			{ "Gravity Pull", "Притяжение" },
			{ "Low HP Bonus", "Бонус на лоу-HP" },
			{ "Max Charge Bonus", "Заряд в беге" },
			{ "Echo Shot DMG", "Урон эхо-пули" },
			{ "Backstab Chance", "Удар в спину" },
			{ "Bullet Growth", "Рост пули в полёте" },
			{ "Wall Drilling", "Сквозное бурение" },
			{ "Max HP Lock", "Лимит здоровья" },
			{ "Spin-Up Fire Rate", "Разгон очереди" },
			{ "Knockback", "Отбрасывание" }
		};

		private static readonly Dictionary<string, string> SimpleAmounts = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "Slightly more", "Чуть больше" },
			{ "More", "Больше" },
			{ "A bunch more", "Гораздо больше" },
			{ "A bunch of", "Много" },
			{ "A little bit of", "Немного" },
			{ "A lot of", "Много" },
			{ "Some", "Больше" },
			{ "A huge amount of", "Огромный бонус" },
			{ "Slightly lower", "Чуть меньше" },
			{ "Lower", "Меньше" },
			{ "A lot lower", "Гораздо меньше" },
			{ "Smaller", "Меньше" },
			{ "Slightly smaller", "Чуть меньше" },
			{ "Less", "Меньше" },
			{ "Slightly less", "Чуть меньше" }
		};

		private static readonly Dictionary<string, string> GameMessages = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "HALF ORANGE", "ПОЛОВИНА — ОРАНЖЕВЫЕ" },
			{ "ROUND ORANGE", "РАУНД — ОРАНЖЕВЫЕ" },
			{ "HALF BLUE", "ПОЛОВИНА — СИНИЕ" },
			{ "ROUND BLUE", "РАУНД — СИНИЕ" },
			{ "PICK PHASE", "ВЫБОР КАРТ" },
			{ "ORANGE WINS!", "ПОБЕДА ОРАНЖЕВЫХ!" },
			{ "BLUE WINS!", "ПОБЕДА СИНИХ!" },
			{ "TIE", "НИЧЬЯ" },
			{ "DRAW", "НИЧЬЯ" }
		};

		private static readonly Dictionary<string, string> UiTexts = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "VERSUS", "СРАЖЕНИЕ" },
			{ "ONLINE", "ОНЛАЙН" },
			{ "LOCAL", "ЛОКАЛЬНО" },
			{ "SANDBOX", "ПЕСОЧНИЦА" },
			{ "[GameMode] Sandbox", "ПЕСОЧНИЦА" },
			{ "Playground mode", "Режим тренировки и теста карт" },
			{ "A sandbox mode where you can play around, test cards and shoot dummies.", "Режим песочницы, где можно свободно тестировать любые карты и сборки." },
			{ "TWITCH MATCHMAKING", "TWITCH МАТЧМЕЙКИНГ" },
			{ "OPTIONS", "НАСТРОЙКИ" },
			{ "MODS", "МОДЫ" },
			{ "CREDITS", "АВТОРЫ" },
			{ "QUIT", "ВЫХОД" },
			{ "QUIT GAME", "ВЫЙТИ ИЗ ИГРЫ" },
			{ "RESUME", "ПРОДОЛЖИТЬ" },
			{ "MAIN MENU", "ГЛАВНОЕ МЕНЮ" },
			{ "BACK", "НАЗАД" },
			{ "<- Back", "<- Назад" },
			{ "BACK(short)", "НАЗАД" },
			{ "CONTINUE", "ПРОДОЛЖИТЬ" },
			{ "CONTINUE?", "ПРОДОЛЖИТЬ?" },
			{ "DONE", "ГОТОВО" },
			{ "YES", "ДА" },
			{ "NO", "НЕТ" },
			{ "ON", "ВКЛ" },
			{ "OFF", "ВЫКЛ" },
			{ "LOCKED", "ЗАКРЫТО" },
			{ "INVITE FRIEND", "ПРИГЛАСИТЬ ДРУГА" },
			{ "INVITE", "ПРИГЛАСИТЬ" },
			{ "QUICK MATCH", "БЫСТРЫЙ МАТЧ" },
			{ "QUICKMATCH", "БЫСТРЫЙ МАТЧ" },
			{ "HOST", "СОЗДАТЬ ИГРУ" },
			{ "SEARCHING", "ПОИСК..." },
			{ "SEARCHING...", "ПОИСК..." },
			{ "MATCH FOUND", "МАТЧ НАЙДЕН" },
			{ "WAITING", "ОЖИДАНИЕ" },
			{ "WAITING...", "ОЖИДАНИЕ..." },
			{ "WAITING FOR PLAYERS", "ОЖИДАНИЕ ИГРОКОВ" },
			{ "WAITING FOR PLAYERS...", "ОЖИДАНИЕ ИГРОКОВ..." },
			{ "REGION", "РЕГИОН" },
			{ "Trying to connect to photon", "Подключение к серверу..." },
			{ "Is connected", "Подключено" },
			{ "PRESS JUMP", "НАЖМИ ПРЫЖОК" },
			{ "TO JOIN", "ЧТОБЫ ВОЙТИ" },
			{ "PRESS JUMP\nTO JOIN", "НАЖМИ ПРЫЖОК\nЧТОБЫ ВОЙТИ" },
			{ "PRESS [SPACE] TO JOIN", "НАЖМИ [SPACE] ДЛЯ ВХОДА" },
			{ "PRESS [A] TO JOIN", "НАЖМИ [A] ДЛЯ ВХОДА" },
			{ "PRESS      [A]           TO JOIN", "НАЖМИ [A] ДЛЯ ВХОДА" },
			{ "PRESS      [A]          TO JOIN", "НАЖМИ [A] ДЛЯ ВХОДА" },
			{ "PRESS [SPACE] WHEN READY", "НАЖМИ [SPACE] КОГДА ГОТОВ" },
			{ "PRESS [START] WHEN READY", "НАЖМИ [START] КОГДА ГОТОВ" },
			{ "PRESS [SPACE] TO START", "НАЖМИ [SPACE] ДЛЯ СТАРТА" },
			{ "PRESS [A] TO START", "НАЖМИ [A] ДЛЯ СТАРТА" },
			{ "READY", "ГОТОВ" },
			{ "NOT READY", "НЕ ГОТОВ" },
			{ "JOIN/READY", "ВОЙТИ / ГОТОВ" },
			{ "UNREADY/LEAVE", "ОТМЕНА / ВЫЙТИ" },
			{ "TEAM", "КОМАНДА" },
			{ "TEAM(short)", "КОМ." },
			{ "CHANGE TEAM", "СМЕНИТЬ КОМАНДУ" },
			{ "select team", "выбери команду" },
			{ "Deathmatch", "Каждый за себя" },
			{ "Free For All Deathmatch. Last player standing wins.", "Каждый за себя. Побеждает последний выживший игрок." },
			{ "Team Deathmatch", "Командный бой" },
			{ "Team Deathmatch. Last team standing wins.", "Командный бой. Побеждает последняя выжившая команда." },
			{ "Game Modes", "Режимы игры" },
			{ "Arms Race", "Гонка вооружений" },
			{ "GameMode] Arms race", "Гонка вооружений" },
			{ "[GameMode] Arms race", "Гонка вооружений" },
			{ "EDIT CHARACTER", "ПЕРСОНАЖ" },
			{ "SELECT CHARACTER", "ВЫБРАТЬ" },
			{ "FACE", "ЛИЦО" },
			{ "EYES", "ГЛАЗА" },
			{ "MOUTH", "РОТ" },
			{ "MOUTHS", "РОТ" },
			{ "DETAIL", "ДЕТАЛЬ" },
			{ "DETAIL 1", "ДЕТАЛЬ 1" },
			{ "DETAIL 2", "ДЕТАЛЬ 2" },
			{ "DETAIL1", "ДЕТАЛЬ 1" },
			{ "DETAIL2", "ДЕТАЛЬ 2" },
			{ "TO EDIT", "ИЗМЕНИТЬ" },
			{ "TO MOVE ITEMS", "ДВИГАТЬ ДЕТАЛИ" },
			{ "TO SAVE", "СОХРАНИТЬ" },
			{ "MASTER VOLUME", "ОБЩАЯ ГРОМКОСТЬ" },
			{ "SFX VOLUME", "ГРОМКОСТЬ ЗВУКОВ" },
			{ "SFX", "ЗВУКИ" },
			{ "MUSIC VOLUME", "ГРОМКОСТЬ МУЗЫКИ" },
			{ "RESOLUTION", "РАЗРЕШЕНИЕ" },
			{ "FULLSCREEN", "ПОЛНЫЙ ЭКРАН" },
			{ "WINDOWED", "В ОКНЕ" },
			{ "V-SYNC", "ВЕРТ. СИНХРОНИЗАЦИЯ" },
			{ "VSYNC", "ВЕРТ. СИНХРОНИЗАЦИЯ" },
			{ "BLOOM", "СВЕЧЕНИЕ (BLOOM)" },
			{ "CONTROLS", "УПРАВЛЕНИЕ" },
			{ "SHOW CARD STAT NUMBERS", "ПОКАЗЫВАТЬ ЦИФРЫ ХАРАКТЕРИСТИК" },
			{ "LEFT STICK AIMING", "ПРИЦЕЛ ЛЕВЫМ СТИКОМ" },
			{ "Aim with left stick", "Прицел левым стиком" },
			{ "LOCK AIMING TO 8 DIRECTION (MOUSE)", "ПРИВЯЗКА ПРИЦЕЛА К 8 НАПРАВЛЕНИЯМ (МЫШЬ)" },
			{ "LOCK AIMING TO 8 DIRECTION (CONTROLLER)", "ПРИВЯЗКА ПРИЦЕЛА К 8 НАПРАВЛЕНИЯМ (ГЕЙМПАД)" },
			{ "MOD OPTIONS", "НАСТРОЙКИ МОДОВ" },
			{ "Mod Options:", "Настройки модов:" },
			{ "UnboundLib Options", "Настройки UnboundLib" },
			{ "Rounds With Friends Options", "Настройки Rounds With Friends" },
			{ "Toggle Cards", "Вкл / Выкл Карты" },
			{ "Toggle Levels", "Вкл / Выкл Уровни" },
			{ "Toggle", "Переключить" },
			{ "ALL MODS SYNCED", "ВСЕ МОДЫ СИНХРОНИЗИРОВАНЫ" },
			{ "Enable All", "Включить все" },
			{ "Disable All", "Выключить все" },
			{ "END MATCH", "ЗАВЕРШИТЬ МАТЧ" },
			{ "REMATCH", "РЕВАНШ" },
			{ "SHOOT THE CARDS TO PICK THEM", "СТРЕЛЯЙ ПО КАРТАМ, ЧТОБЫ ВЫБРАТЬ ИХ" },
			{ "TYPE NAMES OF CARDS TO SPAWN THEM", "ПИШИ НАЗВАНИЯ КАРТ В ЧАТ, ЧТОБЫ ВЫЗВАТЬ ИХ" },
			{ "PRESS ENTER TO CHAT", "НАЖМИ ENTER ДЛЯ ЧАТА" },
			{ "Enter text...", "Введите сообщение..." },
			{ "Enter name", "Введите имя" },
			{ "PICK ONE", "ВЫБЕРИ КАРТУ" },
			{ "GET OAUTH", "ПОЛУЧИТЬ ТОКЕН" },
			{ "TWITCH NAME:", "ИМЯ НА TWITCH:" }
		};

		public static string TranslateCardName(string name)
		{
			if (string.IsNullOrWhiteSpace(name))
			{
				return name;
			}
			string key = name.Trim();
			if (CardNames.TryGetValue(key, out var value))
			{
				return value;
			}
			return name;
		}

		public static string TranslateDescription(string description)
		{
			if (string.IsNullOrWhiteSpace(description))
			{
				return description;
			}
			string key = description.Trim().Replace("\r\n", "\n");
			if (CardDescriptions.TryGetValue(key, out var value))
			{
				return value;
			}
			return description;
		}

		public static string TranslateStatName(string stat)
		{
			if (string.IsNullOrWhiteSpace(stat))
			{
				return stat;
			}
			string key = stat.Trim();
			if (StatNames.TryGetValue(key, out var value))
			{
				return value;
			}
			return stat;
		}

		public static string TranslateSimpleAmountString(string simpleText)
		{
			if (string.IsNullOrWhiteSpace(simpleText))
			{
				return simpleText;
			}
			string key = simpleText.Trim();
			if (SimpleAmounts.TryGetValue(key, out var value))
			{
				return value;
			}
			return simpleText;
		}

		public static string TranslateStatAmount(string amount)
		{
			if (string.IsNullOrWhiteSpace(amount))
			{
				return amount;
			}
			string text = amount.Trim();
			if (SimpleAmounts.TryGetValue(text, out var value))
			{
				return value;
			}
			text = Regex.Replace(text, "^([+-]?\\d+(?:\\.\\d+)?)s$", "$1с", RegexOptions.IgnoreCase);
			return Regex.Replace(text, "^([+-]?\\d+(?:\\.\\d+)?)m$", "$1м", RegexOptions.IgnoreCase);
		}

		public static string TranslateGameMessage(string msg)
		{
			if (string.IsNullOrWhiteSpace(msg))
			{
				return msg;
			}
			string key = msg.Trim();
			if (GameMessages.TryGetValue(key, out var value))
			{
				return value;
			}
			if (UiTexts.TryGetValue(key, out var value2))
			{
				return value2;
			}
			return msg;
		}

		public static string TranslateUIText(string raw)
		{
			if (string.IsNullOrWhiteSpace(raw))
			{
				return raw;
			}
			string text = raw.Trim();
			if (UiTexts.TryGetValue(text, out var value))
			{
				return value;
			}
			if (GameMessages.TryGetValue(text, out var value2))
			{
				return value2;
			}
			if (SimpleAmounts.TryGetValue(text, out var value3))
			{
				return value3;
			}
			if (text.IndexOf('\n') >= 0)
			{
				string[] array = raw.Replace("\r\n", "\n").Split(new char[1] { '\n' });
				bool flag = false;
				for (int i = 0; i < array.Length; i++)
				{
					string text2 = TranslateSingleLineUI(array[i]);
					if (!string.Equals(text2, array[i], StringComparison.Ordinal))
					{
						array[i] = text2;
						flag = true;
					}
				}
				if (flag)
				{
					return string.Join("\n", array);
				}
			}
			return TranslateSingleLineUI(raw);
		}

		private static string TranslateSingleLineUI(string raw)
		{
			if (string.IsNullOrWhiteSpace(raw))
			{
				return raw;
			}
			string text = raw.Trim();
			if (UiTexts.TryGetValue(text, out var value))
			{
				return value;
			}
			if (GameMessages.TryGetValue(text, out var value2))
			{
				return value2;
			}
			string text2 = Regex.Replace(text, "\\s+", " ");
			if (UiTexts.TryGetValue(text2, out var value3))
			{
				return value3;
			}
			if (text2.StartsWith("Team ", StringComparison.OrdinalIgnoreCase) && text2.Length <= 10)
			{
				return "Команда " + text2.Substring(5);
			}
			if (text2.StartsWith("Connecting to ", StringComparison.OrdinalIgnoreCase))
			{
				return "Подключение к " + text2.Substring(14);
			}
			if (text2.StartsWith("Ping: ", StringComparison.OrdinalIgnoreCase))
			{
				return "Пинг: " + text2.Substring(6);
			}
			return raw;
		}

		private static string NormalizeSearchKey(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				return string.Empty;
			}
			return s.Trim().Replace(" ", "").Replace("-", "")
				.Replace("_", "")
				.Replace("'", "")
				.Replace("ё", "е")
				.Replace("Ё", "Е")
				.ToUpperInvariant();
		}

		public static bool TryGetEnglishCardName(string input, out string englishName)
		{
			englishName = null;
			if (string.IsNullOrWhiteSpace(input))
			{
				return false;
			}
			string text = input.Trim();
			bool flag = false;
			foreach (char c in text)
			{
				if ((c >= 'а' && c <= 'я') || (c >= 'А' && c <= 'Я') || c == 'ё' || c == 'Ё')
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				return false;
			}
			string text2 = NormalizeSearchKey(text);
			if (text2.Length == 0)
			{
				return false;
			}
			foreach (KeyValuePair<string, string> cardName in CardNames)
			{
				if (string.Equals(cardName.Value, text, StringComparison.OrdinalIgnoreCase) || string.Equals(NormalizeSearchKey(cardName.Value), text2, StringComparison.Ordinal))
				{
					englishName = cardName.Key;
					return true;
				}
			}
			if (text2.Length >= 2)
			{
				foreach (KeyValuePair<string, string> cardName2 in CardNames)
				{
					if (NormalizeSearchKey(cardName2.Value).StartsWith(text2, StringComparison.Ordinal))
					{
						englishName = cardName2.Key;
						return true;
					}
				}
				foreach (KeyValuePair<string, string> cardName3 in CardNames)
				{
					if (NormalizeSearchKey(cardName3.Value).IndexOf(text2, StringComparison.Ordinal) >= 0)
					{
						englishName = cardName3.Key;
						return true;
					}
				}
			}
			return false;
		}
	}
}
namespace ChaosRuPack.Effects
{
	public class BackstabAnomalyEffect : MonoBehaviour
	{
		public int Stacks = 1;

		private Player _player;

		private Gun _gun;

		private Action<GameObject> _onShootProjectile;

		private void Start()
		{
			_player = ((Component)this).GetComponent<Player>();
			if ((Object)(object)_player != (Object)null && (Object)(object)_player.data != (Object)null && (Object)(object)_player.data.weaponHandler != (Object)null)
			{
				_gun = _player.data.weaponHandler.gun;
				if ((Object)(object)_gun != (Object)null)
				{
					_onShootProjectile = OnShootProjectile;
					_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(_gun.ShootPojectileAction, _onShootProjectile);
				}
			}
		}

		private void OnShootProjectile(GameObject bullet)
		{
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)bullet == (Object)null || (Object)(object)_player == (Object)null || (Object)(object)_player.data == (Object)null || _player.data.dead)
			{
				return;
			}
			float num = Mathf.Clamp01(0.02f * (float)Stacks);
			if (Random.value >= num || (Object)(object)PlayerManager.instance == (Object)null || PlayerManager.instance.players == null)
			{
				return;
			}
			List<Player> list = new List<Player>();
			for (int i = 0; i < PlayerManager.instance.players.Count; i++)
			{
				Player val = PlayerManager.instance.players[i];
				if ((Object)(object)val != (Object)null && val.teamID != _player.teamID && (Object)(object)val.data != (Object)null && !val.data.dead)
				{
					list.Add(val);
				}
			}
			if (list.Count != 0)
			{
				Player val2 = list[Random.Range(0, list.Count)];
				Vector3 val3 = val2.data.input.aimDirection;
				if (((Vector3)(ref val3)).sqrMagnitude < 0.01f)
				{
					val3 = ((Component)_player).transform.position - ((Component)val2).transform.position;
				}
				if (((Vector3)(ref val3)).sqrMagnitude < 0.01f)
				{
					val3 = Vector3.right;
				}
				val3.z = 0f;
				((Vector3)(ref val3)).Normalize();
				Vector3 val4 = -val3;
				Vector3 val5 = ((Component)val2).transform.position + val4 * 1.65f;
				val5.z = 0f;
				Vector3 val6 = ((Component)val2).transform.position - val5;
				Vector3 normalized = ((Vector3)(ref val6)).normalized;
				normalized.z = 0f;
				bullet.transform.position = val5;
				bullet.transform.rotation = Quaternion.LookRotation(normalized, Vector3.forward);
				ProjectileHit component = bullet.GetComponent<ProjectileHit>();
				if ((Object)(object)component != (Object)null)
				{
					component.damage *= 1.35f;
				}
				RayCastTrail[] componentsInChildren = bullet.GetComponentsInChildren<RayCastTrail>(true);
				for (int j = 0; j < componentsInChildren.Length; j++)
				{
					componentsInChildren[j].MoveRay();
				}
				BackstabBulletTracker backstabBulletTracker = bullet.AddComponent<BackstabBulletTracker>();
				backstabBulletTracker.Target = val2;
				backstabBulletTracker.SpawnPos = val5;
				backstabBulletTracker.AttackDir = normalized;
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)_gun != (Object)null && _onShootProjectile != null)
			{
				_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(_gun.ShootPojectileAction, _onShootProjectile);
			}
		}
	}
	public class BackstabBulletTracker : MonoBehaviour
	{
		public Player Target;

		public Vector3 SpawnPos;

		public Vector3 AttackDir;

		private void Start()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Target != (Object)null && (Object)(object)Target.data != (Object)null && !Target.data.dead)
			{
				Vector3 val = ((Component)Target).transform.position - SpawnPos;
				val.z = 0f;
				if (((Vector3)(ref val)).sqrMagnitude > 0.001f)
				{
					AttackDir = ((Vector3)(ref val)).normalized;
				}
			}
			((Component)this).transform.position = SpawnPos;
			((Component)this).transform.rotation = Quaternion.LookRotation(AttackDir, Vector3.forward);
			MoveTransform component = ((Component)this).GetComponent<MoveTransform>();
			if ((Object)(object)component != (Object)null)
			{
				float num = ((Vector3)(ref component.velocity)).magnitude;
				if (num < 5f)
				{
					num = ((Vector3)(ref component.localForce)).magnitude;
				}
				if (num < 5f)
				{
					num = 25f;
				}
				component.velocity = AttackDir * num;
			}
			RayCastTrail[] componentsInChildren = ((Component)this).GetComponentsInChildren<RayCastTrail>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].MoveRay();
			}
		}
	}
	public class BerserkersGambitEffect : MonoBehaviour
	{
		public int Stacks = 1;

		private Player _player;

		private Gun _gun;

		private Action<GameObject> _onShootProjectile;

		private void Start()
		{
			_player = ((Component)this).GetComponent<Player>();
			if ((Object)(object)_player != (Object)null && (Object)(object)_player.data != (Object)null && (Object)(object)_player.data.weaponHandler != (Object)null)
			{
				_gun = _player.data.weaponHandler.gun;
				if ((Object)(object)_gun != (Object)null)
				{
					_onShootProjectile = OnShootProjectile;
					_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(_gun.ShootPojectileAction, _onShootProjectile);
				}
			}
		}

		private float GetMissingHealthRatio()
		{
			if ((Object)(object)_player == (Object)null || (Object)(object)_player.data == (Object)null || _player.data.maxHealth <= 0.01f)
			{
				return 0f;
			}
			return Mathf.Clamp01(1f - _player.data.health / _player.data.maxHealth);
		}

		private void Update()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_player == (Object)null || (Object)(object)_player.data == (Object)null || _player.data.dead)
			{
				return;
			}
			float missingHealthRatio = GetMissingHealthRatio();
			if (!(missingHealthRatio <= 0.02f))
			{
				if ((Object)(object)_gun != (Object)null)
				{
					Gun gun = _gun;
					((Weapon)gun).sinceAttack = ((Weapon)gun).sinceAttack + Time.deltaTime * missingHealthRatio * 1f * (float)Stacks;
				}
				Vector3 direction = _player.data.input.direction;
				if (Mathf.Abs(direction.x) > 0.1f)
				{
					Vector2 val = default(Vector2);
					((Vector2)(ref val))..ctor(Mathf.Sign(direction.x) * 320f * missingHealthRatio * (float)Stacks * Time.deltaTime, 0f);
					_player.data.healthHandler.TakeForce(val, (ForceMode2D)0, true, true, 0f);
				}
			}
		}

		private void OnShootProjectile(GameObject bullet)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)bullet == (Object)null)
			{
				return;
			}
			float missingHealthRatio = GetMissingHealthRatio();
			if (!(missingHealthRatio <= 0.02f))
			{
				float num = 1f + 0.65f * missingHealthRatio * (float)Stacks;
				ProjectileHit component = bullet.GetComponent<ProjectileHit>();
				if ((Object)(object)component != (Object)null)
				{
					component.damage *= num;
				}
				MoveTransform component2 = bullet.GetComponent<MoveTransform>();
				if ((Object)(object)component2 != (Object)null)
				{
					float num2 = 1f + 0.4f * missingHealthRatio * (float)Stacks;
					component2.localForce *= num2;
					component2.velocity *= num2;
				}
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)_gun != (Object)null && _onShootProjectile != null)
			{
				_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(_gun.ShootPojectileAction, _onShootProjectile);
			}
		}
	}
	public class EchoChamberEffect : MonoBehaviour
	{
		public int Stacks = 1;

		private Player _player;

		private Gun _gun;

		private bool _isEchoFiring;

		private Action _onAttackAction;

		private void Start()
		{
			_player = ((Component)this).GetComponent<Player>();
			if ((Object)(object)_player != (Object)null && (Object)(object)_player.data != (Object)null && (Object)(object)_player.data.weaponHandler != (Object)null)
			{
				_gun = _player.data.weaponHandler.gun;
				if ((Object)(object)_gun != (Object)null)
				{
					_onAttackAction = OnAttack;
					_gun.AddAttackAction(_onAttackAction);
				}
			}
		}

		private void OnAttack()
		{
			if (!_isEchoFiring && !((Object)(object)_player == (Object)null) && !((Object)(object)_player.data == (Object)null) && !_player.data.dead)
			{
				((MonoBehaviour)this).StartCoroutine(FireEchoRoutine(Stacks));
			}
		}

		private IEnumerator FireEchoRoutine(int count)
		{
			for (int i = 0; i < count; i++)
			{
				yield return (object)new WaitForSeconds(0.25f);
				if ((Object)(object)_player == (Object)null || (Object)(object)_player.data == (Object)null || _player.data.dead || (Object)(object)_gun == (Object)null)
				{
					break;
				}
				_isEchoFiring = true;
				try
				{
					((Weapon)_gun).Attack(0f, true, 0.5f, 0.2f, false);
				}
				finally
				{
					_isEchoFiring = false;
				}
			}
		}
	}
	public class GravityTetherEffect : MonoBehaviour
	{
		public int Stacks = 1;

		private Player _player;

		private Gun _gun;

		private Action<GameObject> _onShootProjectile;

		private void Start()
		{
			_player = ((Component)this).GetComponent<Player>();
			if ((Object)(object)_player != (Object)null && (Object)(object)_player.data != (Object)null && (Object)(object)_player.data.weaponHandler != (Object)null)
			{
				_gun = _player.data.weaponHandler.gun;
				if ((Object)(object)_gun != (Object)null)
				{
					_onShootProjectile = OnShootProjectile;
					_gun.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(_gun.ShootPojectileAction, _onShootProjectile);
				}
			}
		}

		private void OnShootProjectile(GameObject bullet)
		{
			if ((Object)(object)bullet == (Object)null)
			{
				return;
			}
			ProjectileHit component = bullet.GetComponent<ProjectileHit>();
			if ((Object)(object)component != (Object)null)
			{
				int currentStacks = Stacks;
				component.AddHitActionWithData((Action<HitInfo>)delegate(HitInfo hit)
				{
					OnBulletHit(hit,