Decompiled source of RiskOfRamen v1.0.2

RiskOfRamen.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HG.Reflection;
using LoadingScreenFix;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using RoR2.ExpansionManagement;
using RoR2.Items;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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: AssemblyVersion("1.0.0.0")]
namespace RiskOfRamen;

public class RiskOfRamenContent : IContentPackProvider
{
	public static ItemDef _WaxIdol;

	public static ItemDef _ObsidianCard;

	public static ItemDef _DenkuRope;

	public static ItemDef _DentedBuckle;

	public static GameObject _DentedBuckleDisplay;

	public static GameObject _WaxWispBody;

	public static GameObject _WaxWispMaster;

	public static CharacterSpawnCard _cscWaxWisp;

	public static ItemDisplayRuleDict _idrsObsidianCard;

	public static AssetBundle _assetBundle;

	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;
		_WaxIdol = _assetBundle.LoadAsset<ItemDef>("WaxIdol");
		_ObsidianCard = _assetBundle.LoadAsset<ItemDef>("ObsidianCard");
		_DenkuRope = _assetBundle.LoadAsset<ItemDef>("DenkuRope");
		_DentedBuckle = _assetBundle.LoadAsset<ItemDef>("DentedBuckle");
		_DentedBuckleDisplay = _assetBundle.LoadAsset<GameObject>("DentedBuckleDisplay");
		_WaxWispBody = _assetBundle.LoadAsset<GameObject>("WaxWispBody");
		_WaxWispMaster = _assetBundle.LoadAsset<GameObject>("WaxWispMaster");
		_cscWaxWisp = _assetBundle.LoadAsset<CharacterSpawnCard>("cscWaxWisp");
		ExpansionDef val = _assetBundle.LoadAsset<ExpansionDef>("RiskOfRamenExpansion");
		RiskOfRamenContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _WaxIdol });
		RiskOfRamenContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _ObsidianCard });
		RiskOfRamenContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _DenkuRope });
		RiskOfRamenContentPack.itemDefs.Add((ItemDef[])(object)new ItemDef[1] { _DentedBuckle });
		RiskOfRamenContentPack.bodyPrefabs.Add((GameObject[])(object)new GameObject[1] { _WaxWispBody });
		RiskOfRamenContentPack.masterPrefabs.Add((GameObject[])(object)new GameObject[1] { _WaxWispMaster });
		RiskOfRamenContentPack.expansionDefs.Add((ExpansionDef[])(object)new ExpansionDef[1] { val });
		SwapAllShaders();
		ItemDisplayRuleDict val2 = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
		val2.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Stomach",
				localPos = new Vector3(-0.01069f, 0.20945f, 0.10322f),
				localAngles = new Vector3(7.32446f, 93.89349f, 34.56269f),
				localScale = new Vector3(0.7f, 0.7f, 0.7f)
			}
		});
		val2.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Pelvis",
				localPos = new Vector3(-0.00065f, 0.02525f, -0.17033f),
				localAngles = new Vector3(357.2977f, 241.9827f, 353.2495f),
				localScale = new Vector3(0.8f, 0.8f, 0.8f)
			}
		});
		val2.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Head",
				localPos = new Vector3(0.04059f, -0.07579f, 0.04173f),
				localAngles = new Vector3(5.20473f, 311.6991f, 148.7727f),
				localScale = new Vector3(0.3f, 0.3f, 0.3f)
			}
		});
		val2.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Base",
				localPos = new Vector3(-0.23566f, 1.7088f, 3.49431f),
				localAngles = new Vector3(1.66824f, 260.5212f, 260.5211f),
				localScale = new Vector3(4f, 4f, 4f)
			}
		});
		val2.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "LowerArmL",
				localPos = new Vector3(0.00505f, 0.06586f, 0.08095f),
				localAngles = new Vector3(354.1721f, 286.9717f, 167.6142f),
				localScale = new Vector3(0.4f, 0.4f, 0.4f)
			}
		});
		val2.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Head",
				localPos = new Vector3(0.00989f, 0.07221f, -0.01828f),
				localAngles = new Vector3(76.23507f, 324.0986f, 224.7837f),
				localScale = new Vector3(0.5f, 0.5f, 0.5f)
			}
		});
		val2.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Head",
				localPos = new Vector3(-0.0076f, -0.04877f, -0.00465f),
				localAngles = new Vector3(0f, 74.59808f, 0f),
				localScale = new Vector3(0.3f, 0.3f, 0.3f)
			}
		});
		val2.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Base",
				localPos = new Vector3(-0.22865f, 0.38963f, -0.78915f),
				localAngles = new Vector3(320.8967f, 95.01687f, 82.54913f),
				localScale = new Vector3(1f, 1f, 1f)
			}
		});
		val2.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Neck",
				localPos = new Vector3(-0.02591f, 0.03909f, -0.14636f),
				localAngles = new Vector3(0f, 90f, 166.7403f),
				localScale = new Vector3(0.6f, 0.6f, 0.6f)
			}
		});
		val2.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Head",
				localPos = new Vector3(-0.30599f, 1.35453f, -1.89603f),
				localAngles = new Vector3(6.1305f, 244.7297f, 327.0264f),
				localScale = new Vector3(7f, 7f, 7f)
			}
		});
		val2.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Stomach",
				localPos = new Vector3(0.06066f, 0.18265f, 0.00761f),
				localAngles = new Vector3(7.79403f, 38.64711f, 162.7407f),
				localScale = new Vector3(0.6f, 0.6f, 0.6f)
			}
		});
		val2.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Base",
				localPos = new Vector3(0.06066f, 0.04395f, 0.06448f),
				localAngles = new Vector3(288.186f, 98.37619f, 79.05092f),
				localScale = new Vector3(0.6f, 0.6f, 0.6f)
			}
		});
		val2.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DenkuRope.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "MuzzleMegaBlaster",
				localPos = new Vector3(-0.02028f, -0.00406f, -0.05083f),
				localAngles = new Vector3(298.6656f, 34.01602f, 207.773f),
				localScale = new Vector3(0.5f, 0.5f, 0.5f)
			}
		});
		ItemDisplayRuleDict val3 = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
		val3.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "CalfR",
				localPos = new Vector3(-0.08452f, 0.2241f, 0.02499f),
				localAngles = new Vector3(338.3474f, 98.51011f, 0.91329f),
				localScale = new Vector3(0.3f, 0.3f, 0.3f)
			}
		});
		val3.Add("mdlHuntress", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "UpperArmL",
				localPos = new Vector3(-0.08723f, 0.09964f, -0.01873f),
				localAngles = new Vector3(27.84832f, 281.4216f, 174.5701f),
				localScale = new Vector3(0.3f, 0.3f, 0.3f)
			}
		});
		val3.Add("mdlBandit2", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Stomach",
				localPos = new Vector3(-0.05635f, 0.04164f, 0.16436f),
				localAngles = new Vector3(28.10276f, 156.4939f, 180.7979f),
				localScale = new Vector3(0.3f, 0.3f, 0.3f)
			}
		});
		val3.Add("mdlToolbot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "UpperArmL",
				localPos = new Vector3(-0.02233f, 1.97931f, -0.99985f),
				localAngles = new Vector3(2.15264f, 5.1404f, 176.7258f),
				localScale = new Vector3(3.5f, 3.5f, 3.5f)
			}
		});
		val3.Add("mdlEngi", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "LowerArmL",
				localPos = new Vector3(0.01394f, 0.13063f, -0.09528f),
				localAngles = new Vector3(21.59121f, 341.9269f, 182.462f),
				localScale = new Vector3(0.3f, 0.3f, 0.3f)
			}
		});
		val3.Add("mdlMerc", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "ThighR",
				localPos = new Vector3(-0.13783f, 0.10082f, 0.02668f),
				localAngles = new Vector3(20.26766f, 267.0182f, 183.088f),
				localScale = new Vector3(0.3f, 0.3f, 0.3f)
			}
		});
		val3.Add("mdlMage", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "UpperArmL",
				localPos = new Vector3(0.05757f, 0.15938f, -0.00618f),
				localAngles = new Vector3(27.84833f, 281.4216f, 174.5701f),
				localScale = new Vector3(0.3f, 0.3f, 0.3f)
			}
		});
		val3.Add("mdlTreebot", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "FlowerBase",
				localPos = new Vector3(-0.26653f, 0.74262f, 0.66245f),
				localAngles = new Vector3(25.29461f, 341.2172f, 176.4987f),
				localScale = new Vector3(1f, 1f, 1f)
			}
		});
		val3.Add("mdlLoader", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "MechHandL",
				localPos = new Vector3(-0.09678f, 0.0888f, 0.06277f),
				localAngles = new Vector3(28.01476f, 302.2359f, 174.3781f),
				localScale = new Vector3(0.3f, 0.3f, 0.3f)
			}
		});
		val3.Add("mdlCroco", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "MuzzleHandL",
				localPos = new Vector3(-0.79111f, 0.41593f, -1.39771f),
				localAngles = new Vector3(45.29366f, 346.007f, 95.27855f),
				localScale = new Vector3(2f, 2f, 2f)
			}
		});
		val3.Add("mdlCaptain", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "CalfR",
				localPos = new Vector3(0.00546f, -0.00302f, -0.06705f),
				localAngles = new Vector3(12.07266f, 348.8349f, 189.9568f),
				localScale = new Vector3(0.2f, 0.2f, 0.2f)
			}
		});
		val3.Add("mdlRailGunner", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "TopRail",
				localPos = new Vector3(0.00546f, 0.71316f, 0.04062f),
				localAngles = new Vector3(345.0563f, 6.60493f, 355.4799f),
				localScale = new Vector3(0.2f, 0.2f, 0.2f)
			}
		});
		val3.Add("mdlVoidSurvivor", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _ObsidianCard.pickupModelPrefab,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Chest",
				localPos = new Vector3(-0.14121f, 0.06264f, 0.18703f),
				localAngles = new Vector3(21.73587f, 330.568f, 202.2781f),
				localScale = new Vector3(0.2f, 0.2f, 0.2f)
			}
		});
		ItemDisplayRuleDict val4 = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
		val4.Add("mdlCommandoDualies", (ItemDisplayRule[])(object)new ItemDisplayRule[1]
		{
			new ItemDisplayRule
			{
				ruleType = (ItemDisplayRuleType)0,
				followerPrefab = _DentedBuckleDisplay,
				followerPrefabAddress = new AssetReferenceGameObject(""),
				limbMask = (LimbFlags)0,
				childName = "Chest",
				localPos = new Vector3(0.00443f, 0.05508f, -0.00686f),
				localAngles = new Vector3(9.45424f, 351.758f, 358.6464f),
				localScale = new Vector3(0.2f, 0.2f, 0.2f)
			}
		});
		ItemAPI.Add(new CustomItem(_DentedBuckle, val4));
	}

	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_0106: 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)
			{
				RiskOfRamenMain.LogInfo("Swapped shader " + ((Object)material.shader).name + " with " + name);
				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.*/)]
[BepInPlugin("com.Ramen.RiskOfRamen", "Risk Of Ramen", "1.0.0")]
public class RiskOfRamenMain : BaseUnityPlugin
{
	public const string GUID = "com.Ramen.RiskOfRamen";

	public const string MODNAME = "Risk Of Ramen";

	public const string VERSION = "1.0.0";

	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");

	[Obsolete]
	private void Awake()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected O, but got Unknown
		instance = this;
		pluginInfo = ((BaseUnityPlugin)this).Info;
		new RiskOfRamenContent();
		RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
		LoadingScreenFix.AddSpriteAnimations(GetLoadingScreenBundle());
	}

	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)
	{
		//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_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		BuffDef val = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdOnFire.asset").WaitForCompletion();
		BuffDef val2 = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdStrongerBurn.asset").WaitForCompletion();
		if (Object.op_Implicit((Object)(object)self.inventory))
		{
			int itemCountEffective = self.inventory.GetItemCountEffective(RiskOfRamenContent._DenkuRope);
			int itemCountEffective2 = self.inventory.GetItemCountEffective(RiskOfRamenContent._ObsidianCard);
			int itemCountEffective3 = self.inventory.GetItemCountEffective(RiskOfRamenContent._WaxIdol);
			int itemCountEffective4 = self.inventory.GetItemCountEffective(RiskOfRamenContent._DentedBuckle);
			if (itemCountEffective >= 1)
			{
				args.critDamageMultAdd += 0.1f * (float)itemCountEffective;
			}
			if (itemCountEffective2 >= 1)
			{
				args.barrierDecayMult -= 0.25f + 0.1f * (float)itemCountEffective2;
			}
			if (itemCountEffective3 >= 1 && (self.HasBuff(val) || self.HasBuff(val2)))
			{
				args.armorAdd += (float)(40 + 10 * itemCountEffective3);
			}
			if (itemCountEffective4 >= 1)
			{
				args.critAdd += GetBarrierPercentage(self) * (0.25f * (float)itemCountEffective4);
			}
		}
	}

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

	public static float GetBarrierPercentage(CharacterBody self)
	{
		return self.healthComponent.barrier / self.healthComponent.fullBarrier;
	}
}
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()
	{
		return RiskOfRamenContent._WaxIdol;
	}

	private void Start()
	{
		wispResummonCooldown = timeBetweenWispRetryResummons;
	}

	private void FixedUpdate()
	{
		//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_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_009d: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Expected O, but got Unknown
		int stack = base.stack;
		CharacterMaster bodyMaster = ((BaseItemBodyBehavior)this).body.master;
		if (!Object.op_Implicit((Object)(object)bodyMaster))
		{
			return;
		}
		int deployableCount = bodyMaster.GetDeployableCount((DeployableSlot)1);
		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)
			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, (DeployableSlot)1);
					}
				}
			}
		}
	}
}