Decompiled source of HoleBuffs v0.10.0

HoleBuffs.dll

Decompiled 6 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
using Steamworks;
using Steamworks.Data;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HoleBuffs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HoleBuffs")]
[assembly: AssemblyTitle("HoleBuffs")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 HoleBuffs
{
	public enum StackMode
	{
		Additive,
		Compounding,
		Flat
	}
	public enum CardTier
	{
		Common,
		Uncommon,
		Legendary,
		Combo
	}
	public class ClassDef
	{
		public string Id;

		public string Name;

		public string Theme;

		public string Playstyle;

		public string ColorHex;

		public string Icon;

		public ItemType[] Items = (ItemType[])(object)new ItemType[0];

		public Color Color
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				Color val = default(Color);
				return ColorUtility.TryParseHtmlString(ColorHex, ref val) ? val : Color.gray;
			}
		}
	}
	public class BuffDef
	{
		public string Id;

		public string Name;

		public string Description;

		public float PerStack;

		public StackMode Mode = StackMode.Additive;

		public int MaxStacks = 0;

		public string Icon;

		public ItemType Item = (ItemType)0;

		public string Badge;

		public Func<int, string> Value;

		public string StackText;

		public string Class;

		public string Class2;

		public CardTier Tier = CardTier.Common;

		public bool Experimental;

		public string Needs;

		public string ItemGroup;

		public ClassDef ClassInfo => Buffs.GetClass(Class);

		public Color Color => ClassInfo?.Color ?? Color.gray;

		public bool IsCombo => Tier == CardTier.Combo;

		public bool InClass(string cls)
		{
			return Class == cls || Class2 == cls;
		}
	}
	public static class Buffs
	{
		public static readonly ItemType[] StartingItems;

		public static readonly (string id, string name, ItemType item)[] ItemGroups;

		public static readonly List<ClassDef> Classes;

		private const CardTier Co = CardTier.Common;

		private const CardTier Un = CardTier.Uncommon;

		private const CardTier Le = CardTier.Legendary;

		private const StackMode SAdd = StackMode.Additive;

		private const StackMode SCmp = StackMode.Compounding;

		private const StackMode SFlat = StackMode.Flat;

		private const string Host = "host";

		private const string Everyone = "everyone";

		public static readonly List<BuffDef> Pool;

		private static readonly Dictionary<string, int> stacks;

		public static readonly List<string> MyClasses;

		private static string Pct(float x)
		{
			return $"{x * 100f:0}%";
		}

		private static string Comp(float per, int n)
		{
			return Pct((float)Math.Pow(1f - per, n));
		}

		public static string GroupName(string group)
		{
			return ItemGroups.FirstOrDefault(((string id, string name, ItemType item) g) => g.id == group).name ?? group;
		}

		public static ClassDef GetClass(string id)
		{
			return Classes.FirstOrDefault((ClassDef c) => c.Id == id);
		}

		private static BuffDef C(string cls, CardTier tier, string id, string name, string desc, float per, StackMode mode, int max, Func<int, string> value, string stack, string icon = null, ItemType item = (ItemType)0, string badge = null, bool exp = false, string needs = null)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			return new BuffDef
			{
				Class = cls,
				Tier = tier,
				Id = id,
				Name = name,
				Description = desc,
				PerStack = per,
				Mode = mode,
				MaxStacks = max,
				Value = value,
				StackText = stack,
				Icon = icon,
				Item = item,
				Badge = badge,
				Experimental = exp,
				Needs = needs
			};
		}

		private static BuffDef Combo(string a, string b, string id, string name, string desc, float per, int max, Func<int, string> value, string stack, string icon = null, ItemType item = (ItemType)0, string badge = null, bool exp = false, string needs = null)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			BuffDef buffDef = C(a, CardTier.Combo, id, name, desc, per, StackMode.Flat, max, value, stack, icon, item, badge, exp, needs);
			buffDef.Class2 = b;
			return buffDef;
		}

		private static BuffDef I(string group, BuffDef d)
		{
			d.ItemGroup = group;
			return d;
		}

		public static BuffDef OwnedInGroup(string group)
		{
			return (group == null) ? null : Pool.FirstOrDefault((BuffDef b) => b.ItemGroup == group && Stacks(b.Id) > 0);
		}

		public static bool GroupAllows(BuffDef def)
		{
			BuffDef buffDef = OwnedInGroup(def.ItemGroup);
			return buffDef == null || buffDef == def;
		}

		public static BuffDef Get(string id)
		{
			return Pool.FirstOrDefault((BuffDef b) => b.Id == id);
		}

		public static BuffDef ComboFor(string a, string b)
		{
			return Pool.FirstOrDefault((BuffDef d) => d.IsCombo && ((d.Class == a && d.Class2 == b) || (d.Class == b && d.Class2 == a)));
		}

		public static int Stacks(string id)
		{
			int value;
			return stacks.TryGetValue(id, out value) ? value : 0;
		}

		public static bool Has(string id)
		{
			return Stacks(id) > 0;
		}

		public static float MultFor(string id, int n)
		{
			BuffDef buffDef = Get(id);
			if (buffDef == null)
			{
				return (n > 0) ? 1f : 1f;
			}
			return buffDef.Mode switch
			{
				StackMode.Compounding => (float)Math.Pow(1f - buffDef.PerStack, n), 
				StackMode.Flat => buffDef.PerStack * (float)n, 
				_ => 1f + buffDef.PerStack * (float)n, 
			};
		}

		public static float Mult(string id)
		{
			return MultFor(id, Stacks(id));
		}

		public static void AddClass(string cls)
		{
			if (cls != null && !MyClasses.Contains(cls))
			{
				MyClasses.Add(cls);
				Plugin.Log.LogInfo((object)("[HoleBuffs] Joined class " + GetClass(cls)?.Name + ". Classes: " + string.Join(", ", MyClasses)));
				BuffSync.PublishLocal();
			}
		}

		public static void Add(BuffDef def, int power = 1)
		{
			int num = GainFor(def, power);
			stacks[def.Id] = Stacks(def.Id) + num;
			Plugin.Log.LogInfo((object)$"[HoleBuffs] Picked {def.Name} (+{num}). Now x{Stacks(def.Id)}.");
			BuffSync.PublishLocal();
		}

		public static int GainFor(BuffDef def, int power)
		{
			return (def.MaxStacks > 0) ? Math.Max(1, Math.Min(power, def.MaxStacks - Stacks(def.Id))) : power;
		}

		public static bool CanTakeMore(BuffDef def)
		{
			return def.MaxStacks <= 0 || Stacks(def.Id) < def.MaxStacks;
		}

		public static void Clear()
		{
			stacks.Clear();
			MyClasses.Clear();
			Plugin.Log.LogInfo((object)"[HoleBuffs] Buffs cleared (new course).");
			BuffSync.PublishLocal();
		}

		public static IEnumerable<BuffDef> Owned()
		{
			return Pool.Where((BuffDef b) => Stacks(b.Id) > 0);
		}

		public static string Summary()
		{
			string text = string.Join("  ·  ", from b in Owned()
				select $"{b.Name} x{Stacks(b.Id)}");
			return (text.Length == 0) ? "none yet" : text;
		}

		public static string Serialize()
		{
			return string.Join(",", (from kv in stacks
				where kv.Value > 0
				select kv.Key + ":" + kv.Value).Concat(MyClasses.Select((string c) => "cls_" + c + ":1")));
		}

		public static Dictionary<string, int> Parse(string data)
		{
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			if (string.IsNullOrEmpty(data))
			{
				return dictionary;
			}
			string[] array = data.Split(',');
			foreach (string text in array)
			{
				string[] array2 = text.Split(':');
				if (array2.Length == 2 && int.TryParse(array2[1], out var result))
				{
					dictionary[array2[0]] = result;
				}
			}
			return dictionary;
		}

		static Buffs()
		{
			ItemType[] array = new ItemType[4];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			StartingItems = (ItemType[])(object)array;
			ItemGroups = new(string, string, ItemType)[4]
			{
				("pistol", "Pistol", (ItemType)2),
				("coffee", "Coffee", (ItemType)1),
				("shield", "Shield", (ItemType)9),
				("boots", "Spring Boots", (ItemType)5)
			};
			List<ClassDef> list = new List<ClassDef>();
			ClassDef classDef = new ClassDef
			{
				Id = "storm",
				Name = "Storm Front",
				Icon = "cls_storm",
				ColorHex = "#3B7DD8",
				Theme = "Weather magic",
				Playstyle = "Call down lightning, ride the wind, wear the shield."
			};
			ClassDef classDef2 = classDef;
			ItemType[] array2 = new ItemType[3];
			RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			classDef2.Items = (ItemType[])(object)array2;
			list.Add(classDef);
			classDef = new ClassDef
			{
				Id = "demo",
				Name = "Demolition",
				Icon = "cls_demo",
				ColorHex = "#D9552B",
				Theme = "Bomb squad",
				Playstyle = "Bigger, smarter, cheaper rockets and mines."
			};
			ClassDef classDef3 = classDef;
			ItemType[] array3 = new ItemType[3];
			RuntimeHelpers.InitializeArray(array3, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			classDef3.Items = (ItemType[])(object)array3;
			list.Add(classDef);
			classDef = new ClassDef
			{
				Id = "phantom",
				Name = "Phantom",
				Icon = "cls_phantom",
				ColorHex = "#7E57C2",
				Theme = "Stage magician",
				Playstyle = "Vanish, steal, and snipe from the smoke."
			};
			ClassDef classDef4 = classDef;
			ItemType[] array4 = new ItemType[3];
			RuntimeHelpers.InitializeArray(array4, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			classDef4.Items = (ItemType[])(object)array4;
			list.Add(classDef);
			classDef = new ClassDef
			{
				Id = "gear",
				Name = "Gearhead",
				Icon = "cls_gear",
				ColorHex = "#E0A21B",
				Theme = "Stunt driver",
				Playstyle = "Faster carts, bigger jumps, and the road as a weapon."
			};
			ClassDef classDef5 = classDef;
			ItemType[] array5 = new ItemType[3];
			RuntimeHelpers.InitializeArray(array5, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			classDef5.Items = (ItemType[])(object)array5;
			list.Add(classDef);
			classDef = new ClassDef
			{
				Id = "appetite",
				Name = "Big Appetite",
				Icon = "cls_appetite",
				ColorHex = "#4FA34A",
				Theme = "Competitive eater",
				Playstyle = "Hard to knock out, huge in giant form, hunts big game."
			};
			ClassDef classDef6 = classDef;
			ItemType[] array6 = new ItemType[3];
			RuntimeHelpers.InitializeArray(array6, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			classDef6.Items = (ItemType[])(object)array6;
			list.Add(classDef);
			Classes = list;
			Pool = new List<BuffDef>
			{
				C("storm", CardTier.Common, "s_tailwind", "Tailwind", "Wind pushes your ball less.", 0.2f, StackMode.Compounding, 3, (int n) => "Wind on your ball: " + Comp(0.2f, n), "Each extra pick takes 20% off what's left", "wind", (ItemType)0, null, exp: true, "host"),
				C("storm", CardTier.Common, "s_rubber", "Rubber Soles", "Lightning, railgun and orbital laser hits knock you back less.", 0.25f, StackMode.Compounding, 2, (int n) => Comp(0.25f, n) + " lightning knockback", "Each extra pick takes 25% off what's left", null, (ItemType)16, "shield"),
				C("storm", CardTier.Common, "s_forecast", "Long Forecast", "Your Thunderstorms last longer.", 0.25f, StackMode.Additive, 2, (int n) => $"Storms last +{25 * n}%", "+25% more per extra pick", null, (ItemType)15, "clock", exp: true, "host"),
				I("shield", C("storm", CardTier.Common, "s_capacitor", "Capacitor", "Your Electromagnet shield lasts longer.", 0.3f, StackMode.Additive, 3, (int n) => $"Shield lasts +{30 * n}%", "+30% more per extra pick", null, (ItemType)9, "clock")),
				I("boots", C("storm", CardTier.Common, "s_updraft", "Updraft", "Spring Boots jumps float at the top for longer.", 0.35f, StackMode.Compounding, 2, (int n) => "Gravity at the peak: " + Comp(0.35f, n), "Each extra pick floats you longer", null, (ItemType)5, "wind")),
				I("pistol", C("storm", CardTier.Uncommon, "s_caller", "Storm Caller", "Pistol hits can turn into a lightning strike.", 0.35f, StackMode.Flat, 2, (int n) => $"{Math.Min(70, 35 * n)}% of pistol hits become lightning", "+35% more per extra pick (max 70%)", null, (ItemType)2, "bolt", exp: false, "host")),
				I("coffee", C("storm", CardTier.Uncommon, "s_ionbrew", "Ion Brew", "Drinking Coffee wraps you in an Electromagnet shield.", 1f, StackMode.Flat, 3, (int n) => $"{1 + n}s shield per Coffee", "+1s more per extra pick", null, (ItemType)1, "shield", exp: true)),
				C("storm", CardTier.Uncommon, "s_conductor", "Conductor", "Whoever knocks you out gets struck by lightning. Once every 30s.", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", "qcharge", (ItemType)0, null, exp: false, "host"),
				C("storm", CardTier.Uncommon, "s_voltage", "High Voltage", "Your Railgun and Orbital Laser hits knock players farther.", 0.3f, StackMode.Additive, 2, (int n) => $"+{30 * n}% railgun and laser knockback", "+30% more per extra pick", null, (ItemType)16, "boom", exp: false, "everyone"),
				C("storm", CardTier.Legendary, "s_chain", "Chain Lightning", "Your direct lightning hits arc to the nearest other player within 10m.", 1f, StackMode.Flat, 1, (int n) => "Active", "Legendary · one-time", "chain", (ItemType)0, null, exp: false, "host"),
				C("storm", CardTier.Legendary, "s_eye", "Eye of the Storm", "20s into every hole, a storm cloud forms over the course leader (never you).", 1f, StackMode.Flat, 1, (int n) => "Active", "Legendary · one-time", "eye", (ItemType)0, null, exp: false, "host"),
				C("demo", CardTier.Common, "d_boom", "Bigger Boom", "Your rocket and landmine blasts are wider.", 0.15f, StackMode.Additive, 3, (int n) => $"Blast radius +{15 * n}%", "+15% more per extra pick", null, (ItemType)7, "wide", exp: false, "host"),
				C("demo", CardTier.Common, "d_pads", "Blast Pads", "Explosions knock you back less, including your own back blast.", 0.25f, StackMode.Compounding, 2, (int n) => Comp(0.25f, n) + " explosion knockback", "Each extra pick takes 25% off what's left", null, (ItemType)8, "shield"),
				C("demo", CardTier.Common, "d_trigger", "Hair Trigger", "Your landmines arm faster.", 0.3f, StackMode.Compounding, 2, (int n) => "Mines arm in " + Comp(0.3f, n) + " of the time", "Each extra pick takes 30% off what's left", null, (ItemType)8, "clock", exp: false, "host"),
				C("demo", CardTier.Common, "d_smart", "Smart Rockets", "Your rockets turn sharper while homing.", 0.25f, StackMode.Additive, 3, (int n) => $"Rockets turn +{25 * n}%", "+25% more per extra pick", null, (ItemType)7, "up", exp: false, "host"),
				I("pistol", C("demo", CardTier.Common, "d_rounds", "Explosive Rounds", "Your pistol hits knock players farther.", 0.3f, StackMode.Additive, 3, (int n) => $"+{30 * n}% pistol knockback", "+30% more per extra pick", null, (ItemType)2, "boom", exp: false, "everyone")),
				I("boots", C("demo", CardTier.Common, "d_blastoff", "Blast Off", "Spring Boots launch you farther forward.", 0.25f, StackMode.Additive, 2, (int n) => $"+{25 * n}% Spring Boots distance", "+25% more per extra pick", null, (ItemType)5, "speed")),
				C("demo", CardTier.Uncommon, "d_rocketjump", "Rocket Jump", "Your own back blast launches you into the air instead of knocking you out.", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", null, (ItemType)7, "jump"),
				C("demo", CardTier.Uncommon, "d_spare", "Spare Parts", "Rockets, Landmines and Freeze Bombs are sometimes not used up.", 0.3f, StackMode.Flat, 2, (int n) => $"{Math.Min(70, 30 * n)}% chance to keep the use", "+30% more per extra pick (max 70%)", null, (ItemType)8, "recycle", exp: false, "host"),
				C("demo", CardTier.Uncommon, "d_shrapnel", "Shrapnel", "Your rockets and landmines knock players farther.", 0.25f, StackMode.Additive, 2, (int n) => $"+{25 * n}% explosion knockback dealt", "+25% more per extra pick", null, (ItemType)7, "boom", exp: false, "everyone"),
				I("shield", C("demo", CardTier.Uncommon, "d_reactive", "Reactive Armor", "Your shield's explosion is much bigger.", 0.4f, StackMode.Additive, 2, (int n) => $"Shield explosion +{40 * n}%", "+40% more per extra pick", null, (ItemType)9, "boom")),
				I("coffee", C("demo", CardTier.Uncommon, "d_blastbrew", "Blast Brew", "While your Coffee boost lasts, explosions knock you back much less.", 0.5f, StackMode.Compounding, 2, (int n) => Comp(0.5f, n) + " explosion knockback while boosted", "Each extra pick halves it again", null, (ItemType)1, "shield")),
				C("demo", CardTier.Legendary, "d_deadman", "Dead Man's Switch", "When you're knocked out, you drop an armed landmine. Once every 20s.", 1f, StackMode.Flat, 1, (int n) => "Active", "Legendary · one-time", null, (ItemType)8, "star", exp: false, "host"),
				C("demo", CardTier.Legendary, "d_depot", "Ordnance Depot", "Item boxes give you a Rocket Launcher or Landmine 40% of the time.", 1f, StackMode.Flat, 1, (int n) => "Active", "Legendary · one-time", null, (ItemType)7, "magnet", exp: false, "host"),
				C("phantom", CardTier.Common, "p_feet", "Light Feet", "Move faster.", 0.06f, StackMode.Additive, 4, (int n) => $"+{6 * n}% move speed", "+6% more per extra pick", "speed", (ItemType)0),
				C("phantom", CardTier.Common, "p_slip", "Slipstream", "The Smoke Bomb's speed boost is stronger.", 0.2f, StackMode.Additive, 2, (int n) => $"Smoke speed boost +{20 * n}%", "+20% more per extra pick", null, (ItemType)13, "up"),
				C("phantom", CardTier.Common, "p_lens", "Wide Lens", "Your Flash Camera reaches farther and wider.", 0.2f, StackMode.Additive, 2, (int n) => $"Flash reach +{20 * n}%", "+20% more per extra pick", null, (ItemType)14, "wide", exp: false, "host"),
				C("phantom", CardTier.Common, "p_deadeye", "Deadeye", "Your Elephant Gun is more accurate.", 0.35f, StackMode.Compounding, 2, (int n) => "Spread: " + Comp(0.35f, n), "Each extra pick takes 35% off what's left", null, (ItemType)3, "eye"),
				I("coffee", C("phantom", CardTier.Common, "p_darkroast", "Dark Roast", "Drinking Coffee makes you invisible for a moment.", 1f, StackMode.Flat, 3, (int n) => $"{1 + n}s invisible per Coffee", "+1s more per extra pick", null, (ItemType)1, "ghost", exp: true)),
				I("pistol", C("phantom", CardTier.Uncommon, "p_silencer", "Silencer", "Firing a gun no longer breaks your smoke invisibility.", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", null, (ItemType)2, "ghost")),
				C("phantom", CardTier.Uncommon, "p_vanish", "Vanishing Act", "You're invisible for 2s after getting up from a knockout.", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", "ghost", (ItemType)0, null, exp: true),
				C("phantom", CardTier.Uncommon, "p_pickpocket", "Pickpocket", "Diving into a player steals a random item from them. Once per player per hole.", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", "hand", (ItemType)0, null, exp: false, "host"),
				I("shield", C("phantom", CardTier.Uncommon, "p_cloak", "Cloaking Field", "While your Electromagnet shield is up, you're invisible too.", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", null, (ItemType)9, "ghost", exp: true)),
				I("boots", C("phantom", CardTier.Uncommon, "p_shadowstep", "Shadow Step", "Spring Boots jumps make you invisible for a moment.", 1f, StackMode.Flat, 3, (int n) => $"{1 + n}s invisible per jump", "+1s more per extra pick", null, (ItemType)5, "ghost", exp: true)),
				C("phantom", CardTier.Legendary, "p_mirrors", "Smoke & Mirrors", "While invisible, the first hit against you misses.", 1f, StackMode.Flat, 1, (int n) => "Active", "Legendary · one-time", null, (ItemType)13, "shield", exp: true),
				C("phantom", CardTier.Legendary, "p_sleight", "Sleight of Hand", "Any item you use has a 35% chance not to be used up.", 1f, StackMode.Flat, 1, (int n) => "Active", "Legendary · one-time", "hand", (ItemType)0, null, exp: false, "host"),
				C("gear", CardTier.Common, "g_turbo", "Turbo", "Golf carts you drive go faster.", 0.12f, StackMode.Additive, 3, (int n) => $"+{12 * n}% cart top speed", "+12% more per extra pick", "cart", (ItemType)0),
				C("gear", CardTier.Common, "g_grip", "Grip Tires", "Golf carts you drive steer sharper.", 0.15f, StackMode.Additive, 2, (int n) => $"+{15 * n}% steering", "+15% more per extra pick", "steer", (ItemType)0),
				C("gear", CardTier.Common, "g_crumple", "Crumple Zone", "Carts and traffic knock you back less.", 0.25f, StackMode.Compounding, 2, (int n) => Comp(0.25f, n) + " vehicle knockback", "Each extra pick takes 25% off what's left", null, (ItemType)6, "shield"),
				C("gear", CardTier.Common, "g_horn", "Foghorn", "Your Airhorn reaches farther.", 0.25f, StackMode.Additive, 2, (int n) => $"Airhorn reach +{25 * n}%", "+25% more per extra pick", null, (ItemType)4, "wide"),
				I("boots", C("gear", CardTier.Common, "g_coils", "Spring Coils", "Spring Boots jump higher.", 0.2f, StackMode.Additive, 3, (int n) => $"+{20 * n}% Spring Boots height", "+20% more per extra pick", null, (ItemType)5, "up")),
				I("pistol", C("gear", CardTier.Common, "g_recoil", "Recoil", "Firing the pistol kicks you backward. Use it to dodge or fly.", 1f, StackMode.Flat, 2, (int n) => (n > 1) ? "Big kick" : "Kick", "Extra pick: a bigger kick", null, (ItemType)2, "speed")),
				C("gear", CardTier.Uncommon, "g_nitro", "Nitro", "Honking gives your cart a 2s speed boost. 10s cooldown.", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", null, (ItemType)6, "speed"),
				C("gear", CardTier.Uncommon, "g_bumper", "Bumper Car", "Players you run over fly farther.", 0.4f, StackMode.Additive, 2, (int n) => $"+{40 * n}% run-over knockback", "+40% more per extra pick", null, (ItemType)6, "boom", exp: false, "everyone"),
				C("gear", CardTier.Uncommon, "g_stunt", "Stunt Driver", "Golf cart jumps go higher.", 0.3f, StackMode.Additive, 2, (int n) => $"+{30 * n}% cart jump height", "+30% more per extra pick", "ramp", (ItemType)0),
				C("gear", CardTier.Uncommon, "g_afterburner", "Afterburner", "Your Rocket Driver swings hit harder.", 0.2f, StackMode.Additive, 2, (int n) => $"+{20 * n}% Rocket Driver power", "+20% more per extra pick", null, (ItemType)11, "up"),
				I("coffee", C("gear", CardTier.Uncommon, "g_octane", "High Octane", "While your Coffee boost lasts, carts you drive go even faster.", 0.15f, StackMode.Additive, 2, (int n) => $"+{15 * n}% cart speed while boosted", "+15% more per extra pick", null, (ItemType)1, "cart")),
				I("shield", C("gear", CardTier.Uncommon, "g_ram", "Force Field Bumper", "While your shield is up, players you run over fly 50% farther.", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", null, (ItemType)9, "cart", exp: false, "everyone")),
				C("gear", CardTier.Legendary, "g_roadrage", "Road Rage", "Traffic can't knock you out and barely moves you.", 1f, StackMode.Flat, 1, (int n) => "Active", "Legendary · one-time", "roadwar", (ItemType)0),
				C("gear", CardTier.Legendary, "g_getaway", "Getaway Driver", "Bailing out of a moving cart launches you 50% farther, then gives a 3s speed boost.", 1f, StackMode.Flat, 1, (int n) => "Active", "Legendary · one-time", "dive", (ItemType)0),
				I("coffee", C("appetite", CardTier.Common, "a_double", "Double Shot", "Coffee speed boosts last longer.", 0.25f, StackMode.Additive, 3, (int n) => $"Coffee lasts +{25 * n}%", "+25% more per extra pick", null, (ItemType)1, "clock")),
				C("appetite", CardTier.Common, "a_stomach", "Iron Stomach", "Knockouts end sooner.", 0.3f, StackMode.Flat, 3, (int n) => $"Knockouts {0.3f * (float)n:0.0}s shorter", "-0.3s more per extra pick", "quick", (ItemType)0),
				C("appetite", CardTier.Common, "a_skin", "Thick Skin", "Every hit knocks you back a little less.", 0.08f, StackMode.Compounding, 3, (int n) => Comp(0.08f, n) + " knockback taken", "Each extra pick takes 8% off what's left", "tough", (ItemType)0),
				C("appetite", CardTier.Common, "a_windup", "Wind-Up", "Every swing hits harder.", 0.05f, StackMode.Additive, 3, (int n) => $"+{5 * n}% swing power", "+5% more per extra pick", "power", (ItemType)0),
				I("pistol", C("appetite", CardTier.Common, "a_sugar", "Sugar Rush", "Every pistol hit on a player gives you a speed boost.", 1f, StackMode.Flat, 3, (int n) => $"{1 + n}s boost per hit", "+1s more per extra pick", null, (ItemType)2, "speed")),
				C("appetite", CardTier.Uncommon, "a_doggy", "Doggy Bag", "Coffee and Jumbo Burgers are sometimes not used up.", 0.3f, StackMode.Flat, 2, (int n) => $"{Math.Min(70, 30 * n)}% chance to keep the use", "+30% more per extra pick (max 70%)", null, (ItemType)17, "recycle", exp: false, "host"),
				C("appetite", CardTier.Uncommon, "a_coma", "Food Coma", "When giant form ends, you can't be knocked out for 3s.", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", null, (ItemType)17, "shield"),
				C("appetite", CardTier.Uncommon, "a_heavy", "Heavyweight", "Your dives knock players farther.", 0.4f, StackMode.Additive, 2, (int n) => $"+{40 * n}% dive knockback", "+40% more per extra pick", "tackle", (ItemType)0, null, exp: false, "everyone"),
				C("appetite", CardTier.Uncommon, "a_biggame", "Big Game Hunter", "Your Elephant Gun hits knock players farther.", 0.3f, StackMode.Additive, 2, (int n) => $"+{30 * n}% Elephant Gun knockback", "+30% more per extra pick", null, (ItemType)3, "boom", exp: false, "everyone"),
				I("shield", C("appetite", CardTier.Uncommon, "a_fortified", "Fortified Shield", "When your shield ends, you can't be knocked out for 2s.", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", null, (ItemType)9, "star")),
				I("boots", C("appetite", CardTier.Uncommon, "a_pound", "Ground Pound", "Landing a Spring Boots jump shoves players around you (never you).", 1f, StackMode.Flat, 1, (int n) => "Active", "One-time card", null, (ItemType)5, "boom")),
				C("appetite", CardTier.Legendary, "a_buffet", "All You Can Eat", "Giant form lasts 50% longer, and your giant dives go 30% farther.", 1f, StackMode.Flat, 1, (int n) => "Active", "Legendary · one-time", null, (ItemType)17, "clock"),
				C("appetite", CardTier.Legendary, "a_breakfast", "Second Breakfast", "Start every hole with a Coffee, and every third hole with a Jumbo Burger.", 1f, StackMode.Flat, 1, (int n) => "Active", "Legendary · one-time", "supply", (ItemType)0, null, exp: false, "host"),
				Combo("storm", "demo", "c_thunderbomb", "Thunder Bomb", "Your rocket explosions also call lightning at the blast.", 1f, 5, (int n) => string.Format("{0} bolt{1} per rocket", n, (n > 1) ? "s" : ""), "+1 bolt per extra pick", null, (ItemType)7, "bolt", exp: false, "host"),
				Combo("storm", "gear", "c_electric", "Electric Car", "Players you run over can get struck by lightning.", 0.25f, 5, (int n) => $"{Math.Min(100, 25 + 25 * n)}% chance per run-over", "+25% more per extra pick", null, (ItemType)6, "bolt", exp: false, "host"),
				Combo("storm", "phantom", "c_flashbolt", "Flash Bolt", "Players you blind with the Flash Camera can get struck by lightning.", 0.35f, 5, (int n) => $"{Math.Min(100, 35 * n)}% chance per blinded player", "+35% more per extra pick", null, (ItemType)14, "bolt", exp: false, "host"),
				Combo("storm", "appetite", "c_rod", "Lightning Rod", "In giant form, lightning, railguns and orbital lasers can't knock you out.", 1f, 5, (int n) => (n > 1) ? $"Immune in giant form, giant form +{n - 1}s" : "Immune in giant form", "Each extra pick: giant form lasts 1s longer", null, (ItemType)17, "bolt"),
				Combo("demo", "phantom", "c_hidden", "Hidden Mines", "Your planted landmines are invisible to other players.", 0.25f, 5, (int n) => (n > 1) ? $"Invisible, and arm {25 * (n - 1)}% faster" : "Invisible mines", "Each extra pick: mines arm 25% faster", null, (ItemType)8, "ghost", exp: true, "everyone"),
				Combo("demo", "gear", "c_crashtest", "Crash Test", "While driving, explosions push you less and give you a 2s speed boost.", 0.3f, 5, (int n) => Comp(0.3f, n) + " explosion knockback in a cart", "Each extra pick takes 30% off what's left", null, (ItemType)6, "shield"),
				Combo("demo", "appetite", "c_bellyflop", "Belly Flop", "Landing a giant-form jump sets off a blast around you (it never hits you).", 0.25f, 5, (int n) => (n > 1) ? $"Blast, +{25 * (n - 1)}% knockback" : "Blast on landing", "Each extra pick: +25% blast knockback", null, (ItemType)17, "boom"),
				Combo("phantom", "gear", "c_ghostrider", "Ghost Rider", "Getting out of a golf cart makes you invisible.", 1f, 5, (int n) => $"{2 + n}s invisible after leaving a cart", "+1s more per extra pick", null, (ItemType)6, "ghost", exp: true),
				Combo("phantom", "appetite", "c_midnight", "Midnight Snack", "Your first Coffee or Jumbo Burger each hole is free.", 1f, 5, (int n) => string.Format("First {0} Coffee/Burger use{1} each hole free", n, (n > 1) ? "s" : ""), "+1 free use per extra pick", null, (ItemType)1, "recycle", exp: false, "host"),
				Combo("gear", "appetite", "c_drivethru", "Drive-Thru", "Getting into a golf cart gives you a speed boost. 15s cooldown.", 1f, 5, (int n) => $"{2 + n}s boost per cart", "+1s more per extra pick", null, (ItemType)6, "coffee")
			};
			stacks = new Dictionary<string, int>();
			MyClasses = new List<string>();
		}
	}
	public static class BuffSync
	{
		private const string Key = "holebuffs";

		private static readonly FieldInfo lobbyField = AccessTools.Field(typeof(BNetworkManager), "steamLobby");

		private static readonly Dictionary<ulong, (string raw, Dictionary<string, int> parsed)> cache = new Dictionary<ulong, (string, Dictionary<string, int>)>();

		private static Lobby? CurrentLobby()
		{
			try
			{
				if (lobbyField == null || !BNetworkManager.IsSteamLobbyValid())
				{
					return null;
				}
				return (Lobby?)lobbyField.GetValue(null);
			}
			catch
			{
				return null;
			}
		}

		public static void PublishLocal()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			Lobby? val = CurrentLobby();
			if (!val.HasValue)
			{
				Plugin.Log.LogInfo((object)"[HoleBuffs] No Steam lobby; buffs stay local only.");
				return;
			}
			Lobby value = val.Value;
			((Lobby)(ref value)).SetMemberData("holebuffs", Buffs.Serialize());
		}

		public static int StacksFor(PlayerInfo player, string buffId)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player == (Object)null)
			{
				return 0;
			}
			if ((Object)(object)player == (Object)(object)GameManager.LocalPlayerInfo)
			{
				return Buffs.Stacks(buffId);
			}
			Lobby? val = CurrentLobby();
			if (!val.HasValue)
			{
				return 0;
			}
			ulong guid = player.PlayerId.Guid;
			Lobby value = val.Value;
			string text = ((Lobby)(ref value)).GetMemberData(new Friend(SteamId.op_Implicit(guid)), "holebuffs") ?? "";
			if (!cache.TryGetValue(guid, out (string, Dictionary<string, int>) value2) || value2.Item1 != text)
			{
				value2 = (text, Buffs.Parse(text));
				cache[guid] = value2;
			}
			int value3;
			return value2.Item2.TryGetValue(buffId, out value3) ? value3 : 0;
		}

		public static float MultFor(PlayerInfo player, string buffId)
		{
			return Buffs.MultFor(buffId, StacksFor(player, buffId));
		}
	}
	internal static class CardOverlay
	{
		public static void Init(ConfigFile config)
		{
			Ui.Init(config);
		}

		private static int Px(float v)
		{
			return Ui.Px(v);
		}

		public static void DrawHud()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			Ui.Ensure();
			string text = "Buffs: " + Buffs.Summary();
			string text2 = Offers.ClassSummary();
			if (text2 != null)
			{
				text = "Classes: " + text2 + "     " + text;
			}
			GUIStyle val = Ui.Style(18, (FontStyle)1, Ui.Ink, (TextAnchor)3, wrap: false);
			Vector2 val2 = val.CalcSize(new GUIContent(text));
			Rect r = default(Rect);
			((Rect)(ref r))..ctor((float)Px(16f), (float)Px(14f), Mathf.Min(val2.x + (float)Px(28f), (float)(Screen.width - Px(32f))), val2.y + (float)Px(12f));
			Ui.Round(r, Ui.RoundPill, new Color(Ui.Panel.r, Ui.Panel.g, Ui.Panel.b, 0.88f));
			GUI.Label(new Rect(((Rect)(ref r)).x + (float)Px(14f), ((Rect)(ref r)).y, ((Rect)(ref r)).width - (float)Px(20f), ((Rect)(ref r)).height), text, val);
		}

		private static Rect Panel(bool legendary)
		{
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			float num = Screen.width;
			float num2 = Screen.height;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(num * 0.1f, num2 * 0.1f, num * 0.8f, num2 * 0.8f);
			if (legendary)
			{
				Ui.Round(new Rect(((Rect)(ref val)).x - (float)Px(14f), ((Rect)(ref val)).y - (float)Px(14f), ((Rect)(ref val)).width + (float)Px(28f), ((Rect)(ref val)).height + (float)Px(28f)), Ui.RoundPanel, new Color(Ui.LegendaryColor.r, Ui.LegendaryColor.g, Ui.LegendaryColor.b, 0.55f));
				Ui.Round(new Rect(((Rect)(ref val)).x - (float)Px(6f), ((Rect)(ref val)).y - (float)Px(6f), ((Rect)(ref val)).width + (float)Px(12f), ((Rect)(ref val)).height + (float)Px(12f)), Ui.RoundPanel, Ui.LegendaryColor);
				Ui.Round(val, Ui.RoundPanel, Color.Lerp(Ui.Panel, new Color(1f, 0.93f, 0.7f), 0.45f));
			}
			else
			{
				Ui.PanelBox(val);
			}
			return val;
		}

		public static int Draw(Offer offer, int selected, int picksLeft, out int hovered, out bool rerollClicked)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: 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_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: 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_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			hovered = -1;
			rerollClicked = false;
			Ui.Ensure();
			RuleSet active = Settings.Active;
			List<BuffDef> cards = offer.Cards;
			bool flag = offer.Kind == OfferKind.Legendary;
			Ui.Dim(flag ? 0.6f : 0.45f);
			Rect val = Panel(flag);
			float y = ((Rect)(ref val)).y + ((Rect)(ref val)).height * 0.035f;
			Rect area = default(Rect);
			((Rect)(ref area))..ctor(((Rect)(ref val)).x + (float)Px(40f), y, ((Rect)(ref val)).width - (float)Px(80f), 0f);
			string text;
			string text2;
			if (flag)
			{
				text = "LEGENDARY PICK";
				text2 = "Only Legendary cards this round. You keep it for the rest of the course, so choose carefully.";
			}
			else if (offer.Kind == OfferKind.Starter)
			{
				text = "Your first card";
				text2 = "Pick a Common card from " + Buffs.GetClass(offer.StarterClass)?.Name + ".";
			}
			else
			{
				text = ((picksLeft > 1) ? $"Hole {offer.HoleNumber} complete! Choose {picksLeft} buffs" : $"Hole {offer.HoleNumber} complete! Choose a buff");
				string text3 = Offers.ClassSummary();
				text2 = ((text3 != null) ? ("Your classes:  " + text3) : $"Press 1-{cards.Count}  ·  ← → and Enter  ·  or click a card");
				if (offer.ComboRound)
				{
					text2 = "COMBO ROUND: everyone gets a combo card this time.   " + text2;
				}
			}
			if (active.CardPower > 1)
			{
				text2 += $"   ·   Each card gives {active.CardPower} levels";
			}
			Ui.Text(area, ref y, text, Ui.Style(flag ? 50 : 46, (FontStyle)1, flag ? Color.Lerp(Ui.LegendaryColor, Ui.Ink, 0.45f) : Ui.Ink, (TextAnchor)4));
			y += (float)Px(4f);
			Ui.Text(area, ref y, text2, Ui.Style(21, (FontStyle)((offer.ComboRound || flag) ? 1 : 0), offer.ComboRound ? Ui.ComboColor : Ui.Muted, (TextAnchor)4));
			int count = cards.Count;
			float num = ((Rect)(ref val)).width * 0.25f;
			float num2 = ((Rect)(ref val)).width * 0.025f;
			float num3 = Mathf.Min(num, (((Rect)(ref val)).width - (float)(count + 1) * num2) / (float)Mathf.Max(1, count));
			float k = Mathf.Clamp(num3 / num, 0.62f, 1f);
			float num4 = ((Rect)(ref val)).height * 0.66f;
			float num5 = (((Rect)(ref val)).width - (float)count * num3) / (float)(count + 1);
			float num6 = ((Rect)(ref val)).y + ((Rect)(ref val)).height * 0.2f;
			int result = -1;
			Event current = Event.current;
			Rect card = default(Rect);
			for (int i = 0; i < count; i++)
			{
				BuffDef def = cards[i];
				bool flag2 = i == selected;
				((Rect)(ref card))..ctor(((Rect)(ref val)).x + num5 + (float)i * (num3 + num5), num6 - (flag2 ? ((float)Px(12f)) : 0f), num3, num4);
				if (((Rect)(ref card)).Contains(current.mousePosition))
				{
					hovered = i;
					if ((int)current.type == 0 && current.button == 0)
					{
						result = i;
						current.Use();
					}
				}
				DrawCard(card, def, i, flag2, k, active);
			}
			float num7 = ((Rect)(ref val)).yMax - ((Rect)(ref val)).height * 0.085f;
			int rerollsLeft = Offers.RerollsLeft;
			string label = ((active.Rerolls >= 99) ? "Reroll (R)" : $"Reroll (R) · {rerollsLeft} left");
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((Rect)(ref val)).xMax - (float)Px(260f) - (float)Px(40f), num7 - (float)Px(6f), (float)Px(260f), (float)Px(46f));
			if (Ui.Button(r, label, Ui.Ink, Ui.Panel, 20, rerollsLeft > 0))
			{
				rerollClicked = true;
			}
			Rect area2 = default(Rect);
			((Rect)(ref area2))..ctor(((Rect)(ref val)).x + (float)Px(40f), num7 + (float)Px(4f), ((Rect)(ref val)).width - (float)Px(360f), 0f);
			float y2 = ((Rect)(ref area2)).y;
			Ui.Text(area2, ref y2, "Your buffs:  " + Buffs.Summary(), Ui.Style(20, (FontStyle)0, Ui.Muted, (TextAnchor)0));
			return result;
		}

		private static void DrawCard(Rect card, BuffDef def, int index, bool isSel, float k, RuleSet rules)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: 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_0246: 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)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0682: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0624: Unknown result type (might be due to invalid IL or missing references)
			//IL_065b: Unknown result type (might be due to invalid IL or missing references)
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_070f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0733: Unknown result type (might be due to invalid IL or missing references)
			//IL_0765: Unknown result type (might be due to invalid IL or missing references)
			//IL_0775: Unknown result type (might be due to invalid IL or missing references)
			//IL_0772: Unknown result type (might be due to invalid IL or missing references)
			//IL_0790: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07de: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ace: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0adc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b7b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd2: Unknown result type (might be due to invalid IL or missing references)
			Color color = def.Color;
			Color col = ((!def.IsCombo) ? color : (Buffs.GetClass(def.Class2)?.Color ?? color));
			Color val = Ui.TierColor(def.Tier);
			bool flag = def.Tier == CardTier.Legendary;
			Ui.Round(new Rect(((Rect)(ref card)).x + (float)Px(4f), ((Rect)(ref card)).y + (float)Px(8f), ((Rect)(ref card)).width, ((Rect)(ref card)).height), Ui.RoundCard, new Color(0.25f, 0.18f, 0.1f, isSel ? 0.22f : 0.12f));
			if (flag)
			{
				Ui.Round(new Rect(((Rect)(ref card)).x - (float)Px(8f), ((Rect)(ref card)).y - (float)Px(8f), ((Rect)(ref card)).width + (float)Px(16f), ((Rect)(ref card)).height + (float)Px(16f)), Ui.RoundCard, new Color(Ui.LegendaryColor.r, Ui.LegendaryColor.g, Ui.LegendaryColor.b, isSel ? 0.75f : 0.45f));
			}
			Ui.Round(card, Ui.RoundCard, flag ? Ui.LegendaryColor : color);
			float num = (isSel ? Px(10f) : Px(6f));
			if (def.IsCombo)
			{
				Ui.Round(new Rect(((Rect)(ref card)).x + num * 0.6f, ((Rect)(ref card)).y + num * 0.6f, ((Rect)(ref card)).width - num * 1.2f, ((Rect)(ref card)).height - num * 1.2f), Ui.RoundCard, col);
				num *= 1.2f;
			}
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((Rect)(ref card)).x + num, ((Rect)(ref card)).y + num, ((Rect)(ref card)).width - 2f * num, ((Rect)(ref card)).height - 2f * num);
			Ui.Round(r, Ui.RoundCard, flag ? Color.Lerp(Ui.Card, new Color(1f, 0.92f, 0.62f), 0.35f) : Ui.Card);
			float num2 = Px(18f * k);
			Rect area = default(Rect);
			((Rect)(ref area))..ctor(((Rect)(ref r)).x + num2, ((Rect)(ref r)).y + num2, ((Rect)(ref r)).width - 2f * num2, ((Rect)(ref r)).height - 2f * num2);
			float y = ((Rect)(ref area)).y;
			float num3 = Px(54f * k);
			string label = (def.IsCombo ? (Buffs.GetClass(def.Class)?.Name + " + " + Buffs.GetClass(def.Class2)?.Name) : (def.ClassInfo?.Name ?? ""));
			Rect r2 = default(Rect);
			((Rect)(ref r2))..ctor(((Rect)(ref area)).x, y, ((Rect)(ref area)).width - num3 * 0.75f, (float)Px(30f * k));
			Ui.Tag(r2, label, def.IsCombo ? Ui.ComboColor : color, Color.white, Mathf.RoundToInt(15f * k));
			y = ((Rect)(ref r2)).yMax + (float)Px(12f * k);
			Rect r3 = default(Rect);
			((Rect)(ref r3))..ctor(((Rect)(ref card)).xMax - num3 * 0.8f, ((Rect)(ref card)).y - num3 * 0.2f, num3, num3);
			Ui.TierBadge(r3, def.Tier);
			GUIStyle val2 = Ui.Style(Mathf.RoundToInt(13f * k), (FontStyle)1, Color.Lerp(val, Ui.Ink, 0.3f), (TextAnchor)1, wrap: false);
			GUI.Label(new Rect(((Rect)(ref r3)).center.x - (float)Px(60f), ((Rect)(ref r3)).yMax + (float)Px(4f), (float)Px(120f), (float)Px(20f)), Ui.TierName(def.Tier).ToUpper(), val2);
			float num4 = Mathf.Min(((Rect)(ref area)).width * 0.5f, (float)Px(160f * k));
			Rect r4 = default(Rect);
			((Rect)(ref r4))..ctor(((Rect)(ref area)).center.x - num4 / 2f, y, num4, num4);
			if (flag)
			{
				Ui.Tex(new Rect(((Rect)(ref r4)).x - (float)Px(7f), ((Rect)(ref r4)).y - (float)Px(7f), num4 + (float)Px(14f), num4 + (float)Px(14f)), (Texture)(object)Ui.Circle, Color.Lerp(Ui.LegendaryColor, Color.white, 0.35f));
			}
			if ((int)def.Item != 0 && (Object)(object)Ui.ItemSprite(def.Item) != (Object)null)
			{
				Ui.Tex(r4, (Texture)(object)Ui.Circle, Color.Lerp(color, Color.white, 0.75f));
				Ui.SpriteIn(new Rect(((Rect)(ref r4)).x + num4 * 0.16f, ((Rect)(ref r4)).y + num4 * 0.16f, num4 * 0.68f, num4 * 0.68f), Ui.ItemSprite(def.Item));
				if (def.Badge != null)
				{
					float num5 = num4 * 0.42f;
					Rect r5 = default(Rect);
					((Rect)(ref r5))..ctor(((Rect)(ref r4)).xMax - num5 * 0.85f, ((Rect)(ref r4)).yMax - num5 * 0.85f, num5, num5);
					Ui.Tex(new Rect(((Rect)(ref r5)).x - (float)Px(4f), ((Rect)(ref r5)).y - (float)Px(4f), num5 + (float)Px(8f), num5 + (float)Px(8f)), (Texture)(object)Ui.Circle, Ui.Card);
					Ui.Tex(r5, (Texture)(object)Ui.Circle, color);
					Ui.Tex(new Rect(((Rect)(ref r5)).x + num5 * 0.2f, ((Rect)(ref r5)).y + num5 * 0.2f, num5 * 0.6f, num5 * 0.6f), (Texture)(object)Ui.Icon(def.Badge), Color.white);
				}
			}
			else
			{
				Ui.Tex(r4, (Texture)(object)Ui.Circle, color);
				Ui.Tex(new Rect(((Rect)(ref r4)).x + num4 * 0.17f, ((Rect)(ref r4)).y + num4 * 0.17f, num4 * 0.66f, num4 * 0.66f), (Texture)(object)Ui.Icon(def.Icon ?? def.Badge), Color.white);
			}
			y = ((Rect)(ref r4)).yMax + (float)Px(12f * k);
			Ui.Text(area, ref y, def.Name, Ui.Style(Mathf.RoundToInt(31f * k), (FontStyle)1, Ui.Ink, (TextAnchor)1));
			y += (float)Px(6f);
			Ui.Tex(new Rect(((Rect)(ref area)).center.x - ((Rect)(ref area)).width * 0.2f, y, ((Rect)(ref area)).width * 0.4f, (float)Px(4f)), (Texture)(object)Ui.White, flag ? Ui.LegendaryColor : color);
			y += (float)Px(12f);
			Ui.Text(area, ref y, def.Description, Ui.Style(Mathf.RoundToInt(20f * k), (FontStyle)0, Ui.Ink, (TextAnchor)1));
			float num6 = Px(50f * k);
			float num7 = Px(40f * k);
			Rect val3 = default(Rect);
			((Rect)(ref val3))..ctor(((Rect)(ref r)).center.x - num6 / 2f, ((Rect)(ref r)).yMax - num7 - (float)Px(14f), num6, num7);
			int num8 = Buffs.Stacks(def.Id);
			int num9 = Buffs.GainFor(def, rules.CardPower);
			bool flag2 = def.MaxStacks == 1;
			string text = ((num8 > 0) ? $"You have x{num8}: {def.Value?.Invoke(num8)}" : "You don't have this yet");
			string text2 = ((def.Value != null) ? ("→ " + def.Value(num8 + num9) + ((num9 > 1) ? $"  (+{num9})" : "")) : "");
			string text3 = def.StackText ?? "";
			if (def.ItemGroup != null)
			{
				text3 = text3 + ((text3.Length > 0) ? "  ·  " : "") + "Your only " + Buffs.GroupName(def.ItemGroup) + " card";
			}
			if (def.Experimental)
			{
				text3 = text3 + ((text3.Length > 0) ? "  ·  " : "") + "Experimental";
			}
			if (def.Needs == "host")
			{
				text3 += "  ·  Host needs the mod";
			}
			else if (def.Needs == "everyone")
			{
				text3 += "  ·  Everyone needs the mod";
			}
			GUIStyle st = Ui.Style(Mathf.RoundToInt(18f * k), (FontStyle)0, Ui.Muted, (TextAnchor)1);
			GUIStyle st2 = Ui.Style(Mathf.RoundToInt(21f * k), (FontStyle)1, Color.Lerp(color, Ui.Ink, 0.35f), (TextAnchor)1);
			GUIStyle st3 = Ui.Style(Mathf.RoundToInt(16f * k), (FontStyle)2, Ui.Muted, (TextAnchor)1);
			float num10 = Px(12f * k);
			float num11 = ((Rect)(ref area)).width - 2f * num10;
			bool flag3 = !flag2;
			float num12 = (flag3 ? (Ui.Height(text, st, num11) + (float)Px(4f) + Ui.Height(text2, st2, num11) + (float)Px(6f)) : 0f) + Ui.Height(text3, st3, num11) + 2f * num10;
			float num13 = Mathf.Max(y + (float)Px(10f), ((Rect)(ref val3)).y - (float)Px(14f) - num12);
			Rect r6 = default(Rect);
			((Rect)(ref r6))..ctor(((Rect)(ref area)).x, num13, ((Rect)(ref area)).width, num12);
			Color val4 = (def.IsCombo ? Ui.ComboColor : (flag ? Ui.LegendaryColor : color));
			Ui.Round(r6, Ui.RoundPill, new Color(val4.r, val4.g, val4.b, 0.14f));
			Rect area2 = default(Rect);
			((Rect)(ref area2))..ctor(((Rect)(ref r6)).x + num10, ((Rect)(ref r6)).y + num10, num11, 0f);
			float y2 = ((Rect)(ref area2)).y;
			if (flag3)
			{
				Ui.Text(area2, ref y2, text, st);
				y2 += (float)Px(4f);
				Ui.Text(area2, ref y2, text2, st2);
				y2 += (float)Px(6f);
			}
			if (text3.Length > 0)
			{
				Ui.Text(area2, ref y2, text3, st3);
			}
			Ui.Round(val3, Ui.RoundPill, (!isSel) ? Ui.Ink : (flag ? Ui.LegendaryColor : color));
			if (index < 9)
			{
				GUI.Label(val3, (index + 1).ToString(), Ui.Style(Mathf.RoundToInt(22f * k), (FontStyle)1, Ui.Panel, (TextAnchor)4, wrap: false));
			}
		}

		public static int DrawClassPick(IList<ClassDef> choices, int selected, bool intro, out int hovered)
		{
			//IL_001c: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			hovered = -1;
			Ui.Ensure();
			RuleSet active = Settings.Active;
			Ui.Dim(0.5f);
			Rect val = Panel(legendary: false);
			float y = ((Rect)(ref val)).y + ((Rect)(ref val)).height * 0.035f;
			Rect area = default(Rect);
			((Rect)(ref area))..ctor(((Rect)(ref val)).x + (float)Px(60f), y, ((Rect)(ref val)).width - (float)Px(120f), 0f);
			int num = Buffs.MyClasses.Count + 1;
			string text = (intro ? "Choose your first class" : ((num == 2) ? "Choose your second class" : $"Choose class {num}"));
			Ui.Text(area, ref y, text, Ui.Style(46, (FontStyle)1, Ui.Ink, (TextAnchor)4));
			y += (float)Px(6f);
			if (intro)
			{
				string text2 = string.Format("This course you'll build {0} class{1}. Cards only come from your classes. ", active.ClassCount, (active.ClassCount > 1) ? "es" : "") + "Item boxes give everyone Pistols, Coffee, Shields and Spring Boots. Each class unlocks its own items.";
				string text3 = "You pick a Common card right after this. " + Offers.ScheduleText();
				Ui.Text(area, ref y, text2, Ui.Style(21, (FontStyle)0, Ui.Ink, (TextAnchor)4));
				y += (float)Px(2f);
				Ui.Text(area, ref y, text3, Ui.Style(19, (FontStyle)0, Ui.Muted, (TextAnchor)4));
			}
			else
			{
				Ui.Text(area, ref y, "Your classes:  " + Offers.ClassSummary() + "   ·   You'll pick a card from both right after.", Ui.Style(21, (FontStyle)0, Ui.Muted, (TextAnchor)4));
			}
			int count = choices.Count;
			float num2 = ((Rect)(ref val)).width * 0.36f;
			float num3 = ((Rect)(ref val)).width * 0.03f;
			float num4 = Mathf.Min(num2, (((Rect)(ref val)).width - (float)(count + 1) * num3) / (float)Mathf.Max(1, count));
			float k = Mathf.Clamp(num4 / num2, 0.55f, 1f);
			float num5 = y + (float)Px(26f);
			float num6 = ((Rect)(ref val)).yMax - (float)Px(40f) - num5;
			float num7 = (((Rect)(ref val)).width - (float)count * num4) / (float)(count + 1);
			int result = -1;
			Event current = Event.current;
			Rect card = default(Rect);
			for (int i = 0; i < count; i++)
			{
				ClassDef c = choices[i];
				bool flag = i == selected;
				((Rect)(ref card))..ctor(((Rect)(ref val)).x + num7 + (float)i * (num4 + num7), num5 - (flag ? ((float)Px(10f)) : 0f), num4, num6);
				if (((Rect)(ref card)).Contains(current.mousePosition))
				{
					hovered = i;
					if ((int)current.type == 0 && current.button == 0)
					{
						result = i;
						current.Use();
					}
				}
				DrawClassCard(card, c, i, flag, k);
			}
			return result;
		}

		private static void DrawClassCard(Rect card, ClassDef c, int index, bool isSel, float k)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: 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_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: 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_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_061b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0651: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_0694: Unknown result type (might be due to invalid IL or missing references)
			//IL_068d: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
			Color color = c.Color;
			Ui.Round(new Rect(((Rect)(ref card)).x + (float)Px(4f), ((Rect)(ref card)).y + (float)Px(8f), ((Rect)(ref card)).width, ((Rect)(ref card)).height), Ui.RoundCard, new Color(0.25f, 0.18f, 0.1f, isSel ? 0.22f : 0.12f));
			Ui.Round(card, Ui.RoundCard, color);
			float num = (isSel ? Px(10f) : Px(6f));
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((Rect)(ref card)).x + num, ((Rect)(ref card)).y + num, ((Rect)(ref card)).width - 2f * num, ((Rect)(ref card)).height - 2f * num);
			Ui.Round(r, Ui.RoundCard, Ui.Card);
			Rect area = default(Rect);
			((Rect)(ref area))..ctor(((Rect)(ref r)).x + (float)Px(22f * k), ((Rect)(ref r)).y + (float)Px(20f * k), ((Rect)(ref r)).width - (float)Px(44f * k), ((Rect)(ref r)).height - (float)Px(40f * k));
			float y = ((Rect)(ref area)).y;
			float num2 = Mathf.Min(((Rect)(ref area)).width * 0.34f, (float)Px(150f * k));
			Rect r2 = default(Rect);
			((Rect)(ref r2))..ctor(((Rect)(ref area)).center.x - num2 / 2f, y, num2, num2);
			Ui.Tex(new Rect(((Rect)(ref r2)).x - (float)Px(6f), ((Rect)(ref r2)).y - (float)Px(6f), num2 + (float)Px(12f), num2 + (float)Px(12f)), (Texture)(object)Ui.Circle, Color.Lerp(color, Color.white, 0.55f));
			Ui.Tex(r2, (Texture)(object)Ui.Circle, color);
			Ui.Tex(new Rect(((Rect)(ref r2)).x + num2 * 0.18f, ((Rect)(ref r2)).y + num2 * 0.18f, num2 * 0.64f, num2 * 0.64f), (Texture)(object)Ui.Icon(c.Icon), Color.white);
			y = ((Rect)(ref r2)).yMax + (float)Px(12f);
			Ui.Text(area, ref y, c.Name, Ui.Style(Mathf.RoundToInt(38f * k), (FontStyle)1, Ui.Ink, (TextAnchor)1));
			Ui.Text(area, ref y, c.Theme, Ui.Style(Mathf.RoundToInt(20f * k), (FontStyle)2, Color.Lerp(color, Ui.Ink, 0.3f), (TextAnchor)1));
			y += (float)Px(6f);
			Ui.Tex(new Rect(((Rect)(ref area)).center.x - ((Rect)(ref area)).width * 0.2f, y, ((Rect)(ref area)).width * 0.4f, (float)Px(4f)), (Texture)(object)Ui.White, color);
			y += (float)Px(12f);
			Ui.Text(area, ref y, c.Playstyle, Ui.Style(Mathf.RoundToInt(21f * k), (FontStyle)0, Ui.Ink, (TextAnchor)1));
			y += (float)Px(10f);
			float num3 = Px(46f * k);
			float num4 = (float)c.Items.Length * (num3 + (float)Px(8f)) - (float)Px(8f);
			float num5 = ((Rect)(ref area)).center.x - num4 / 2f;
			ItemType[] items = c.Items;
			Rect r3 = default(Rect);
			foreach (ItemType item in items)
			{
				((Rect)(ref r3))..ctor(num5, y, num3, num3);
				Ui.Tex(r3, (Texture)(object)Ui.Circle, Color.Lerp(color, Color.white, 0.75f));
				Sprite val = Ui.ItemSprite(item);
				if ((Object)(object)val != (Object)null)
				{
					Ui.SpriteIn(new Rect(((Rect)(ref r3)).x + num3 * 0.14f, ((Rect)(ref r3)).y + num3 * 0.14f, num3 * 0.72f, num3 * 0.72f), val);
				}
				num5 += num3 + (float)Px(8f);
			}
			y += num3 + (float)Px(4f);
			Ui.Text(area, ref y, "Unlocks these items in your item boxes", Ui.Style(Mathf.RoundToInt(15f * k), (FontStyle)2, Ui.Muted, (TextAnchor)1));
			y += (float)Px(10f);
			GUIStyle st = Ui.Style(Mathf.RoundToInt(15f * k), (FontStyle)0, Ui.Ink, (TextAnchor)0);
			CardTier[] array = new CardTier[3]
			{
				CardTier.Common,
				CardTier.Uncommon,
				CardTier.Legendary
			};
			foreach (CardTier tier in array)
			{
				IEnumerable<string> values = from b in Buffs.Pool
					where b.Class == c.Id && b.Tier == tier && !b.IsCombo
					select (b.ItemGroup != null) ? (b.Name + "*") : b.Name;
				string text = ColorUtility.ToHtmlStringRGB(Color.Lerp(Ui.TierColor(tier), Ui.Ink, 0.25f));
				Ui.Text(area, ref y, "<color=#" + text + "><b>" + Ui.TierName(tier) + ":</b></color> " + string.Join(", ", values), st);
				y += (float)Px(3f);
			}
			Ui.Text(area, ref y, "* starting-item card (you keep one per item)", Ui.Style(Mathf.RoundToInt(13f * k), (FontStyle)2, Ui.Muted, (TextAnchor)0));
			float num6 = Px(50f * k);
			float num7 = Px(40f * k);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(((Rect)(ref r)).center.x - num6 / 2f, ((Rect)(ref r)).yMax - num7 - (float)Px(14f), num6, num7);
			Ui.Round(val2, Ui.RoundPill, isSel ? color : Ui.Ink);
			GUI.Label(val2, (index + 1).ToString(), Ui.Style(Mathf.RoundToInt(22f * k), (FontStyle)1, Ui.Panel, (TextAnchor)4, wrap: false));
		}
	}
	internal static class SpeedBoost
	{
		[ThreadStatic]
		internal static bool FromCoffee;

		private static MethodInfo direct;

		public static void GiveDirect(PlayerMovement movement, float seconds)
		{
			try
			{
				direct = direct ?? AccessTools.GetDeclaredMethods(typeof(PlayerMovement)).FirstOrDefault((MethodInfo m) => m.Name.StartsWith("<AddSpeedBoost>g__AddSpeedBoostAtEndOfFrame"));
				if (direct != null)
				{
					direct.Invoke(movement, new object[1] { seconds });
				}
				else
				{
					AccessTools.Method(typeof(PlayerMovement), "AddSpeedBoost", (Type[])null, (Type[])null)?.Invoke(movement, new object[1] { seconds });
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[HoleBuffs] Speed boost failed: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(PlayerMovement), "AddSpeedBoost")]
	internal static class AddSpeedBoostPatch
	{
		private static void Prefix(PlayerMovement __instance, ref float duration)
		{
			if (((NetworkBehaviour)__instance).isLocalPlayer && SpeedBoost.FromCoffee)
			{
				duration *= Buffs.Mult("a_double");
			}
		}
	}
	[HarmonyPatch(typeof(PlayerMovement), "InformDrankCoffee")]
	internal static class CoffeePatch
	{
		private static void Prefix()
		{
			SpeedBoost.FromCoffee = true;
		}

		private static void Finalizer()
		{
			SpeedBoost.FromCoffee = false;
		}

		private static void Postfix(PlayerMovement __instance)
		{
			if (((NetworkBehaviour)__instance).isLocalPlayer)
			{
				Fx.CoffeeUntil = Time.time + GameManager.ItemSettings.CoffeeEffectDuration * Buffs.Mult("a_double");
				int num = Buffs.Stacks("s_ionbrew");
				if (num > 0)
				{
					Fx.Shield(1f + (float)num);
				}
				int num2 = Buffs.Stacks("p_darkroast");
				if (num2 > 0)
				{
					Fx.Vanish(1f + (float)num2);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class GiantDurationPatch
	{
		private static MethodBase TargetMethod()
		{
			return Fx.FindMoveNext(typeof(PlayerInfo), "LocalPlayerActivateJumboBurgerGiantForm");
		}

		private static float Scale(float v)
		{
			return (Buffs.Has("a_buffet") ? (v * 1.5f) : v) + (float)Mathf.Max(0, Buffs.Stacks("c_rod") - 1);
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			return Fx.AfterGetter(code, typeof(ItemSettings), "JumboBurgerGiantFormDuration", AccessTools.Method(typeof(GiantDurationPatch), "Scale", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch(typeof(PlayerInfo), "get_NormalizedJumboBurgerGiantFormRemainingTime")]
	internal static class GiantTimerUiPatch
	{
		private static void Prefix(PlayerInfo __instance)
		{
			Fx.Owner = __instance;
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Scale(float v)
		{
			return ((Fx.OwnerStacks("a_buffet") > 0) ? (v * 1.5f) : v) + (float)Mathf.Max(0, Fx.OwnerStacks("c_rod") - 1);
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			return Fx.AfterGetter(code, typeof(ItemSettings), "JumboBurgerGiantFormDuration", AccessTools.Method(typeof(GiantTimerUiPatch), "Scale", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch(typeof(PlayerMovement), "PlayJumboBurgerGiantFormLandingEffectsForAllClients")]
	internal static class GiantLandingPatch
	{
		private static void Postfix(PlayerMovement __instance, Vector3 worldPosition, float verticalSpeed)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)__instance).isLocalPlayer && Buffs.Has("c_bellyflop") && !(Mathf.Abs(verticalSpeed) < 4f) && Fx.Ready("bellyflop", Fx.Me, null, 1.5f))
			{
				Fx.LocalBlast(worldPosition, GameManager.ItemSettings.LandmineExplosionRange, soft: false, "bellyflop");
			}
		}
	}
	[HarmonyPatch]
	internal static class ShieldDurationPatch
	{
		private static MethodBase TargetMethod()
		{
			return Fx.FindMethod(typeof(PlayerInfo), "<LocalPlayerUpdateIsElectromagnetShieldActive>g__ShouldBeActive");
		}

		private static float Scale(float v)
		{
			return v * Buffs.Mult("s_capacitor");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			return Fx.AfterGetter(code, typeof(ItemSettings), "ElectromagnetShieldDuration", AccessTools.Method(typeof(ShieldDurationPatch), "Scale", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch]
	internal static class ShieldExplosionPatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			MethodBase a = Fx.FindMethod(typeof(PlayerInfo), "<LocalPlayerCancelElectromagnetShield>g__ExplodeElectromagnetShield");
			MethodBase b = Fx.FindMethod(typeof(PlayerInfo), "<PlayElectromagnetShieldHitInternal>g__PlayExplosion");
			if (a != null)
			{
				yield return a;
			}
			if (b != null)
			{
				yield return b;
			}
		}

		private static void Prefix(PlayerInfo __instance)
		{
			Fx.Owner = __instance;
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Scale(float v)
		{
			return v * Fx.OwnerMult("d_reactive");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			return Fx.AfterGetter(code, typeof(ItemSettings), "ElectromagnetShieldExplosionRange", AccessTools.Method(typeof(ShieldExplosionPatch), "Scale", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch(typeof(PlayerInfo), "LocalPlayerActivateElectromagnetShield")]
	internal static class RealShieldPatch
	{
		private static void Prefix()
		{
			if (!Fx.ActivatingBonusShield)
			{
				Fx.LastRealShield = Time.time;
				if (Buffs.Has("p_cloak"))
				{
					Fx.Vanish(GameManager.ItemSettings.ElectromagnetShieldDuration * Buffs.Mult("s_capacitor"));
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerInfo), "LocalPlayerActivateSmokeBomb")]
	internal static class RealSmokePatch
	{
		private static void Prefix()
		{
			if (!Fx.ActivatingBonusSmoke)
			{
				Fx.LastRealSmoke = Time.time;
			}
		}
	}
	[HarmonyPatch]
	internal static class StormDurationPatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			MethodBase a = Fx.FindMethod(typeof(Thunderstorm), "<OnBUpdate>g__ServerUpdate");
			MethodInfo b = AccessTools.Method(typeof(Thunderstorm), "InformLightningStruck", (Type[])null, (Type[])null);
			if (a != null)
			{
				yield return a;
			}
			if (b != null)
			{
				yield return b;
			}
		}

		private static void Prefix(Thunderstorm __instance)
		{
			Fx.Owner = (((Object)(object)__instance.Networkowner != (Object)null) ? __instance.Networkowner.PlayerInfo : null);
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Scale(float v)
		{
			return v * Fx.OwnerMult("s_forecast");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			return Fx.AfterGetter(code, typeof(ItemSettings), "ThunderstormDuration", AccessTools.Method(typeof(StormDurationPatch), "Scale", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch(typeof(Hittable), "ApplyAirDamping")]
	internal static class TailwindPatch
	{
		private static void Prefix(Hittable __instance)
		{
			Fx.Owner = null;
			Entity asEntity = __instance.AsEntity;
			if (!((Object)(object)asEntity == (Object)null) && asEntity.IsGolfBall)
			{
				GolfBall component = ((Component)__instance).GetComponent<GolfBall>();
				PlayerGolfer val = (((Object)(object)component != (Object)null) ? component.Owner : null);
				Fx.Owner = (((Object)(object)val != (Object)null) ? val.PlayerInfo : null);
			}
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Scale(float v)
		{
			return v * Fx.OwnerMult("s_tailwind");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			MethodInfo scaler = AccessTools.Method(typeof(TailwindPatch), "Scale", (Type[])null, (Type[])null);
			return Fx.AfterGetter(Fx.AfterGetter(code, typeof(WindHittableSettings), "WindFactor", scaler), typeof(WindHittableSettings), "CrossWindFactor", scaler);
		}
	}
	[HarmonyPatch]
	internal static class RocketRangePatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			yield return AccessTools.Method(typeof(Rocket), "ServerExplode", (Type[])null, (Type[])null);
			yield return AccessTools.Method(typeof(Rocket), "OnExploded", (Type[])null, (Type[])null);
		}

		private static void Prefix(Rocket __instance)
		{
			Fx.Owner = __instance.Networklauncher;
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Scale(float v)
		{
			return v * Fx.OwnerMult("d_boom");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			return Fx.AfterGetter(code, typeof(ItemSettings), "RocketExplosionRange", AccessTools.Method(typeof(RocketRangePatch), "Scale", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch]
	internal static class LandmineRangePatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			yield return AccessTools.Method(typeof(Landmine), "ServerExplode", (Type[])null, (Type[])null);
			yield return AccessTools.Method(typeof(Landmine), "OnExploded", (Type[])null, (Type[])null);
		}

		private static void Prefix(Landmine __instance)
		{
			Fx.Owner = (((Object)(object)__instance.Owner != (Object)null) ? __instance.Owner.PlayerInfo : null);
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Scale(float v)
		{
			return v * Fx.OwnerMult("d_boom");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			return Fx.AfterGetter(code, typeof(ItemSettings), "LandmineExplosionRange", AccessTools.Method(typeof(LandmineRangePatch), "Scale", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch]
	internal static class RocketHomingPatch
	{
		private static MethodBase TargetMethod()
		{
			return Fx.FindMethod(typeof(Rocket), "<OnFixedBUpdate>g__ApplyHoming");
		}

		private static void Prefix(Rocket __instance)
		{
			Fx.Owner = __instance.Networklauncher;
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Scale(float v)
		{
			return v * Fx.OwnerMult("d_smart");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			return Fx.AfterGetter(code, typeof(ItemSettings), "RocketMaxVelocityRotationPerSecond", AccessTools.Method(typeof(RocketHomingPatch), "Scale", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch(typeof(Landmine), "ServerInitialize")]
	internal static class LandmineArmPatch
	{
		private static void Prefix(PlayerInventory owner)
		{
			Fx.Owner = (((Object)(object)owner != (Object)null) ? owner.PlayerInfo : null);
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Scale(float v)
		{
			v *= Fx.OwnerMult("d_trigger");
			int num = Fx.OwnerStacks("c_hidden");
			if (num > 1)
			{
				v *= Mathf.Pow(0.75f, (float)(num - 1));
			}
			return v;
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			MethodInfo scaler = AccessTools.Method(typeof(LandmineArmPatch), "Scale", (Type[])null, (Type[])null);
			code = Fx.AfterGetter(code, typeof(ItemSettings), "LandminePlantingArmDelay", scaler);
			code = Fx.AfterGetter(code, typeof(ItemSettings), "LandmineTossingMinArmDelay", scaler);
			return Fx.AfterGetter(code, typeof(ItemSettings), "LandmineTossingMaxArmDelay", scaler);
		}
	}
	[HarmonyPatch(typeof(Landmine), "CanExplodeOnCollisionWith")]
	internal static class BonusMineOwnerPatch
	{
		private static readonly FieldInfo useIdField = AccessTools.Field(typeof(Landmine), "itemUseId");

		private static bool Prefix(Landmine __instance, Entity hitEntity, ref bool __result)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (useIdField == null || (Object)(object)hitEntity == (Object)null || !hitEntity.IsPlayer)
			{
				return true;
			}
			ItemUseId id = (ItemUseId)useIdField.GetValue(__instance);
			PlayerInfo val = (((Object)(object)__instance.Owner != (Object)null) ? __instance.Owner.PlayerInfo : null);
			if (!Fx.IsBonus(id) || (Object)(object)val == (Object)null || (Object)(object)hitEntity.PlayerInfo != (Object)(object)val)
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(Rocket), "ServerExplode")]
	internal static class ThunderBombPatch
	{
		private static void Postfix(Rocket __instance, Vector3 worldPosition)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			PlayerInfo networklauncher = __instance.Networklauncher;
			int num = (((Object)(object)networklauncher != (Object)null) ? BuffSync.StacksFor(networklauncher, "c_thunderbomb") : 0);
			for (int i = 0; i < num; i++)
			{
				Vector3 val = ((i == 0) ? Vector3.zero : (Quaternion.Euler(0f, 360f * (float)i / (float)num, 0f) * Vector3.forward * 3f));
				Fx.Strike(worldPosition + val, networklauncher);
			}
		}
	}
	[HarmonyPatch]
	internal static class FlashRangePatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			string[] array = new string[2] { "<UseFlashCameraRoutine>g__UseCamera", "<OnBUpdate>g__LocalPlayerUpdateFlashCameraTargetIndicators" };
			for (int i = 0; i < array.Length; i++)
			{
				MethodBase m = Fx.FindMethod(namePrefix: array[i], root: typeof(PlayerInventory));
				if (m != null)
				{
					yield return m;
				}
			}
			yield return AccessTools.Method(typeof(PlayerInventory), "CanHitWithFlashCamera", (Type[])null, (Type[])null);
		}

		private static void Prefix(PlayerInventory __instance)
		{
			Fx.Owner = __instance.PlayerInfo;
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Scale(float v)
		{
			return v * Fx.OwnerMult("p_lens");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			MethodInfo scaler = AccessTools.Method(typeof(FlashRangePatch), "Scale", (Type[])null, (Type[])null);
			return Fx.AfterGetter(Fx.AfterGetter(code, typeof(ItemSettings), "FlashCameraMaxRange", scaler), typeof(ItemSettings), "FlashCameraHalfMaxYaw", scaler);
		}
	}
	[HarmonyPatch]
	internal static class AirhornRangePatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			string[] array = new string[2] { "<BlowAirhornRoutine>g__BlowAirhorn", "<OnBUpdate>g__LocalPlayerUpdateAirhornTargetIndicators" };
			for (int i = 0; i < array.Length; i++)
			{
				MethodBase m = Fx.FindMethod(namePrefix: array[i], root: typeof(PlayerInventory));
				if (m != null)
				{
					yield return m;
				}
			}
		}

		private static void Prefix(PlayerInventory __instance)
		{
			Fx.Owner = __instance.PlayerInfo;
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Scale(float v)
		{
			return v * Fx.OwnerMult("g_horn");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			return Fx.AfterGetter(code, typeof(ItemSettings), "AirhornRange", AccessTools.Method(typeof(AirhornRangePatch), "Scale", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch]
	internal static class SilencerShootPatch
	{
		[ThreadStatic]
		internal static bool Shooting;

		private static IEnumerable<MethodBase> TargetMethods()
		{
			string[] array = new string[4] { "<ShootDuelingPistolRoutine>g__Shoot", "<ShootElephantGunRoutine>g__Shoot", "<ShootRocketLauncherRoutine>g__Shoot", "<ChargeAndShootRailgunRoutine>g__Shoot" };
			for (int i = 0; i < array.Length; i++)
			{
				MethodBase m = Fx.FindMethod(namePrefix: array[i], root: typeof(PlayerInventory));
				if (m != null)
				{
					yield return m;
				}
			}
		}

		private static void Prefix()
		{
			Shooting = true;
		}

		private static void Finalizer()
		{
			Shooting = false;
		}
	}
	[HarmonyPatch(typeof(PlayerInfo), "LocalPlayerCancelSmokeBombInvisibility")]
	internal static class SilencerCancelPatch
	{
		private static bool Prefix()
		{
			return !SilencerShootPatch.Shooting || !Buffs.Has("p_silencer");
		}
	}
	[HarmonyPatch(typeof(PlayerInfo), "HonkGolfCart")]
	internal static class NitroPatch
	{
		private static void Postfix(PlayerInfo __instance)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)__instance).isLocalPlayer || !Buffs.Has("g_nitro") || (Object)(object)__instance.Movement == (Object)null)
			{
				return;
			}
			try
			{
				if (__instance.ActiveGolfCartSeat.seat != 0)
				{
					return;
				}
			}
			catch
			{
				return;
			}
			if (Fx.Ready("nitro", __instance, null, 10f))
			{
				SpeedBoost.GiveDirect(__instance.Movement, 2f);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerMovement), "InformEnteredGolfCart")]
	internal static class EnterCartPatch
	{
		private static void Postfix(PlayerMovement __instance)
		{
			if (((NetworkBehaviour)__instance).isLocalPlayer)
			{
				int num = Buffs.Stacks("c_drivethru");
				if (num > 0 && Fx.Ready("drivethru", Fx.Me, null, 15f))
				{
					SpeedBoost.GiveDirect(__instance, 2f + (float)num);
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerMovement), "InformExitedGolfCart")]
	internal static class ExitCartPatch
	{
		private static void Postfix(PlayerMovement __instance)
		{
			if (((NetworkBehaviour)__instance).isLocalPlayer)
			{
				int num = Buffs.Stacks("c_ghostrider");
				if (num > 0)
				{
					Fx.Vanish(2f + (float)num);
				}
				if (Buffs.Has("g_getaway") && !((Object)(object)Plugin.Instance == (Object)null))
				{
					((MonoBehaviour)Plugin.Instance).StartCoroutine(Getaway(__instance));
				}
			}
		}

		private static IEnumerator Getaway(PlayerMovement m)
		{
			yield return null;
			Rigidbody rb = (((Object)(object)m != (Object)null && (Object)(object)m.PlayerInfo != (Object)null) ? m.PlayerInfo.Rigidbody : null);
			if ((Object)(object)rb == (Object)null)
			{
				yield break;
			}
			Vector3 v = rb.linearVelocity;
			Vector3 flat = new Vector3(v.x, 0f, v.z);
			if (!(((Vector3)(ref flat)).magnitude < 5f))
			{
				float k = Mathf.Sqrt(1.5f);
				rb.linearVelocity = new Vector3(v.x * k, v.y, v.z * k);
				yield return (object)new WaitForSeconds(1.2f);
				if ((Object)(object)m != (Object)null)
				{
					SpeedBoost.GiveDirect(m, 3f);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class RecoilPatch
	{
		private static readonly MethodInfo setVelocity = AccessTools.PropertySetter(typeof(PlayerMovement), "Velocity");

		private static MethodBase TargetMethod()
		{
			return Fx.FindMethod(typeof(PlayerInventory), "<ShootDuelingPistolRoutine>g__Shoot");
		}

		private static void Postfix(PlayerInventory __instance)
		{
			//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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			int num = Buffs.Stacks("g_recoil");
			PlayerInfo playerInfo = __instance.PlayerInfo;
			if (num <= 0 || !((NetworkBehaviour)__instance).isLocalPlayer || (Object)(object)playerInfo == (Object)null || (Object)(object)playerInfo.Movement == (Object)null || Local.InCart(playerInfo))
			{
				return;
			}
			try
			{
				Vector3 val = -((Component)playerInfo).transform.forward;
				val.y = 0f;
				((Vector3)(ref val)).Normalize();
				Vector3 val2 = playerInfo.Movement.Velocity + val * (7f + 4f * (float)(num - 1)) + Vector3.up * (4f + 2f * (float)(num - 1));
				setVelocity?.Invoke(playerInfo.Movement, new object[1] { val2 });
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[HoleBuffs] Recoil failed: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(Hittable), "HitWithItem")]
	internal static class SugarRushPatch
	{
		private static void Prefix(Hittable __instance, ItemType itemType, ItemUseId itemUseId, PlayerInventory itemUser)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			int num = Buffs.Stacks("a_sugar");
			if (num <= 0 || (int)itemType != 2 || Fx.IsBonus(itemUseId) || (Object)(object)itemUser == (Object)null || !((NetworkBehaviour)itemUser).isLocalPlayer)
			{
				return;
			}
			Entity asEntity = __instance.AsEntity;
			if (!((Object)(object)asEntity == (Object)null) && asEntity.IsPlayer && !Fx.IsMe(asEntity.PlayerInfo))
			{
				PlayerInfo playerInfo = itemUser.PlayerInfo;
				if ((Object)(object)playerInfo != (Object)null && (Object)(object)playerInfo.Movement != (Object)null && Fx.Ready("sugar", playerInfo, null, 1f))
				{
					SpeedBoost.GiveDirect(playerInfo.Movement, 1f + (float)num);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class DeadeyePatch
	{
		private static MethodBase TargetMethod()
		{
			return Fx.FindMethod(typeof(PlayerInventory), "<ShootElephantGunRoutine>g__Shoot");
		}

		private static float Scale(float v)
		{
			return v * Buffs.Mult("p_deadeye");
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			return Fx.AfterGetter(code, typeof(ItemSettings), "ElephantGunMaxInaccuracyAngle", AccessTools.Method(typeof(DeadeyePatch), "Scale", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch(typeof(PlayerMovement), "ApplyGravity")]
	internal static class UpdraftPatch
	{
		private static void Prefix(PlayerMovement __instance)
		{
			Fx.Owner = (((NetworkBehaviour)__instance).isLocalPlayer ? __instance.PlayerInfo : null);
		}

		private static void Finalizer()
		{
			Fx.Owner = null;
		}

		private static float Gravity(float v)
		{
			return ((Object)(object)Fx.Owner != (Object)null) ? (v * Buffs.Mult("s_updraft")) : v;
		}

		private static float Window(float v)
		{
			return ((Object)(object)Fx.Owner != (Object)null && Buffs.Has("s_updraft")) ? (v * (1f + 0.5f * (float)Buffs.Stacks("s_updraft"))) : v;
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> code)
		{
			code = Fx.AfterGetter(code, typeof(ItemSettings), "SpringBootsJumpPeakLingerGravityFactor", AccessTools.Method(typeof(UpdraftPatch), "Gravity", (Type[])null, (Type[])null));
			return Fx.AfterGetter(code, typeof(ItemSettings), "SpringBootsJumpPeakLingerStartSpeed", AccessTools.Method(typeof(UpdraftPatch), "Window", (Type[])null, (Type[])null));
		}
	}
	[HarmonyPatch(typeof(PlayerMovement), "SetIsInSpringBootsJump")]
	internal static class GroundPoundPatch
	{
		private static void Prefix(PlayerMovement __instance, bool isInJump, bool fromLanding)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (!isInJump && fromLanding && ((NetworkBehaviour)__instance).isLocalPlayer && Buffs.Has("a_pound") && __instance.IsInSpringBootsJump && Fx.Ready("pound", Fx.Me, null, 1.5f))
			{
				Fx.LocalBlast(((Component)__instance).transform.position, 4f, soft: true, "pound");
			}
		}
	}
	[HarmonyPatch(typeof(CourseManager), "InformPlayerKnockedOutInternal")]
	internal static class HostKnockoutPatch
	{
		private static void Postfix(PlayerMovement knockedOutPlayer, PlayerInfo responsiblePlayer, KnockoutType knockoutType)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Invalid comparison between Unknown and I4
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Invalid comparison between Unknown and I4
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PlayerInfo val = (((Object)(object)knockedOutPlayer != (Object)null) ? knockedOutPlayer.PlayerInfo : null);
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				bool flag = (Object)(object)responsiblePlayer != (Object)null && (Object)(object)responsiblePlayer != (Object)(object)val;
				if (flag && BuffSync.StacksFor(val, "s_conductor") > 0 && Fx.Ready("conductor", val, null, 30f))
				{
					Fx.StrikePlayer(responsiblePlayer, val);
				}
				if (flag && (int)knockoutType == 24 && BuffSync.StacksFor(responsiblePlayer, "s_chain") > 0 && Fx.Ready("chain", responsiblePlayer, null, 2f))
				{
					PlayerInfo val2 = Fx.Nearest(Fx.Pos(val), 10f, responsiblePlayer, val);
					if ((Object)(object)val2 != (Object)null)
					{
						Fx.StrikePlayer(val2, responsiblePlayer);
					}
				}
				if (flag && (int)knockoutType == 6)
				{
					int num = BuffSync.StacksFor(responsiblePlayer, "c_electric");
					if (num > 0 && Fx.Roll(Mathf.Min(1f, 0.25f + 0.25f * (float)num)) && Fx.TargetReady(responsiblePlayer, val))
					{
						Fx.StrikePlayer(val, responsiblePlayer);
					}
				}
				if (BuffSync.StacksFor(val, "d_deadman") > 0 && (Object)(object)val.Inventory != (Object)null && Fx.Ready("deadman", val, null, 20f))
				{
					CourseManager.ServerSpawnLandmine(Fx.Pos(val) + Vector3.up * 0.3f, Quaternion.identity, Vector3.zero, Vector3.zero, (LandmineArmType)1, Fx.BonusId(val, (ItemType)8), val.Inventory);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[HoleBuffs] Knockout effects failed: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(Hittable), "UserCode_CmdHitWithItem__ItemType__ItemUseId__Vector3__Vector3__Vector3__Single__PlayerInventory__Boolean__Boolean__Boolean__Double__UInt64__NetworkConnectionToClient")]
	internal static class HostItemHitPatch
	{
		private static bool Prefix(Hittable __instance, ItemType itemType, PlayerInventory itemUser, bool isReflected)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Invalid comparison between Unknown and I4
			try
			{
				Entity asEntity = __instance.AsEntity;
				if ((Object)(object)asEntity == (Object)null || !asEntity.IsPlayer || (Object)(object)itemUser == (Object)null)
				{
					return true;
				}
				PlayerInfo playerInfo = asEntity.PlayerInfo;
				PlayerInfo playerInfo2 = itemUser.PlayerInfo;
				if ((Object)(object)playerInfo == (Object)null || (Object)(object)playerInfo2 == (Object)null || (Object)(object)playerInfo == (Object)(object)playerInfo2)
				{
					return true;
				}
				if (!isReflected && (int)itemType == 2)
				{
					int num = BuffSync.StacksFor(playerInfo2, "s_caller");
					if (num > 0 && Fx.Roll(Mathf.Min(0.7f, 0.35f * (float)num)) && Fx.Ready("caller", playerInfo2, playerInfo, 1f))
					{
						Fx.StrikePlayer(playerInfo, playerInfo2);
						return false;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[HoleBuffs] Item hit effects failed: " + ex));
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerInventory), "UserCode_CmdInformUsedFlashCamera__Hittable[]__Single[]__UInt64__NetworkConnectionToClient")]
	internal static class HostFlashPatch
	{
		private static void Prefix(PlayerInventory __instance, Hittable[] hitHittables, float[] hitHittableDistances)
		{
			try
			{
				PlayerInfo playerInfo = __instance.PlayerInfo;
				if ((Object)(object)playerInfo == (Object)null || hitHittables == null)
				{
					return;
				}
				float num = BuffSync.MultFor(playerInfo, "p_lens");
				if (num > 1f && hitHittableDistances != null)
				{
					for (int i = 0; i < hitHittableDistances.Length; i++)
					{
						hitHittableDistances[i] /= num;
					}
				}
				int num2 = BuffSync.StacksFor(playerInfo, "c_flashbolt");
				if (num2 <= 0)
				{
					return;
				}
				foreach (Hittable val in hitHittables)
				{
					Entity val2 = (((Object)(object)val != (Object)null) ? val.AsEntity : null);
					if (!((Object)(object)val2 == (Object)null) && val2.IsPlayer && !((Object)(object)val2.PlayerInfo == (Object)(object)playerInfo) && Fx.Roll(Mathf.Min(1f, 0.35f * (float)num2)) && Fx.TargetReady(playerInfo, val2.PlayerInfo))
					{
						Fx.StrikePlayer(val2.PlayerInfo, playerInfo);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[HoleBuffs] Flash effects failed: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(Hittable), "UserCode_CmdHitWithDive__Vector3__PlayerMovement__NetworkConnectionToClient")]
	internal static class HostDivePatch
	{
		private static readonly MethodInfo removeItemAt = AccessTools.Method(typeof(PlayerInventory), "RemoveItemAt", new Type[3]
		{
			typeof(int),
			typeof(bool),
			typeof(bool)
		}, (Type[])null);

		private static readonly HashSet<string> robbedThisHole = new HashSet<string>();

		private static readonly Random rng = new Random();

		public static void ResetHole()
		{
			robbedThisHole.Clear();
		}

		private static void Postfix(Hittable __instance, PlayerMovement hitter)
		{
			//IL_0164: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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_01ee: 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)
			try
			{
				Entity asEntity = __instance.AsEntity;
				PlayerInfo val = (((Object)(object)hitter != (Object)null) ? hitter.PlayerInfo : null);
				if ((Object)(object)asEntity == (Object)null || !asEntity.IsPlayer || (Object)(object)val == (Object)null || removeItemAt == null)
				{
					return;
				}
				PlayerInfo playerInfo = asEntity.PlayerInfo;
				if ((Object)(object)playerInfo == (Object)null || (Object)(object)playerInfo == (Object)(object)val || (Object)(object)playerInfo.Inventory == (Object)null || (Object)(object)val.Inventory == (Object)null || BuffSync.StacksFor(val, "p_pickpocket") <= 0)
				{
					return;
				}
				string item = ((NetworkBehaviour)val).netId + ">" + ((NetworkBehaviour)playerInfo).netId;
				if (robbedThisHole.Contains(item))
				{
					return;
				}
				SyncList<InventorySlot> slots = playerInfo.Inventory.slots;
				List<int> list = (from i in Enumerable.Range(0, slots.Count)
					where (int)slots[i].itemType > 0
					select i).ToList();
				if (list.Count != 0)
				{
					int num = list[rng.Next(list.Count)];
					InventorySlot val2 = slots[num];
					if (val.Inventory.ServerTryAddItem(val2.itemType, val2.remainingUses))
					{
						removeItemAt.Invoke(playerInfo.Inventory, new object[3] { num, false, false });
						robbedThisHole.Add(item);
						ManualLogSource log = Plugin.Log;
						PlayerId playerId = val.PlayerId;
						string arg = ((playerId != null) ? playerId.PlayerName : null);
						object arg2 = val2.itemType;
						PlayerId playerId2 = playerInfo.PlayerId;
						log.LogInfo((object)$"[HoleBuffs] Pickpocket: {arg} stole {arg2} from {((playerId2 != null) ? playerId2.PlayerName : null)}");
					}
				}