Decompiled source of RiskOfRamen v1.1.3

RiskOfRamen.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HG;
using HG.Reflection;
using LoadingScreenFix;
using On.RoR2;
using R2API;
using RiskOfRamen.Assets.Allocentrism;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Items;
using RoR2.Projectile;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("RiskOfRamen")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RiskOfRamen")]
[assembly: AssemblyTitle("RiskOfRamen")]
[assembly: OptIn]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
public class ProjectileTargetOrbiter : NetworkBehaviour
{
	[SyncVar]
	[SerializeField]
	private Vector3 offset;

	[SerializeField]
	[SyncVar]
	private float initialDegreesFromOwnerForward;

	[SerializeField]
	[SyncVar]
	private float degreesPerSecond;

	[SerializeField]
	[SyncVar]
	public float radius;

	[SerializeField]
	[SyncVar]
	private Vector3 planeNormal = Vector3.up;

	private Rigidbody rigidBody;

	private Transform Target;

	private bool resetOnAcquireOwner = true;

	[SyncVar]
	private Vector3 initialRadialDirection;

	[SyncVar]
	private float initialRunTime;

	public Vector3 Networkoffset
	{
		get
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return offset;
		}
		[param: In]
		set
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((NetworkBehaviour)this).SetSyncVar<Vector3>(value, ref offset, 1u);
		}
	}

	public float NetworkinitialDegreesFromOwnerForward
	{
		get
		{
			return initialDegreesFromOwnerForward;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVar<float>(value, ref initialDegreesFromOwnerForward, 2u);
		}
	}

	public float NetworkdegreesPerSecond
	{
		get
		{
			return degreesPerSecond;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVar<float>(value, ref degreesPerSecond, 4u);
		}
	}

	public float Networkradius
	{
		get
		{
			return radius;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVar<float>(value, ref radius, 8u);
		}
	}

	public Vector3 NetworkplaneNormal
	{
		get
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return planeNormal;
		}
		[param: In]
		set
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((NetworkBehaviour)this).SetSyncVar<Vector3>(value, ref planeNormal, 16u);
		}
	}

	public Vector3 NetworkinitialRadialDirection
	{
		get
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return initialRadialDirection;
		}
		[param: In]
		set
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((NetworkBehaviour)this).SetSyncVar<Vector3>(value, ref initialRadialDirection, 32u);
		}
	}

	public float NetworkinitialRunTime
	{
		get
		{
			return initialRunTime;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVar<float>(value, ref initialRunTime, 64u);
		}
	}

	public Transform getTarget()
	{
		return Target;
	}

	public void Initialize(Transform target, Vector3 planeNormal, float radius, float degreesPerSecond, float initialDegreesFromOwnerForward)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		Target = target;
		NetworkplaneNormal = planeNormal;
		Networkradius = radius;
		NetworkdegreesPerSecond = degreesPerSecond;
		NetworkinitialDegreesFromOwnerForward = initialDegreesFromOwnerForward;
		ResetState();
	}

	private void OnEnable()
	{
		rigidBody = ((Component)this).GetComponent<Rigidbody>();
	}

	public void FixedUpdate()
	{
		UpdatePosition(doSnap: false);
	}

	private void ResetState()
	{
		//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_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		NetworkinitialRunTime = Time.fixedTime;
		((Vector3)(ref planeNormal)).Normalize();
		if (Object.op_Implicit((Object)(object)Target))
		{
			NetworkinitialRadialDirection = Quaternion.AngleAxis(initialDegreesFromOwnerForward, planeNormal) * Target.forward;
			resetOnAcquireOwner = false;
		}
		UpdatePosition(doSnap: true);
	}

	private void UpdatePosition(bool doSnap)
	{
		//IL_002a: 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_0041: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//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_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)Target))
		{
			float num = (Time.fixedTime - initialRunTime) * degreesPerSecond;
			Vector3 val = Target.position + offset + Quaternion.AngleAxis(num, planeNormal) * initialRadialDirection * radius;
			if (!Object.op_Implicit((Object)(object)rigidBody) || doSnap)
			{
				((Component)this).transform.position = val;
			}
			else if (Object.op_Implicit((Object)(object)rigidBody))
			{
				rigidBody.MovePosition(val);
			}
		}
	}

	public void SetInitialDegreesFromOwnerForward(float degrees)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		NetworkinitialDegreesFromOwnerForward = degrees;
		if (Object.op_Implicit((Object)(object)Target))
		{
			NetworkinitialRadialDirection = Quaternion.AngleAxis(initialDegreesFromOwnerForward, planeNormal) * Target.forward;
		}
	}

	public float GetInitialRunTime()
	{
		return initialRunTime;
	}

	public void SetInitialRunTime(float _time)
	{
		NetworkinitialRunTime = Mathf.Max(_time, 0f);
	}

	private void AcquireTarget(Transform target)
	{
		if (Object.op_Implicit((Object)(object)((Component)target).transform))
		{
			Target = ((Component)target).transform;
			if (resetOnAcquireOwner)
			{
				resetOnAcquireOwner = false;
				ResetState();
			}
		}
	}

	private void UNetVersion()
	{
	}

	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		//IL_0005: 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_0041: 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_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		if (forceAll)
		{
			writer.Write(offset);
			writer.Write(initialDegreesFromOwnerForward);
			writer.Write(degreesPerSecond);
			writer.Write(radius);
			writer.Write(planeNormal);
			writer.Write(initialRadialDirection);
			writer.Write(initialRunTime);
			return true;
		}
		bool flag = false;
		if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(offset);
		}
		if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(initialDegreesFromOwnerForward);
		}
		if ((((NetworkBehaviour)this).syncVarDirtyBits & 4u) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(degreesPerSecond);
		}
		if ((((NetworkBehaviour)this).syncVarDirtyBits & 8u) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(radius);
		}
		if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x10u) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(planeNormal);
		}
		if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x20u) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(initialRadialDirection);
		}
		if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x40u) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(initialRunTime);
		}
		if (!flag)
		{
			writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
		}
		return flag;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: 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_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: 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_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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 (initialState)
		{
			offset = reader.ReadVector3();
			initialDegreesFromOwnerForward = reader.ReadSingle();
			degreesPerSecond = reader.ReadSingle();
			radius = reader.ReadSingle();
			planeNormal = reader.ReadVector3();
			initialRadialDirection = reader.ReadVector3();
			initialRunTime = reader.ReadSingle();
			return;
		}
		uint num = reader.ReadPackedUInt32();
		if ((num & (true ? 1u : 0u)) != 0)
		{
			offset = reader.ReadVector3();
		}
		if ((num & 2u) != 0)
		{
			initialDegreesFromOwnerForward = reader.ReadSingle();
		}
		if ((num & 4u) != 0)
		{
			degreesPerSecond = reader.ReadSingle();
		}
		if ((num & 8u) != 0)
		{
			radius = reader.ReadSingle();
		}
		if ((num & 0x10u) != 0)
		{
			planeNormal = reader.ReadVector3();
		}
		if ((num & 0x20u) != 0)
		{
			initialRadialDirection = reader.ReadVector3();
		}
		if ((num & 0x40u) != 0)
		{
			initialRunTime = reader.ReadSingle();
		}
	}

	public override void PreStartClient()
	{
	}
}
namespace RiskOfRamen
{
	public class ContaminationFontBehaviors : NetworkBehaviour
	{
		public PurchaseInteraction purchaseInteraction;

		private GameObject shrineUseEffect;

		public void Start()
		{
			//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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			shrineUseEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/ShrineUseEffect.prefab").WaitForCompletion();
			if (NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance))
			{
				purchaseInteraction.SetAvailable(true);
			}
			purchaseInteraction.costType = RiskOfRamenMain.corruptibleLunarIndex;
			((UnityEvent<PayCostContext, PayCostResults>)(object)purchaseInteraction.onDetailedPurchaseServer).AddListener((UnityAction<PayCostContext, PayCostResults>)OnDetailedPurchaseServer);
		}

		[Server]
		public void OnDetailedPurchaseServer(PayCostContext context, PayCostResults results)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void RiskOfRamen.ContaminationFontBehaviors::OnDetailedPurchaseServer(RoR2.CostTypeDef/PayCostContext,RoR2.CostTypeDef/PayCostResults)' called on client");
				return;
			}
			if (!NetworkServer.active)
			{
				RiskOfRamenMain.LogInfo("[Server] function 'ContaminationFontBehaivors::OnPurchase(RoR2.Interactor)' called on client");
				return;
			}
			EffectManager.SpawnEffect(shrineUseEffect, new EffectData
			{
				origin = ((Component)this).gameObject.transform.position,
				rotation = Quaternion.identity,
				scale = 3f,
				color = Color32.op_Implicit(Color.magenta)
			}, true);
			ItemDef itemDef = ItemCatalog.GetItemDef(results.itemStacksTaken[0].itemIndex);
			ItemDef val = RiskOfRamenContent.TryGetPairForLunar(itemDef);
			ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier);
			ItemTierDef itemTierDef2 = ItemTierCatalog.GetItemTierDef(val.tier);
			string colorHexString = ColorCatalog.GetColorHexString(itemTierDef.colorIndex);
			string colorHexString2 = ColorCatalog.GetColorHexString(itemTierDef2.colorIndex);
			SubjectFormatChatMessage val2 = new SubjectFormatChatMessage();
			val2.paramTokens = new string[5]
			{
				Util.GetBestMasterName(context.activatorMaster),
				colorHexString,
				Language.GetString(itemDef.nameToken),
				colorHexString2,
				Language.GetString(val.nameToken)
			};
			((SubjectChatMessage)val2).baseToken = "{1} corrupted <color=#{2}>{3}</color> into <color=#{4}>{5}</color>";
			Chat.SendBroadcastChat((ChatMessageBase)(object)val2, 0);
		}

		public ItemDef tryCorruptInputLunar(ItemDef def)
		{
			return def;
		}

		private void UNetVersion()
		{
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			bool result = default(bool);
			return result;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
		}

		public override void PreStartClient()
		{
		}
	}
	public class GlassTiaraBodyBehavior : BaseItemBodyBehavior
	{
		private uint prevGold;

		public float curseAdd;

		[ItemDefAssociation(useOnServer = true, useOnClient = false)]
		private static ItemDef GetItemDef()
		{
			if (!RiskOfRamenConfig.enableItem(RiskOfRamenContent._GlassTiara).Value)
			{
				return null;
			}
			return RiskOfRamenContent._GlassTiara;
		}

		private void Start()
		{
			prevGold = ((BaseItemBodyBehavior)this).body.master.money;
		}

		private void FixedUpdate()
		{
			_ = base.stack;
			if (curseAdd < 0f)
			{
				curseAdd = 0f;
			}
			if (((BaseItemBodyBehavior)this).body.master.money < prevGold)
			{
				OnGoldSpent(prevGold, ((BaseItemBodyBehavior)this).body.master.money);
			}
			if (((BaseItemBodyBehavior)this).body.master.money > prevGold)
			{
				OnGoldEarned(prevGold, ((BaseItemBodyBehavior)this).body.master.money);
			}
			prevGold = ((BaseItemBodyBehavior)this).body.master.money;
		}

		private void OnGoldSpent(uint oldMoney, uint newMoney)
		{
			curseAdd += (float)(oldMoney - newMoney) * (0.15f + 0.05f * (float)base.stack);
		}

		private void OnGoldEarned(uint oldMoney, uint newMoney)
		{
			curseAdd -= (float)(newMoney - oldMoney) * (0.1f * (float)base.stack);
		}
	}
	public class KiFruitBodyBehavior : BaseItemBodyBehavior, IOnIncomingDamageServerReceiver
	{
		public int armorReduction;

		[ItemDefAssociation(useOnServer = true, useOnClient = false)]
		private static ItemDef GetItemDef()
		{
			if (!RiskOfRamenConfig.enableItem(RiskOfRamenContent._KiFruit).Value)
			{
				return null;
			}
			return RiskOfRamenContent._KiFruit;
		}

		private void FixedUpdate()
		{
			if (NetworkServer.active && ((BaseItemBodyBehavior)this).body.HasBuff(Buffs.Cripple))
			{
				((BaseItemBodyBehavior)this).body.RemoveBuff(Buffs.Cripple);
			}
		}

		public void OnIncomingDamageServer(DamageInfo damageInfo)
		{
			if (damageInfo.damage > ((BaseItemBodyBehavior)this).body.healthComponent.health * 0.1f)
			{
				armorReduction++;
			}
		}
	}
	public class ParasiticClamBodyBehavior : BaseItemBodyBehavior, IOnTakeDamageServerReceiver
	{
		[ItemDefAssociation(useOnServer = true, useOnClient = false)]
		private static ItemDef GetItemDef()
		{
			if (!RiskOfRamenConfig.enableItem(RiskOfRamenContent._ParasiticClam).Value)
			{
				return null;
			}
			return RiskOfRamenContent._ParasiticClam;
		}

		public void OnTakeDamageServer(DamageReport damageReport)
		{
			if ((Object)(object)damageReport.attackerBody != (Object)null)
			{
				damageReport.victimBody.AddTimedBuff(RiskOfRamenContent._parasiticClamBuff, 10f, 10);
			}
		}
	}
	public class RamenUtils
	{
		public static float GetBarrierPercentage(CharacterBody self)
		{
			return self.healthComponent.barrier / self.healthComponent.fullBarrier;
		}

		public static bool IsAnyVoidTier(ItemDef item)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			ItemTier[] array = new ItemTier[5];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			array[4] = (ItemTier)(int)RiskOfRamenContent._VoidLunarTier.tier;
			return ((IEnumerable<ItemTier>)(object)array).Contains(item.tier);
		}

		internal static Color GetItemColor(ItemDef item)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			return Color32.op_Implicit(ColorCatalog.GetColor(item._itemTierDef.colorIndex));
		}

		public static ItemIndex chooseRandomItemIndex(Inventory inventory, Pair[] pairs)
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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)
			List<ItemIndex> list = new List<ItemIndex>();
			foreach (Pair val in pairs)
			{
				if (inventory.GetItemCountPermanent(val.itemDef1) >= 1)
				{
					list.Add(val.itemDef1.itemIndex);
				}
			}
			if (list.Count > 0)
			{
				return Run.instance.treasureRng.NextElementUniform<ItemIndex>(list);
			}
			return (ItemIndex)(-1);
		}

		public static List<ItemIndex> GetCorruptibleItemsInInventory(Inventory inventory)
		{
			//IL_0016: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			List<ItemIndex> list = new List<ItemIndex>();
			foreach (ItemIndex item in inventory.itemAcquisitionOrder)
			{
				if ((int)ContagiousItemManager.GetTransformedItemIndex(item) != -1)
				{
					list.Add(item);
				}
			}
			return list;
		}

		public static int SafeGetEffectiveItemCount(Inventory inventory, ItemDef item)
		{
			if (RiskOfRamenConfig.enableItem(item).Value)
			{
				return inventory.GetItemCountEffective(item);
			}
			return 0;
		}

		public static int SafeGetTempItemCount(Inventory inventory, ItemDef item)
		{
			if (RiskOfRamenConfig.enableItem(item).Value)
			{
				return inventory.GetItemCountTemp(item);
			}
			return 0;
		}

		public static int SafeGetPermaItemCount(Inventory inventory, ItemDef item)
		{
			if (RiskOfRamenConfig.enableItem(item).Value)
			{
				return inventory.GetItemCountPermanent(item);
			}
			return 0;
		}
	}
	public class RiskOfRamenConfig
	{
		private static ConfigFile Config;

		public Dictionary<string, ItemTier> tierListStandard = new Dictionary<string, ItemTier>
		{
			{
				"White",
				(ItemTier)0
			},
			{
				"Green",
				(ItemTier)1
			},
			{
				"Red",
				(ItemTier)2
			}
		};

		public Dictionary<string, ItemTier> tierListVoid = new Dictionary<string, ItemTier>
		{
			{
				"Void White",
				(ItemTier)6
			},
			{
				"Void Green",
				(ItemTier)7
			},
			{
				"Void Red",
				(ItemTier)8
			}
		};

		public static ConfigEntry<bool> enableVoidLunars;

		public static ConfigEntry<bool> spawnWaxWisp;

		public static ConfigEntry<bool> enableItem(ItemDef itemDef)
		{
			return Config.Bind<bool>("Items", "Enable " + Language.GetString(itemDef.nameToken), true, "Whether or not " + Language.GetString(itemDef.nameToken) + " should appear in-game.");
		}

		public static void CreateConfig(ConfigFile config)
		{
			Config = config;
			enableVoidLunars = Config.Bind<bool>("Void Lunars", "Enable Void Lunars", true, "If enabled, Risk of Ramen's Void Lunar items will be obtainable and the Contamination Font will spawn in the Void Locus.");
			spawnWaxWisp = Config.Bind<bool>("Specific Item Configuration", "Wax Idol Spawns Wax Wisp", true, "If enabled, the Wax Idol will spawn a Wax Wisp minion. It currently has no AI, and is just kind of there, so if it becomes annoying you can turn it off.");
		}

		public static void CreateItemConfigs(NamedAssetCollection<ItemDef> itemDefs)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			AssetEnumerator<ItemDef> enumerator = itemDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					enableItem(enumerator.Current);
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
		}

		public static ConfigFile getConfig()
		{
			return Config;
		}
	}
	public class RiskOfRamenContent : IContentPackProvider
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static GetDeployableSameSlotLimit <>9__36_0;

			public static GetDeployableSameSlotLimit <>9__36_1;

			internal int <LoadStaticContentAsync>b__36_0(CharacterMaster self, int deployableCountMultiplier)
			{
				if (Object.op_Implicit((Object)(object)self))
				{
					return AllocentrismBodyBehavior.GetMaxProjectiles(self.inventory);
				}
				return 1;
			}

			internal int <LoadStaticContentAsync>b__36_1(CharacterMaster self, int deployableCountMultiplier)
			{
				if (Object.op_Implicit((Object)(object)self))
				{
					return WaxIdolBodyBehavior.GetMaxProjectiles(self.inventory);
				}
				return 1;
			}
		}

		public static ItemDef _WaxIdol;

		public static ItemDef _ObsidianCard;

		public static ItemDef _DenkuRope;

		public static ItemDef _StainedBelt;

		public static ItemDef _WornTurnkey;

		public static ItemDef _GlassTiara;

		public static ItemDef _Allocentrism;

		public static ItemDef _EsotericEremite;

		public static ItemDef _ParasiticClam;

		public static ItemDef _ChitinousChisel;

		public static ItemDef _KiFruit;

		public static ItemTierDef _VoidLunarTier;

		public static GameObject _ContaminationFont;

		public static InteractableSpawnCard _iscContaminationFont;

		public static GameObject _WaxWispBody;

		public static GameObject _WaxWispMaster;

		public static CharacterSpawnCard _cscWaxWisp;

		public static BuffDef _stillnessBuff;

		public static BuffDef _hermitDebuff;

		public static BuffDef _hermitBuff;

		public static BuffDef _parasiticClamBuff;

		public static GameObject _AllocentrismBomb;

		public static GameObject _AllocentrismGhost;

		public static EffectDef _AllocentrismExplosion;

		public static DeployableSlot AllocentrismBomb;

		public static DeployableSlot WaxWispSlot;

		public static ExpansionDef _expansionDef;

		public static AssetBundle _assetBundle;

		public static Pair[] _corruptibleLunars;

		public string identifier => "com.Ramen.RiskOfRamen";

		public static ReadOnlyContentPack readOnlyContentPack => new ReadOnlyContentPack(RiskOfRamenContentPack);

		internal static ContentPack RiskOfRamenContentPack { get; } = new ContentPack();


		[Obsolete]
		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			AssetBundleCreateRequest asyncOperation = AssetBundle.LoadFromFileAsync(RiskOfRamenMain.assetBundleDir);
			while (!((AsyncOperation)asyncOperation).isDone)
			{
				args.ReportProgress(((AsyncOperation)asyncOperation).progress);
				yield return null;
			}
			_assetBundle = asyncOperation.assetBundle;
			RiskOfRamenMain.LogInfo("Loading assets...");
			LoadAssets();
			RiskOfRamenMain.LogInfo("Adding content...");
			AddContent();
			RiskOfRamenMain.LogInfo("Swapping stubbed shaders...");
			SwapAllShaders();
			RiskOfRamenMain.LogInfo("Registering deployable slots...");
			object obj = <>c.<>9__36_0;
			if (obj == null)
			{
				GetDeployableSameSlotLimit val = (CharacterMaster self, int deployableCountMultiplier) => (!Object.op_Implicit((Object)(object)self)) ? 1 : AllocentrismBodyBehavior.GetMaxProjectiles(self.inventory);
				<>c.<>9__36_0 = val;
				obj = (object)val;
			}
			AllocentrismBomb = DeployableAPI.RegisterDeployableSlot((GetDeployableSameSlotLimit)obj);
			object obj2 = <>c.<>9__36_1;
			if (obj2 == null)
			{
				GetDeployableSameSlotLimit val2 = (CharacterMaster self, int deployableCountMultiplier) => (!Object.op_Implicit((Object)(object)self)) ? 1 : WaxIdolBodyBehavior.GetMaxProjectiles(self.inventory);
				<>c.<>9__36_1 = val2;
				obj2 = (object)val2;
			}
			WaxWispSlot = DeployableAPI.RegisterDeployableSlot((GetDeployableSameSlotLimit)obj2);
			RiskOfRamenMain.LogInfo("Populating Void Lunar lists...");
			_corruptibleLunars = PopulateCorruptibleLunars();
			RiskOfRamenMain.LogInfo("Creating item configs...");
			RiskOfRamenConfig.CreateItemConfigs(RiskOfRamenContentPack.itemDefs);
		}

		private static void LoadAssets()
		{
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Expected O, but got Unknown
			_WaxIdol = _assetBundle.LoadAsset<ItemDef>("WaxIdol");
			_ObsidianCard = _assetBundle.LoadAsset<ItemDef>("ObsidianCard");
			_DenkuRope = _assetBundle.LoadAsset<ItemDef>("DenkuRope");
			_StainedBelt = _assetBundle.LoadAsset<ItemDef>("StainedBelt");
			_WornTurnkey = _assetBundle.LoadAsset<ItemDef>("WornTurnkey");
			_GlassTiara = _assetBundle.LoadAsset<ItemDef>("GlassTiara");
			_Allocentrism = _assetBundle.LoadAsset<ItemDef>("Allocentrism");
			_EsotericEremite = _assetBundle.LoadAsset<ItemDef>("EsotericEremite");
			_ParasiticClam = _assetBundle.LoadAsset<ItemDef>("ParasiticClam");
			_ChitinousChisel = _assetBundle.LoadAsset<ItemDef>("ChitinousChisel");
			_KiFruit = _assetBundle.LoadAsset<ItemDef>("KiFruit");
			_VoidLunarTier = _assetBundle.LoadAsset<ItemTierDef>("VoidLunarTierDefRamen");
			_WaxWispBody = _assetBundle.LoadAsset<GameObject>("WaxWispBody");
			_WaxWispMaster = _assetBundle.LoadAsset<GameObject>("WaxWispMaster");
			_cscWaxWisp = _assetBundle.LoadAsset<CharacterSpawnCard>("cscWaxWisp");
			_ContaminationFont = _assetBundle.LoadAsset<GameObject>("ContaminationFontInteractable");
			_iscContaminationFont = _assetBundle.LoadAsset<InteractableSpawnCard>("iscContaminationFont");
			_stillnessBuff = _assetBundle.LoadAsset<BuffDef>("StillnessBuff");
			_hermitDebuff = _assetBundle.LoadAsset<BuffDef>("HermitDebuff");
			_hermitBuff = _assetBundle.LoadAsset<BuffDef>("HermitBuff");
			_parasiticClamBuff = _assetBundle.LoadAsset<BuffDef>("ParasiticClamBuff");
			_AllocentrismBomb = _assetBundle.LoadAsset<GameObject>("AllocentrismBomb");
			_AllocentrismGhost = _assetBundle.LoadAsset<GameObject>("AllocentrismBombProjectileGhost");
			_AllocentrismExplosion = new EffectDef(_assetBundle.LoadAsset<GameObject>("ExplosionAllocentrism"));
			_expansionDef = _assetBundle.LoadAsset<ExpansionDef>("RiskOfRamenExpansion");
		}

		private static void AddContent()
		{
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			TryAddItem(_WaxIdol);
			TryAddItem(_ObsidianCard);
			TryAddItem(_DenkuRope);
			TryAddItem(_StainedBelt);
			TryAddItem(_WornTurnkey);
			TryAddItem(_GlassTiara);
			TryAddItem(_EsotericEremite);
			TryAddItem(_ParasiticClam);
			TryAddItem(_ChitinousChisel);
			TryAddItem(_Allocentrism);
			TryAddItem(_KiFruit);
			RiskOfRamenContentPack.itemTierDefs.Add((ItemTierDef[])(object)new ItemTierDef[1] { _VoidLunarTier });
			RiskOfRamenContentPack.bodyPrefabs.Add((GameObject[])(object)new GameObject[1] { _WaxWispBody });
			RiskOfRamenContentPack.masterPrefabs.Add((GameObject[])(object)new GameObject[1] { _WaxWispMaster });
			RiskOfRamenContentPack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { _stillnessBuff });
			RiskOfRamenContentPack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { _hermitDebuff });
			RiskOfRamenContentPack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { _hermitBuff });
			RiskOfRamenContentPack.buffDefs.Add((BuffDef[])(object)new BuffDef[1] { _parasiticClamBuff });
			RiskOfRamenContentPack.networkedObjectPrefabs.Add((GameObject[])(object)new GameObject[1] { _ContaminationFont });
			RiskOfRamenContentPack.expansionDefs.Add((ExpansionDef[])(object)new ExpansionDef[1] { _expansionDef });
			RiskOfRamenContentPack.effectDefs.Add((EffectDef[])(object)new EffectDef[1] { _AllocentrismExplosion });
			if (RiskOfRamenConfig.enableItem(_Allocentrism).Value)
			{
				ItemRelationshipProvider val = CreateVoidPair(_Allocentrism, Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/LunarSun/LunarSun.asset").WaitForCompletion());
				RiskOfRamenContentPack.itemRelationshipProviders.Add((ItemRelationshipProvider[])(object)new ItemRelationshipProvider[1] { val });
			}
			if (RiskOfRamenConfig.enableItem(_GlassTiara).Value)
			{
				ItemRelationshipProvider val2 = CreateVoidPair(_GlassTiara, Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/GoldOnHit/GoldOnHit.asset").WaitForCompletion());
				RiskOfRamenContentPack.itemRelationshipProviders.Add((ItemRelationshipProvider[])(object)new ItemRelationshipProvider[1] { val2 });
			}
			if (RiskOfRamenConfig.enableItem(_EsotericEremite).Value)
			{
				ItemRelationshipProvider val3 = CreateVoidPair(_EsotericEremite, Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/HalfAttackSpeedHalfCooldowns/HalfAttackSpeedHalfCooldowns.asset").WaitForCompletion());
				RiskOfRamenContentPack.itemRelationshipProviders.Add((ItemRelationshipProvider[])(object)new ItemRelationshipProvider[1] { val3 });
			}
			if (RiskOfRamenConfig.enableItem(_ParasiticClam).Value)
			{
				ItemRelationshipProvider val4 = CreateVoidPair(_ParasiticClam, Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/HalfSpeedDoubleHealth/HalfSpeedDoubleHealth.asset").WaitForCompletion());
				RiskOfRamenContentPack.itemRelationshipProviders.Add((ItemRelationshipProvider[])(object)new ItemRelationshipProvider[1] { val4 });
			}
			if (RiskOfRamenConfig.enableItem(_ChitinousChisel).Value)
			{
				ItemRelationshipProvider val5 = CreateVoidPair(_ChitinousChisel, Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/MonstersOnShrineUse/MonstersOnShrineUse.asset").WaitForCompletion());
				RiskOfRamenContentPack.itemRelationshipProviders.Add((ItemRelationshipProvider[])(object)new ItemRelationshipProvider[1] { val5 });
			}
		}

		private static void TryAddItem(ItemDef item)
		{
			if (RiskOfRamenConfig.getConfig().Bind<bool>("Items", "Enable " + Language.GetString(item.nameToken), true, "Whether or not " + Language.GetString(item.nameToken) + " should appear in-game.").Value)
			{
				RiskOfRamenContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { item });
			}
		}

		private static ItemRelationshipProvider CreateVoidPair(ItemDef corrupted, ItemDef normal)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			ItemRelationshipProvider val = ScriptableObject.CreateInstance<ItemRelationshipProvider>();
			((Object)val).name = ((Object)corrupted).name + ((Object)normal).name + "Relationship";
			val.relationshipType = Addressables.LoadAssetAsync<ItemRelationshipType>((object)"RoR2/DLC1/Common/ContagiousItem.asset").WaitForCompletion();
			val.relationships = (Pair[])(object)new Pair[1]
			{
				new Pair
				{
					itemDef1 = normal,
					itemDef2 = corrupted
				}
			};
			return val;
		}

		private static Pair[] PopulateCorruptibleLunars()
		{
			//IL_000a: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			return (Pair[])(object)new Pair[5]
			{
				new Pair
				{
					itemDef1 = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/LunarSun/LunarSun.asset").WaitForCompletion(),
					itemDef2 = _Allocentrism
				},
				new Pair
				{
					itemDef1 = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/GoldOnHit/GoldOnHit.asset").WaitForCompletion(),
					itemDef2 = _GlassTiara
				},
				new Pair
				{
					itemDef1 = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/HalfAttackSpeedHalfCooldowns/HalfAttackSpeedHalfCooldowns.asset").WaitForCompletion(),
					itemDef2 = _EsotericEremite
				},
				new Pair
				{
					itemDef1 = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/MonstersOnShrineUse/MonstersOnShrineUse.asset").WaitForCompletion(),
					itemDef2 = _ChitinousChisel
				},
				new Pair
				{
					itemDef1 = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/HalfSpeedDoubleHealth/HalfSpeedDoubleHealth.asset").WaitForCompletion(),
					itemDef2 = _ParasiticClam
				}
			};
		}

		public static ItemDef TryGetPairForLunar(ItemDef lunar)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			Pair[] corruptibleLunars = _corruptibleLunars;
			foreach (Pair val in corruptibleLunars)
			{
				if ((Object)(object)val.itemDef1 == (Object)(object)lunar)
				{
					return val.itemDef2;
				}
			}
			return null;
		}

		private static void SwapAllShaders()
		{
			Material[] array = _assetBundle.LoadAllAssets<Material>();
			for (int i = 0; i < array.Length; i++)
			{
				TrySwapShader(array[i]);
			}
		}

		internal static void TrySwapShader(Material material)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			string name = ((Object)material.shader).name;
			if (name.Contains("Stubbed"))
			{
				name = name.Replace("Stubbed", string.Empty) + ".shader";
				Shader val = Addressables.LoadAssetAsync<Shader>((object)name).WaitForCompletion();
				if ((Object)(object)val != (Object)null)
				{
					material.shader = val;
				}
				else
				{
					RiskOfRamenMain.LogError("Failed to load shader " + name);
				}
			}
			else if (name == "Standard")
			{
				Texture texture = material.GetTexture("_BumpMap");
				float @float = material.GetFloat("_BumpScale");
				Texture texture2 = material.GetTexture("_EmissionMap");
				material.shader = Resources.Load<Shader>("Shaders/Deferred/HGStandard");
				material.SetTexture("_NormalMap", texture);
				material.SetFloat("_NormalStrength", @float);
				material.SetTexture("_EmTex", texture2);
				material.SetColor("_EmColor", new Color(0.2f, 0.2f, 0.2f));
				material.SetFloat("_EmPower", 0.15f);
			}
		}

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

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}

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

		internal RiskOfRamenContent()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(AddSelf);
		}
	}
	[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.*/)]
	[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.*/)]
	[BepInPlugin("com.Ramen.RiskOfRamen", "Risk Of Ramen", "1.1.3")]
	public class RiskOfRamenMain : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static BuildCostStringDelegate <>9__43_0;

			internal void <ModHelper_getAdditionalEntries>b__43_0(CostTypeDef costTypeDef, BuildCostStringContext context)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				context.stringBuilder.Append(context.cost);
				context.stringBuilder.Append(" Lunar");
			}
		}

		public const string GUID = "com.Ramen.RiskOfRamen";

		public const string MODNAME = "Risk Of Ramen";

		public const string VERSION = "1.1.3";

		public static CostTypeDef corruptibleLunar;

		public static CostTypeIndex corruptibleLunarIndex;

		public static PluginInfo pluginInfo { get; private set; }

		public static RiskOfRamenMain instance { get; private set; }

		internal static AssetBundle assetBundle { get; private set; }

		internal static string assetBundleDir => Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "riskoframenassets");

		internal static string loadingScreenBundleDir => Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "riskoframenssa");

		internal static string sceneBundleDir => Path.Combine(Path.GetDirectoryName(pluginInfo.Location), "riskoframenscenes");

		[Obsolete]
		private void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			instance = this;
			pluginInfo = ((BaseUnityPlugin)this).Info;
			RiskOfRamenConfig.CreateConfig(((BaseUnityPlugin)this).Config);
			new RiskOfRamenContent();
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
			SceneDirector.onPostPopulateSceneServer += SceneDirector_onPostPopulatesceneServer;
			PurchaseInteraction.onPurchaseGlobalServer += PurchaseInteraction_onPurchaseGlobalServer;
			LoadingScreenFix.AddSpriteAnimations(GetLoadingScreenBundle());
			CostTypeCatalog.modHelper.getAdditionalEntries += ModHelper_getAdditionalEntries;
			CharacterMaster.OnServerStageBegin += new hook_OnServerStageBegin(CharacterMaster_OnServerStageBegin);
			SpawnCard.onSpawnedServerGlobal += SpawnCard_onSpawnedServerGlobal;
			CharacterBody.GetVisibilityLevel_CharacterBody += new hook_GetVisibilityLevel_CharacterBody(CharacterBody_GetVisibilityLevel_CharacterBody);
			CharacterBody.OnBuffFinalStackLost += new hook_OnBuffFinalStackLost(CharacterBody_OnBuffFinalStackLost);
		}

		[SystemInitializer(new Type[] { typeof(CostTypeCatalog) })]
		private static void Init()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			corruptibleLunarIndex = (CostTypeIndex)Array.IndexOf(CostTypeCatalog.costTypeDefs, corruptibleLunar);
		}

		internal static void LogFatal(object data)
		{
			((BaseUnityPlugin)instance).Logger.LogFatal(data);
		}

		internal static void LogError(object data)
		{
			((BaseUnityPlugin)instance).Logger.LogError(data);
		}

		internal static void LogWarning(object data)
		{
			((BaseUnityPlugin)instance).Logger.LogWarning(data);
		}

		internal static void LogMessage(object data)
		{
			((BaseUnityPlugin)instance).Logger.LogMessage(data);
		}

		internal static void LogInfo(object data)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo(data);
		}

		internal static void LogDebug(object data)
		{
			((BaseUnityPlugin)instance).Logger.LogDebug(data);
		}

		private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody self, StatHookEventArgs args)
		{
			BuffDef onFire = Buffs.OnFire;
			BuffDef strongerBurn = Buffs.StrongerBurn;
			BuffDef stillnessBuff = RiskOfRamenContent._stillnessBuff;
			BuffDef hermitBuff = RiskOfRamenContent._hermitBuff;
			BuffDef parasiticClamBuff = RiskOfRamenContent._parasiticClamBuff;
			if (Object.op_Implicit((Object)(object)self.inventory))
			{
				int num = RamenUtils.SafeGetEffectiveItemCount(self.inventory, RiskOfRamenContent._DenkuRope);
				if (num >= 1)
				{
					args.critDamageMultAdd += 0.1f * (float)num;
				}
				int num2 = RamenUtils.SafeGetEffectiveItemCount(self.inventory, RiskOfRamenContent._ObsidianCard);
				if (num2 >= 1)
				{
					args.barrierDecayMult -= 0.25f + 0.1f * (float)num2;
				}
				int num3 = RamenUtils.SafeGetEffectiveItemCount(self.inventory, RiskOfRamenContent._WaxIdol);
				if (num3 >= 1 && (self.HasBuff(onFire) || self.HasBuff(strongerBurn)))
				{
					args.armorAdd += (float)(40 + 10 * num3);
				}
				int num4 = RamenUtils.SafeGetEffectiveItemCount(self.inventory, RiskOfRamenContent._StainedBelt);
				if (num4 >= 1)
				{
					args.critAdd += RamenUtils.GetBarrierPercentage(self) * (0.25f * (float)num4);
				}
				if (RamenUtils.SafeGetEffectiveItemCount(self.inventory, RiskOfRamenContent._ParasiticClam) >= 1)
				{
					args.baseRegenAdd -= self.baseRegen;
				}
				if (self.HasBuff(parasiticClamBuff))
				{
					args.attackSpeedMultAdd += 0.1f + 0.05f * (float)self.GetBuffCount(parasiticClamBuff);
					args.moveSpeedMultAdd += 0.1f + 0.05f * (float)self.GetBuffCount(parasiticClamBuff);
				}
				if (self.HasBuff(stillnessBuff))
				{
					float num5 = 0.1f + 0.1f * (float)self.GetBuffCount(stillnessBuff);
					args.healthMultAdd += num5;
					args.regenMultAdd += num5;
					args.moveSpeedMultAdd += num5;
					args.damageMultAdd += num5;
					args.attackSpeedMultAdd += num5;
					args.critAdd += num5;
					args.armorTotalMult *= 1f + num5;
				}
				if (self.HasBuff(hermitBuff))
				{
					args.damageTotalMult *= 2f;
				}
				if (RamenUtils.SafeGetEffectiveItemCount(self.inventory, RiskOfRamenContent._GlassTiara) >= 1)
				{
					GlassTiaraBodyBehavior component = ((Component)self).GetComponent<GlassTiaraBodyBehavior>();
					args.baseCurseAdd += component.curseAdd / self.baseMaxHealth;
				}
				if (RamenUtils.SafeGetEffectiveItemCount(self.inventory, RiskOfRamenContent._KiFruit) >= 1)
				{
					KiFruitBodyBehavior component2 = ((Component)self).GetComponent<KiFruitBodyBehavior>();
					args.armorAdd -= (float)component2.armorReduction;
				}
				int num6 = RamenUtils.SafeGetEffectiveItemCount(self.inventory, RiskOfRamenContent._ChitinousChisel);
				if (num6 >= 1)
				{
					args.luckAdd += (float)num6;
				}
			}
		}

		private void PurchaseInteraction_onPurchaseGlobalServer(PayCostContext context, PayCostResults results)
		{
			//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)
			if (context.purchaseInteraction.isShrine && RamenUtils.SafeGetEffectiveItemCount(context.activatorInventory, RiskOfRamenContent._ChitinousChisel) > 0)
			{
				List<ItemIndex> corruptibleItemsInInventory = RamenUtils.GetCorruptibleItemsInInventory(context.activatorInventory);
				LogDebug(corruptibleItemsInInventory);
				if (corruptibleItemsInInventory.Count() > 0)
				{
					ItemIndex val = Run.instance.treasureRng.NextElementUniform<ItemIndex>(corruptibleItemsInInventory);
					ContagiousItemManager.TryForceReplacement(context.activatorInventory, val);
				}
			}
		}

		private void CharacterBody_OnBuffFinalStackLost(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
		{
			if ((Object)(object)buffDef == (Object)(object)RiskOfRamenContent._hermitDebuff)
			{
				self.AddBuff(RiskOfRamenContent._hermitBuff);
			}
			orig.Invoke(self, buffDef);
		}

		private VisibilityLevel CharacterBody_GetVisibilityLevel_CharacterBody(orig_GetVisibilityLevel_CharacterBody orig, CharacterBody self, CharacterBody observer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (observer.HasBuff(RiskOfRamenContent._hermitDebuff))
			{
				return (VisibilityLevel)2;
			}
			return orig.Invoke(self, observer);
		}

		private static void SpawnCard_onSpawnedServerGlobal(SpawnResult spawnResult)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			if (!RiskOfRamenConfig.enableItem(RiskOfRamenContent._EsotericEremite).Value)
			{
				return;
			}
			int num = 0;
			List<CharacterMaster> list = new List<CharacterMaster>();
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (RamenUtils.SafeGetEffectiveItemCount(instance.master.inventory, RiskOfRamenContent._EsotericEremite) >= 1)
				{
					list.Add(instance.master);
				}
				num += RamenUtils.SafeGetEffectiveItemCount(instance.master.inventory, RiskOfRamenContent._EsotericEremite);
			}
			if (num > 0 && Util.CheckRoll(20f + 5f * (float)num, 0f, (CharacterMaster)null) && (Object)(object)spawnResult.spawnedInstance.GetComponent<CharacterMaster>() != (Object)null)
			{
				spawnResult.spawnedInstance.GetComponent<CharacterMaster>().GetBody().AddTimedBuff(RiskOfRamenContent._hermitDebuff, (float)(5 + 5 * num));
			}
		}

		private static void SceneDirector_onPostPopulatesceneServer(SceneDirector sceneDirector)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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)
			//IL_0048: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			if (SceneCatalog.currentSceneDef.baseSceneName == "voidstage" && RiskOfRamenConfig.enableVoidLunars.Value)
			{
				DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest((SpawnCard)(object)RiskOfRamenContent._iscContaminationFont, new DirectorPlacementRule
				{
					placementMode = (PlacementMode)6,
					position = new Vector3(-38.9945f, 16.818f, -212.6613f),
					IgnoreSwarmsArtifact = true
				}, RoR2Application.rng));
			}
		}

		private void CharacterMaster_OnServerStageBegin(orig_OnServerStageBegin orig, CharacterMaster self, Stage stage)
		{
			uint difficultyScaledCost = (uint)Run.instance.GetDifficultyScaledCost(50, Stage.instance.entryDifficultyCoefficient);
			uint num = (uint)RamenUtils.SafeGetEffectiveItemCount(self.inventory, RiskOfRamenContent._GlassTiara);
			if (num >= 1)
			{
				self.GiveMoney(difficultyScaledCost * (num + 1));
			}
			orig.Invoke(self, stage);
		}

		internal static AssetBundle GetLoadingScreenBundle()
		{
			return AssetBundle.LoadFromFile(loadingScreenBundleDir);
		}

		internal static AssetBundle GetSceneBundle()
		{
			return AssetBundle.LoadFromFile(sceneBundleDir);
		}

		public static ItemTransformation GetTransformationForSpecificItemPairCost(ItemIndex itemIndex, Pair[] pairs, int cost)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_006d: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			ItemIndex newItemIndex = (ItemIndex)(-1);
			foreach (Pair val in pairs)
			{
				ItemIndex itemIndex2 = val.itemDef1.itemIndex;
				if (((object)(ItemIndex)(ref itemIndex2)).Equals((object?)itemIndex))
				{
					newItemIndex = val.itemDef2.itemIndex;
				}
			}
			ItemTransformation result = default(ItemTransformation);
			((ItemTransformation)(ref result)).allowWhenDisabled = false;
			((ItemTransformation)(ref result)).minToTransform = cost;
			((ItemTransformation)(ref result)).maxToTransform = 1;
			((ItemTransformation)(ref result)).originalItemIndex = itemIndex;
			((ItemTransformation)(ref result)).newItemIndex = newItemIndex;
			((ItemTransformation)(ref result)).forbidPermanentItems = false;
			((ItemTransformation)(ref result)).forbidTempItems = true;
			result.transformationType = (ItemTransformationTypeIndex)(-1);
			return result;
		}

		public static PayCostDelegate GetSpecificItemPayCost(Pair[] pairs)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			return (PayCostDelegate)delegate(PayCostContext context, PayCostResults results)
			{
				//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_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody obj = UnityObjectExtensions.AsValidOrNull<CharacterBody>(((Component)context.activator).GetComponent<CharacterBody>());
				Inventory val = ((obj != null) ? obj.inventory : null);
				List<ItemIndex> list = new List<ItemIndex>();
				Pair[] array = pairs;
				foreach (Pair val2 in array)
				{
					if (RamenUtils.SafeGetPermaItemCount(val, val2.itemDef1) >= 1)
					{
						list.Add(val2.itemDef1.itemIndex);
					}
				}
				TryTransformResult val3 = default(TryTransformResult);
				foreach (ItemIndex item in list)
				{
					ItemTransformation transformationForSpecificItemPairCost = GetTransformationForSpecificItemPairCost(item, pairs, context.cost);
					if (((ItemTransformation)(ref transformationForSpecificItemPairCost)).TryTransform(val, ref val3))
					{
						results.AddTakenItemsFromTransformation(ref val3);
						break;
					}
				}
			};
		}

		public static IsAffordableDelegate GetSpecificItemIsAffordable(Pair[] pairs)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			return (IsAffordableDelegate)delegate(CostTypeDef costTypeDef, IsAffordableContext context)
			{
				//IL_0000: 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_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				CharacterBody obj = UnityObjectExtensions.AsValidOrNull<CharacterBody>(((Component)context.activator).GetComponent<CharacterBody>());
				Inventory val = ((obj != null) ? obj.inventory : null);
				if (Object.op_Implicit((Object)(object)val))
				{
					ItemTransformation transformationForSpecificItemPairCost = GetTransformationForSpecificItemPairCost(RamenUtils.chooseRandomItemIndex(val, pairs), pairs, context.cost);
					return ((ItemTransformation)(ref transformationForSpecificItemPairCost)).CanTake(val).HasValue;
				}
				return false;
			};
		}

		private void ModHelper_getAdditionalEntries(List<CostTypeDef> list)
		{
			//IL_0000: 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)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0057: Expected O, but got Unknown
			//IL_001a: 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_0025: Expected O, but got Unknown
			CostTypeDef val = new CostTypeDef();
			object obj = <>c.<>9__43_0;
			if (obj == null)
			{
				BuildCostStringDelegate val2 = delegate(CostTypeDef costTypeDef, BuildCostStringContext context)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					context.stringBuilder.Append(context.cost);
					context.stringBuilder.Append(" Lunar");
				};
				<>c.<>9__43_0 = val2;
				obj = (object)val2;
			}
			val.buildCostString = (BuildCostStringDelegate)obj;
			val.payCost = GetSpecificItemPayCost(RiskOfRamenContent._corruptibleLunars);
			val.isAffordable = GetSpecificItemIsAffordable(RiskOfRamenContent._corruptibleLunars);
			val.colorIndex = (ColorIndex)25;
			corruptibleLunar = val;
			list.Add(corruptibleLunar);
		}
	}
	public class WaxIdolBodyBehavior : BaseItemBodyBehavior
	{
		private static readonly float timeBetweenWispResummons = 30f;

		private static readonly float timeBetweenWispRetryResummons = 1f;

		private float wispResummonCooldown;

		[ItemDefAssociation(useOnServer = true, useOnClient = false)]
		private static ItemDef GetItemDef()
		{
			if (!RiskOfRamenConfig.enableItem(RiskOfRamenContent._WaxIdol).Value)
			{
				return null;
			}
			return RiskOfRamenContent._WaxIdol;
		}

		private void Start()
		{
			wispResummonCooldown = timeBetweenWispRetryResummons;
		}

		private void FixedUpdate()
		{
			//IL_0041: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			int stack = base.stack;
			CharacterMaster bodyMaster = ((BaseItemBodyBehavior)this).body.master;
			if (!Object.op_Implicit((Object)(object)bodyMaster) || !RiskOfRamenConfig.spawnWaxWisp.Value)
			{
				return;
			}
			int deployableCount = bodyMaster.GetDeployableCount(RiskOfRamenContent.WaxWispSlot);
			if (deployableCount >= stack)
			{
				return;
			}
			wispResummonCooldown -= Time.fixedDeltaTime;
			if (wispResummonCooldown <= 0f)
			{
				DirectorSpawnRequest val = new DirectorSpawnRequest((SpawnCard)(object)RiskOfRamenContent._cscWaxWisp, new DirectorPlacementRule
				{
					placementMode = (PlacementMode)1,
					minDistance = 3f,
					maxDistance = 40f,
					spawnOnTarget = ((Component)this).transform
				}, RoR2Application.rng);
				val.summonerBodyObject = ((Component)this).gameObject;
				val.onSpawnedServer = OnWispSpawned;
				DirectorCore.instance.TrySpawnObject(val);
				if (deployableCount < stack)
				{
					wispResummonCooldown = timeBetweenWispRetryResummons;
				}
				else
				{
					wispResummonCooldown = timeBetweenWispResummons;
				}
			}
			void OnWispSpawned(SpawnResult spawnResult)
			{
				//IL_0000: 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)
				GameObject spawnedInstance = spawnResult.spawnedInstance;
				if (Object.op_Implicit((Object)(object)spawnedInstance))
				{
					CharacterMaster component = spawnedInstance.GetComponent<CharacterMaster>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.inventory.GiveItemPermanent(Items.BoostDamage, 30);
						component.inventory.GiveItemPermanent(Items.BoostHp, 10);
						Deployable component2 = ((Component)component).GetComponent<Deployable>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							bodyMaster.AddDeployable(component2, RiskOfRamenContent.WaxWispSlot);
						}
					}
				}
			}
		}

		public static int GetMaxProjectiles(Inventory inventory)
		{
			if (inventory.GetItemCountEffective(RiskOfRamenContent._WaxIdol) >= 1)
			{
				return 1;
			}
			return 0;
		}
	}
	public class WornTurnkeyBodyBehavior : BaseItemBodyBehavior
	{
		private static readonly int secondsOfStillness = 1;

		[ItemDefAssociation(useOnServer = true, useOnClient = false)]
		private static ItemDef GetItemDef()
		{
			if (!RiskOfRamenConfig.enableItem(RiskOfRamenContent._WornTurnkey).Value)
			{
				return null;
			}
			return RiskOfRamenContent._WornTurnkey;
		}

		private void Start()
		{
		}

		private void FixedUpdate()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			int stack = base.stack;
			if (((BaseItemBodyBehavior)this).body.HasBuff(RiskOfRamenContent._stillnessBuff) || !((BaseItemBodyBehavior)this).body.GetNotMoving())
			{
				return;
			}
			TeamComponent[] array = Object.FindObjectsOfType<TeamComponent>();
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].teamIndex == ((BaseItemBodyBehavior)this).body.teamComponent.teamIndex)
				{
					((Component)array[i]).GetComponent<CharacterBody>().AddTimedBuff(RiskOfRamenContent._stillnessBuff, 3f, stack);
				}
			}
		}
	}
}
namespace RiskOfRamen.Assets.Allocentrism
{
	public class AllocentrismBodyBehavior : BaseItemBodyBehavior, IOnKilledOtherServerReceiver
	{
		private const float secondsPerTransform = 60f;

		private const float secondsPerProjectile = 3f;

		private const int baseMaxProjectiles = 2;

		private const int maxProjectilesPerStack = 1;

		private const float baseOrbitDegreesPerSecond = 180f;

		private const float orbitDegreesPerSecondFalloff = 0.9f;

		private const float baseOrbitRadius = 2f;

		private const float orbitRadiusPerStack = 0.25f;

		private const float maxInclinationDegrees = 0f;

		private const float baseDamageCoefficient = 3.6f;

		private float projectileTimer;

		private float transformTimer;

		private GameObject projectilePrefab;

		private Xoroshiro128Plus transformRng;

		private static readonly FilterDelegate transformationFilter = new FilterDelegate(TransformationFilter);

		public event Action<AllocentrismBodyBehavior> onDisabled;

		[ItemDefAssociation(useOnServer = true, useOnClient = false)]
		private static ItemDef GetItemDef()
		{
			if (!RiskOfRamenConfig.enableItem(RiskOfRamenContent._Allocentrism).Value)
			{
				return null;
			}
			return RiskOfRamenContent._Allocentrism;
		}

		public static int GetMaxProjectiles(Inventory inventory)
		{
			return 15 + inventory.GetItemCountEffective(RiskOfRamenContent._Allocentrism);
		}

		public void InitializeOrbiter(ProjectileTargetOrbiter orbiter, AllocentrismBombController controller, Transform target)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0087: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			float num = ((BaseItemBodyBehavior)this).body.radius + 2f + Random.Range(0.25f, 0.25f * (float)base.stack);
			float num2 = num / 2f;
			num2 *= num2;
			float degreesPerSecond = 180f * Mathf.Pow(0.9f, num2);
			Quaternion val = Quaternion.AngleAxis(Random.Range(0f, 360f), Vector3.up);
			Quaternion val2 = Quaternion.AngleAxis(Random.Range(0f, 0f), Vector3.forward);
			Vector3 planeNormal = val * val2 * Vector3.up;
			float initialDegreesFromOwnerForward = Random.Range(0f, 360f);
			orbiter.Initialize(target, planeNormal, num, degreesPerSecond, initialDegreesFromOwnerForward);
			onDisabled += DestroyOrbiter;
			void DestroyOrbiter(AllocentrismBodyBehavior allocentrismBodyBehavior)
			{
				if (Object.op_Implicit((Object)(object)controller))
				{
					controller.Detonate();
				}
			}
		}

		private void Start()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			((Behaviour)this).enabled = true;
			projectilePrefab = RiskOfRamenContent._AllocentrismBomb;
			ulong num = Run.instance.seed ^ (ulong)Run.instance.stageClearCount;
			transformRng = new Xoroshiro128Plus(num);
		}

		private void OnDisable()
		{
			this.onDisabled?.Invoke(this);
			this.onDisabled = null;
		}

		private void FixedUpdate()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			CharacterMaster master = ((BaseItemBodyBehavior)this).body.master;
			if (Object.op_Implicit((Object)(object)master))
			{
				master.IsDeployableLimited(RiskOfRamenContent.AllocentrismBomb);
				transformTimer += Time.fixedDeltaTime;
				if (transformTimer > 30f)
				{
					transformTimer = 0f;
					TransformItem();
				}
			}
		}

		private void TransformItem()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			TryTransformRandomItemsResult val = default(TryTransformRandomItemsResult);
			if (Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.inventory) && Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)this).body.master) && ((BaseItemBodyBehavior)this).body.inventory.TryTransformRandomItem(new TryTransformRandomItemArgs
			{
				filter = transformationFilter,
				rng = transformRng
			}, ref val))
			{
				CharacterMasterNotificationQueue.SendTransformNotification(((BaseItemBodyBehavior)this).body.master, val.originalItemIndex, val.newItemIndex, (TransformationType)4);
			}
		}

		private static ItemIndex TransformationFilter(FilterArgs args)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_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_0025: Invalid comparison between Unknown and I4
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (args.itemIndex != RiskOfRamenContent._Allocentrism.itemIndex)
			{
				ItemDef itemDef = ItemCatalog.GetItemDef(args.itemIndex);
				if ((int)itemDef.tier != 5 && itemDef.canRemove && !RamenUtils.IsAnyVoidTier(itemDef))
				{
					return RiskOfRamenContent._Allocentrism.itemIndex;
				}
			}
			return (ItemIndex)(-1);
		}

		void IOnKilledOtherServerReceiver.OnKilledOtherServer(DamageReport damageReport)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)damageReport.victimBody) && !damageReport.attackerMaster.IsDeployableLimited(RiskOfRamenContent.AllocentrismBomb))
			{
				FireProjectileInfo val = default(FireProjectileInfo);
				val.projectilePrefab = projectilePrefab;
				val.crit = ((BaseItemBodyBehavior)this).body.RollCrit();
				val.damage = ((BaseItemBodyBehavior)this).body.damage * 3.6f;
				val.damageColorIndex = (DamageColorIndex)3;
				val.force = 0f;
				val.owner = ((Component)this).gameObject;
				val.position = damageReport.victimBody.corePosition;
				val.rotation = Quaternion.identity;
				for (int i = 0; i < 4 + base.stack; i++)
				{
					float num = damageReport.damageInfo.damage * 3f;
					MissileUtils.FireMissile(damageReport.victimBody.corePosition, ((BaseItemBodyBehavior)this).body, default(ProcChainMask), (GameObject)null, num, ((BaseItemBodyBehavior)this).body.RollCrit(), projectilePrefab, (DamageColorIndex)3, false);
				}
				RiskOfRamenMain.LogDebug("Allocentrism missiles fired at " + ((Object)damageReport.victim).name);
			}
		}
	}
	public class AllocentrismBombController : MonoBehaviour
	{
		public ProjectileImpactExplosion explosion;

		public ProjectileControllerTrigger controllerTrigger;

		private DeployableSlot deployableSlot;

		internal Transform target;

		private void Start()
		{
			if (NetworkServer.active)
			{
				DeployToOwner();
			}
		}

		public void OnEnable()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			deployableSlot = RiskOfRamenContent.AllocentrismBomb;
			if (NetworkServer.active)
			{
				Object.op_Implicit((Object)(object)((ProjectileController)controllerTrigger).owner);
			}
		}

		public void Detonate()
		{
			if (Object.op_Implicit((Object)(object)explosion))
			{
				((ProjectileExplosion)explosion).Detonate();
			}
		}

		private void DeployToOwner()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			GameObject owner = ((ProjectileController)((Component)this).GetComponent<ProjectileControllerTrigger>()).owner;
			if (!Object.op_Implicit((Object)(object)owner))
			{
				return;
			}
			CharacterBody component = owner.GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)component))
			{
				CharacterMaster master = component.master;
				if (Object.op_Implicit((Object)(object)master))
				{
					master.AddDeployable(((Component)this).GetComponent<Deployable>(), deployableSlot);
				}
			}
		}
	}
}