Decompiled source of TheHouse v2.1.0

HouseMod.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EmotesAPI;
using EntityStates;
using EntityStates.Commando;
using EntityStates.Commando.CommandoWeapon;
using HG;
using HG.BlendableTypes;
using HouseMod.Modules;
using HouseMod.Modules.Achievements;
using HouseMod.Modules.Components;
using HouseMod.Modules.Survivors;
using HouseMod.SkillStates;
using HouseMod.SkillStates.House;
using HouseMod.SkillStates.House.Cards;
using HouseMod.SkillStates.House.Shots;
using HouseMod.SkillStates.House.TheGame;
using IL.RoR2;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using NS_KingKombatArena;
using On.RoR2;
using On.RoR2.UI;
using OrographicGambitBaseMod.Modules;
using OrographicGambitBaseMod.Modules.Components;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using Rewired;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[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.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("HouseMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HouseMod")]
[assembly: AssemblyTitle("HouseMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
internal class BodyInfo
{
	internal string bodyName = "";

	internal string bodyNameToken = "";

	internal string subtitleNameToken = "";

	internal Texture characterPortrait = null;

	internal GameObject crosshair = null;

	internal GameObject podPrefab = null;

	internal float maxHealth = 100f;

	internal float healthGrowth = 2f;

	internal float healthRegen = 0f;

	internal float shield = 0f;

	internal float shieldGrowth = 0f;

	internal float moveSpeed = 7f;

	internal float moveSpeedGrowth = 0f;

	internal float acceleration = 80f;

	internal float jumpPower = 15f;

	internal float jumpPowerGrowth = 0f;

	internal float damage = 12f;

	internal float attackSpeed = 1f;

	internal float attackSpeedGrowth = 0f;

	internal float armor = 0f;

	internal float armorGrowth = 0f;

	internal float crit = 1f;

	internal float critGrowth = 0f;

	internal int jumpCount = 1;

	internal Color bodyColor = Color.grey;
}
internal class CustomRendererInfo
{
	internal string childName;

	internal Material material;

	internal bool ignoreOverlays;
}
internal class SkillDefInfo
{
	public string skillName;

	public string skillNameToken;

	public string skillDescriptionToken;

	public Sprite skillIcon;

	public SerializableEntityStateType activationState;

	public string activationStateMachineName;

	public int baseMaxStock;

	public float baseRechargeInterval;

	public bool beginSkillCooldownOnSkillEnd;

	public bool canceledFromSprinting;

	public bool forceSprintDuringState;

	public bool fullRestockOnAssign;

	public InterruptPriority interruptPriority;

	public bool resetCooldownTimerOnUse;

	public bool isCombatSkill;

	public bool mustKeyPress;

	public bool cancelSprintingOnActivation;

	public int rechargeStock;

	public int requiredStock;

	public int stockToConsume;

	public string[] keywordTokens;
}
namespace HouseMod
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.JavAngle.HouseMod", "HouseMod", "2.1.0")]
	[R2APISubmoduleDependency(new string[] { "PrefabAPI", "LanguageAPI", "SoundAPI", "NetworkingAPI" })]
	public class HousePlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.JavAngle.HouseMod";

		public const string MODNAME = "HouseMod";

		public const string MODVERSION = "2.1.0";

		public const string developerPrefix = "JAVANGLE";

		public static bool scepterInstalled;

		public static bool scrollableLobbyInstalled;

		public static bool RiskOfOptionsInstalled;

		public static bool EmotesAPIInstalled;

		public static bool KKArenaInstalled;

		public static bool GOTCEInstalled;

		public static HousePlugin instance;

		private bool emoteAPIsetup = false;

		private void Awake()
		{
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			instance = this;
			if (Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter"))
			{
				scepterInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ScrollableLobbyUI"))
			{
				scrollableLobbyInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
			{
				RiskOfOptionsInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI"))
			{
				EmotesAPIInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.Kingpinush.KingKombatArena"))
			{
				KKArenaInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.TheBestAssociatedLargelyLudicrousSillyheadGroup.GOTCE"))
			{
				GOTCEInstalled = true;
			}
			Assets.PopulateAssets();
			Config.ReadConfig();
			States.RegisterStates();
			Buffs.RegisterBuffs();
			Projectiles.RegisterProjectiles();
			Tokens.AddTokens();
			ItemDisplays.PopulateDisplays();
			NetworkingAPI.RegisterMessageType<WildRoomNetworkComponent>();
			NetworkingAPI.RegisterMessageType<StageDetonateNetworkComponent>();
			House.CreateCharacter();
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
			Hook();
		}

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

		private void Start()
		{
			ContentManager.onContentPacksAssigned += ContentManager_onContentPacksAssigned;
		}

		private void ContentManager_onContentPacksAssigned(ReadOnlyArray<ReadOnlyContentPack> obj)
		{
			House.InitializeItemDisplays();
			House.SetItemDisplays();
		}

		private void Hook()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
			HUD.Awake += new hook_Awake(CardTableHUD);
			HUD.Awake += new hook_Awake(CylinderHUD);
			HUD.Awake += new hook_Awake(GlobalHUD);
			CharacterSelectController.UpdateSurvivorInfoPanel += new hook_UpdateSurvivorInfoPanel(CharacterSelectController_UpdateSurvivorInfoPanel);
			CharacterSelectController.RebuildLocal += new hook_RebuildLocal(CharacterSelectController_RebuildLocal);
			CharacterSelectController.OnEnable += new hook_OnEnable(CharacterSelectController_OnEnable);
			HealthComponent.TakeDamage += new Manipulator(HealthComponent_TakeDamage);
			if (EmotesAPIInstalled)
			{
				SetUpEmotes();
			}
			if (KKArenaInstalled)
			{
				HousePassiveManager.isKKAInstalled = true;
			}
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self) && self.HasBuff(Buffs.Spadesbuff))
			{
				self.moveSpeed *= 1.4f;
			}
		}

		private static void HealthComponent_TakeDamage(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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)
			ILCursor val = new ILCursor(il);
			ILLabel conditionalTarget = null;
			int num = default(int);
			if (!val.TryGotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCall<HealthComponent>(x, "get_fullCombinedHealth"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.9f),
				(Instruction x) => ILPatternMatchingExt.MatchMul(x),
				(Instruction x) => ILPatternMatchingExt.MatchBltUn(x, ref conditionalTarget)
			}))
			{
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Func<HealthComponent, DamageInfo, bool>>((Func<HealthComponent, DamageInfo, bool>)delegate(HealthComponent healthComponent, DamageInfo damageInfo)
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)damageInfo.attacker))
				{
					CharacterBody body = healthComponent.body;
					CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
					return (Object)(object)component == (Object)(object)body && body.bodyIndex == BodyCatalog.FindBodyIndex("JavangleHouse");
				}
				return false;
			});
			val.Emit(OpCodes.Brtrue, (object)conditionalTarget);
		}

		private void CardTableHUD(orig_Awake orig, HUD self)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			Transform val = self.mainContainer.transform.Find("MainUIArea");
			val = val.Find("SpringCanvas");
			val = val.Find("BottomRightCluster");
			HouseHUDManager.defualtUI = val;
			GameObject val2 = Object.Instantiate<GameObject>(Assets.HouseHotbar);
			val2.transform.SetParent(self.mainContainer.transform);
			RectTransform component = val2.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(1f, 0f);
			component.anchorMax = new Vector2(1f, 0f);
			component.sizeDelta = Vector2.zero;
			((Transform)component).localScale = Vector2.op_Implicit(Vector2.zero);
			component.anchoredPosition = new Vector2(Config.hudPositionX.Value, Config.hudPositionY.Value);
			ChildLocator component2 = val2.GetComponent<ChildLocator>();
			HouseHUDManager.HouseHotbar = component;
			HouseHUDManager.HotbarAnimator = val2.GetComponent<Animator>();
			HouseHUDManager.CardArts = (Image[])(object)new Image[3]
			{
				((Component)component2.FindChild("CardArt1")).GetComponent<Image>(),
				((Component)component2.FindChild("CardArt2")).GetComponent<Image>(),
				((Component)component2.FindChild("CardArt3")).GetComponent<Image>()
			};
			HouseHUDManager.CardTooltips = new TooltipComponent[HouseHUDManager.CardArts.Length];
			for (int num = HouseHUDManager.CardArts.Length - 1; num >= 0; num--)
			{
				HouseHUDManager.CardTooltips[num] = ((Component)HouseHUDManager.CardArts[num]).gameObject.AddComponent<TooltipComponent>();
			}
			HouseHUDManager.CardColour = (Image[])(object)new Image[3]
			{
				((Component)component2.FindChild("CardColour1")).GetComponent<Image>(),
				((Component)component2.FindChild("CardColour2")).GetComponent<Image>(),
				((Component)component2.FindChild("CardColour3")).GetComponent<Image>()
			};
			HouseHUDManager.HotbarIcons = (Image[])(object)new Image[5]
			{
				((Component)component2.FindChild("PrimaryIcon")).GetComponent<Image>(),
				((Component)component2.FindChild("CardIcon1")).GetComponent<Image>(),
				((Component)component2.FindChild("CardIcon2")).GetComponent<Image>(),
				((Component)component2.FindChild("CardIcon3")).GetComponent<Image>(),
				((Component)component2.FindChild("EquipmentIcon")).GetComponent<Image>()
			};
			HouseHUDManager.HotbarTooltips = new TooltipComponent[HouseHUDManager.HotbarIcons.Length];
			for (int num2 = HouseHUDManager.HotbarIcons.Length - 1; num2 >= 0; num2--)
			{
				HouseHUDManager.HotbarTooltips[num2] = ((Component)HouseHUDManager.HotbarIcons[num2]).gameObject.AddComponent<TooltipComponent>();
			}
			HouseHUDManager.HotbarCooldown = (Text[])(object)new Text[5]
			{
				((Component)component2.FindChild("PrimaryCooldown")).GetComponent<Text>(),
				((Component)component2.FindChild("CardCooldown1")).GetComponent<Text>(),
				((Component)component2.FindChild("CardCooldown2")).GetComponent<Text>(),
				((Component)component2.FindChild("CardCooldown3")).GetComponent<Text>(),
				((Component)component2.FindChild("EquipmentCooldown")).GetComponent<Text>()
			};
			HouseHUDManager.HotbarStocks = (Text[])(object)new Text[5]
			{
				((Component)component2.FindChild("PrimaryStocks")).GetComponent<Text>(),
				((Component)component2.FindChild("CardStocks1")).GetComponent<Text>(),
				((Component)component2.FindChild("CardStocks2")).GetComponent<Text>(),
				((Component)component2.FindChild("CardStocks3")).GetComponent<Text>(),
				((Component)component2.FindChild("EquipmentStock")).GetComponent<Text>()
			};
			HouseHUDManager.HotbarKeys = (Text[])(object)new Text[5]
			{
				((Component)component2.FindChild("PrimaryHotkey")).GetComponent<Text>(),
				((Component)component2.FindChild("CardHotkey1")).GetComponent<Text>(),
				((Component)component2.FindChild("CardHotkey2")).GetComponent<Text>(),
				((Component)component2.FindChild("CardHotkey3")).GetComponent<Text>(),
				((Component)component2.FindChild("EquipmentHotkey")).GetComponent<Text>()
			};
			HouseHUDManager.DrawPile = ((Component)component2.FindChild("DeckCount")).GetComponent<Text>();
			val2.AddComponent<HouseHUDManager>();
		}

		private void CylinderHUD(orig_Awake orig, HUD self)
		{
			//IL_003f: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			GameObject val = Object.Instantiate<GameObject>(Assets.HouseCrosshair);
			val.transform.SetParent(self.mainContainer.transform);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0.5f, 0.5f);
			component.anchorMax = new Vector2(0.5f, 0.5f);
			component.sizeDelta = Vector2.zero;
			((Transform)component).localScale = Vector2.op_Implicit(Vector2.zero);
			component.anchoredPosition = new Vector2(Config.crosshairPositionX.Value, Config.crosshairPositionY.Value);
			ChildLocator component2 = val.GetComponent<ChildLocator>();
			HouseHUDManager.HouseCrosshair = component;
			HouseHUDManager.CrosshairAnimator = val.GetComponent<Animator>();
			HouseHUDManager.PrioityShot = ((Component)component2.FindChild("PriorityShot")).GetComponent<Image>();
			HouseHUDManager.ShotAmmo = (Image[])(object)new Image[6]
			{
				((Component)component2.FindChild("Shot1")).GetComponent<Image>(),
				((Component)component2.FindChild("Shot2")).GetComponent<Image>(),
				((Component)component2.FindChild("Shot3")).GetComponent<Image>(),
				((Component)component2.FindChild("Shot4")).GetComponent<Image>(),
				((Component)component2.FindChild("Shot5")).GetComponent<Image>(),
				((Component)component2.FindChild("Shot6")).GetComponent<Image>()
			};
			HouseHUDManager.Cylinders = (Image[])(object)new Image[3]
			{
				((Component)component2.FindChild("Cylinder1")).GetComponent<Image>(),
				((Component)component2.FindChild("Cylinder2")).GetComponent<Image>(),
				((Component)component2.FindChild("Cylinder3")).GetComponent<Image>()
			};
		}

		private void GlobalHUD(orig_Awake orig, HUD self)
		{
			//IL_003f: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			GameObject val = Object.Instantiate<GameObject>(Assets.HouseGlobalHUD);
			val.transform.SetParent(self.mainContainer.transform);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0.5f, 1f);
			component.anchorMax = new Vector2(0.5f, 1f);
			component.sizeDelta = Vector2.zero;
			((Transform)component).localScale = Vector2.op_Implicit(Vector2.one);
			component.anchoredPosition = Vector2.op_Implicit(new Vector3(0f, -200f, 0f));
			ChildLocator component2 = val.GetComponent<ChildLocator>();
			HouseGlobalHUDManager.animator = val.GetComponent<Animator>();
			HouseGlobalHUDManager.StageDetonationTimer = ((Component)component2.FindChild("StageDetonationTimer")).GetComponent<Text>();
			HouseGlobalHUDManager.WildWheel = (Text[])(object)new Text[6]
			{
				((Component)component2.FindChild("WildWheel1")).GetComponent<Text>(),
				((Component)component2.FindChild("WildWheel2")).GetComponent<Text>(),
				((Component)component2.FindChild("WildWheel3")).GetComponent<Text>(),
				((Component)component2.FindChild("WildWheel4")).GetComponent<Text>(),
				((Component)component2.FindChild("WildWheel5")).GetComponent<Text>(),
				((Component)component2.FindChild("WildWheel6")).GetComponent<Text>()
			};
			HouseGlobalHUDManager.WildMadnessLevel = ((Component)component2.FindChild("WildRoomMadnessLevel")).GetComponent<Text>();
			val.AddComponent<HouseGlobalHUDManager>();
		}

		private void CharacterSelectController_UpdateSurvivorInfoPanel(orig_UpdateSurvivorInfoPanel orig, CharacterSelectController self)
		{
			orig.Invoke(self);
			SurvivorDef currentSurvivorDef = self.currentSurvivorDef;
			if (Object.op_Implicit((Object)(object)currentSurvivorDef) && currentSurvivorDef.displayNameToken == "JAVANGLE_HOUSE_BODY_NAME")
			{
				if (((UIBehaviour)self.survivorDescription).IsActive())
				{
					HouseLoadoutOverview.OverviewPanel.SetActive(true);
				}
				else
				{
					HouseLoadoutOverview.OverviewPanel.SetActive(false);
				}
			}
			else
			{
				HouseLoadoutOverview.OverviewPanel.SetActive(false);
			}
		}

		private void CharacterSelectController_RebuildLocal(orig_RebuildLocal orig, CharacterSelectController self)
		{
			orig.Invoke(self);
			SurvivorDef currentSurvivorDef = self.currentSurvivorDef;
			if (Object.op_Implicit((Object)(object)currentSurvivorDef) && currentSurvivorDef.displayNameToken == "JAVANGLE_HOUSE_BODY_NAME")
			{
				HouseLoadoutOverview.SetCardOverview();
			}
			else
			{
				HouseLoadoutOverview.UnsetCardOverview();
			}
		}

		private void CharacterSelectController_OnEnable(orig_OnEnable orig, CharacterSelectController self)
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			((Component)self).gameObject.AddComponent<HouseLoadoutOverview>();
			Transform parent = ((TMP_Text)self.survivorDescription).transform.parent.parent;
			GameObject val = Object.Instantiate<GameObject>(Assets.HouseCSSOverview, parent);
			Transform val2 = self.activeSurvivorInfoPanel.transform.Find("SubheaderPanel (Overview, Skills, Loadout)");
			val2 = val2.Find("GenericMenuButton (Overview)");
			val2 = val2.Find("ButtonText");
			ChildLocator component = val.GetComponent<ChildLocator>();
			Transform val3 = component.FindChild("Shots");
			int num = HouseShotDefs.shots.Length - 1;
			for (int i = 1; i <= num; i++)
			{
				GameObject val4 = Object.Instantiate<GameObject>(Assets.HouseCSSIcon, val3);
				TooltipComponent tooltipComponent = val4.AddComponent<TooltipComponent>();
				val4.AddComponent<LoadoutButton>();
				Image component2 = val4.GetComponent<Image>();
				component2.sprite = HouseShotDefs.shots[i].icon;
				((Graphic)component2).color = HouseShotDefs.shots[i].color;
				tooltipComponent.tooltipName = HouseShotDefs.shots[i].name;
				tooltipComponent.tooltipDescription = HouseShotDefs.shots[i].description;
				tooltipComponent.tooltipColor = HouseShotDefs.shots[i].color;
				tooltipComponent.Awake();
				tooltipComponent.UpdateCardTooltips();
			}
			val3 = component.FindChild("StandardSpread");
			num = HouseCardDefs.AbreviateStandard.Length - 1;
			for (int j = 0; j <= num; j++)
			{
				GameObject val5 = Object.Instantiate<GameObject>(Assets.HouseCSSIcon, val3);
				TooltipComponent tooltipComponent2 = val5.AddComponent<TooltipComponent>();
				val5.AddComponent<LoadoutButton>();
				Image component3 = val5.GetComponent<Image>();
				component3.sprite = HouseCardDefs.cards[HouseCardDefs.AbreviateStandard[j]].cardIcon;
				tooltipComponent2.tooltipName = HouseCardDefs.cards[HouseCardDefs.AbreviateStandard[j]].name;
				tooltipComponent2.tooltipDescription = HouseCardDefs.cards[HouseCardDefs.AbreviateStandard[j]].description;
				tooltipComponent2.tooltipColor = HouseCardDefs.cards[HouseCardDefs.AbreviateStandard[j]].color;
				tooltipComponent2.Awake();
				tooltipComponent2.UpdateCardTooltips();
			}
			val3 = component.FindChild("FullHouse");
			num = HouseCardDefs.AbreviateFull.Length - 1;
			for (int k = 0; k <= num; k++)
			{
				GameObject val6 = Object.Instantiate<GameObject>(Assets.HouseCSSIcon, val3);
				TooltipComponent tooltipComponent3 = val6.AddComponent<TooltipComponent>();
				val6.AddComponent<LoadoutButton>();
				Image component4 = val6.GetComponent<Image>();
				component4.sprite = HouseCardDefs.cards[HouseCardDefs.AbreviateFull[k]].cardIcon;
				tooltipComponent3.tooltipName = HouseCardDefs.cards[HouseCardDefs.AbreviateFull[k]].name;
				tooltipComponent3.tooltipDescription = HouseCardDefs.cards[HouseCardDefs.AbreviateFull[k]].description;
				tooltipComponent3.tooltipColor = HouseCardDefs.cards[HouseCardDefs.AbreviateFull[k]].color;
				tooltipComponent3.Awake();
				tooltipComponent3.UpdateCardTooltips();
			}
			HouseLoadoutOverview.OverviewPanel = val;
			HouseLoadoutOverview.OverviewButton = ((Component)val2).GetComponent<HGTextMeshProUGUI>();
		}

		private void SetUpEmotes()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			SurvivorCatalog.Init += (hook_Init)delegate(orig_Init orig)
			{
				orig.Invoke();
				if (!emoteAPIsetup)
				{
					emoteAPIsetup = true;
					foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
					{
						if (((Object)allSurvivorDef.bodyPrefab).name == "JavangleHouse")
						{
							GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("House_emote");
							CustomEmotesAPI.ImportArmature(allSurvivorDef.bodyPrefab, val, 0, true);
							val.GetComponentInChildren<BoneMapper>().scale = 1.1f;
							CustomEmotesAPI.CreateNameTokenSpritePair("JAVANGLE_HOUSE_BODY_NAME", Assets.mainAssetBundle.LoadAsset<Sprite>("HouseEmoteIconWheel"));
						}
					}
				}
			};
			CustomEmotesAPI.animChanged += new AnimationChanged(HouseHideMeshes);
		}

		private void HouseHideMeshes(string newAnimation, BoneMapper mapper)
		{
			if (!(((Object)mapper).name == "House_emote"))
			{
				return;
			}
			if (newAnimation != "none")
			{
				Animator componentInParent = ((Component)((Component)mapper).transform.parent).gameObject.GetComponentInParent<Animator>();
				ChildLocator componentInParent2 = ((Component)mapper).gameObject.GetComponentInParent<ChildLocator>();
				if (!Object.op_Implicit((Object)(object)componentInParent))
				{
					Debug.LogError((object)"Could not find Animator");
				}
				else
				{
					componentInParent.Play("EmoteWeapon", 8);
				}
			}
			else
			{
				Animator componentInParent3 = ((Component)((Component)mapper).transform.parent).gameObject.GetComponentInParent<Animator>();
				ChildLocator componentInParent4 = ((Component)mapper).gameObject.GetComponentInParent<ChildLocator>();
				if (!Object.op_Implicit((Object)(object)componentInParent3))
				{
					Debug.LogError((object)"Could not find Animator");
				}
				else
				{
					componentInParent3.Play("BufferEmpty", 8);
				}
			}
		}
	}
}
namespace HouseMod.SkillStates
{
	public class HouseMain : GenericCharacterMain
	{
		private Animator animator;

		private HouseController houseController;

		protected EntityStateMachine weaponStateMachine;

		public LocalUser localUser;

		public override void OnEnter()
		{
			((GenericCharacterMain)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			houseController = ((EntityState)this).GetComponent<HouseController>();
			localUser = LocalUserManager.readOnlyLocalUsersList[0];
			EntityStateMachine[] components = ((EntityState)this).gameObject.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (Object.op_Implicit((Object)(object)val) && val.customName == "Weapon")
				{
					weaponStateMachine = val;
				}
			}
		}

		public override void Update()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority && !localUser.isUIFocused)
			{
				KeyboardShortcut value = Config.CardSlot1.Value;
				if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
				{
					((EntityState)this).skillLocator.secondary.ExecuteIfReady();
					return;
				}
				value = Config.CardSlot2.Value;
				if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
				{
					((EntityState)this).skillLocator.utility.ExecuteIfReady();
					return;
				}
				value = Config.CardSlot3.Value;
				if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
				{
					((EntityState)this).skillLocator.special.ExecuteIfReady();
					return;
				}
			}
			((GenericCharacterMain)this).Update();
		}

		public override void FixedUpdate()
		{
			((GenericCharacterMain)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)animator))
			{
				float num = 1f;
				if (animator.GetBool("isGrounded"))
				{
					num = 0f;
				}
				animator.SetFloat("inAir", num);
				animator.SetBool("inCombat", !((EntityState)this).characterBody.outOfCombat || !((EntityState)this).characterBody.outOfDanger);
			}
		}
	}
}
namespace HouseMod.SkillStates.House
{
	public class BulletArtsEmpty : BaseSkillState
	{
		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			HousePassiveManager component = ((EntityState)this).GetComponent<HousePassiveManager>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				Debug.LogError((object)"[HouseError] UseCard could not find passiveManager");
				((EntityState)this).outer.SetNextStateToMain();
				return;
			}
			BaseShotSkill shotFromCylinder = component.GetShotFromCylinder();
			if (shotFromCylinder != null)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)shotFromCylinder);
			}
			else
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class BulletArtsQuickdraw : BaseSkillState
	{
		public static float potency = 0.45f;

		public static int chanceToFire = 4;

		public static float speedModifier = 0.4f;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			HousePassiveManager component = ((EntityState)this).GetComponent<HousePassiveManager>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				Debug.LogError((object)"[HouseError] UseCard could not find passiveManager");
				((EntityState)this).outer.SetNextStateToMain();
				return;
			}
			BaseShotSkill baseShotSkill = null;
			baseShotSkill = ((component.roulletePriorityShot != 0) ? component.GetShotFromCylinder() : ((component.roulleteOrderPosition <= 5 && component.random.Next(0, chanceToFire) != 0) ? ((BaseShotSkill)Activator.CreateInstance(((object)HouseShotDefs.shots[1].skillstate).GetType())) : component.GetShotFromCylinder()));
			baseShotSkill.potency = potency;
			baseShotSkill.baseDuration *= speedModifier;
			baseShotSkill.baseFireTime *= speedModifier;
			if (baseShotSkill != null)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)baseShotSkill);
			}
			else
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class HouseDeathState : GenericCharacterDeath
	{
		private Vector3 previousPosition;

		private float upSpeedVelocity;

		private float upSpeed;

		private Animator modelAnimator;

		public override bool shouldAutoDestroy => false;

		public override void OnEnter()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterDeath)this).OnEnter();
			Vector3 val = Vector3.up * 3f;
			HousePassiveManager component = ((EntityState)this).GetComponent<HousePassiveManager>();
			if (Object.op_Implicit((Object)(object)component))
			{
				if (component.RussianRouletteDeath)
				{
					((EntityState)this).PlayAnimation("FullBody, Override", "House2RRDeath");
					return;
				}
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					val += ((EntityState)this).characterMotor.velocity;
					((Behaviour)((EntityState)this).characterMotor).enabled = false;
				}
				if (Object.op_Implicit((Object)(object)((GenericCharacterDeath)this).cachedModelTransform))
				{
					RagdollController component2 = ((Component)((GenericCharacterDeath)this).cachedModelTransform).GetComponent<RagdollController>();
					if (Object.op_Implicit((Object)(object)component2))
					{
						component2.BeginRagdoll(val);
					}
				}
				return;
			}
			Debug.LogError((object)"[HouseError] I have a game injury, my game is injured, ow");
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				val += ((EntityState)this).characterMotor.velocity;
				((Behaviour)((EntityState)this).characterMotor).enabled = false;
			}
			if (Object.op_Implicit((Object)(object)((GenericCharacterDeath)this).cachedModelTransform))
			{
				RagdollController component3 = ((Component)((GenericCharacterDeath)this).cachedModelTransform).GetComponent<RagdollController>();
				if (Object.op_Implicit((Object)(object)component3))
				{
					component3.BeginRagdoll(val);
				}
			}
		}

		public override void PlayDeathAnimation(float crossfadeDuration = 0.1f)
		{
		}

		public override void FixedUpdate()
		{
			((GenericCharacterDeath)this).FixedUpdate();
			if (NetworkServer.active && ((EntityState)this).fixedAge > 4f)
			{
				EntityState.Destroy((Object)(object)((EntityState)this).gameObject);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)6;
		}
	}
	internal class StageDetonate : MonoBehaviour
	{
		public static StageDetonate instance;

		public bool isDetonated = false;

		private bool fired = false;

		private static float BaseTimeUntilDetonation = 210f;

		private static float BaseEscalationInterval = 30f;

		private float timeUntilDetonation;

		private float escalationInterval;

		private Text timer;

		private void Awake()
		{
			if (Object.op_Implicit((Object)(object)instance))
			{
				Debug.LogError((object)"[HouseError] There can only be one StageDetonate!!!!!!!");
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			instance = this;
			timeUntilDetonation = BaseTimeUntilDetonation;
			escalationInterval = BaseEscalationInterval;
			Escalate();
			timer = HouseGlobalHUDManager.StageDetonationTimer;
			HouseGlobalHUDManager.animator.SetBool("StageDetonate", true);
		}

		private void OnDestroy()
		{
			HouseGlobalHUDManager.animator.SetBool("StageDetonate", false);
		}

		private void FixedUpdate()
		{
			timeUntilDetonation -= Time.fixedDeltaTime;
			string text = TimeSpan.FromSeconds(Mathf.Max(timeUntilDetonation, 0f)).ToString("mm\\:ss\\:ff");
			timer.text = text;
			if (timeUntilDetonation <= 0f && !fired)
			{
				fired = true;
				HouseGlobalHUDManager.animator.Play("SDDetonate", 1);
			}
			if (NetworkServer.active)
			{
				escalationInterval -= Time.fixedDeltaTime;
				if (isDetonated)
				{
					RIPStage();
				}
				if (escalationInterval <= 0f)
				{
					escalationInterval = BaseEscalationInterval;
					Escalate();
				}
			}
		}

		private void RIPStage()
		{
			if (!NetworkServer.active)
			{
				return;
			}
			for (int i = -10; i < 20; i++)
			{
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)(sbyte)i);
				for (int num = teamMembers.Count - 1; num >= 0; num--)
				{
					TeamComponent val = teamMembers[num];
					CharacterBody component = ((Component)val).gameObject.GetComponent<CharacterBody>();
					if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.master))
					{
						component.master.TrueKill();
					}
				}
			}
		}

		private void Escalate()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				GameObject val = MasterCatalog.FindMasterPrefab("BrotherHauntMaster");
				GameObject val2 = Object.Instantiate<GameObject>(val, ((Component)this).transform.position, Quaternion.identity);
				CharacterMaster component = val2.GetComponent<CharacterMaster>();
				NetworkServer.Spawn(val2);
				component.SpawnBody(((Component)this).transform.position, Quaternion.identity);
				component.inventory.GiveItem(Items.InvadingDoppelganger.itemIndex, 1);
				component.inventory.GiveItem(Items.Ghost.itemIndex, 1);
			}
		}
	}
	public class StageDetonateNetworkComponent : INetMessage, ISerializableObject
	{
		public Vector3 pos;

		public Quaternion rot;

		public void OnReceived()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)StageDetonate.instance))
			{
				GameObject val = Object.Instantiate<GameObject>(Assets.StageDetonationVFX, pos, rot);
				NetworkServer.Spawn(val);
			}
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0003: 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)
			writer.Write(pos);
			writer.Write(rot);
		}

		public void Deserialize(NetworkReader reader)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			pos = reader.ReadVector3();
			rot = reader.ReadQuaternion();
		}
	}
	internal class WildRoom : MonoBehaviour
	{
		private enum WReffects
		{
			MadnessUp,
			MadnessDown,
			RandomBuffs,
			RandomHeal,
			RandomDamage,
			RollAgain,
			Slap,
			Teleport,
			Artifact,
			VehicleMadness,
			HealingCores,
			Mitchels,
			Length
		}

		public static WildRoom instance;

		public static float effectCooldown = 10f;

		public static int effectVariance = 10;

		public static float MadnessCDR = 0.5f;

		private int madnessLevel = 1;

		private float timeToNextEffect = 5f;

		private Random random;

		private float effectTimer = 0f;

		private bool effictFired = true;

		private int rolledEffect = 999;

		private int numberOfEffectsRolled = 0;

		private ArtifactDef artifactDef;

		private bool wasEnabled = false;

		private string[] bannedArtifacts = new string[1] { "" };

		private void Singleton()
		{
			if ((Object)(object)instance != (Object)null)
			{
				Debug.LogWarning((object)"[HouseError] Attempted to create a duplicate of WildRoom, there can only be one.");
				Object.Destroy((Object)(object)this);
			}
			else
			{
				instance = this;
			}
		}

		private void Awake()
		{
			Singleton();
			for (int num = HouseGlobalHUDManager.WildWheel.Length - 1; num >= 0; num--)
			{
				HouseGlobalHUDManager.instance.WheelTextRandom(num + 1);
			}
			Util.PlaySound("House_WildRoomStart", ((Component)this).gameObject);
			HouseGlobalHUDManager.WildWheel[2].text = "Wildroom";
			random = new Random();
			HouseGlobalHUDManager.animator.SetBool("Wildroom", true);
			HouseGlobalHUDManager.WildMadnessLevel.text = madnessLevel.ToString();
		}

		private void OnDestroy()
		{
			Debug.Log((object)"[HouseMessage] Wildroom OnDestroy");
			if (Object.op_Implicit((Object)(object)HouseGlobalHUDManager.animator))
			{
				HouseGlobalHUDManager.animator.SetBool("Wildroom", false);
			}
			if (Object.op_Implicit((Object)(object)artifactDef))
			{
				RunArtifactManager.instance.SetArtifactEnabledServer(artifactDef, wasEnabled);
			}
			Util.PlaySound("House_WildRoomEnd", ((Component)this).gameObject);
		}

		private void FixedUpdate()
		{
			if (NetworkServer.active)
			{
				timeToNextEffect -= Time.fixedDeltaTime;
				if (timeToNextEffect < 0f)
				{
					float num = effectCooldown + (float)random.Next(effectVariance);
					timeToNextEffect = num - num * (1f - 1f / (MadnessCDR * (float)(madnessLevel - 1) + 1f)) + 2.1f;
					NetMessageExtensions.Send((INetMessage)(object)new WildRoomNetworkComponent
					{
						WildRoomRoll = random.Next(12)
					}, (NetworkDestination)1);
				}
			}
			if (!effictFired)
			{
				effectTimer -= Time.fixedDeltaTime;
				if (effectTimer < 0f)
				{
					effictFired = true;
					PlayEffect(rolledEffect);
				}
			}
		}

		public void SetEffect(int roll)
		{
			if (numberOfEffectsRolled < 5 && roll == 1)
			{
				roll = 0;
			}
			switch (roll)
			{
			default:
				Debug.LogError((object)"[HouseError] Wildroom networked roll was outside the list");
				break;
			case 0:
				HouseGlobalHUDManager.SpinTheWheel("Increase Madness");
				break;
			case 1:
				HouseGlobalHUDManager.SpinTheWheel("Decrease Madness");
				break;
			case 2:
				HouseGlobalHUDManager.SpinTheWheel("Random Status");
				break;
			case 3:
				HouseGlobalHUDManager.SpinTheWheel("Heal All Random");
				break;
			case 4:
				HouseGlobalHUDManager.SpinTheWheel("Damage All Random");
				break;
			case 5:
				HouseGlobalHUDManager.SpinTheWheel("ReRoll");
				break;
			case 6:
				HouseGlobalHUDManager.SpinTheWheel("Slap");
				break;
			case 7:
				HouseGlobalHUDManager.SpinTheWheel("Warp");
				break;
			case 8:
				HouseGlobalHUDManager.SpinTheWheel("Temporary Artifact");
				break;
			case 9:
				HouseGlobalHUDManager.SpinTheWheel("Beep Beep");
				break;
			case 10:
				HouseGlobalHUDManager.SpinTheWheel("Core Blimey!");
				break;
			case 11:
				HouseGlobalHUDManager.SpinTheWheel("King's Haunt");
				break;
			}
			rolledEffect = roll;
			numberOfEffectsRolled++;
			effectTimer = 2f;
			effictFired = false;
		}

		private void PlayEffect(int Effect)
		{
			switch (Effect)
			{
			default:
				Debug.LogError((object)"[HouseError] Wildroom networked roll was outside the list");
				break;
			case 0:
				MadnessUp();
				break;
			case 1:
				MadnessDown();
				break;
			case 2:
				RandomBuffs();
				break;
			case 3:
				RandomHeals();
				break;
			case 4:
				RandomDamage();
				break;
			case 5:
				ReRoll();
				break;
			case 6:
				RandomSlap();
				break;
			case 7:
				Teleportation();
				break;
			case 8:
				RandomArtifact();
				break;
			case 9:
				VehicleMadness();
				break;
			case 10:
				HealingCores();
				break;
			case 11:
				Mitchels();
				break;
			}
		}

		public void MadnessUp()
		{
			madnessLevel++;
			HouseGlobalHUDManager.WildMadnessLevel.text = madnessLevel.ToString();
		}

		private void MadnessDown()
		{
			madnessLevel--;
			HouseGlobalHUDManager.WildMadnessLevel.text = madnessLevel.ToString();
			if (madnessLevel <= 0)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private void ReRoll()
		{
			if (NetworkServer.active)
			{
				timeToNextEffect = 0.75f;
			}
		}

		private void RandomBuffs()
		{
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			if (!NetworkServer.active)
			{
				return;
			}
			for (int i = -10; i < 20; i++)
			{
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)(sbyte)i);
				for (int num = teamMembers.Count - 1; num >= 0; num--)
				{
					try
					{
						TeamComponent val = teamMembers[num];
						if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).gameObject))
						{
							try
							{
								CharacterBody component = ((Component)val).gameObject.GetComponent<CharacterBody>();
								if (Object.op_Implicit((Object)(object)component) && (!component.isPlayerControlled || component.baseNameToken == "JAVANGLE_HOUSE_BODY_NAME"))
								{
									try
									{
										component.AddTimedBuff(BuffCatalog.buffDefs[random.Next(BuffCatalog.buffDefs.Length)], 10f);
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] RandomBuffs Failed to apply buff to target");
									}
									try
									{
										Util.PlaySound("HouseCard_Wildcard", ((Component)component).gameObject);
										EffectManager.SpawnEffect(Assets.VFXcardWildCard, new EffectData
										{
											origin = component.footPosition,
											rootObject = ((Component)component).gameObject,
											scale = 1f
										}, true);
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] RandomBuffs Failed to spawn VFX");
									}
								}
							}
							catch
							{
								Debug.LogWarning((object)"[HouseError] RandomBuffs Failed to find body");
							}
						}
					}
					catch
					{
						Debug.LogWarning((object)"[HouseError] RandomBuffs Failed to find target");
					}
				}
			}
		}

		private void RandomHeals()
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			for (int i = -10; i < 20; i++)
			{
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)(sbyte)i);
				for (int num = teamMembers.Count - 1; num >= 0; num--)
				{
					try
					{
						TeamComponent val = teamMembers[num];
						if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).gameObject))
						{
							try
							{
								CharacterBody component = ((Component)val).gameObject.GetComponent<CharacterBody>();
								if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent))
								{
									try
									{
										float num2 = ((float)random.Next(70) + 30f) / 100f;
										component.healthComponent.HealFraction(num2, default(ProcChainMask));
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] RandomHeals Failed to Heal target");
									}
									try
									{
										Util.PlaySound("HouseCard_Heart", ((Component)component).gameObject);
										EffectManager.SpawnEffect(Assets.VFXcardHearts, new EffectData
										{
											origin = component.footPosition,
											rootObject = ((Component)component).gameObject,
											scale = 1f
										}, true);
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] RandomHeals Failed to spawn VFX");
									}
								}
							}
							catch
							{
								Debug.LogWarning((object)"[HouseError] RandomHeals Failed to find body");
							}
						}
					}
					catch
					{
						Debug.LogWarning((object)"[HouseError] RandomHeals Failed to find target");
					}
				}
			}
		}

		private void RandomDamage()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			DamageInfo val = new DamageInfo
			{
				attacker = ((Component)this).gameObject,
				damage = 0f,
				force = Vector3.zero,
				crit = false,
				damageColorIndex = (DamageColorIndex)0,
				damageType = (DamageType)66,
				inflictor = null,
				position = Vector3.zero,
				procChainMask = default(ProcChainMask),
				procCoefficient = 0f
			};
			for (int i = -10; i < 20; i++)
			{
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)(sbyte)i);
				for (int num = teamMembers.Count - 1; num >= 0; num--)
				{
					try
					{
						TeamComponent val2 = teamMembers[num];
						if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Component)val2).gameObject))
						{
							try
							{
								CharacterBody component = ((Component)val2).gameObject.GetComponent<CharacterBody>();
								if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent) && (!component.isPlayerControlled || component.baseNameToken == "JAVANGLE_HOUSE_BODY_NAME"))
								{
									try
									{
										float num2 = ((float)random.Next(35) + 5f) / 100f;
										val.damage = component.healthComponent.fullCombinedHealth * num2;
										val.position = component.corePosition;
										component.healthComponent.TakeDamage(val);
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] RandomDamage Failed to Damage target");
									}
									try
									{
										Util.PlaySound("HouseCard_Bust", ((Component)component).gameObject);
										EffectManager.SpawnEffect(Assets.VFXcardBust, new EffectData
										{
											origin = component.footPosition,
											rootObject = ((Component)component).gameObject,
											scale = 1f
										}, true);
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] RandomDamage Failed to spawn VFX");
									}
								}
							}
							catch
							{
								Debug.LogWarning((object)"[HouseError] RandomDamage Failed to find body");
							}
						}
					}
					catch
					{
						Debug.LogWarning((object)"[HouseError] RandomDamage Failed to find target");
					}
				}
			}
		}

		private void RandomSlap()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Expected O, but got Unknown
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			DamageInfo val = new DamageInfo
			{
				attacker = ((Component)this).gameObject,
				damage = 0f,
				force = Vector3.zero,
				crit = false,
				damageColorIndex = (DamageColorIndex)0,
				damageType = (DamageType)66,
				inflictor = null,
				position = Vector3.zero,
				procChainMask = default(ProcChainMask),
				procCoefficient = 0f
			};
			for (int i = -10; i < 20; i++)
			{
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)(sbyte)i);
				for (int num = teamMembers.Count - 1; num >= 0; num--)
				{
					try
					{
						TeamComponent val2 = teamMembers[num];
						if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Component)val2).gameObject))
						{
							try
							{
								CharacterBody component = ((Component)val2).gameObject.GetComponent<CharacterBody>();
								if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent) && (!component.isPlayerControlled || component.baseNameToken == "JAVANGLE_HOUSE_BODY_NAME"))
								{
									try
									{
										float num2 = random.Next(5000);
										if (Object.op_Implicit((Object)(object)component.characterMotor) && component.characterMotor.isGrounded)
										{
											num2 *= 2f;
										}
										Vector3 val3 = new Vector3((float)random.Next(200) - 100f, (float)random.Next(133) - 33f, (float)random.Next(200) - 100f);
										val.force = ((Vector3)(ref val3)).normalized * num2;
										val.position = component.corePosition;
										component.healthComponent.TakeDamage(val);
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] RandomSlap Failed to Slap target");
									}
									try
									{
										Util.PlaySound("HouseCard_Wildcard", ((Component)component).gameObject);
										EffectManager.SpawnEffect(Assets.VFXcardWildCard, new EffectData
										{
											origin = component.footPosition,
											rootObject = ((Component)component).gameObject,
											scale = 1f
										}, true);
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] RandomSlap Failed to spawn VFX");
									}
								}
							}
							catch
							{
								Debug.LogWarning((object)"[HouseError] RandomSlap Failed to find body");
							}
						}
					}
					catch
					{
						Debug.LogWarning((object)"[HouseError] RandomSlap Failed to find target");
					}
				}
			}
		}

		private void Teleportation()
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			Node[] nodes = SceneInfo.instance.groundNodes.nodes;
			for (int i = -10; i < 20; i++)
			{
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)(sbyte)i);
				for (int num = teamMembers.Count - 1; num >= 0; num--)
				{
					try
					{
						TeamComponent val = teamMembers[num];
						if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).gameObject))
						{
							try
							{
								CharacterBody component = ((Component)val).gameObject.GetComponent<CharacterBody>();
								if (Object.op_Implicit((Object)(object)component) && (!component.isPlayerControlled || component.baseNameToken == "JAVANGLE_HOUSE_BODY_NAME"))
								{
									try
									{
										Vector3 position = nodes[random.Next(nodes.Length)].position;
										TeleportHelper.TeleportBody(component, position);
										GameObject teleportEffectPrefab = Run.instance.GetTeleportEffectPrefab(((Component)component).gameObject);
										if (Object.op_Implicit((Object)(object)teleportEffectPrefab))
										{
											EffectManager.SimpleEffect(teleportEffectPrefab, position, Quaternion.identity, true);
										}
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] Teleportation Failed to Warp target");
									}
								}
							}
							catch
							{
								Debug.LogWarning((object)"[HouseError] Teleportation Failed to find body");
							}
						}
					}
					catch
					{
						Debug.LogWarning((object)"[HouseError] Teleportation Failed to find target");
					}
				}
			}
		}

		private void VehicleMadness()
		{
			//IL_01bb: 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_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			for (int i = -10; i < 20; i++)
			{
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)(sbyte)i);
				for (int num = teamMembers.Count - 1; num >= 0; num--)
				{
					try
					{
						TeamComponent val = teamMembers[num];
						if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).gameObject))
						{
							try
							{
								CharacterBody component = ((Component)val).gameObject.GetComponent<CharacterBody>();
								if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent) && (!component.isPlayerControlled || component.baseNameToken == "JAVANGLE_HOUSE_BODY_NAME") && ((double)Math.Abs(component.healthComponent.combinedHealth - component.healthComponent.fullCombinedHealth) < 1E-09 || component.isPlayerControlled))
								{
									try
									{
										string text = ((random.Next(2) == 0) ? "PotMobileBody" : "HaulerBody");
										Debug.Log((object)("[HouseMessage] transforming to: " + text));
										GameObject bodyPrefab = component.master.bodyPrefab;
										Transform transform = component.transform;
										transform.position += Vector3.up * 5f;
										component.master.TransformBody(text);
										component.master.bodyPrefab = bodyPrefab;
										PolymorphBuffComponent val2 = ((Component)component.master).gameObject.AddComponent<PolymorphBuffComponent>();
										val2.buffDuration = random.Next(5, 15);
										val2.master = component.master;
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] VehicleMadness Failed to transform target");
									}
									try
									{
										Util.PlaySound("HouseCard_Wildcard", ((Component)component).gameObject);
										EffectManager.SpawnEffect(Assets.VFXcardWildCard, new EffectData
										{
											origin = component.footPosition,
											scale = 1f
										}, true);
									}
									catch
									{
										Debug.LogWarning((object)"[HouseError] VehicleMadness Failed to spawn VFX");
									}
								}
							}
							catch
							{
								Debug.LogWarning((object)"[HouseError] VehicleMadness Failed to find body");
							}
						}
					}
					catch
					{
						Debug.LogWarning((object)"[HouseError] VehicleMadness Failed to find target");
					}
				}
			}
		}

		private void HealingCores()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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)
			if (!NetworkServer.active)
			{
				return;
			}
			Node[] nodes = SceneInfo.instance.groundNodes.nodes;
			for (int num = random.Next(7, 23); num > 0; num--)
			{
				Vector3 position = nodes[random.Next(nodes.Length)].position;
				position += new Vector3(0f, 4f, 0f);
				GameObject val = MasterCatalog.FindMasterPrefab("AffixEarthHealerMaster");
				GameObject val2 = Object.Instantiate<GameObject>(val, position, Quaternion.identity);
				CharacterMaster component = val2.GetComponent<CharacterMaster>();
				component.teamIndex = (TeamIndex)0;
				switch (random.Next(3))
				{
				default:
					Debug.LogWarning((object)"Wildroom healingcores OnDeath index out of range");
					break;
				case 0:
					component.inventory.SetEquipmentIndex(Equipment.AffixWhite.equipmentIndex);
					break;
				case 1:
					component.inventory.SetEquipmentIndex(Equipment.AffixPoison.equipmentIndex);
					break;
				case 2:
					component.inventory.SetEquipmentIndex(Elites.Earth.eliteEquipmentDef.equipmentIndex);
					break;
				}
				NetworkServer.Spawn(val2);
				component.SpawnBody(position, Quaternion.identity);
			}
		}

		private void Mitchels()
		{
			//IL_0046: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				Node[] nodes = SceneInfo.instance.groundNodes.nodes;
				for (int num = random.Next(3, 8); num > 0; num--)
				{
					Vector3 position = nodes[random.Next(nodes.Length)].position;
					position += new Vector3(0f, 7f, 0f);
					GameObject val = MasterCatalog.FindMasterPrefab("BrotherGlassMaster");
					GameObject val2 = Object.Instantiate<GameObject>(val, position, Quaternion.identity);
					CharacterMaster component = val2.GetComponent<CharacterMaster>();
					component.teamIndex = (TeamIndex)((random.Next(2) != 0) ? 3 : 0);
					component.inventory.GiveItem(Items.HealthDecay, random.Next(10, 21));
					NetworkServer.Spawn(val2);
					component.SpawnBody(position, Quaternion.identity);
				}
			}
		}

		private void RandomArtifact()
		{
			if (NetworkServer.active)
			{
				if (Object.op_Implicit((Object)(object)artifactDef))
				{
					RunArtifactManager.instance.SetArtifactEnabledServer(artifactDef, wasEnabled);
				}
				artifactDef = ArtifactCatalog.artifactDefs[random.Next(ArtifactCatalog.artifactDefs.Length)];
				if ((Object)(object)artifactDef == (Object)(object)Artifacts.TeamDeath || (Object)(object)artifactDef == (Object)(object)Artifacts.ShadowClone || (Object)(object)artifactDef == (Object)(object)Artifacts.Glass)
				{
					RandomArtifact();
					return;
				}
				wasEnabled = RunArtifactManager.instance.IsArtifactEnabled(artifactDef);
				RunArtifactManager.instance.SetArtifactEnabledServer(artifactDef, true);
			}
		}
	}
	public class WildRoomNetworkComponent : INetMessage, ISerializableObject
	{
		public int WildRoomRoll = 999;

		public void OnReceived()
		{
			if (WildRoomRoll == 999)
			{
				Debug.LogWarning((object)"[HouseError] Wildroom network failure");
			}
			else
			{
				WildRoom.instance.SetEffect(WildRoomRoll);
			}
		}

		public void Serialize(NetworkWriter writer)
		{
			writer.Write(WildRoomRoll);
		}

		public void Deserialize(NetworkReader reader)
		{
			WildRoomRoll = reader.ReadInt32();
		}
	}
	internal class HouseGlobalHUDManager : MonoBehaviour
	{
		public static HouseGlobalHUDManager instance;

		private static Random random;

		public static Animator animator;

		public static Text StageDetonationTimer;

		public static Text[] WildWheel;

		public static Text WildMadnessLevel;

		private static string result = "Ooops";

		private static string[] DummyResponses = new string[56]
		{
			"Die IRL",
			"C.U.M 3",
			"Automatic Loss",
			"Manual Win",
			"Go to Jail",
			"Shadow Realm",
			HousePlugin.GOTCEInstalled ? "Uninstall GOTCE" : "Install GOTCE",
			"Get Green",
			"Get !Yellow",
			"Gravity Displeases Me!",
			"Go To Ambry",
			"Go To AI Test",
			"Big Wins",
			"The Game",
			"Gamble, Idiots",
			"End the Run",
			"Instant Death",
			"These aren't real",
			"Spin Again",
			"The Wheel Spins!",
			"Spin, wheel! Spin!",
			"Big Heads",
			"Teeny, tiny Heads",
			"Plague of Dancing",
			"Jarate",
			"Ubercharge",
			"Two Crows",
			"Garbage Goober",
			"Jerry (Spin Again)",
			"Kyle 2.0",
			"Bag of Meat",
			"Trivia",
			"Nothing",
			"Learn Canon Heights",
			"Spontanious Combustion",
			"Pineapple Pizza",
			"Horde of Many: Gip",
			"All become House",
			"Slab War",
			"Blind Pest Boss",
			"Voidtouched Polyp",
			"House Crisis",
			"Gain 100 free items",
			"Balls will stay",
			"Truth or Dare",
			"ALL IN!",
			"Oops, all Random!",
			"Crowdfunder Buff",
			"Artificer Nerf",
			"Read me!",
			"Desync Cards",
			"Gold Rush",
			"Tiny Xi Construct",
			"Tonic Affliction",
			"Start Teleporter",
			"Loooooong House"
		};

		private void Singleton()
		{
			if ((Object)(object)instance != (Object)null)
			{
				Debug.LogWarning((object)"[HouseError] Attempted to create a duplicate of HouseGlobalHUDManager, there can only be one.");
				Object.Destroy((Object)(object)this);
			}
			else
			{
				instance = this;
			}
		}

		private void Awake()
		{
			Singleton();
			random = new Random();
			for (int num = WildWheel.Length - 1; num >= 0; num--)
			{
				WheelTextRandom(num + 1);
			}
		}

		public void DetonateStage()
		{
			StageDetonate.instance.isDetonated = true;
		}

		public static void SpinTheWheel(string ResultText)
		{
			result = ResultText;
			animator.Play("WildWheel", 3);
			Util.PlaySound("House_WildRoomRoll", ((Component)animator).gameObject);
		}

		public void WheelTextRandom(int wheelSlot)
		{
			if (wheelSlot == 0)
			{
				Debug.LogWarning((object)"[HouseError] WildWheel tried to index slot 0");
				return;
			}
			wheelSlot--;
			WildWheel[wheelSlot].text = DummyResponses[random.Next(DummyResponses.Length)];
		}

		public void WheelTextResult()
		{
			WildWheel[2].text = result;
		}
	}
	internal class HouseHUDManager : MonoBehaviour
	{
		public static HouseHUDManager instance;

		private static Sprite crossDot = Assets.mainAssetBundle.LoadAsset<Sprite>("DiamondAmmoIMG");

		public static HousePassiveManager passiveManager;

		public static RectTransform HouseCrosshair;

		public static Animator CrosshairAnimator;

		public static Image[] ShotAmmo;

		public static Image PrioityShot;

		public static Image[] Cylinders;

		public static Transform defualtUI;

		public static RectTransform HouseHotbar;

		public static Animator HotbarAnimator;

		public static Image[] CardArts;

		public static Image[] CardColour;

		public static TooltipComponent[] CardTooltips;

		public static Image[] HotbarIcons;

		public static Text[] HotbarCooldown;

		public static Text[] HotbarStocks;

		public static Text[] HotbarKeys;

		public static TooltipComponent[] HotbarTooltips;

		public static Text DrawPile;

		private int[] newHand = new int[3];

		private void Singleton()
		{
			if ((Object)(object)instance != (Object)null)
			{
				Debug.LogWarning((object)"[HouseError] Attempted to create a duplicate of HouseHUDManager, there can only be one.");
				Object.Destroy((Object)(object)this);
			}
			else
			{
				instance = this;
			}
		}

		private void Awake()
		{
			Singleton();
		}

		private void FixedUpdate()
		{
			UpdateCooldowns();
		}

		public void Reload(int priority, int[] bullets)
		{
			CrosshairAnimator.Play("Reload", 0);
			UpdateAmmo(priority, bullets);
		}

		public void UpdateAmmo(int priority, int[] bullets)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (priority == 0)
			{
				PrioityShot.sprite = crossDot;
				((Graphic)PrioityShot).color = Color.white;
				((Component)PrioityShot).transform.localScale = Vector3.one;
			}
			else
			{
				PrioityShot.sprite = HouseShotDefs.shots[priority].icon;
				((Graphic)PrioityShot).color = HouseShotDefs.shots[priority].color;
				((Component)PrioityShot).transform.localScale = Vector3.one * 1.25f;
			}
			for (int i = 0; i < 6; i++)
			{
				ShotAmmo[i].sprite = HouseShotDefs.shots[bullets[i]].icon;
				((Graphic)ShotAmmo[i]).color = HouseShotDefs.shots[bullets[i]].color;
			}
		}

		public void NewHand(int[] newHandInt, string cardUsed = "Default")
		{
			newHandInt.CopyTo(newHand, 0);
			HotbarAnimator.Play("NewHand" + cardUsed, 0);
		}

		public void UpdateCardDisplay()
		{
			//IL_007c: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < 3; i++)
			{
				CardArts[i].sprite = HouseCardDefs.cards[newHand[i]].cardArt;
				CardTooltips[i].tooltipName = HouseCardDefs.cards[newHand[i]].name;
				CardTooltips[i].tooltipDescription = HouseCardDefs.cards[newHand[i]].description;
				CardTooltips[i].tooltipColor = HouseCardDefs.cards[newHand[i]].color;
				CardTooltips[i].UpdateCardTooltips();
				HotbarIcons[i + 1].sprite = HouseCardDefs.cards[newHand[i]].cardIcon;
				HotbarTooltips[i + 1].tooltipName = HouseCardDefs.cards[newHand[i]].name;
				HotbarTooltips[i + 1].tooltipDescription = HouseCardDefs.cards[newHand[i]].description;
				HotbarTooltips[i + 1].tooltipColor = HouseCardDefs.cards[newHand[i]].color;
				HotbarTooltips[i + 1].UpdateCardTooltips();
				DrawPile.text = (passiveManager.gameDeck.Length - passiveManager.handPosition).ToString();
			}
		}

		private void UpdateCooldowns()
		{
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)passiveManager))
			{
				return;
			}
			for (int i = 0; i < 4; i++)
			{
				int num = Mathf.CeilToInt(passiveManager.characterBody.skillLocator.allSkills[i + 1].cooldownRemaining);
				HotbarCooldown[i].text = ((num > 0) ? num.ToString() : "");
				int stock = passiveManager.characterBody.skillLocator.allSkills[i + 1].stock;
				HotbarStocks[i].text = ((stock > 1) ? stock.ToString() : "");
				((Graphic)HotbarIcons[i]).color = ((stock > 0) ? Color.white : Color.grey);
				if (i > 0)
				{
					((Graphic)CardArts[i - 1]).color = (Color)((stock > 0) ? Color.white : new Color(0.2f, 0.2f, 0.2f, 1f));
				}
			}
			int num2 = Mathf.CeilToInt(passiveManager.characterBody.equipmentSlot.cooldownTimer);
			HotbarCooldown[4].text = ((num2 > 0) ? num2.ToString() : "");
			int stock2 = passiveManager.characterBody.equipmentSlot.stock;
			HotbarStocks[4].text = ((stock2 > 1) ? stock2.ToString() : "");
			EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(passiveManager.characterBody.equipmentSlot.equipmentIndex);
			HotbarIcons[4].sprite = (Object.op_Implicit((Object)(object)equipmentDef) ? equipmentDef.pickupIconSprite : null);
			((Graphic)HotbarIcons[4]).color = ((stock2 > 0 && Object.op_Implicit((Object)(object)equipmentDef)) ? Color.white : Color.grey);
			HotbarTooltips[4].tooltipName = (Object.op_Implicit((Object)(object)equipmentDef) ? equipmentDef.nameToken : "");
			HotbarTooltips[4].tooltipDescription = (Object.op_Implicit((Object)(object)equipmentDef) ? equipmentDef.descriptionToken : "");
			HotbarTooltips[4].UpdateCardTooltips();
		}

		public void UpdatePrimaryIconAndHotkeys()
		{
			HotbarIcons[0].sprite = passiveManager.characterBody.skillLocator.primary.icon;
			HotbarTooltips[0].tooltipName = passiveManager.characterBody.skillLocator.primary.skillNameToken;
			HotbarTooltips[0].tooltipDescription = passiveManager.characterBody.skillLocator.primary.skillDescriptionToken;
			HotbarTooltips[0].UpdateCardTooltips();
			MPEventSystem eventSystem = passiveManager.characterBody.master.playerCharacterMasterController.networkUser.localUser.eventSystem;
			HotbarKeys[0].text = Glyphs.GetGlyphString(eventSystem, "PrimarySkill", (AxisRange)0, (InputSource)0);
			HotbarKeys[1].text = Glyphs.GetGlyphString(eventSystem, "SecondarySkill", (AxisRange)0, (InputSource)0);
			HotbarKeys[2].text = Glyphs.GetGlyphString(eventSystem, "UtilitySkill", (AxisRange)0, (InputSource)0);
			HotbarKeys[3].text = Glyphs.GetGlyphString(eventSystem, "SpecialSkill", (AxisRange)0, (InputSource)0);
		}

		public void EnableHUD()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)HouseCrosshair))
			{
				Debug.LogError((object)"[HouseError] HouseHUDManager enabled without HouseCrosshair");
				return;
			}
			if (!Object.op_Implicit((Object)(object)HouseHotbar))
			{
				Debug.LogError((object)"[HouseError] HouseHUDManager enabled without HouseHotbar");
				return;
			}
			if (!Object.op_Implicit((Object)(object)defualtUI))
			{
				Debug.LogError((object)"[HouseError] HouseHUDManager enabled without DefaultUI");
				return;
			}
			((Transform)HouseCrosshair).localScale = Vector2.op_Implicit(Vector2.one * Config.crosshairScale.Value);
			((Transform)HouseHotbar).localScale = Vector2.op_Implicit(Vector2.one * Config.hudScale.Value);
			defualtUI.localScale = Vector2.op_Implicit(Vector2.zero);
		}

		public void DisableHUD()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			((Transform)HouseCrosshair).localScale = Vector2.op_Implicit(Vector2.zero);
			((Transform)HouseHotbar).localScale = Vector2.op_Implicit(Vector2.zero);
			defualtUI.localScale = Vector2.op_Implicit(Vector2.one);
		}
	}
	internal class HouseLoadoutOverview : MonoBehaviour
	{
		public static HouseLoadoutOverview instance;

		public static GameObject OverviewPanel;

		public static HGTextMeshProUGUI OverviewButton;

		public static bool isHouse;

		private bool activating = false;

		private float cooldown = 0f;

		private void Awake()
		{
			if (Object.op_Implicit((Object)(object)instance))
			{
				Debug.LogError((object)"[HouseError] tried to create multiple instances of HouseLoadoutOverview");
				Object.Destroy((Object)(object)this);
			}
			else
			{
				instance = this;
			}
		}

		private void FixedUpdate()
		{
			if (activating)
			{
				cooldown -= Time.fixedDeltaTime;
				bool flag = true;
				activating = false;
				SetCardOverviewDelayed();
			}
		}

		private void SetCardOverviewDelayed()
		{
			((TMP_Text)OverviewButton).text = "Cards";
		}

		public static void SetCardOverview()
		{
			if (!Object.op_Implicit((Object)(object)instance))
			{
				Debug.LogError((object)"[HouseError] No instance of HouseLoadoutOverview found");
				return;
			}
			instance.cooldown = 0.1f;
			instance.activating = true;
		}

		public static void UnsetCardOverview()
		{
			((TMP_Text)OverviewButton).text = "Overview";
		}
	}
	internal class HousePassiveManager : MonoBehaviour
	{
		public CharacterBody characterBody;

		public bool Initialised = false;

		public float InitTime = 0.5f;

		public bool isAuthority;

		public int roulletePriorityShot = 0;

		public int[] roulleteAmmo = new int[6] { 1, 1, 1, 1, 1, 1 };

		public int[] roulleteOrder = new int[6] { 0, 1, 2, 3, 4, 5 };

		public int roulleteOrderPosition = 0;

		public int[] gameDeck;

		public int[] handCards = new int[3];

		public int handPosition = 0;

		public int LoadArt = 0;

		public int CardArt = 0;

		public Random random = new Random();

		public CombatDirector combatDirector;

		public float costScaler = 1f;

		public bool RussianRouletteDeath = false;

		public static bool isKKAInstalled;

		public float MissileInterval = 0f;

		public int MissileCount = 0;

		private void Awake()
		{
			characterBody = ((Component)this).GetComponent<CharacterBody>();
			((Component)this).gameObject.SetActive(false);
			combatDirector = ((Component)this).gameObject.AddComponent<CombatDirector>();
			combatDirector.moneyWaveIntervals = (RangeFloat[])(object)new RangeFloat[1];
			((Component)this).gameObject.SetActive(true);
		}

		private void Start()
		{
			costScaler = Mathf.Pow(Run.instance.difficultyCoefficient, 1.25f);
			RussianRouletteDeath = false;
		}

		private void OnDestroy()
		{
			if (isAuthority)
			{
				HouseHUDManager.instance.DisableHUD();
			}
		}

		private void FixedUpdate()
		{
			Initialise();
			CardMissiles();
			if (isKKAInstalled)
			{
				KKAupdate();
			}
		}

		private void CardMissiles()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			if (MissileCount <= 0)
			{
				return;
			}
			MissileInterval -= Time.fixedDeltaTime;
			if (!(MissileInterval <= 0f))
			{
				return;
			}
			MissileInterval = 0.12f;
			MissileCount--;
			if (Util.HasEffectiveAuthority(characterBody.networkIdentity))
			{
				FireProjectileInfo val = default(FireProjectileInfo);
				val.position = characterBody.corePosition;
				val.rotation = Quaternion.LookRotation(Vector3.up + Random.insideUnitSphere * 0.3f);
				val.crit = characterBody.RollCrit();
				val.damageColorIndex = (DamageColorIndex)0;
				val.owner = ((Component)this).gameObject;
				val.procChainMask = default(ProcChainMask);
				val.force = 0f;
				val.useFuseOverride = false;
				val.useSpeedOverride = false;
				switch (random.Next(2))
				{
				case 0:
					val.projectilePrefab = Projectiles.PositiveCardMissilePrefab;
					val.damage = characterBody.damage * 0.7f;
					break;
				case 1:
					val.projectilePrefab = Projectiles.NeutralCardMissilePrefab;
					val.damage = characterBody.damage * 2.5f;
					break;
				}
				ProjectileManager.instance.FireProjectile(val);
			}
		}

		public BaseShotSkill GetShotFromCylinder()
		{
			if (roulletePriorityShot != 0)
			{
				int num = roulletePriorityShot;
				roulletePriorityShot = 0;
				if (isAuthority)
				{
					HouseHUDManager.instance.UpdateAmmo(roulletePriorityShot, roulleteAmmo);
				}
				return (BaseShotSkill)Activator.CreateInstance(((object)HouseShotDefs.shots[num].skillstate).GetType());
			}
			if (roulleteOrderPosition > 5)
			{
				return (BaseShotSkill)Activator.CreateInstance(((object)HouseShotDefs.shots[0].skillstate).GetType());
			}
			int num2 = roulleteAmmo[roulleteOrder[roulleteOrderPosition]];
			roulleteAmmo[roulleteOrder[roulleteOrderPosition]] = 0;
			roulleteOrderPosition++;
			if (isAuthority)
			{
				HouseHUDManager.instance.UpdateAmmo(roulletePriorityShot, roulleteAmmo);
			}
			return (BaseShotSkill)Activator.CreateInstance(((object)HouseShotDefs.shots[num2].skillstate).GetType());
		}

		public BaseCardSkill GetCardFromSlot(int slotNo)
		{
			Reload(HouseCardDefs.cards[handCards[slotNo]].type);
			return (BaseCardSkill)Activator.CreateInstance(((object)HouseCardDefs.cards[handCards[slotNo]].skillstate).GetType());
		}

		public void NextHand(string slotNo = "Default")
		{
			for (int i = 0; i < 3; i++)
			{
				handCards[i] = gameDeck[handPosition];
				handPosition++;
				if (handPosition > gameDeck.Length - 1)
				{
					Shuffle(gameDeck);
					handPosition = 0;
					Util.PlaySound("House_Shuffle", ((Component)this).gameObject);
				}
			}
			if (isAuthority)
			{
				HouseHUDManager.instance.NewHand(handCards, slotNo);
			}
		}

		private void Reload(HouseCard.CardType type)
		{
			switch (LoadArt)
			{
			default:
				Debug.LogError((object)"[HouseError] HousePassiveManager was unable to find LoadArt");
				gameDeck = HouseCardDefs.DeckStandardSpread;
				break;
			case 0:
				ReloadStandard(type);
				break;
			case 1:
				ReloadAllIn();
				break;
			}
			if (isAuthority)
			{
				HouseHUDManager.instance.Reload(roulletePriorityShot, roulleteAmmo);
			}
		}

		private void ReloadStandard(HouseCard.CardType type)
		{
			roulleteOrderPosition = 0;
			Shuffle(roulleteOrder);
			roulleteAmmo = new int[6] { 1, 1, 1, 1, 1, 1 };
			if (random.Next(2) != 0)
			{
				return;
			}
			for (int num = random.Next(2) + 1; num > 0; num--)
			{
				int[] array = new int[1] { 1 };
				switch (type)
				{
				default:
					Debug.LogWarning((object)"[HouseError] PassiveManager was told that the card had no type.");
					break;
				case HouseCard.CardType.Positive:
					array = HouseShotDefs.positiveShots;
					break;
				case HouseCard.CardType.Negative:
					array = HouseShotDefs.negativeShots;
					break;
				case HouseCard.CardType.Neutral:
					array = HouseShotDefs.neutralShots;
					break;
				case HouseCard.CardType.Random:
					array = HouseShotDefs.randomShots;
					break;
				}
				roulleteAmmo[random.Next(6)] = array[random.Next(array.Length)];
			}
		}

		private void ReloadAllIn()
		{
			roulleteOrderPosition = 0;
			Shuffle(roulleteOrder);
			roulleteAmmo = new int[6] { 5, 5, 5, 5, 5, 5 };
			for (int num = random.Next(6); num > 0; num--)
			{
				roulleteAmmo[roulleteOrder[num]] = HouseShotDefs.positiveShots[random.Next(HouseShotDefs.positiveShots.Length)];
			}
			Shuffle(roulleteOrder);
		}

		public void Shuffle(int[] array)
		{
			for (int num = array.Length - 1; num > 0; num--)
			{
				int num2 = random.Next(0, num + 1);
				int num3 = array[num];
				array[num] = array[num2];
				array[num2] = num3;
			}
		}

		private void Initialise()
		{
			if (Initialised)
			{
				return;
			}
			InitTime -= Time.fixedDeltaTime;
			if (!(InitTime <= 0f))
			{
				return;
			}
			SkillLocator skillLocator = characterBody.skillLocator;
			if (!Object.op_Implicit((Object)(object)skillLocator))
			{
				Debug.LogError((object)"[HouseError] HousePassiveManager was unable to find SkillLocator");
				gameDeck = HouseCardDefs.DeckStandardSpread;
			}
			else
			{
				GenericSkill val = characterBody.skillLocator.allSkills[0];
				string skillNameToken = val.skillNameToken;
				string text = skillNameToken;
				if (!(text == "JAVANGLE_HOUSE_STANDARDSPREAD_NAME"))
				{
					if (!(text == "JAVANGLE_HOUSE_FULLHOUSE_NAME"))
					{
						Debug.LogError((object)"[HouseError] HousePassiveManager was unable to find Deck");
						gameDeck = HouseCardDefs.DeckStandardSpread;
					}
					else
					{
						gameDeck = HouseCardDefs.DeckFullHouse;
					}
				}
				else
				{
					gameDeck = HouseCardDefs.DeckStandardSpread;
				}
				GenericSkill val2 = characterBody.skillLocator.allSkills[2];
				string skillNameToken2 = val2.skillNameToken;
				string text2 = skillNameToken2;
				if (!(text2 == "JAVANGLE_HOUSE_RELOADSTANDARD_NAME"))
				{
					if (!(text2 == "JAVANGLE_HOUSE_RELOADALLIN_NAME"))
					{
						Debug.LogError((object)"[HouseError] HousePassiveManager was unable to find ReloadArt");
					}
					else
					{
						LoadArt = 1;
					}
				}
				else
				{
					LoadArt = 0;
				}
				GenericSkill val3 = characterBody.skillLocator.allSkills[3];
				string skillNameToken3 = val3.skillNameToken;
				string text3 = skillNameToken3;
				if (!(text3 == "JAVANGLE_HOUSE_CARDARTSHOP_NAME"))
				{
					if (!(text3 == "JAVANGLE_HOUSE_CARDARTSSWEEP_NAME"))
					{
						Debug.LogError((object)"[HouseError] HousePassiveManager was unable to find CardArt");
					}
					else
					{
						CardArt = 1;
					}
				}
				else
				{
					CardArt = 0;
				}
			}
			Initialised = true;
			Shuffle(gameDeck);
			NextHand();
			Reload(HouseCard.CardType.Positive);
			bool flag = Util.HasEffectiveAuthority(characterBody.networkIdentity);
			isAuthority = flag && characterBody.isPlayerControlled;
			if (isAuthority)
			{
				HouseHUDManager.passiveManager = this;
				HouseHUDManager.instance.EnableHUD();
				HouseHUDManager.instance.UpdatePrimaryIconAndHotkeys();
				HouseHUDManager.instance.Reload(roulletePriorityShot, roulleteAmmo);
				HouseHUDManager.instance.NewHand(handCards);
			}
		}

		private void KKAupdate()
		{
			if (isAuthority && Object.op_Implicit((Object)(object)HouseHUDManager.HouseHotbar))
			{
				if (KingKombatArenaMainPlugin.s_GAME_MODE_ACTIVE && KingKombatArenaMainPlugin.IsInWaitingArea(((Component)characterBody).gameObject))
				{
					HouseHUDManager.instance.DisableHUD();
				}
				else
				{
					HouseHUDManager.instance.EnableHUD();
				}
			}
		}
	}
	public class LoadoutButton : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IDragHandler
	{
		private Image frame;

		private void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			frame = ((Component)((Component)this).transform.GetChild(0)).GetComponent<Image>();
			((Graphic)frame).color = Color.clear;
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			Util.PlaySound("Play_UI_menuHover", ((Component)RoR2Application.instance).gameObject);
			((Graphic)frame).color = new Color(1f, 1f, 1f, 1f);
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)frame).color = new Color(1f, 1f, 1f, 0f);
		}

		public void OnDrag(PointerEventData eventData)
		{
		}
	}
	public class UseCard : BaseSkillState
	{
		public int slotNo = 0;

		public override void OnEnter()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected I4, but got Unknown
			((BaseState)this).OnEnter();
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			HousePassiveManager component = ((EntityState)this).GetComponent<HousePassiveManager>();
			SkillLocator component2 = ((EntityState)this).GetComponent<SkillLocator>();
			if (!Object.op_Implicit((Object)(object)component2))
			{
				Debug.LogError((object)"[HouseError] UseCard could not find SkillLocator");
				((EntityState)this).outer.SetNextStateToMain();
				return;
			}
			if (!Object.op_Implicit((Object)(object)component))
			{
				Debug.LogError((object)"[HouseError] UseCard could not find passiveManager");
				((EntityState)this).outer.SetNextStateToMain();
				return;
			}
			SkillSlot val = component2.FindSkillSlot(((BaseSkillState)this).activatorSkillSlot);
			SkillSlot val2 = val;
			switch (val2 - 1)
			{
			default:
				Debug.LogError((object)"[HouseError:] UseCard has no slot number?");
				((EntityState)this).outer.SetNextStateToMain();
				break;
			case 0:
				slotNo = 0;
				((EntityState)this).outer.SetNextState((EntityState)(object)component.GetCardFromSlot(0));
				break;
			case 1:
				slotNo = 1;
				((EntityState)this).outer.SetNextState((EntityState)(object)component.GetCardFromSlot(1));
				break;
			case 2:
				slotNo = 2;
				((EntityState)this).outer.SetNextState((EntityState)(object)component.GetCardFromSlot(2));
				break;
			}
			component.NextHand(slotNo.ToString());
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
}
namespace HouseMod.SkillStates.House.TheGame
{
	internal class BaseCardSkill : BaseSkillState
	{
		public int CardNo = 0;

		public static float cooldown = 6f;

		public int[] cardCombo = new int[0];

		public bool isCombo = false;

		protected OverlapAttack attack;

		public GameObject cardSweepVFX = Assets.CardSweepPositive;

		public static float SweepDamage = 7f;

		public static float SweepShield = 0.15f;

		public float duration = 1f;

		public float activationTime = 0.35f;

		public bool hasActivated = false;

		public GameObject cardActivationVFX = Assets.VFXcardWildCard;

		public GameObject cardTypeActivationVFX = Assets.NeutralCardActivation;

		public string cardActivationSFX = "Card_Wilcard";

		public HousePassiveManager passiveManager;

		public static float hopDuration = 0.45f;

		public static float initialSpeedCoefficient = 7.5f;

		public static float finalSpeedCoefficient = 4f;

		public float hopSpeed;

		public Vector3 forwardDirection;

		public Vector3 previousPosition;

		public bool isGroundedStart;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			if (isCombo)
			{
				activationTime = 0.035f;
				duration = 0.1f;
			}
			passiveManager = ((EntityState)this).GetComponent<HousePassiveManager>();
			((EntityState)this).PlayAnimation("Gesture, Override Full", "UseCard", "UseCard.playbackRate", duration * 1.2f);
			CardHopOnEnter();
			CardSweepEnter();
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			CardHop();
			if (((EntityState)this).fixedAge >= activationTime)
			{
				Activate();
			}
			if (!(((EntityState)this).fixedAge >= duration))
			{
				return;
			}
			if (((EntityState)this).isAuthority && cardCombo.Length != 0)
			{
				BaseCardSkill baseCardSkill = (BaseCardSkill)Activator.CreateInstance(((object)HouseCardDefs.cards[cardCombo[0]].skillstate).GetType());
				baseCardSkill.isCombo = true;
				if (cardCombo.Length > 1)
				{
					int[] array = new int[cardCombo.Length - 1];
					for (int num = cardCombo.Length - 1; num > 0; num--)
					{
						array[num - 1] = cardCombo[num];
					}
					baseCardSkill.cardCombo = array;
				}
				((EntityState)this).outer.SetNextState((EntityState)(object)baseCardSkill);
			}
			else
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public virtual void CardHop()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_0147: 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_0160: 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)
			if (Object.op_Implicit((Object)(object)passiveManager) && passiveManager.CardArt == 0 && !isCombo && !isGroun